mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-28 22:36:26 -05:00
shader: Inline common IR::Block methods
This commit is contained in:
parent
24cc298660
commit
4bbe530337
2 changed files with 13 additions and 18 deletions
|
@ -69,24 +69,12 @@ u32 Block::LocationEnd() const noexcept {
|
||||||
return location_end;
|
return location_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
Block::InstructionList& Block::Instructions() noexcept {
|
|
||||||
return instructions;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Block::InstructionList& Block::Instructions() const noexcept {
|
|
||||||
return instructions;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Block::AddImmediatePredecessor(Block* block) {
|
void Block::AddImmediatePredecessor(Block* block) {
|
||||||
if (std::ranges::find(imm_predecessors, block) == imm_predecessors.end()) {
|
if (std::ranges::find(imm_predecessors, block) == imm_predecessors.end()) {
|
||||||
imm_predecessors.push_back(block);
|
imm_predecessors.push_back(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::span<IR::Block* const> Block::ImmediatePredecessors() const noexcept {
|
|
||||||
return imm_predecessors;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string BlockToIndex(const std::map<const Block*, size_t>& block_to_index,
|
static std::string BlockToIndex(const std::map<const Block*, size_t>& block_to_index,
|
||||||
Block* block) {
|
Block* block) {
|
||||||
if (const auto it{block_to_index.find(block)}; it != block_to_index.end()) {
|
if (const auto it{block_to_index.find(block)}; it != block_to_index.end()) {
|
||||||
|
|
|
@ -59,15 +59,22 @@ public:
|
||||||
/// Gets the end location for this basic block.
|
/// Gets the end location for this basic block.
|
||||||
[[nodiscard]] u32 LocationEnd() const noexcept;
|
[[nodiscard]] u32 LocationEnd() const noexcept;
|
||||||
|
|
||||||
/// Gets a mutable reference to the instruction list for this basic block.
|
|
||||||
[[nodiscard]] InstructionList& Instructions() noexcept;
|
|
||||||
/// Gets an immutable reference to the instruction list for this basic block.
|
|
||||||
[[nodiscard]] const InstructionList& Instructions() const noexcept;
|
|
||||||
|
|
||||||
/// Adds a new immediate predecessor to this basic block.
|
/// Adds a new immediate predecessor to this basic block.
|
||||||
void AddImmediatePredecessor(Block* block);
|
void AddImmediatePredecessor(Block* block);
|
||||||
|
|
||||||
|
/// Gets a mutable reference to the instruction list for this basic block.
|
||||||
|
[[nodiscard]] InstructionList& Instructions() noexcept {
|
||||||
|
return instructions;
|
||||||
|
}
|
||||||
|
/// Gets an immutable reference to the instruction list for this basic block.
|
||||||
|
[[nodiscard]] const InstructionList& Instructions() const noexcept {
|
||||||
|
return instructions;
|
||||||
|
}
|
||||||
|
|
||||||
/// Gets an immutable span to the immediate predecessors.
|
/// Gets an immutable span to the immediate predecessors.
|
||||||
[[nodiscard]] std::span<Block* const> ImmediatePredecessors() const noexcept;
|
[[nodiscard]] std::span<Block* const> ImmediatePredecessors() const noexcept {
|
||||||
|
return imm_predecessors;
|
||||||
|
}
|
||||||
|
|
||||||
/// Intrusively store the host definition of this instruction.
|
/// Intrusively store the host definition of this instruction.
|
||||||
template <typename DefinitionType>
|
template <typename DefinitionType>
|
||||||
|
|
Loading…
Reference in a new issue