Removing BranchIf.

This commit is contained in:
Ben Vanik 2013-12-15 14:34:41 -08:00
parent 417a970aab
commit 84651623a5
5 changed files with 0 additions and 83 deletions

View File

@ -693,61 +693,6 @@ int Translate_BRANCH(TranslationContext& ctx, Instr* i) {
return DispatchToC(ctx, i, IntCode_BRANCH);
}
uint32_t IntCode_BRANCH_IF_I8(IntCodeState& ics, const IntCode* i) {
if (ics.rf[i->src1_reg].u8) {
return IntCode_BRANCH_XX(ics, i, i->src2_reg);
} else {
return IntCode_BRANCH_XX(ics, i, i->src3_reg);
}
}
uint32_t IntCode_BRANCH_IF_I16(IntCodeState& ics, const IntCode* i) {
if (ics.rf[i->src1_reg].u16) {
return IntCode_BRANCH_XX(ics, i, i->src2_reg);
} else {
return IntCode_BRANCH_XX(ics, i, i->src3_reg);
}
}
uint32_t IntCode_BRANCH_IF_I32(IntCodeState& ics, const IntCode* i) {
if (ics.rf[i->src1_reg].u32) {
return IntCode_BRANCH_XX(ics, i, i->src2_reg);
} else {
return IntCode_BRANCH_XX(ics, i, i->src3_reg);
}
}
uint32_t IntCode_BRANCH_IF_I64(IntCodeState& ics, const IntCode* i) {
if (ics.rf[i->src1_reg].u64) {
return IntCode_BRANCH_XX(ics, i, i->src2_reg);
} else {
return IntCode_BRANCH_XX(ics, i, i->src3_reg);
}
}
uint32_t IntCode_BRANCH_IF_F32(IntCodeState& ics, const IntCode* i) {
if (ics.rf[i->src1_reg].f32) {
return IntCode_BRANCH_XX(ics, i, i->src2_reg);
} else {
return IntCode_BRANCH_XX(ics, i, i->src3_reg);
}
}
uint32_t IntCode_BRANCH_IF_F64(IntCodeState& ics, const IntCode* i) {
if (ics.rf[i->src1_reg].f64) {
return IntCode_BRANCH_XX(ics, i, i->src2_reg);
} else {
return IntCode_BRANCH_XX(ics, i, i->src3_reg);
}
}
int Translate_BRANCH_IF(TranslationContext& ctx, Instr* i) {
static IntCodeFn fns[] = {
IntCode_BRANCH_IF_I8,
IntCode_BRANCH_IF_I16,
IntCode_BRANCH_IF_I32,
IntCode_BRANCH_IF_I64,
IntCode_BRANCH_IF_F32,
IntCode_BRANCH_IF_F64,
IntCode_INVALID_TYPE,
};
return DispatchToC(ctx, i, fns[i->src1.value->type]);
}
uint32_t IntCode_BRANCH_TRUE_I8(IntCodeState& ics, const IntCode* i) {
if (ics.rf[i->src1_reg].u8) {
return IntCode_BRANCH_XX(ics, i, i->src2_reg);
@ -3130,7 +3075,6 @@ static const TranslateFn dispatch_table[] = {
Translate_SET_RETURN_ADDRESS,
Translate_BRANCH,
Translate_BRANCH_IF,
Translate_BRANCH_TRUE,
Translate_BRANCH_FALSE,

View File

@ -472,24 +472,6 @@ void FunctionBuilder::Branch(Label* label, uint32_t branch_flags) {
EndBlock();
}
void FunctionBuilder::BranchIf(
Value* cond, Label* true_label, Label* false_label,
uint32_t branch_flags) {
if (cond->IsConstantTrue()) {
Branch(true_label, branch_flags);
return;
} else if (cond->IsConstantFalse()) {
Branch(false_label, branch_flags);
return;
}
Instr* i = AppendInstr(OPCODE_BRANCH_IF_info, branch_flags);
i->set_src1(cond);
i->src2.label = true_label;
i->src3.label = false_label;
EndBlock();
}
void FunctionBuilder::BranchTrue(
Value* cond, Label* label, uint32_t branch_flags) {
if (cond->IsConstantTrue()) {

View File

@ -73,8 +73,6 @@ public:
void SetReturnAddress(Value* value);
void Branch(Label* label, uint32_t branch_flags = 0);
void BranchIf(Value* cond, Label* true_label, Label* false_label,
uint32_t branch_flags = 0);
void BranchTrue(Value* cond, Label* label,
uint32_t branch_flags = 0);
void BranchFalse(Value* cond, Label* label,

View File

@ -83,7 +83,6 @@ enum Opcode {
OPCODE_SET_RETURN_ADDRESS,
OPCODE_BRANCH,
OPCODE_BRANCH_IF,
OPCODE_BRANCH_TRUE,
OPCODE_BRANCH_FALSE,

View File

@ -86,12 +86,6 @@ DEFINE_OPCODE(
OPCODE_SIG_X_L,
OPCODE_FLAG_BRANCH);
DEFINE_OPCODE(
OPCODE_BRANCH_IF,
"branch_if",
OPCODE_SIG_X_V_L_L,
OPCODE_FLAG_BRANCH);
DEFINE_OPCODE(
OPCODE_BRANCH_TRUE,
"branch_true",