aboutsummaryrefslogtreecommitdiff
path: root/src/ssa
diff options
context:
space:
mode:
Diffstat (limited to 'src/ssa')
-rw-r--r--src/ssa/ssa.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/ssa/ssa.c b/src/ssa/ssa.c
index d875ea4..34ecada 100644
--- a/src/ssa/ssa.c
+++ b/src/ssa/ssa.c
@@ -244,15 +244,23 @@ static CHECK_RESULT int ssa_add_ins_form1(Ssa *self, SsaInstruction ins_type, Ss
}
static const char* binop_type_to_string(SsaInstruction binop_type) {
- assert(binop_type >= SSA_ADD && binop_type <= SSA_EQUALS);
+ assert(binop_type >= SSA_ADD && binop_type <= SSA_GE);
switch(binop_type) {
- case SSA_ADD: return "+";
- case SSA_SUB: return "-";
- case SSA_MUL: return "*";
- case SSA_DIV: return "/";
- case SSA_EQUALS: return "==";
- case SSA_AND: return "&&";
- default: return "";
+ case SSA_ADD: return "+";
+ case SSA_SUB: return "-";
+ case SSA_MUL: return "*";
+ case SSA_DIV: return "/";
+ case SSA_EQUALS: return "==";
+ case SSA_AND: return "&&";
+ case SSA_ILT: return "<";
+ case SSA_LT: return "<";
+ case SSA_ILE: return "<=";
+ case SSA_LE: return "<=";
+ case SSA_IGT: return ">";
+ case SSA_GT: return ">";
+ case SSA_IGE: return ">=";
+ case SSA_GE: return ">=";
+ default: return "";
}
}
@@ -287,7 +295,7 @@ static CHECK_RESULT int ssa_ins_assign_reg(Ssa *self, SsaRegister dest, SsaRegis
}
static CHECK_RESULT int ssa_ins_binop(Ssa *self, SsaInstruction binop_type, SsaRegister lhs, SsaRegister rhs, SsaRegister *result) {
- assert(binop_type >= SSA_ADD && binop_type <= SSA_AND);
+ assert(binop_type >= SSA_ADD && binop_type <= SSA_GE);
return ssa_add_ins_form2(self, binop_type, lhs, rhs, result);
}
@@ -759,8 +767,18 @@ static SsaInstruction binop_type_to_ssa_type(BinopType binop_type, amal_default_
return 0;
case BINOP_EQUALS:
return SSA_EQUALS;
+ case BINOP_NOT_EQUAL:
+ return SSA_NOT_EQUAL;
case BINOP_AND:
return SSA_AND;
+ case BINOP_LESS:
+ return type->is_signed ? SSA_ILT : SSA_LT;
+ case BINOP_LESS_EQUAL:
+ return type->is_signed ? SSA_ILE : SSA_LE;
+ case BINOP_GREATER:
+ return type->is_signed ? SSA_IGT : SSA_GT;
+ case BINOP_GREATER_EQUAL:
+ return type->is_signed ? SSA_IGE : SSA_GE;
}
return 0;
}