Skip to content

Commit

Permalink
Don't increase instruction count for DEFx and DCL opcodes.
Browse files Browse the repository at this point in the history
We're still not a perfect match with the Microsoft disassembler estimates.

--HG--
branch : trunk
  • Loading branch information
icculus committed Apr 22, 2008
1 parent 411f919 commit 1968a87
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mojoshader.c
Expand Up @@ -3524,6 +3524,9 @@ static void state_DEF(Context *ctx)
{
const RegisterType regtype = ctx->dest_arg.regtype;
const int regnum = ctx->dest_arg.regnum;

ctx->instruction_count--; // these don't increase your instruction count.

switch (regtype)
{
case REG_TYPE_CONST:
Expand All @@ -3542,6 +3545,9 @@ static void state_DEFI(Context *ctx)
{
const RegisterType regtype = ctx->dest_arg.regtype;
const int regnum = ctx->dest_arg.regnum;

ctx->instruction_count--; // these don't increase your instruction count.

if (regtype != REG_TYPE_CONSTINT)
fail(ctx, "DEFI token using invalid register");
else
Expand All @@ -3552,6 +3558,9 @@ static void state_DEFB(Context *ctx)
{
const RegisterType regtype = ctx->dest_arg.regtype;
const int regnum = ctx->dest_arg.regnum;

ctx->instruction_count--; // these don't increase your instruction count.

if (regtype != REG_TYPE_CONSTBOOL)
fail(ctx, "DEFB token using invalid register");
else
Expand All @@ -3564,6 +3573,8 @@ static void state_DCL(Context *ctx)
const RegisterType regtype = arg->regtype;
const int regnum = arg->regnum;

ctx->instruction_count--; // these don't increase your instruction count.

// parse_args_DCL() does a lot of state checking before we get here.

// !!! FIXME: fail if DCL opcode comes after real instructions.
Expand Down

0 comments on commit 1968a87

Please sign in to comment.