diff options
| author | 2021-04-20 22:28:06 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:28 -0400 | |
| commit | 4bbe5303376e693d15d7de80b25f5fda783281ce (patch) | |
| tree | 6432c932baf63ea9b4c6b7e56d0c5dcb3b3b13ba /src | |
| parent | shader: Use a small_vector for phi blocks (diff) | |
| download | yuzu-4bbe5303376e693d15d7de80b25f5fda783281ce.tar.gz yuzu-4bbe5303376e693d15d7de80b25f5fda783281ce.tar.xz yuzu-4bbe5303376e693d15d7de80b25f5fda783281ce.zip | |
shader: Inline common IR::Block methods
Diffstat (limited to 'src')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/basic_block.cpp | 12 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/basic_block.h | 17 |
2 files changed, 12 insertions, 17 deletions
diff --git a/src/shader_recompiler/frontend/ir/basic_block.cpp b/src/shader_recompiler/frontend/ir/basic_block.cpp index e1f0191f4..f92fc2571 100644 --- a/src/shader_recompiler/frontend/ir/basic_block.cpp +++ b/src/shader_recompiler/frontend/ir/basic_block.cpp | |||
| @@ -69,24 +69,12 @@ u32 Block::LocationEnd() const noexcept { | |||
| 69 | return location_end; | 69 | return location_end; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | Block::InstructionList& Block::Instructions() noexcept { | ||
| 73 | return instructions; | ||
| 74 | } | ||
| 75 | |||
| 76 | const Block::InstructionList& Block::Instructions() const noexcept { | ||
| 77 | return instructions; | ||
| 78 | } | ||
| 79 | |||
| 80 | void Block::AddImmediatePredecessor(Block* block) { | 72 | void Block::AddImmediatePredecessor(Block* block) { |
| 81 | if (std::ranges::find(imm_predecessors, block) == imm_predecessors.end()) { | 73 | if (std::ranges::find(imm_predecessors, block) == imm_predecessors.end()) { |
| 82 | imm_predecessors.push_back(block); | 74 | imm_predecessors.push_back(block); |
| 83 | } | 75 | } |
| 84 | } | 76 | } |
| 85 | 77 | ||
| 86 | std::span<IR::Block* const> Block::ImmediatePredecessors() const noexcept { | ||
| 87 | return imm_predecessors; | ||
| 88 | } | ||
| 89 | |||
| 90 | static std::string BlockToIndex(const std::map<const Block*, size_t>& block_to_index, | 78 | static std::string BlockToIndex(const std::map<const Block*, size_t>& block_to_index, |
| 91 | Block* block) { | 79 | Block* block) { |
| 92 | if (const auto it{block_to_index.find(block)}; it != block_to_index.end()) { | 80 | if (const auto it{block_to_index.find(block)}; it != block_to_index.end()) { |
diff --git a/src/shader_recompiler/frontend/ir/basic_block.h b/src/shader_recompiler/frontend/ir/basic_block.h index b14a35ec5..6a1d615d9 100644 --- a/src/shader_recompiler/frontend/ir/basic_block.h +++ b/src/shader_recompiler/frontend/ir/basic_block.h | |||
| @@ -59,15 +59,22 @@ public: | |||
| 59 | /// Gets the end location for this basic block. | 59 | /// Gets the end location for this basic block. |
| 60 | [[nodiscard]] u32 LocationEnd() const noexcept; | 60 | [[nodiscard]] u32 LocationEnd() const noexcept; |
| 61 | 61 | ||
| 62 | /// Adds a new immediate predecessor to this basic block. | ||
| 63 | void AddImmediatePredecessor(Block* block); | ||
| 64 | |||
| 62 | /// Gets a mutable reference to the instruction list for this basic block. | 65 | /// Gets a mutable reference to the instruction list for this basic block. |
| 63 | [[nodiscard]] InstructionList& Instructions() noexcept; | 66 | [[nodiscard]] InstructionList& Instructions() noexcept { |
| 67 | return instructions; | ||
| 68 | } | ||
| 64 | /// Gets an immutable reference to the instruction list for this basic block. | 69 | /// Gets an immutable reference to the instruction list for this basic block. |
| 65 | [[nodiscard]] const InstructionList& Instructions() const noexcept; | 70 | [[nodiscard]] const InstructionList& Instructions() const noexcept { |
| 71 | return instructions; | ||
| 72 | } | ||
| 66 | 73 | ||
| 67 | /// Adds a new immediate predecessor to this basic block. | ||
| 68 | void AddImmediatePredecessor(Block* block); | ||
| 69 | /// Gets an immutable span to the immediate predecessors. | 74 | /// Gets an immutable span to the immediate predecessors. |
| 70 | [[nodiscard]] std::span<Block* const> ImmediatePredecessors() const noexcept; | 75 | [[nodiscard]] std::span<Block* const> ImmediatePredecessors() const noexcept { |
| 76 | return imm_predecessors; | ||
| 77 | } | ||
| 71 | 78 | ||
| 72 | /// Intrusively store the host definition of this instruction. | 79 | /// Intrusively store the host definition of this instruction. |
| 73 | template <typename DefinitionType> | 80 | template <typename DefinitionType> |