summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir/value.cpp
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-04-21 04:59:16 -0300
committerGravatar ameerj2021-07-22 21:51:28 -0400
commit75dee55486cac936f3a2d68533772d23aa733b72 (patch)
tree1c72e6bf1ad648552b26445af563768daacf2bb1 /src/shader_recompiler/frontend/ir/value.cpp
parentshader: Intrusively store in a block if it's sealed or not (diff)
downloadyuzu-75dee55486cac936f3a2d68533772d23aa733b72.tar.gz
yuzu-75dee55486cac936f3a2d68533772d23aa733b72.tar.xz
yuzu-75dee55486cac936f3a2d68533772d23aa733b72.zip
shader: Inline common Value getters
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/frontend/ir/value.cpp107
1 files changed, 0 insertions, 107 deletions
diff --git a/src/shader_recompiler/frontend/ir/value.cpp b/src/shader_recompiler/frontend/ir/value.cpp
index c021d3fa9..b962f170d 100644
--- a/src/shader_recompiler/frontend/ir/value.cpp
+++ b/src/shader_recompiler/frontend/ir/value.cpp
@@ -51,107 +51,6 @@ IR::Type Value::Type() const noexcept {
51 return type; 51 return type;
52} 52}
53 53
54IR::Inst* Value::Inst() const {
55 ValidateAccess(Type::Opaque);
56 return inst;
57}
58
59IR::Block* Value::Label() const {
60 ValidateAccess(Type::Label);
61 return label;
62}
63
64IR::Inst* Value::InstRecursive() const {
65 ValidateAccess(Type::Opaque);
66 if (IsIdentity()) {
67 return inst->Arg(0).InstRecursive();
68 }
69 return inst;
70}
71
72IR::Value Value::Resolve() const {
73 if (IsIdentity()) {
74 return inst->Arg(0).Resolve();
75 }
76 return *this;
77}
78
79IR::Reg Value::Reg() const {
80 ValidateAccess(Type::Reg);
81 return reg;
82}
83
84IR::Pred Value::Pred() const {
85 ValidateAccess(Type::Pred);
86 return pred;
87}
88
89IR::Attribute Value::Attribute() const {
90 ValidateAccess(Type::Attribute);
91 return attribute;
92}
93
94IR::Patch Value::Patch() const {
95 ValidateAccess(Type::Patch);
96 return patch;
97}
98
99bool Value::U1() const {
100 if (IsIdentity()) {
101 return inst->Arg(0).U1();
102 }
103 ValidateAccess(Type::U1);
104 return imm_u1;
105}
106
107u8 Value::U8() const {
108 if (IsIdentity()) {
109 return inst->Arg(0).U8();
110 }
111 ValidateAccess(Type::U8);
112 return imm_u8;
113}
114
115u16 Value::U16() const {
116 if (IsIdentity()) {
117 return inst->Arg(0).U16();
118 }
119 ValidateAccess(Type::U16);
120 return imm_u16;
121}
122
123u32 Value::U32() const {
124 if (IsIdentity()) {
125 return inst->Arg(0).U32();
126 }
127 ValidateAccess(Type::U32);
128 return imm_u32;
129}
130
131f32 Value::F32() const {
132 if (IsIdentity()) {
133 return inst->Arg(0).F32();
134 }
135 ValidateAccess(Type::F32);
136 return imm_f32;
137}
138
139u64 Value::U64() const {
140 if (IsIdentity()) {
141 return inst->Arg(0).U64();
142 }
143 ValidateAccess(Type::U64);
144 return imm_u64;
145}
146
147f64 Value::F64() const {
148 if (IsIdentity()) {
149 return inst->Arg(0).F64();
150 }
151 ValidateAccess(Type::F64);
152 return imm_f64;
153}
154
155bool Value::operator==(const Value& other) const { 54bool Value::operator==(const Value& other) const {
156 if (type != other.type) { 55 if (type != other.type) {
157 return false; 56 return false;
@@ -205,10 +104,4 @@ bool Value::operator!=(const Value& other) const {
205 return !operator==(other); 104 return !operator==(other);
206} 105}
207 106
208void Value::ValidateAccess(IR::Type expected) const {
209 if (type != expected) {
210 throw LogicError("Reading {} out of {}", expected, type);
211 }
212}
213
214} // namespace Shader::IR 107} // namespace Shader::IR