llvm.org GIT mirror llvm / 125fc7f
Fast-math interfaces for Instructions Add in getter/setter methods for Instructions, allowing them to be the interface to FPMathOperator similarly to now NUS/NSW is handled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168642 91177308-0d34-0410-b5e6-96231b3b80d8 Michael Ilseman 7 years ago
2 changed file(s) with 135 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
2020
2121 namespace llvm {
2222
23 struct FastMathFlags;
2324 class LLVMContext;
2425 class MDNode;
2526
174175
175176 /// getDebugLoc - Return the debug location for this node as a DebugLoc.
176177 const DebugLoc &getDebugLoc() const { return DbgLoc; }
178
179 /// Set or clear the unsafe-algebra flag on this instruction, which must be an
180 /// operator which supports this flag. See LangRef.html for the meaning of
181 /// this flag.
182 void setHasUnsafeAlgebra(bool B);
183
184 /// Set or clear the no-nans flag on this instruction, which must be an
185 /// operator which supports this flag. See LangRef.html for the meaning of
186 /// this flag.
187 void setHasNoNaNs(bool B);
188
189 /// Set or clear the no-infs flag on this instruction, which must be an
190 /// operator which supports this flag. See LangRef.html for the meaning of
191 /// this flag.
192 void setHasNoInfs(bool B);
193
194 /// Set or clear the no-signed-zeros flag on this instruction, which must be
195 /// an operator which supports this flag. See LangRef.html for the meaning of
196 /// this flag.
197 void setHasNoSignedZeros(bool B);
198
199 /// Set or clear the allow-reciprocal flag on this instruction, which must be
200 /// an operator which supports this flag. See LangRef.html for the meaning of
201 /// this flag.
202 void setHasAllowReciprocal(bool B);
203
204 /// Convenience function for setting all the fast-math flags on this
205 /// instruction, which must be an operator which supports these flags. See
206 /// LangRef.html for the meaning of these flats.
207 void setFastMathFlags(FastMathFlags FMF);
208
209 /// Determine whether the unsafe-algebra flag is set.
210 bool hasUnsafeAlgebra() const;
211
212 /// Determine whether the no-NaNs flag is set.
213 bool hasNoNaNs() const;
214
215 /// Determine whether the no-infs flag is set.
216 bool hasNoInfs() const;
217
218 /// Determine whether the no-signed-zeros flag is set.
219 bool hasNoSignedZeros() const;
220
221 /// Determine whether the allow-reciprocal flag is set.
222 bool hasAllowReciprocal() const;
223
224 /// Convenience function for getting all the fast-math flags, which must be an
225 /// operator which supports these flags. See LangRef.html for the meaning of
226 /// these flats.
227 FastMathFlags getFastMathFlags() const;
177228
178229 private:
179230 /// hasMetadataHashEntry - Return true if we have an entry in the on-the-side
1515 #include "llvm/Instructions.h"
1616 #include "llvm/Constants.h"
1717 #include "llvm/Module.h"
18 #include "llvm/Operator.h"
1819 #include "llvm/Support/CallSite.h"
1920 #include "llvm/Support/LeakDetector.h"
2021 using namespace llvm;
9192 this);
9293 }
9394
95 /// Set or clear the unsafe-algebra flag on this instruction, which must be an
96 /// operator which supports this flag. See LangRef.html for the meaning of this
97 /// flag.
98 void Instruction::setHasUnsafeAlgebra(bool B) {
99 assert(isa(this) && "setting fast-math flag on invalid op");
100 cast(this)->setHasUnsafeAlgebra(B);
101 }
102
103 /// Set or clear the NoNaNs flag on this instruction, which must be an operator
104 /// which supports this flag. See LangRef.html for the meaning of this flag.
105 void Instruction::setHasNoNaNs(bool B) {
106 assert(isa(this) && "setting fast-math flag on invalid op");
107 cast(this)->setHasNoNaNs(B);
108 }
109
110 /// Set or clear the no-infs flag on this instruction, which must be an operator
111 /// which supports this flag. See LangRef.html for the meaning of this flag.
112 void Instruction::setHasNoInfs(bool B) {
113 assert(isa(this) && "setting fast-math flag on invalid op");
114 cast(this)->setHasNoInfs(B);
115 }
116
117 /// Set or clear the no-signed-zeros flag on this instruction, which must be an
118 /// operator which supports this flag. See LangRef.html for the meaning of this
119 /// flag.
120 void Instruction::setHasNoSignedZeros(bool B) {
121 assert(isa(this) && "setting fast-math flag on invalid op");
122 cast(this)->setHasNoSignedZeros(B);
123 }
124
125 /// Set or clear the allow-reciprocal flag on this instruction, which must be an
126 /// operator which supports this flag. See LangRef.html for the meaning of this
127 /// flag.
128 void Instruction::setHasAllowReciprocal(bool B) {
129 assert(isa(this) && "setting fast-math flag on invalid op");
130 cast(this)->setHasAllowReciprocal(B);
131 }
132
133 /// Convenience function for setting all the fast-math flags on this
134 /// instruction, which must be an operator which supports these flags. See
135 /// LangRef.html for the meaning of these flats.
136 void Instruction::setFastMathFlags(FastMathFlags FMF) {
137 assert(isa(this) && "setting fast-math flag on invalid op");
138 cast(this)->setFastMathFlags(FMF);
139 }
140
141 /// Determine whether the unsafe-algebra flag is set.
142 bool Instruction::hasUnsafeAlgebra() const {
143 assert(isa(this) && "setting fast-math flag on invalid op");
144 return cast(this)->hasUnsafeAlgebra();
145 }
146
147 /// Determine whether the no-NaNs flag is set.
148 bool Instruction::hasNoNaNs() const {
149 assert(isa(this) && "setting fast-math flag on invalid op");
150 return cast(this)->hasNoNaNs();
151 }
152
153 /// Determine whether the no-infs flag is set.
154 bool Instruction::hasNoInfs() const {
155 assert(isa(this) && "setting fast-math flag on invalid op");
156 return cast(this)->hasNoInfs();
157 }
158
159 /// Determine whether the no-signed-zeros flag is set.
160 bool Instruction::hasNoSignedZeros() const {
161 assert(isa(this) && "setting fast-math flag on invalid op");
162 return cast(this)->hasNoSignedZeros();
163 }
164
165 /// Determine whether the allow-reciprocal flag is set.
166 bool Instruction::hasAllowReciprocal() const {
167 assert(isa(this) && "setting fast-math flag on invalid op");
168 return cast(this)->hasAllowReciprocal();
169 }
170
171 /// Convenience function for getting all the fast-math flags, which must be an
172 /// operator which supports these flags. See LangRef.html for the meaning of
173 /// these flats.
174 FastMathFlags Instruction::getFastMathFlags() const {
175 assert(isa(this) && "setting fast-math flag on invalid op");
176 return cast(this)->getFastMathFlags();
177 }
94178
95179 const char *Instruction::getOpcodeName(unsigned OpCode) {
96180 switch (OpCode) {