}
}
-static void
+static int
emit_instruction(
struct x86_function *func,
struct tgsi_full_instruction *inst )
break;
case TGSI_OPCODE_EXP:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_LOG:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_MUL:
break;
case TGSI_OPCODE_CND:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_CND0:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_DOT2ADD:
/* TGSI_OPCODE_DP2A */
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_INDEX:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_NEGATE:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_FRAC:
break;
case TGSI_OPCODE_CLAMP:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_FLOOR:
break;
case TGSI_OPCODE_ROUND:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_EXPBASE2:
break;
case TGSI_OPCODE_MULTIPLYMATRIX:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ABS:
break;
case TGSI_OPCODE_RCC:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_DPH:
break;
case TGSI_OPCODE_DDX:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_DDY:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_KIL:
break;
case TGSI_OPCODE_PK2H:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_PK2US:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_PK4B:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_PK4UB:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_RFL:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SEQ:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SFL:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SGT:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SIN:
break;
case TGSI_OPCODE_SLE:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SNE:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_STR:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_TEX:
break;
case TGSI_OPCODE_TXD:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_UP2H:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_UP2US:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_UP4B:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_UP4UB:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_X2D:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ARA:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ARR:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_BRA:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_CAL:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_RET:
break;
case TGSI_OPCODE_SSG:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_CMP:
break;
case TGSI_OPCODE_TXB:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_NRM:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_DIV:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_DP2:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_TXL:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_BRK:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_IF:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_LOOP:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_REP:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ELSE:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ENDIF:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ENDLOOP:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ENDREP:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_PUSHA:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_POPA:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_CEIL:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_I2F:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_NOT:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_TRUNC:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SHL:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SHR:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_AND:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_OR:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_MOD:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_XOR:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_SAD:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_TXF:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_TXQ:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_CONT:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_EMIT:
- assert( 0 );
+ return 0;
break;
case TGSI_OPCODE_ENDPRIM:
- assert( 0 );
+ return 0;
break;
default:
- assert( 0 );
+ return 0;
}
+
+ return 1;
}
static void
default:
assert( 0 );
+ break;
}
}
}
struct x86_function *func )
{
struct tgsi_parse_context parse;
+ unsigned ok = 1;
DUMP_START();
tgsi_parse_init( &parse, tokens );
- while( !tgsi_parse_end_of_tokens( &parse ) ) {
+ while( !tgsi_parse_end_of_tokens( &parse ) && ok ) {
tgsi_parse_token( &parse );
switch( parse.FullToken.Token.Type ) {
break;
case TGSI_TOKEN_TYPE_INSTRUCTION:
- emit_instruction(
- func,
- &parse.FullToken.FullInstruction );
+ ok = emit_instruction(
+ func,
+ &parse.FullToken.FullInstruction );
+
+ if (!ok) {
+ debug_printf("failed to translate tgsi opcode %d\n",
+ parse.FullToken.FullInstruction.Instruction.Opcode );
+ }
break;
case TGSI_TOKEN_TYPE_IMMEDIATE:
/* XXX implement this */
- return 0;
+ ok = 0;
+ debug_printf("failed to emit immediate value\n");
+ break;
default:
assert( 0 );
+ ok = 0;
+ break;
}
}
DUMP_END();
- return 1;
+ return ok;
}
/**