Heuristically detecting ret - probably breaks some things.
This commit is contained in:
@@ -563,6 +563,21 @@ void HIRBuilder::Return() {
|
||||
EndBlock();
|
||||
}
|
||||
|
||||
void HIRBuilder::ReturnTrue(Value* cond) {
|
||||
if (cond->IsConstant()) {
|
||||
if (cond->IsConstantTrue()) {
|
||||
Return();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ASSERT_ADDRESS_TYPE(value);
|
||||
Instr* i = AppendInstr(OPCODE_RETURN_TRUE_info, 0);
|
||||
i->set_src1(cond);
|
||||
i->src2.value = i->src3.value = NULL;
|
||||
EndBlock();
|
||||
}
|
||||
|
||||
void HIRBuilder::SetReturnAddress(Value* value) {
|
||||
Instr* i = AppendInstr(OPCODE_SET_RETURN_ADDRESS_info, 0);
|
||||
i->set_src1(value);
|
||||
|
||||
@@ -75,6 +75,7 @@ public:
|
||||
void CallIndirect(Value* value, uint32_t call_flags = 0);
|
||||
void CallIndirectTrue(Value* cond, Value* value, uint32_t call_flags = 0);
|
||||
void Return();
|
||||
void ReturnTrue(Value* cond);
|
||||
void SetReturnAddress(Value* value);
|
||||
|
||||
void Branch(Label* label, uint32_t branch_flags = 0);
|
||||
|
||||
@@ -95,6 +95,7 @@ enum Opcode {
|
||||
OPCODE_CALL_INDIRECT,
|
||||
OPCODE_CALL_INDIRECT_TRUE,
|
||||
OPCODE_RETURN,
|
||||
OPCODE_RETURN_TRUE,
|
||||
OPCODE_SET_RETURN_ADDRESS,
|
||||
|
||||
OPCODE_BRANCH,
|
||||
|
||||
@@ -80,6 +80,12 @@ DEFINE_OPCODE(
|
||||
OPCODE_SIG_X,
|
||||
OPCODE_FLAG_BRANCH);
|
||||
|
||||
DEFINE_OPCODE(
|
||||
OPCODE_RETURN_TRUE,
|
||||
"return_true",
|
||||
OPCODE_SIG_X_V,
|
||||
OPCODE_FLAG_BRANCH);
|
||||
|
||||
DEFINE_OPCODE(
|
||||
OPCODE_SET_RETURN_ADDRESS,
|
||||
"set_return_address",
|
||||
|
||||
Reference in New Issue
Block a user