A64: Optimization: Merge interpret blocks

This commit is contained in:
MerryMage
2018-01-13 21:51:13 +00:00
parent 99b7516c8c
commit c6a091d874
9 changed files with 76 additions and 2 deletions

View File

@@ -90,6 +90,11 @@ void Block::SetTerminal(Terminal term) {
terminal = term;
}
void Block::ReplaceTerminal(Terminal term) {
ASSERT_MSG(HasTerminal(), "Terminal has not been set.");
terminal = term;
}
bool Block::HasTerminal() const {
return terminal.which() != 0;
}

View File

@@ -111,6 +111,8 @@ public:
Terminal GetTerminal() const;
/// Sets the terminal instruction for this basic block.
void SetTerminal(Terminal term);
/// Replaces the terminal instruction for this basic block.
void ReplaceTerminal(Terminal term);
/// Determines whether or not this basic block has a terminal instruction.
bool HasTerminal() const;

View File

@@ -20,11 +20,12 @@ struct Invalid {};
/**
* This terminal instruction calls the interpreter, starting at `next`.
* The interpreter must interpret exactly one instruction.
* The interpreter must interpret exactly `num_instructions` instructions.
*/
struct Interpret {
explicit Interpret(const LocationDescriptor& next_) : next(next_) {}
LocationDescriptor next; ///< Location at which interpretation starts.
size_t num_instructions = 1;
};
/**