I seem to relearn blr != return once every month or so.
This commit is contained in:
@@ -642,6 +642,12 @@ void HIRBuilder::ReturnTrue(Value* cond) {
|
||||
EndBlock();
|
||||
}
|
||||
|
||||
void HIRBuilder::SetReturnAddress(Value* value) {
|
||||
Instr* i = AppendInstr(OPCODE_SET_RETURN_ADDRESS_info, 0);
|
||||
i->set_src1(value);
|
||||
i->src2.value = i->src3.value = NULL;
|
||||
}
|
||||
|
||||
void HIRBuilder::Branch(Label* label, uint32_t branch_flags) {
|
||||
Instr* i = AppendInstr(OPCODE_BRANCH_info, branch_flags);
|
||||
i->src1.label = label;
|
||||
|
||||
@@ -81,6 +81,7 @@ public:
|
||||
void CallExtern(runtime::FunctionInfo* symbol_info);
|
||||
void Return();
|
||||
void ReturnTrue(Value* cond);
|
||||
void SetReturnAddress(Value* value);
|
||||
|
||||
void Branch(Label* label, uint32_t branch_flags = 0);
|
||||
void Branch(Block* block, uint32_t branch_flags = 0);
|
||||
|
||||
@@ -18,7 +18,8 @@ namespace hir {
|
||||
|
||||
|
||||
enum CallFlags {
|
||||
CALL_TAIL = (1 << 1),
|
||||
CALL_TAIL = (1 << 1),
|
||||
CALL_POSSIBLE_RETURN = (1 << 2),
|
||||
};
|
||||
enum BranchFlags {
|
||||
BRANCH_LIKELY = (1 << 1),
|
||||
@@ -97,6 +98,7 @@ enum Opcode {
|
||||
OPCODE_CALL_EXTERN,
|
||||
OPCODE_RETURN,
|
||||
OPCODE_RETURN_TRUE,
|
||||
OPCODE_SET_RETURN_ADDRESS,
|
||||
|
||||
OPCODE_BRANCH,
|
||||
OPCODE_BRANCH_TRUE,
|
||||
|
||||
@@ -92,6 +92,12 @@ DEFINE_OPCODE(
|
||||
OPCODE_SIG_X_V,
|
||||
OPCODE_FLAG_BRANCH);
|
||||
|
||||
DEFINE_OPCODE(
|
||||
OPCODE_SET_RETURN_ADDRESS,
|
||||
"set_return_address",
|
||||
OPCODE_SIG_X_V,
|
||||
0);
|
||||
|
||||
DEFINE_OPCODE(
|
||||
OPCODE_BRANCH,
|
||||
"branch",
|
||||
|
||||
Reference in New Issue
Block a user