Fix and rename branch_nz to branch_cond in furlang IR
Signed-off-by: CHatingPython <chatingpython@gmail.com>
This commit is contained in:
@@ -14,7 +14,7 @@ enum class instruction_t {
|
|||||||
BinaryOp,
|
BinaryOp,
|
||||||
Call,
|
Call,
|
||||||
Branch,
|
Branch,
|
||||||
BranchNotZero,
|
BranchCond,
|
||||||
};
|
};
|
||||||
|
|
||||||
class instruction {
|
class instruction {
|
||||||
@@ -112,25 +112,27 @@ private:
|
|||||||
block_index m_block;
|
block_index m_block;
|
||||||
};
|
};
|
||||||
|
|
||||||
class branch_nz_instruction final : public instruction {
|
class branch_cond_instruction final : public instruction {
|
||||||
public:
|
public:
|
||||||
branch_nz_instruction(operand&& condition, block_index block)
|
branch_cond_instruction(operand&& condition, block_index ifBlock, block_index elseBlock)
|
||||||
: m_condition(std::move(condition)), m_block(block) {}
|
: m_condition(std::move(condition)), m_ifBlock(ifBlock), m_elseBlock(elseBlock) {}
|
||||||
|
|
||||||
~branch_nz_instruction() override = default;
|
~branch_cond_instruction() override = default;
|
||||||
|
|
||||||
branch_nz_instruction(branch_nz_instruction&&) = default;
|
branch_cond_instruction(branch_cond_instruction&&) = default;
|
||||||
branch_nz_instruction& operator=(branch_nz_instruction&&) = default;
|
branch_cond_instruction& operator=(branch_cond_instruction&&) = default;
|
||||||
branch_nz_instruction(const branch_nz_instruction&) = delete;
|
branch_cond_instruction(const branch_cond_instruction&) = delete;
|
||||||
branch_nz_instruction& operator=(const branch_nz_instruction&) = delete;
|
branch_cond_instruction& operator=(const branch_cond_instruction&) = delete;
|
||||||
public:
|
public:
|
||||||
instruction_t type() const override { return instruction_t::BranchNotZero; }
|
instruction_t type() const override { return instruction_t::BranchCond; }
|
||||||
|
|
||||||
const operand& condition() const { return m_condition; }
|
const operand& condition() const { return m_condition; }
|
||||||
block_index block() const { return m_block; }
|
block_index if_block() const { return m_ifBlock; }
|
||||||
|
block_index else_block() const { return m_elseBlock; }
|
||||||
private:
|
private:
|
||||||
operand m_condition;
|
operand m_condition;
|
||||||
block_index m_block;
|
block_index m_ifBlock;
|
||||||
|
block_index m_elseBlock;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ir
|
} // namespace ir
|
||||||
|
|||||||
Reference in New Issue
Block a user