summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/frontend/ir/basic_block.cpp5
-rw-r--r--src/shader_recompiler/frontend/ir/basic_block.h11
-rw-r--r--src/shader_recompiler/frontend/ir/function.h12
-rw-r--r--src/shader_recompiler/frontend/ir/microinstruction.h2
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.cpp (renamed from src/shader_recompiler/frontend/ir/opcode.cpp)4
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.h (renamed from src/shader_recompiler/frontend/ir/opcode.h)2
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.inc (renamed from src/shader_recompiler/frontend/ir/opcode.inc)0
-rw-r--r--src/shader_recompiler/frontend/ir/program.cpp38
-rw-r--r--src/shader_recompiler/frontend/ir/program.h21
-rw-r--r--src/shader_recompiler/frontend/ir/value.cpp2
-rw-r--r--src/shader_recompiler/frontend/maxwell/control_flow.h2
-rw-r--r--src/shader_recompiler/frontend/maxwell/decode.cpp2
-rw-r--r--src/shader_recompiler/frontend/maxwell/decode.h2
-rw-r--r--src/shader_recompiler/frontend/maxwell/opcodes.cpp (renamed from src/shader_recompiler/frontend/maxwell/opcode.cpp)2
-rw-r--r--src/shader_recompiler/frontend/maxwell/opcodes.h (renamed from src/shader_recompiler/frontend/maxwell/opcode.h)0
-rw-r--r--src/shader_recompiler/frontend/maxwell/program.cpp49
-rw-r--r--src/shader_recompiler/frontend/maxwell/program.h22
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp2
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_multi_function.cpp2
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp2
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/load_store_memory.cpp2
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/move_register.cpp2
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp2
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/translate.cpp5
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/translate.h7
25 files changed, 113 insertions, 87 deletions
diff --git a/src/shader_recompiler/frontend/ir/basic_block.cpp b/src/shader_recompiler/frontend/ir/basic_block.cpp
index 249251dd0..1a5d82135 100644
--- a/src/shader_recompiler/frontend/ir/basic_block.cpp
+++ b/src/shader_recompiler/frontend/ir/basic_block.cpp
@@ -14,7 +14,8 @@
14 14
15namespace Shader::IR { 15namespace Shader::IR {
16 16
17Block::Block(u32 begin, u32 end) : location_begin{begin}, location_end{end} {} 17Block::Block(ObjectPool<Inst>& inst_pool_, u32 begin, u32 end)
18 : inst_pool{&inst_pool_}, location_begin{begin}, location_end{end} {}
18 19
19Block::~Block() = default; 20Block::~Block() = default;
20 21
@@ -24,7 +25,7 @@ void Block::AppendNewInst(Opcode op, std::initializer_list<Value> args) {
24 25
25Block::iterator Block::PrependNewInst(iterator insertion_point, Opcode op, 26Block::iterator Block::PrependNewInst(iterator insertion_point, Opcode op,
26 std::initializer_list<Value> args, u64 flags) { 27 std::initializer_list<Value> args, u64 flags) {
27 Inst* const inst{std::construct_at(instruction_alloc_pool.allocate(), op, flags)}; 28 Inst* const inst{inst_pool->Create(op, flags)};
28 const auto result_it{instructions.insert(insertion_point, *inst)}; 29 const auto result_it{instructions.insert(insertion_point, *inst)};
29 30
30 if (inst->NumArgs() != args.size()) { 31 if (inst->NumArgs() != args.size()) {
diff --git a/src/shader_recompiler/frontend/ir/basic_block.h b/src/shader_recompiler/frontend/ir/basic_block.h
index ec4a41cb1..ec3ad6263 100644
--- a/src/shader_recompiler/frontend/ir/basic_block.h
+++ b/src/shader_recompiler/frontend/ir/basic_block.h
@@ -10,9 +10,9 @@
10#include <vector> 10#include <vector>
11 11
12#include <boost/intrusive/list.hpp> 12#include <boost/intrusive/list.hpp>
13#include <boost/pool/pool_alloc.hpp>
14 13
15#include "shader_recompiler/frontend/ir/microinstruction.h" 14#include "shader_recompiler/frontend/ir/microinstruction.h"
15#include "shader_recompiler/object_pool.h"
16 16
17namespace Shader::IR { 17namespace Shader::IR {
18 18
@@ -25,7 +25,7 @@ public:
25 using reverse_iterator = InstructionList::reverse_iterator; 25 using reverse_iterator = InstructionList::reverse_iterator;
26 using const_reverse_iterator = InstructionList::const_reverse_iterator; 26 using const_reverse_iterator = InstructionList::const_reverse_iterator;
27 27
28 explicit Block(u32 begin, u32 end); 28 explicit Block(ObjectPool<Inst>& inst_pool_, u32 begin, u32 end);
29 ~Block(); 29 ~Block();
30 30
31 Block(const Block&) = delete; 31 Block(const Block&) = delete;
@@ -119,6 +119,8 @@ public:
119 } 119 }
120 120
121private: 121private:
122 /// Memory pool for instruction list
123 ObjectPool<Inst>* inst_pool;
122 /// Starting location of this block 124 /// Starting location of this block
123 u32 location_begin; 125 u32 location_begin;
124 /// End location of this block 126 /// End location of this block
@@ -127,11 +129,6 @@ private:
127 /// List of instructions in this block 129 /// List of instructions in this block
128 InstructionList instructions; 130 InstructionList instructions;
129 131
130 /// Memory pool for instruction list
131 boost::fast_pool_allocator<Inst, boost::default_user_allocator_malloc_free,
132 boost::details::pool::null_mutex>
133 instruction_alloc_pool;
134
135 /// Block immediate predecessors 132 /// Block immediate predecessors
136 std::vector<IR::Block*> imm_predecessors; 133 std::vector<IR::Block*> imm_predecessors;
137}; 134};
diff --git a/src/shader_recompiler/frontend/ir/function.h b/src/shader_recompiler/frontend/ir/function.h
index 2d4dc5b98..bba7d1d39 100644
--- a/src/shader_recompiler/frontend/ir/function.h
+++ b/src/shader_recompiler/frontend/ir/function.h
@@ -4,22 +4,14 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <memory> 7#include <boost/container/small_vector.hpp>
8#include <vector>
9 8
10#include "shader_recompiler/frontend/ir/basic_block.h" 9#include "shader_recompiler/frontend/ir/basic_block.h"
11 10
12namespace Shader::IR { 11namespace Shader::IR {
13 12
14struct Function { 13struct Function {
15 struct InplaceDelete { 14 boost::container::small_vector<Block*, 16> blocks;
16 void operator()(IR::Block* block) const noexcept {
17 std::destroy_at(block);
18 }
19 };
20 using UniqueBlock = std::unique_ptr<IR::Block, InplaceDelete>;
21
22 std::vector<UniqueBlock> blocks;
23}; 15};
24 16
25} // namespace Shader::IR 17} // namespace Shader::IR
diff --git a/src/shader_recompiler/frontend/ir/microinstruction.h b/src/shader_recompiler/frontend/ir/microinstruction.h
index 22101c9e2..80baffb2e 100644
--- a/src/shader_recompiler/frontend/ir/microinstruction.h
+++ b/src/shader_recompiler/frontend/ir/microinstruction.h
@@ -13,7 +13,7 @@
13#include <boost/intrusive/list.hpp> 13#include <boost/intrusive/list.hpp>
14 14
15#include "common/common_types.h" 15#include "common/common_types.h"
16#include "shader_recompiler/frontend/ir/opcode.h" 16#include "shader_recompiler/frontend/ir/opcodes.h"
17#include "shader_recompiler/frontend/ir/type.h" 17#include "shader_recompiler/frontend/ir/type.h"
18#include "shader_recompiler/frontend/ir/value.h" 18#include "shader_recompiler/frontend/ir/value.h"
19 19
diff --git a/src/shader_recompiler/frontend/ir/opcode.cpp b/src/shader_recompiler/frontend/ir/opcodes.cpp
index 65d074029..1f188411a 100644
--- a/src/shader_recompiler/frontend/ir/opcode.cpp
+++ b/src/shader_recompiler/frontend/ir/opcodes.cpp
@@ -7,7 +7,7 @@
7#include <string_view> 7#include <string_view>
8 8
9#include "shader_recompiler/exception.h" 9#include "shader_recompiler/exception.h"
10#include "shader_recompiler/frontend/ir/opcode.h" 10#include "shader_recompiler/frontend/ir/opcodes.h"
11 11
12namespace Shader::IR { 12namespace Shader::IR {
13namespace { 13namespace {
@@ -26,7 +26,7 @@ constexpr std::array META_TABLE{
26 .type{type_token}, \ 26 .type{type_token}, \
27 .arg_types{__VA_ARGS__}, \ 27 .arg_types{__VA_ARGS__}, \
28 }, 28 },
29#include "opcode.inc" 29#include "opcodes.inc"
30#undef OPCODE 30#undef OPCODE
31}; 31};
32 32
diff --git a/src/shader_recompiler/frontend/ir/opcode.h b/src/shader_recompiler/frontend/ir/opcodes.h
index 1f4440379..999fb2e77 100644
--- a/src/shader_recompiler/frontend/ir/opcode.h
+++ b/src/shader_recompiler/frontend/ir/opcodes.h
@@ -14,7 +14,7 @@ namespace Shader::IR {
14 14
15enum class Opcode { 15enum class Opcode {
16#define OPCODE(name, ...) name, 16#define OPCODE(name, ...) name,
17#include "opcode.inc" 17#include "opcodes.inc"
18#undef OPCODE 18#undef OPCODE
19}; 19};
20 20
diff --git a/src/shader_recompiler/frontend/ir/opcode.inc b/src/shader_recompiler/frontend/ir/opcodes.inc
index 6eb105d92..6eb105d92 100644
--- a/src/shader_recompiler/frontend/ir/opcode.inc
+++ b/src/shader_recompiler/frontend/ir/opcodes.inc
diff --git a/src/shader_recompiler/frontend/ir/program.cpp b/src/shader_recompiler/frontend/ir/program.cpp
new file mode 100644
index 000000000..0ce99ef2a
--- /dev/null
+++ b/src/shader_recompiler/frontend/ir/program.cpp
@@ -0,0 +1,38 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <map>
8#include <string>
9
10#include <fmt/format.h>
11
12#include "shader_recompiler/frontend/ir/function.h"
13#include "shader_recompiler/frontend/ir/program.h"
14
15namespace Shader::IR {
16
17std::string DumpProgram(const Program& program) {
18 size_t index{0};
19 std::map<const IR::Inst*, size_t> inst_to_index;
20 std::map<const IR::Block*, size_t> block_to_index;
21
22 for (const IR::Function& function : program.functions) {
23 for (const IR::Block* const block : function.blocks) {
24 block_to_index.emplace(block, index);
25 ++index;
26 }
27 }
28 std::string ret;
29 for (const IR::Function& function : program.functions) {
30 ret += fmt::format("Function\n");
31 for (const auto& block : function.blocks) {
32 ret += IR::DumpBlock(*block, block_to_index, inst_to_index, index) + '\n';
33 }
34 }
35 return ret;
36}
37
38} // namespace Shader::IR \ No newline at end of file
diff --git a/src/shader_recompiler/frontend/ir/program.h b/src/shader_recompiler/frontend/ir/program.h
new file mode 100644
index 000000000..efaf1aa1e
--- /dev/null
+++ b/src/shader_recompiler/frontend/ir/program.h
@@ -0,0 +1,21 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <string>
8
9#include <boost/container/small_vector.hpp>
10
11#include "shader_recompiler/frontend/ir/function.h"
12
13namespace Shader::IR {
14
15struct Program {
16 boost::container::small_vector<Function, 1> functions;
17};
18
19[[nodiscard]] std::string DumpProgram(const Program& program);
20
21} // namespace Shader::IR
diff --git a/src/shader_recompiler/frontend/ir/value.cpp b/src/shader_recompiler/frontend/ir/value.cpp
index 93ff8ccf1..9ea61813b 100644
--- a/src/shader_recompiler/frontend/ir/value.cpp
+++ b/src/shader_recompiler/frontend/ir/value.cpp
@@ -3,7 +3,7 @@
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include "shader_recompiler/frontend/ir/microinstruction.h" 5#include "shader_recompiler/frontend/ir/microinstruction.h"
6#include "shader_recompiler/frontend/ir/opcode.h" 6#include "shader_recompiler/frontend/ir/opcodes.h"
7#include "shader_recompiler/frontend/ir/value.h" 7#include "shader_recompiler/frontend/ir/value.h"
8 8
9namespace Shader::IR { 9namespace Shader::IR {
diff --git a/src/shader_recompiler/frontend/maxwell/control_flow.h b/src/shader_recompiler/frontend/maxwell/control_flow.h
index 20ada8afd..49b369282 100644
--- a/src/shader_recompiler/frontend/maxwell/control_flow.h
+++ b/src/shader_recompiler/frontend/maxwell/control_flow.h
@@ -16,7 +16,7 @@
16#include "shader_recompiler/frontend/ir/condition.h" 16#include "shader_recompiler/frontend/ir/condition.h"
17#include "shader_recompiler/frontend/maxwell/instruction.h" 17#include "shader_recompiler/frontend/maxwell/instruction.h"
18#include "shader_recompiler/frontend/maxwell/location.h" 18#include "shader_recompiler/frontend/maxwell/location.h"
19#include "shader_recompiler/frontend/maxwell/opcode.h" 19#include "shader_recompiler/frontend/maxwell/opcodes.h"
20 20
21namespace Shader::Maxwell::Flow { 21namespace Shader::Maxwell::Flow {
22 22
diff --git a/src/shader_recompiler/frontend/maxwell/decode.cpp b/src/shader_recompiler/frontend/maxwell/decode.cpp
index ab1cc6c8d..bd85afa1e 100644
--- a/src/shader_recompiler/frontend/maxwell/decode.cpp
+++ b/src/shader_recompiler/frontend/maxwell/decode.cpp
@@ -11,7 +11,7 @@
11#include "common/common_types.h" 11#include "common/common_types.h"
12#include "shader_recompiler/exception.h" 12#include "shader_recompiler/exception.h"
13#include "shader_recompiler/frontend/maxwell/decode.h" 13#include "shader_recompiler/frontend/maxwell/decode.h"
14#include "shader_recompiler/frontend/maxwell/opcode.h" 14#include "shader_recompiler/frontend/maxwell/opcodes.h"
15 15
16namespace Shader::Maxwell { 16namespace Shader::Maxwell {
17namespace { 17namespace {
diff --git a/src/shader_recompiler/frontend/maxwell/decode.h b/src/shader_recompiler/frontend/maxwell/decode.h
index 2a3dd28e8..b4f080fd7 100644
--- a/src/shader_recompiler/frontend/maxwell/decode.h
+++ b/src/shader_recompiler/frontend/maxwell/decode.h
@@ -5,7 +5,7 @@
5#pragma once 5#pragma once
6 6
7#include "common/common_types.h" 7#include "common/common_types.h"
8#include "shader_recompiler/frontend/maxwell/opcode.h" 8#include "shader_recompiler/frontend/maxwell/opcodes.h"
9 9
10namespace Shader::Maxwell { 10namespace Shader::Maxwell {
11 11
diff --git a/src/shader_recompiler/frontend/maxwell/opcode.cpp b/src/shader_recompiler/frontend/maxwell/opcodes.cpp
index 8a7bdb611..12ddf2ac9 100644
--- a/src/shader_recompiler/frontend/maxwell/opcode.cpp
+++ b/src/shader_recompiler/frontend/maxwell/opcodes.cpp
@@ -5,7 +5,7 @@
5#include <array> 5#include <array>
6 6
7#include "shader_recompiler/exception.h" 7#include "shader_recompiler/exception.h"
8#include "shader_recompiler/frontend/maxwell/opcode.h" 8#include "shader_recompiler/frontend/maxwell/opcodes.h"
9 9
10namespace Shader::Maxwell { 10namespace Shader::Maxwell {
11namespace { 11namespace {
diff --git a/src/shader_recompiler/frontend/maxwell/opcode.h b/src/shader_recompiler/frontend/maxwell/opcodes.h
index cd574f29d..cd574f29d 100644
--- a/src/shader_recompiler/frontend/maxwell/opcode.h
+++ b/src/shader_recompiler/frontend/maxwell/opcodes.h
diff --git a/src/shader_recompiler/frontend/maxwell/program.cpp b/src/shader_recompiler/frontend/maxwell/program.cpp
index b3f2de852..8cdd20804 100644
--- a/src/shader_recompiler/frontend/maxwell/program.cpp
+++ b/src/shader_recompiler/frontend/maxwell/program.cpp
@@ -5,6 +5,7 @@
5#include <algorithm> 5#include <algorithm>
6#include <memory> 6#include <memory>
7 7
8#include "shader_recompiler/frontend/ir/basic_block.h"
8#include "shader_recompiler/frontend/maxwell/program.h" 9#include "shader_recompiler/frontend/maxwell/program.h"
9#include "shader_recompiler/frontend/maxwell/termination_code.h" 10#include "shader_recompiler/frontend/maxwell/termination_code.h"
10#include "shader_recompiler/frontend/maxwell/translate/translate.h" 11#include "shader_recompiler/frontend/maxwell/translate/translate.h"
@@ -12,17 +13,18 @@
12 13
13namespace Shader::Maxwell { 14namespace Shader::Maxwell {
14namespace { 15namespace {
15void TranslateCode(Environment& env, const Flow::Function& cfg_function, IR::Function& function, 16void TranslateCode(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Block>& block_pool,
16 std::span<IR::Block*> block_map, IR::Block* block_memory) { 17 Environment& env, const Flow::Function& cfg_function, IR::Function& function,
18 std::span<IR::Block*> block_map) {
17 const size_t num_blocks{cfg_function.blocks.size()}; 19 const size_t num_blocks{cfg_function.blocks.size()};
18 function.blocks.reserve(num_blocks); 20 function.blocks.reserve(num_blocks);
19 21
20 for (const Flow::BlockId block_id : cfg_function.blocks) { 22 for (const Flow::BlockId block_id : cfg_function.blocks) {
21 const Flow::Block& flow_block{cfg_function.blocks_data[block_id]}; 23 const Flow::Block& flow_block{cfg_function.blocks_data[block_id]};
22 24
23 function.blocks.emplace_back(std::construct_at(block_memory, Translate(env, flow_block))); 25 IR::Block* const ir_block{block_pool.Create(Translate(inst_pool, env, flow_block))};
24 block_map[flow_block.id] = function.blocks.back().get(); 26 block_map[flow_block.id] = ir_block;
25 ++block_memory; 27 function.blocks.emplace_back(ir_block);
26 } 28 }
27} 29}
28 30
@@ -34,21 +36,24 @@ void EmitTerminationInsts(const Flow::Function& cfg_function,
34 } 36 }
35} 37}
36 38
37void TranslateFunction(Environment& env, const Flow::Function& cfg_function, IR::Function& function, 39void TranslateFunction(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Block>& block_pool,
38 IR::Block* block_memory) { 40 Environment& env, const Flow::Function& cfg_function,
41 IR::Function& function) {
39 std::vector<IR::Block*> block_map; 42 std::vector<IR::Block*> block_map;
40 block_map.resize(cfg_function.blocks_data.size()); 43 block_map.resize(cfg_function.blocks_data.size());
41 44
42 TranslateCode(env, cfg_function, function, block_map, block_memory); 45 TranslateCode(inst_pool, block_pool, env, cfg_function, function, block_map);
43 EmitTerminationInsts(cfg_function, block_map); 46 EmitTerminationInsts(cfg_function, block_map);
44} 47}
45} // Anonymous namespace 48} // Anonymous namespace
46 49
47Program::Program(Environment& env, const Flow::CFG& cfg) { 50IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool, ObjectPool<IR::Block>& block_pool,
51 Environment& env, const Flow::CFG& cfg) {
52 IR::Program program;
53 auto& functions{program.functions};
48 functions.reserve(cfg.Functions().size()); 54 functions.reserve(cfg.Functions().size());
49 for (const Flow::Function& cfg_function : cfg.Functions()) { 55 for (const Flow::Function& cfg_function : cfg.Functions()) {
50 TranslateFunction(env, cfg_function, functions.emplace_back(), 56 TranslateFunction(inst_pool, block_pool, env, cfg_function, functions.emplace_back());
51 block_alloc_pool.allocate(cfg_function.blocks.size()));
52 } 57 }
53 std::ranges::for_each(functions, Optimization::SsaRewritePass); 58 std::ranges::for_each(functions, Optimization::SsaRewritePass);
54 for (IR::Function& function : functions) { 59 for (IR::Function& function : functions) {
@@ -59,27 +64,7 @@ Program::Program(Environment& env, const Flow::CFG& cfg) {
59 Optimization::VerificationPass(function); 64 Optimization::VerificationPass(function);
60 } 65 }
61 //*/ 66 //*/
62} 67 return program;
63
64std::string DumpProgram(const Program& program) {
65 size_t index{0};
66 std::map<const IR::Inst*, size_t> inst_to_index;
67 std::map<const IR::Block*, size_t> block_to_index;
68
69 for (const IR::Function& function : program.functions) {
70 for (const auto& block : function.blocks) {
71 block_to_index.emplace(block.get(), index);
72 ++index;
73 }
74 }
75 std::string ret;
76 for (const IR::Function& function : program.functions) {
77 ret += fmt::format("Function\n");
78 for (const auto& block : function.blocks) {
79 ret += IR::DumpBlock(*block, block_to_index, inst_to_index, index) + '\n';
80 }
81 }
82 return ret;
83} 68}
84 69
85} // namespace Shader::Maxwell 70} // namespace Shader::Maxwell
diff --git a/src/shader_recompiler/frontend/maxwell/program.h b/src/shader_recompiler/frontend/maxwell/program.h
index 36e678a9e..3355ab129 100644
--- a/src/shader_recompiler/frontend/maxwell/program.h
+++ b/src/shader_recompiler/frontend/maxwell/program.h
@@ -9,28 +9,16 @@
9#include <vector> 9#include <vector>
10 10
11#include <boost/container/small_vector.hpp> 11#include <boost/container/small_vector.hpp>
12#include <boost/pool/pool_alloc.hpp>
13 12
14#include "shader_recompiler/environment.h" 13#include "shader_recompiler/environment.h"
15#include "shader_recompiler/frontend/ir/basic_block.h" 14#include "shader_recompiler/frontend/ir/program.h"
16#include "shader_recompiler/frontend/ir/function.h"
17#include "shader_recompiler/frontend/maxwell/control_flow.h" 15#include "shader_recompiler/frontend/maxwell/control_flow.h"
16#include "shader_recompiler/object_pool.h"
18 17
19namespace Shader::Maxwell { 18namespace Shader::Maxwell {
20 19
21class Program { 20[[nodiscard]] IR::Program TranslateProgram(ObjectPool<IR::Inst>& inst_pool,
22 friend std::string DumpProgram(const Program& program); 21 ObjectPool<IR::Block>& block_pool, Environment& env,
23 22 const Flow::CFG& cfg);
24public:
25 explicit Program(Environment& env, const Flow::CFG& cfg);
26
27private:
28 boost::pool_allocator<IR::Block, boost::default_user_allocator_new_delete,
29 boost::details::pool::null_mutex>
30 block_alloc_pool;
31 boost::container::small_vector<IR::Function, 1> functions;
32};
33
34[[nodiscard]] std::string DumpProgram(const Program& program);
35 23
36} // namespace Shader::Maxwell 24} // namespace Shader::Maxwell
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp
index acd8445ad..3d0c48457 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_conversion_integer.cpp
@@ -4,7 +4,7 @@
4 4
5#include "common/common_types.h" 5#include "common/common_types.h"
6#include "shader_recompiler/exception.h" 6#include "shader_recompiler/exception.h"
7#include "shader_recompiler/frontend/maxwell/opcode.h" 7#include "shader_recompiler/frontend/maxwell/opcodes.h"
8#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h" 8#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
9 9
10namespace Shader::Maxwell { 10namespace Shader::Maxwell {
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_multi_function.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_multi_function.cpp
index 90cddb18b..ba005fbf4 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_multi_function.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/floating_point_multi_function.cpp
@@ -5,7 +5,7 @@
5#include "common/bit_field.h" 5#include "common/bit_field.h"
6#include "common/common_types.h" 6#include "common/common_types.h"
7#include "shader_recompiler/exception.h" 7#include "shader_recompiler/exception.h"
8#include "shader_recompiler/frontend/maxwell/opcode.h" 8#include "shader_recompiler/frontend/maxwell/opcodes.h"
9#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h" 9#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
10 10
11namespace Shader::Maxwell { 11namespace Shader::Maxwell {
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp
index de65173e8..ad97786d4 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_attribute.cpp
@@ -6,7 +6,7 @@
6#include "common/common_types.h" 6#include "common/common_types.h"
7#include "shader_recompiler/exception.h" 7#include "shader_recompiler/exception.h"
8#include "shader_recompiler/frontend/ir/ir_emitter.h" 8#include "shader_recompiler/frontend/ir/ir_emitter.h"
9#include "shader_recompiler/frontend/maxwell/opcode.h" 9#include "shader_recompiler/frontend/maxwell/opcodes.h"
10#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h" 10#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
11 11
12namespace Shader::Maxwell { 12namespace Shader::Maxwell {
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_memory.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_memory.cpp
index 9f1570479..727524284 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_memory.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_memory.cpp
@@ -5,7 +5,7 @@
5#include "common/bit_field.h" 5#include "common/bit_field.h"
6#include "common/common_types.h" 6#include "common/common_types.h"
7#include "shader_recompiler/exception.h" 7#include "shader_recompiler/exception.h"
8#include "shader_recompiler/frontend/maxwell/opcode.h" 8#include "shader_recompiler/frontend/maxwell/opcodes.h"
9#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h" 9#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
10 10
11namespace Shader::Maxwell { 11namespace Shader::Maxwell {
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/move_register.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/move_register.cpp
index 1711d3f48..1f83d1068 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/move_register.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/move_register.cpp
@@ -5,7 +5,7 @@
5#include "common/bit_field.h" 5#include "common/bit_field.h"
6#include "common/common_types.h" 6#include "common/common_types.h"
7#include "shader_recompiler/exception.h" 7#include "shader_recompiler/exception.h"
8#include "shader_recompiler/frontend/maxwell/opcode.h" 8#include "shader_recompiler/frontend/maxwell/opcodes.h"
9#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h" 9#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
10 10
11namespace Shader::Maxwell { 11namespace Shader::Maxwell {
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
index d70399f6b..1bb160acb 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
@@ -4,7 +4,7 @@
4 4
5#include "common/common_types.h" 5#include "common/common_types.h"
6#include "shader_recompiler/exception.h" 6#include "shader_recompiler/exception.h"
7#include "shader_recompiler/frontend/maxwell/opcode.h" 7#include "shader_recompiler/frontend/maxwell/opcodes.h"
8#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h" 8#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
9 9
10namespace Shader::Maxwell { 10namespace Shader::Maxwell {
diff --git a/src/shader_recompiler/frontend/maxwell/translate/translate.cpp b/src/shader_recompiler/frontend/maxwell/translate/translate.cpp
index 66a306745..dcc3f6c0e 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/translate.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/translate.cpp
@@ -23,8 +23,9 @@ static void Invoke(TranslatorVisitor& visitor, Location pc, u64 insn) {
23 } 23 }
24} 24}
25 25
26IR::Block Translate(Environment& env, const Flow::Block& flow_block) { 26IR::Block Translate(ObjectPool<IR::Inst>& inst_pool, Environment& env,
27 IR::Block block{flow_block.begin.Offset(), flow_block.end.Offset()}; 27 const Flow::Block& flow_block) {
28 IR::Block block{inst_pool, flow_block.begin.Offset(), flow_block.end.Offset()};
28 TranslatorVisitor visitor{env, block}; 29 TranslatorVisitor visitor{env, block};
29 30
30 const Location pc_end{flow_block.end}; 31 const Location pc_end{flow_block.end};
diff --git a/src/shader_recompiler/frontend/maxwell/translate/translate.h b/src/shader_recompiler/frontend/maxwell/translate/translate.h
index 788742dea..c1c21b278 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/translate.h
+++ b/src/shader_recompiler/frontend/maxwell/translate/translate.h
@@ -6,11 +6,14 @@
6 6
7#include "shader_recompiler/environment.h" 7#include "shader_recompiler/environment.h"
8#include "shader_recompiler/frontend/ir/basic_block.h" 8#include "shader_recompiler/frontend/ir/basic_block.h"
9#include "shader_recompiler/frontend/maxwell/location.h" 9#include "shader_recompiler/frontend/ir/microinstruction.h"
10#include "shader_recompiler/frontend/maxwell/control_flow.h" 10#include "shader_recompiler/frontend/maxwell/control_flow.h"
11#include "shader_recompiler/frontend/maxwell/location.h"
12#include "shader_recompiler/object_pool.h"
11 13
12namespace Shader::Maxwell { 14namespace Shader::Maxwell {
13 15
14[[nodiscard]] IR::Block Translate(Environment& env, const Flow::Block& flow_block); 16[[nodiscard]] IR::Block Translate(ObjectPool<IR::Inst>& inst_pool, Environment& env,
17 const Flow::Block& flow_block);
15 18
16} // namespace Shader::Maxwell 19} // namespace Shader::Maxwell