summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/maxwell/control_flow.h
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-03-14 03:41:05 -0300
committerGravatar ameerj2021-07-22 21:51:23 -0400
commit71f96fa6366dc6dd306a953bca1b958fb32bc55a (patch)
tree12e13f9502e4b9510446c967a831e5d4bacb729e /src/shader_recompiler/frontend/maxwell/control_flow.h
parentspirv: Add SignedZeroInfNanPreserve logic (diff)
downloadyuzu-71f96fa6366dc6dd306a953bca1b958fb32bc55a.tar.gz
yuzu-71f96fa6366dc6dd306a953bca1b958fb32bc55a.tar.xz
yuzu-71f96fa6366dc6dd306a953bca1b958fb32bc55a.zip
shader: Implement CAL inlining function calls
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/control_flow.h')
-rw-r--r--src/shader_recompiler/frontend/maxwell/control_flow.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/control_flow.h b/src/shader_recompiler/frontend/maxwell/control_flow.h
index 209c9e551..fe74f210f 100644
--- a/src/shader_recompiler/frontend/maxwell/control_flow.h
+++ b/src/shader_recompiler/frontend/maxwell/control_flow.h
@@ -20,16 +20,13 @@
20#include "shader_recompiler/frontend/maxwell/opcodes.h" 20#include "shader_recompiler/frontend/maxwell/opcodes.h"
21#include "shader_recompiler/object_pool.h" 21#include "shader_recompiler/object_pool.h"
22 22
23namespace Shader::IR {
24class Block;
25}
26
27namespace Shader::Maxwell::Flow { 23namespace Shader::Maxwell::Flow {
28 24
29using FunctionId = size_t; 25using FunctionId = size_t;
30 26
31enum class EndClass { 27enum class EndClass {
32 Branch, 28 Branch,
29 Call,
33 Exit, 30 Exit,
34 Return, 31 Return,
35}; 32};
@@ -75,9 +72,14 @@ struct Block : boost::intrusive::set_base_hook<
75 EndClass end_class; 72 EndClass end_class;
76 Stack stack; 73 Stack stack;
77 IR::Condition cond; 74 IR::Condition cond;
78 Block* branch_true; 75 union {
79 Block* branch_false; 76 Block* branch_true;
80 IR::Block* ir; 77 FunctionId function_call;
78 };
79 union {
80 Block* branch_false;
81 Block* return_block;
82 };
81}; 83};
82 84
83struct Label { 85struct Label {
@@ -87,7 +89,7 @@ struct Label {
87}; 89};
88 90
89struct Function { 91struct Function {
90 Function(Location start_address); 92 explicit Function(ObjectPool<Block>& block_pool, Location start_address);
91 93
92 Location entrypoint; 94 Location entrypoint;
93 boost::container::small_vector<Label, 16> labels; 95 boost::container::small_vector<Label, 16> labels;
@@ -137,7 +139,6 @@ private:
137 void AnalyzeBRA(Block* block, FunctionId function_id, Location pc, Instruction inst, 139 void AnalyzeBRA(Block* block, FunctionId function_id, Location pc, Instruction inst,
138 bool is_absolute); 140 bool is_absolute);
139 void AnalyzeBRX(Block* block, Location pc, Instruction inst, bool is_absolute); 141 void AnalyzeBRX(Block* block, Location pc, Instruction inst, bool is_absolute);
140 void AnalyzeCAL(Location pc, Instruction inst, bool is_absolute);
141 AnalysisState AnalyzeEXIT(Block* block, FunctionId function_id, Location pc, Instruction inst); 142 AnalysisState AnalyzeEXIT(Block* block, FunctionId function_id, Location pc, Instruction inst);
142 143
143 /// Return the branch target block id 144 /// Return the branch target block id