llvm.org GIT mirror llvm / f137ed2
[IR][CodeGen] Remove dependency on EVT from IR/Function.cpp. Move EVT to CodeGen layer. Currently EVT is in the IR layer only because of Function.cpp needing a very small piece of the functionality of EVT::getEVTString(). The rest of EVT is used in codegen making CodeGen a better place for it. The previous code converted a Type* to EVT and then called getEVTString. This was only expected to handle the primitive types from Type*. Since there only a few primitive types, we can just print them as strings directly. Differential Revision: https://reviews.llvm.org/D45017 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328806 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 2 years ago
64 changed file(s) with 836 addition(s) and 825 deletion(s). Raw diff Collapse all Expand all
2727 #include "llvm/CodeGen/ISDOpcodes.h"
2828 #include "llvm/CodeGen/TargetLowering.h"
2929 #include "llvm/CodeGen/TargetSubtargetInfo.h"
30 #include "llvm/CodeGen/ValueTypes.h"
3031 #include "llvm/IR/BasicBlock.h"
3132 #include "llvm/IR/CallSite.h"
3233 #include "llvm/IR/Constant.h"
4041 #include "llvm/IR/Operator.h"
4142 #include "llvm/IR/Type.h"
4243 #include "llvm/IR/Value.h"
43 #include "llvm/IR/ValueTypes.h"
4444 #include "llvm/MC/MCSchedule.h"
4545 #include "llvm/Support/Casting.h"
4646 #include "llvm/Support/CommandLine.h"
1414 #ifndef LLVM_CODEGEN_RUNTIMELIBCALLS_H
1515 #define LLVM_CODEGEN_RUNTIMELIBCALLS_H
1616
17 #include "llvm/IR/ValueTypes.h"
17 #include "llvm/CodeGen/ValueTypes.h"
1818
1919 namespace llvm {
2020 namespace RTLIB {
3434 #include "llvm/CodeGen/MachineFunction.h"
3535 #include "llvm/CodeGen/MachineMemOperand.h"
3636 #include "llvm/CodeGen/SelectionDAGNodes.h"
37 #include "llvm/CodeGen/ValueTypes.h"
3738 #include "llvm/IR/DebugLoc.h"
3839 #include "llvm/IR/Instructions.h"
3940 #include "llvm/IR/Metadata.h"
40 #include "llvm/IR/ValueTypes.h"
4141 #include "llvm/Support/Allocator.h"
4242 #include "llvm/Support/ArrayRecycler.h"
4343 #include "llvm/Support/AtomicOrdering.h"
3030 #include "llvm/ADT/iterator_range.h"
3131 #include "llvm/CodeGen/ISDOpcodes.h"
3232 #include "llvm/CodeGen/MachineMemOperand.h"
33 #include "llvm/CodeGen/ValueTypes.h"
3334 #include "llvm/IR/Constants.h"
3435 #include "llvm/IR/DebugLoc.h"
3536 #include "llvm/IR/Instruction.h"
3637 #include "llvm/IR/Instructions.h"
3738 #include "llvm/IR/Metadata.h"
38 #include "llvm/IR/ValueTypes.h"
3939 #include "llvm/Support/AlignOf.h"
4040 #include "llvm/Support/AtomicOrdering.h"
4141 #include "llvm/Support/Casting.h"
1313 #ifndef LLVM_CODEGEN_TARGETCALLINGCONV_H
1414 #define LLVM_CODEGEN_TARGETCALLINGCONV_H
1515
16 #include "llvm/IR/ValueTypes.h"
16 #include "llvm/CodeGen/ValueTypes.h"
1717 #include "llvm/Support/MachineValueType.h"
1818 #include "llvm/Support/MathExtras.h"
1919 #include
3535 #include "llvm/CodeGen/SelectionDAG.h"
3636 #include "llvm/CodeGen/SelectionDAGNodes.h"
3737 #include "llvm/CodeGen/TargetCallingConv.h"
38 #include "llvm/CodeGen/ValueTypes.h"
3839 #include "llvm/IR/Attributes.h"
3940 #include "llvm/IR/CallSite.h"
4041 #include "llvm/IR/CallingConv.h"
4647 #include "llvm/IR/Instruction.h"
4748 #include "llvm/IR/Instructions.h"
4849 #include "llvm/IR/Type.h"
49 #include "llvm/IR/ValueTypes.h"
5050 #include "llvm/MC/MCRegisterInfo.h"
5151 #include "llvm/Support/AtomicOrdering.h"
5252 #include "llvm/Support/Casting.h"
0 //===- CodeGen/ValueTypes.h - Low-Level Target independ. types --*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the set of low-level target independent types which various
10 // values in the code generator are. This allows the target specific behavior
11 // of instructions to be described to target independent passes.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CODEGEN_VALUETYPES_H
16 #define LLVM_CODEGEN_VALUETYPES_H
17
18 #include "llvm/Support/Compiler.h"
19 #include "llvm/Support/MachineValueType.h"
20 #include "llvm/Support/MathExtras.h"
21 #include
22 #include
23 #include
24
25 namespace llvm {
26
27 class LLVMContext;
28 class Type;
29
30 /// Extended Value Type. Capable of holding value types which are not native
31 /// for any processor (such as the i12345 type), as well as the types an MVT
32 /// can represent.
33 struct EVT {
34 private:
35 MVT V = MVT::INVALID_SIMPLE_VALUE_TYPE;
36 Type *LLVMTy = nullptr;
37
38 public:
39 constexpr EVT() = default;
40 constexpr EVT(MVT::SimpleValueType SVT) : V(SVT) {}
41 constexpr EVT(MVT S) : V(S) {}
42
43 bool operator==(EVT VT) const {
44 return !(*this != VT);
45 }
46 bool operator!=(EVT VT) const {
47 if (V.SimpleTy != VT.V.SimpleTy)
48 return true;
49 if (V.SimpleTy == MVT::INVALID_SIMPLE_VALUE_TYPE)
50 return LLVMTy != VT.LLVMTy;
51 return false;
52 }
53
54 /// Returns the EVT that represents a floating-point type with the given
55 /// number of bits. There are two floating-point types with 128 bits - this
56 /// returns f128 rather than ppcf128.
57 static EVT getFloatingPointVT(unsigned BitWidth) {
58 return MVT::getFloatingPointVT(BitWidth);
59 }
60
61 /// Returns the EVT that represents an integer with the given number of
62 /// bits.
63 static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth) {
64 MVT M = MVT::getIntegerVT(BitWidth);
65 if (M.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE)
66 return M;
67 return getExtendedIntegerVT(Context, BitWidth);
68 }
69
70 /// Returns the EVT that represents a vector NumElements in length, where
71 /// each element is of type VT.
72 static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements,
73 bool IsScalable = false) {
74 MVT M = MVT::getVectorVT(VT.V, NumElements, IsScalable);
75 if (M.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE)
76 return M;
77
78 assert(!IsScalable && "We don't support extended scalable types yet");
79 return getExtendedVectorVT(Context, VT, NumElements);
80 }
81
82 /// Returns the EVT that represents a vector EC.Min elements in length,
83 /// where each element is of type VT.
84 static EVT getVectorVT(LLVMContext &Context, EVT VT, MVT::ElementCount EC) {
85 MVT M = MVT::getVectorVT(VT.V, EC);
86 if (M.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE)
87 return M;
88 assert (!EC.Scalable && "We don't support extended scalable types yet");
89 return getExtendedVectorVT(Context, VT, EC.Min);
90 }
91
92 /// Return a vector with the same number of elements as this vector, but
93 /// with the element type converted to an integer type with the same
94 /// bitwidth.
95 EVT changeVectorElementTypeToInteger() const {
96 if (!isSimple()) {
97 assert (!isScalableVector() &&
98 "We don't support extended scalable types yet");
99 return changeExtendedVectorElementTypeToInteger();
100 }
101 MVT EltTy = getSimpleVT().getVectorElementType();
102 unsigned BitWidth = EltTy.getSizeInBits();
103 MVT IntTy = MVT::getIntegerVT(BitWidth);
104 MVT VecTy = MVT::getVectorVT(IntTy, getVectorNumElements(),
105 isScalableVector());
106 assert(VecTy.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE &&
107 "Simple vector VT not representable by simple integer vector VT!");
108 return VecTy;
109 }
110
111 /// Return the type converted to an equivalently sized integer or vector
112 /// with integer element type. Similar to changeVectorElementTypeToInteger,
113 /// but also handles scalars.
114 EVT changeTypeToInteger() {
115 if (isVector())
116 return changeVectorElementTypeToInteger();
117
118 if (isSimple())
119 return MVT::getIntegerVT(getSizeInBits());
120
121 return changeExtendedTypeToInteger();
122 }
123
124 /// Test if the given EVT is simple (as opposed to being extended).
125 bool isSimple() const {
126 return V.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE;
127 }
128
129 /// Test if the given EVT is extended (as opposed to being simple).
130 bool isExtended() const {
131 return !isSimple();
132 }
133
134 /// Return true if this is a FP or a vector FP type.
135 bool isFloatingPoint() const {
136 return isSimple() ? V.isFloatingPoint() : isExtendedFloatingPoint();
137 }
138
139 /// Return true if this is an integer or a vector integer type.
140 bool isInteger() const {
141 return isSimple() ? V.isInteger() : isExtendedInteger();
142 }
143
144 /// Return true if this is an integer, but not a vector.
145 bool isScalarInteger() const {
146 return isSimple() ? V.isScalarInteger() : isExtendedScalarInteger();
147 }
148
149 /// Return true if this is a vector value type.
150 bool isVector() const {
151 return isSimple() ? V.isVector() : isExtendedVector();
152 }
153
154 /// Return true if this is a vector type where the runtime
155 /// length is machine dependent
156 bool isScalableVector() const {
157 // FIXME: We don't support extended scalable types yet, because the
158 // matching IR type doesn't exist. Once it has been added, this can
159 // be changed to call isExtendedScalableVector.
160 if (!isSimple())
161 return false;
162 return V.isScalableVector();
163 }
164
165 /// Return true if this is a 16-bit vector type.
166 bool is16BitVector() const {
167 return isSimple() ? V.is16BitVector() : isExtended16BitVector();
168 }
169
170 /// Return true if this is a 32-bit vector type.
171 bool is32BitVector() const {
172 return isSimple() ? V.is32BitVector() : isExtended32BitVector();
173 }
174
175 /// Return true if this is a 64-bit vector type.
176 bool is64BitVector() const {
177 return isSimple() ? V.is64BitVector() : isExtended64BitVector();
178 }
179
180 /// Return true if this is a 128-bit vector type.
181 bool is128BitVector() const {
182 return isSimple() ? V.is128BitVector() : isExtended128BitVector();
183 }
184
185 /// Return true if this is a 256-bit vector type.
186 bool is256BitVector() const {
187 return isSimple() ? V.is256BitVector() : isExtended256BitVector();
188 }
189
190 /// Return true if this is a 512-bit vector type.
191 bool is512BitVector() const {
192 return isSimple() ? V.is512BitVector() : isExtended512BitVector();
193 }
194
195 /// Return true if this is a 1024-bit vector type.
196 bool is1024BitVector() const {
197 return isSimple() ? V.is1024BitVector() : isExtended1024BitVector();
198 }
199
200 /// Return true if this is a 2048-bit vector type.
201 bool is2048BitVector() const {
202 return isSimple() ? V.is2048BitVector() : isExtended2048BitVector();
203 }
204
205 /// Return true if this is an overloaded type for TableGen.
206 bool isOverloaded() const {
207 return (V==MVT::iAny || V==MVT::fAny || V==MVT::vAny || V==MVT::iPTRAny);
208 }
209
210 /// Return true if the bit size is a multiple of 8.
211 bool isByteSized() const {
212 return (getSizeInBits() & 7) == 0;
213 }
214
215 /// Return true if the size is a power-of-two number of bytes.
216 bool isRound() const {
217 unsigned BitSize = getSizeInBits();
218 return BitSize >= 8 && !(BitSize & (BitSize - 1));
219 }
220
221 /// Return true if this has the same number of bits as VT.
222 bool bitsEq(EVT VT) const {
223 if (EVT::operator==(VT)) return true;
224 return getSizeInBits() == VT.getSizeInBits();
225 }
226
227 /// Return true if this has more bits than VT.
228 bool bitsGT(EVT VT) const {
229 if (EVT::operator==(VT)) return false;
230 return getSizeInBits() > VT.getSizeInBits();
231 }
232
233 /// Return true if this has no less bits than VT.
234 bool bitsGE(EVT VT) const {
235 if (EVT::operator==(VT)) return true;
236 return getSizeInBits() >= VT.getSizeInBits();
237 }
238
239 /// Return true if this has less bits than VT.
240 bool bitsLT(EVT VT) const {
241 if (EVT::operator==(VT)) return false;
242 return getSizeInBits() < VT.getSizeInBits();
243 }
244
245 /// Return true if this has no more bits than VT.
246 bool bitsLE(EVT VT) const {
247 if (EVT::operator==(VT)) return true;
248 return getSizeInBits() <= VT.getSizeInBits();
249 }
250
251 /// Return the SimpleValueType held in the specified simple EVT.
252 MVT getSimpleVT() const {
253 assert(isSimple() && "Expected a SimpleValueType!");
254 return V;
255 }
256
257 /// If this is a vector type, return the element type, otherwise return
258 /// this.
259 EVT getScalarType() const {
260 return isVector() ? getVectorElementType() : *this;
261 }
262
263 /// Given a vector type, return the type of each element.
264 EVT getVectorElementType() const {
265 assert(isVector() && "Invalid vector type!");
266 if (isSimple())
267 return V.getVectorElementType();
268 return getExtendedVectorElementType();
269 }
270
271 /// Given a vector type, return the number of elements it contains.
272 unsigned getVectorNumElements() const {
273 assert(isVector() && "Invalid vector type!");
274 if (isSimple())
275 return V.getVectorNumElements();
276 return getExtendedVectorNumElements();
277 }
278
279 // Given a (possibly scalable) vector type, return the ElementCount
280 MVT::ElementCount getVectorElementCount() const {
281 assert((isVector()) && "Invalid vector type!");
282 if (isSimple())
283 return V.getVectorElementCount();
284
285 assert(!isScalableVector() &&
286 "We don't support extended scalable types yet");
287 return {getExtendedVectorNumElements(), false};
288 }
289
290 /// Return the size of the specified value type in bits.
291 unsigned getSizeInBits() const {
292 if (isSimple())
293 return V.getSizeInBits();
294 return getExtendedSizeInBits();
295 }
296
297 unsigned getScalarSizeInBits() const {
298 return getScalarType().getSizeInBits();
299 }
300
301 /// Return the number of bytes overwritten by a store of the specified value
302 /// type.
303 unsigned getStoreSize() const {
304 return (getSizeInBits() + 7) / 8;
305 }
306
307 /// Return the number of bits overwritten by a store of the specified value
308 /// type.
309 unsigned getStoreSizeInBits() const {
310 return getStoreSize() * 8;
311 }
312
313 /// Rounds the bit-width of the given integer EVT up to the nearest power of
314 /// two (and at least to eight), and returns the integer EVT with that
315 /// number of bits.
316 EVT getRoundIntegerType(LLVMContext &Context) const {
317 assert(isInteger() && !isVector() && "Invalid integer type!");
318 unsigned BitWidth = getSizeInBits();
319 if (BitWidth <= 8)
320 return EVT(MVT::i8);
321 return getIntegerVT(Context, 1 << Log2_32_Ceil(BitWidth));
322 }
323
324 /// Finds the smallest simple value type that is greater than or equal to
325 /// half the width of this EVT. If no simple value type can be found, an
326 /// extended integer value type of half the size (rounded up) is returned.
327 EVT getHalfSizedIntegerVT(LLVMContext &Context) const {
328 assert(isInteger() && !isVector() && "Invalid integer type!");
329 unsigned EVTSize = getSizeInBits();
330 for (unsigned IntVT = MVT::FIRST_INTEGER_VALUETYPE;
331 IntVT <= MVT::LAST_INTEGER_VALUETYPE; ++IntVT) {
332 EVT HalfVT = EVT((MVT::SimpleValueType)IntVT);
333 if (HalfVT.getSizeInBits() * 2 >= EVTSize)
334 return HalfVT;
335 }
336 return getIntegerVT(Context, (EVTSize + 1) / 2);
337 }
338
339 /// Return a VT for an integer vector type with the size of the
340 /// elements doubled. The typed returned may be an extended type.
341 EVT widenIntegerVectorElementType(LLVMContext &Context) const {
342 EVT EltVT = getVectorElementType();
343 EltVT = EVT::getIntegerVT(Context, 2 * EltVT.getSizeInBits());
344 return EVT::getVectorVT(Context, EltVT, getVectorElementCount());
345 }
346
347 // Return a VT for a vector type with the same element type but
348 // half the number of elements. The type returned may be an
349 // extended type.
350 EVT getHalfNumVectorElementsVT(LLVMContext &Context) const {
351 EVT EltVT = getVectorElementType();
352 auto EltCnt = getVectorElementCount();
353 assert(!(EltCnt.Min & 1) && "Splitting vector, but not in half!");
354 return EVT::getVectorVT(Context, EltVT, EltCnt / 2);
355 }
356
357 /// Returns true if the given vector is a power of 2.
358 bool isPow2VectorType() const {
359 unsigned NElts = getVectorNumElements();
360 return !(NElts & (NElts - 1));
361 }
362
363 /// Widens the length of the given vector EVT up to the nearest power of 2
364 /// and returns that type.
365 EVT getPow2VectorType(LLVMContext &Context) const {
366 if (!isPow2VectorType()) {
367 unsigned NElts = getVectorNumElements();
368 unsigned Pow2NElts = 1 << Log2_32_Ceil(NElts);
369 return EVT::getVectorVT(Context, getVectorElementType(), Pow2NElts,
370 isScalableVector());
371 }
372 else {
373 return *this;
374 }
375 }
376
377 /// This function returns value type as a string, e.g. "i32".
378 std::string getEVTString() const;
379
380 /// This method returns an LLVM type corresponding to the specified EVT.
381 /// For integer types, this returns an unsigned type. Note that this will
382 /// abort for types that cannot be represented.
383 Type *getTypeForEVT(LLVMContext &Context) const;
384
385 /// Return the value type corresponding to the specified type.
386 /// This returns all pointers as iPTR. If HandleUnknown is true, unknown
387 /// types are returned as Other, otherwise they are invalid.
388 static EVT getEVT(Type *Ty, bool HandleUnknown = false);
389
390 intptr_t getRawBits() const {
391 if (isSimple())
392 return V.SimpleTy;
393 else
394 return (intptr_t)(LLVMTy);
395 }
396
397 /// A meaningless but well-behaved order, useful for constructing
398 /// containers.
399 struct compareRawBits {
400 bool operator()(EVT L, EVT R) const {
401 if (L.V.SimpleTy == R.V.SimpleTy)
402 return L.LLVMTy < R.LLVMTy;
403 else
404 return L.V.SimpleTy < R.V.SimpleTy;
405 }
406 };
407
408 private:
409 // Methods for handling the Extended-type case in functions above.
410 // These are all out-of-line to prevent users of this header file
411 // from having a dependency on Type.h.
412 EVT changeExtendedTypeToInteger() const;
413 EVT changeExtendedVectorElementTypeToInteger() const;
414 static EVT getExtendedIntegerVT(LLVMContext &C, unsigned BitWidth);
415 static EVT getExtendedVectorVT(LLVMContext &C, EVT VT,
416 unsigned NumElements);
417 bool isExtendedFloatingPoint() const LLVM_READONLY;
418 bool isExtendedInteger() const LLVM_READONLY;
419 bool isExtendedScalarInteger() const LLVM_READONLY;
420 bool isExtendedVector() const LLVM_READONLY;
421 bool isExtended16BitVector() const LLVM_READONLY;
422 bool isExtended32BitVector() const LLVM_READONLY;
423 bool isExtended64BitVector() const LLVM_READONLY;
424 bool isExtended128BitVector() const LLVM_READONLY;
425 bool isExtended256BitVector() const LLVM_READONLY;
426 bool isExtended512BitVector() const LLVM_READONLY;
427 bool isExtended1024BitVector() const LLVM_READONLY;
428 bool isExtended2048BitVector() const LLVM_READONLY;
429 EVT getExtendedVectorElementType() const;
430 unsigned getExtendedVectorNumElements() const LLVM_READONLY;
431 unsigned getExtendedSizeInBits() const LLVM_READONLY;
432 };
433
434 } // end namespace llvm
435
436 #endif // LLVM_CODEGEN_VALUETYPES_H
+0
-437
include/llvm/IR/ValueTypes.h less more
None //===- IR/ValueTypes.h - Low-Level Target independ. types --*- C++ -*-===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the set of low-level target independent types which various
10 // values in the code generator are. This allows the target specific behavior
11 // of instructions to be described to target independent passes.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_CODEGEN_VALUETYPES_H
16 #define LLVM_CODEGEN_VALUETYPES_H
17
18 #include "llvm/Support/Compiler.h"
19 #include "llvm/Support/MachineValueType.h"
20 #include "llvm/Support/MathExtras.h"
21 #include
22 #include
23 #include
24
25 namespace llvm {
26
27 class LLVMContext;
28 class Type;
29
30 /// Extended Value Type. Capable of holding value types which are not native
31 /// for any processor (such as the i12345 type), as well as the types an MVT
32 /// can represent.
33 struct EVT {
34 private:
35 MVT V = MVT::INVALID_SIMPLE_VALUE_TYPE;
36 Type *LLVMTy = nullptr;
37
38 public:
39 constexpr EVT() = default;
40 constexpr EVT(MVT::SimpleValueType SVT) : V(SVT) {}
41 constexpr EVT(MVT S) : V(S) {}
42
43 bool operator==(EVT VT) const {
44 return !(*this != VT);
45 }
46 bool operator!=(EVT VT) const {
47 if (V.SimpleTy != VT.V.SimpleTy)
48 return true;
49 if (V.SimpleTy == MVT::INVALID_SIMPLE_VALUE_TYPE)
50 return LLVMTy != VT.LLVMTy;
51 return false;
52 }
53
54 /// Returns the EVT that represents a floating-point type with the given
55 /// number of bits. There are two floating-point types with 128 bits - this
56 /// returns f128 rather than ppcf128.
57 static EVT getFloatingPointVT(unsigned BitWidth) {
58 return MVT::getFloatingPointVT(BitWidth);
59 }
60
61 /// Returns the EVT that represents an integer with the given number of
62 /// bits.
63 static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth) {
64 MVT M = MVT::getIntegerVT(BitWidth);
65 if (M.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE)
66 return M;
67 return getExtendedIntegerVT(Context, BitWidth);
68 }
69
70 /// Returns the EVT that represents a vector NumElements in length, where
71 /// each element is of type VT.
72 static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements,
73 bool IsScalable = false) {
74 MVT M = MVT::getVectorVT(VT.V, NumElements, IsScalable);
75 if (M.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE)
76 return M;
77
78 assert(!IsScalable && "We don't support extended scalable types yet");
79 return getExtendedVectorVT(Context, VT, NumElements);
80 }
81
82 /// Returns the EVT that represents a vector EC.Min elements in length,
83 /// where each element is of type VT.
84 static EVT getVectorVT(LLVMContext &Context, EVT VT, MVT::ElementCount EC) {
85 MVT M = MVT::getVectorVT(VT.V, EC);
86 if (M.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE)
87 return M;
88 assert (!EC.Scalable && "We don't support extended scalable types yet");
89 return getExtendedVectorVT(Context, VT, EC.Min);
90 }
91
92 /// Return a vector with the same number of elements as this vector, but
93 /// with the element type converted to an integer type with the same
94 /// bitwidth.
95 EVT changeVectorElementTypeToInteger() const {
96 if (!isSimple()) {
97 assert (!isScalableVector() &&
98 "We don't support extended scalable types yet");
99 return changeExtendedVectorElementTypeToInteger();
100 }
101 MVT EltTy = getSimpleVT().getVectorElementType();
102 unsigned BitWidth = EltTy.getSizeInBits();
103 MVT IntTy = MVT::getIntegerVT(BitWidth);
104 MVT VecTy = MVT::getVectorVT(IntTy, getVectorNumElements(),
105 isScalableVector());
106 assert(VecTy.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE &&
107 "Simple vector VT not representable by simple integer vector VT!");
108 return VecTy;
109 }
110
111 /// Return the type converted to an equivalently sized integer or vector
112 /// with integer element type. Similar to changeVectorElementTypeToInteger,
113 /// but also handles scalars.
114 EVT changeTypeToInteger() {
115 if (isVector())
116 return changeVectorElementTypeToInteger();
117
118 if (isSimple())
119 return MVT::getIntegerVT(getSizeInBits());
120
121 return changeExtendedTypeToInteger();
122 }
123
124 /// Test if the given EVT is simple (as opposed to being extended).
125 bool isSimple() const {
126 return V.SimpleTy != MVT::INVALID_SIMPLE_VALUE_TYPE;
127 }
128
129 /// Test if the given EVT is extended (as opposed to being simple).
130 bool isExtended() const {
131 return !isSimple();
132 }
133
134 /// Return true if this is a FP or a vector FP type.
135 bool isFloatingPoint() const {
136 return isSimple() ? V.isFloatingPoint() : isExtendedFloatingPoint();
137 }
138
139 /// Return true if this is an integer or a vector integer type.
140 bool isInteger() const {
141 return isSimple() ? V.isInteger() : isExtendedInteger();
142 }
143
144 /// Return true if this is an integer, but not a vector.
145 bool isScalarInteger() const {
146 return isSimple() ? V.isScalarInteger() : isExtendedScalarInteger();
147 }
148
149 /// Return true if this is a vector value type.
150 bool isVector() const {
151 return isSimple() ? V.isVector() : isExtendedVector();
152 }
153
154 /// Return true if this is a vector type where the runtime
155 /// length is machine dependent
156 bool isScalableVector() const {
157 // FIXME: We don't support extended scalable types yet, because the
158 // matching IR type doesn't exist. Once it has been added, this can
159 // be changed to call isExtendedScalableVector.
160 if (!isSimple())
161 return false;
162 return V.isScalableVector();
163 }
164
165 /// Return true if this is a 16-bit vector type.
166 bool is16BitVector() const {
167 return isSimple() ? V.is16BitVector() : isExtended16BitVector();
168 }
169
170 /// Return true if this is a 32-bit vector type.
171 bool is32BitVector() const {
172 return isSimple() ? V.is32BitVector() : isExtended32BitVector();
173 }
174
175 /// Return true if this is a 64-bit vector type.
176 bool is64BitVector() const {
177 return isSimple() ? V.is64BitVector() : isExtended64BitVector();
178 }
179
180 /// Return true if this is a 128-bit vector type.
181 bool is128BitVector() const {
182 return isSimple() ? V.is128BitVector() : isExtended128BitVector();
183 }
184
185 /// Return true if this is a 256-bit vector type.
186 bool is256BitVector() const {
187 return isSimple() ? V.is256BitVector() : isExtended256BitVector();
188 }
189
190 /// Return true if this is a 512-bit vector type.
191 bool is512BitVector() const {
192 return isSimple() ? V.is512BitVector() : isExtended512BitVector();
193 }
194
195 /// Return true if this is a 1024-bit vector type.
196 bool is1024BitVector() const {
197 return isSimple() ? V.is1024BitVector() : isExtended1024BitVector();
198 }
199
200 /// Return true if this is a 2048-bit vector type.
201 bool is2048BitVector() const {
202 return isSimple() ? V.is2048BitVector() : isExtended2048BitVector();
203 }
204
205 /// Return true if this is an overloaded type for TableGen.
206 bool isOverloaded() const {
207 return (V==MVT::iAny || V==MVT::fAny || V==MVT::vAny || V==MVT::iPTRAny);
208 }
209
210 /// Return true if the bit size is a multiple of 8.
211 bool isByteSized() const {
212 return (getSizeInBits() & 7) == 0;
213 }
214
215 /// Return true if the size is a power-of-two number of bytes.
216 bool isRound() const {
217 unsigned BitSize = getSizeInBits();
218 return BitSize >= 8 && !(BitSize & (BitSize - 1));
219 }
220
221 /// Return true if this has the same number of bits as VT.
222 bool bitsEq(EVT VT) const {
223 if (EVT::operator==(VT)) return true;
224 return getSizeInBits() == VT.getSizeInBits();
225 }
226
227 /// Return true if this has more bits than VT.
228 bool bitsGT(EVT VT) const {
229 if (EVT::operator==(VT)) return false;
230 return getSizeInBits() > VT.getSizeInBits();
231 }
232
233 /// Return true if this has no less bits than VT.
234 bool bitsGE(EVT VT) const {
235 if (EVT::operator==(VT)) return true;
236 return getSizeInBits() >= VT.getSizeInBits();
237 }
238
239 /// Return true if this has less bits than VT.
240 bool bitsLT(EVT VT) const {
241 if (EVT::operator==(VT)) return false;
242 return getSizeInBits() < VT.getSizeInBits();
243 }
244
245 /// Return true if this has no more bits than VT.
246 bool bitsLE(EVT VT) const {
247 if (EVT::operator==(VT)) return true;
248 return getSizeInBits() <= VT.getSizeInBits();
249 }
250
251 /// Return the SimpleValueType held in the specified simple EVT.
252 MVT getSimpleVT() const {
253 assert(isSimple() && "Expected a SimpleValueType!");
254 return V;
255 }
256
257 /// If this is a vector type, return the element type, otherwise return
258 /// this.
259 EVT getScalarType() const {
260 return isVector() ? getVectorElementType() : *this;
261 }
262
263 /// Given a vector type, return the type of each element.
264 EVT getVectorElementType() const {
265 assert(isVector() && "Invalid vector type!");
266 if (isSimple())
267 return V.getVectorElementType();
268 return getExtendedVectorElementType();
269 }
270
271 /// Given a vector type, return the number of elements it contains.
272 unsigned getVectorNumElements() const {
273 assert(isVector() && "Invalid vector type!");
274 if (isSimple())
275 return V.getVectorNumElements();
276 return getExtendedVectorNumElements();
277 }
278
279 // Given a (possibly scalable) vector type, return the ElementCount
280 MVT::ElementCount getVectorElementCount() const {
281 assert((isVector()) && "Invalid vector type!");
282 if (isSimple())
283 return V.getVectorElementCount();
284
285 assert(!isScalableVector() &&
286 "We don't support extended scalable types yet");
287 return {getExtendedVectorNumElements(), false};
288 }
289
290 /// Return the size of the specified value type in bits.
291 unsigned getSizeInBits() const {
292 if (isSimple())
293 return V.getSizeInBits();
294 return getExtendedSizeInBits();
295 }
296
297 unsigned getScalarSizeInBits() const {
298 return getScalarType().getSizeInBits();
299 }
300
301 /// Return the number of bytes overwritten by a store of the specified value
302 /// type.
303 unsigned getStoreSize() const {
304 return (getSizeInBits() + 7) / 8;
305 }
306
307 /// Return the number of bits overwritten by a store of the specified value
308 /// type.
309 unsigned getStoreSizeInBits() const {
310 return getStoreSize() * 8;
311 }
312
313 /// Rounds the bit-width of the given integer EVT up to the nearest power of
314 /// two (and at least to eight), and returns the integer EVT with that
315 /// number of bits.
316 EVT getRoundIntegerType(LLVMContext &Context) const {
317 assert(isInteger() && !isVector() && "Invalid integer type!");
318 unsigned BitWidth = getSizeInBits();
319 if (BitWidth <= 8)
320 return EVT(MVT::i8);
321 return getIntegerVT(Context, 1 << Log2_32_Ceil(BitWidth));
322 }
323
324 /// Finds the smallest simple value type that is greater than or equal to
325 /// half the width of this EVT. If no simple value type can be found, an
326 /// extended integer value type of half the size (rounded up) is returned.
327 EVT getHalfSizedIntegerVT(LLVMContext &Context) const {
328 assert(isInteger() && !isVector() && "Invalid integer type!");
329 unsigned EVTSize = getSizeInBits();
330 for (unsigned IntVT = MVT::FIRST_INTEGER_VALUETYPE;
331 IntVT <= MVT::LAST_INTEGER_VALUETYPE; ++IntVT) {
332 EVT HalfVT = EVT((MVT::SimpleValueType)IntVT);
333 if (HalfVT.getSizeInBits() * 2 >= EVTSize)
334 return HalfVT;
335 }
336 return getIntegerVT(Context, (EVTSize + 1) / 2);
337 }
338
339 /// Return a VT for an integer vector type with the size of the
340 /// elements doubled. The typed returned may be an extended type.
341 EVT widenIntegerVectorElementType(LLVMContext &Context) const {
342 EVT EltVT = getVectorElementType();
343 EltVT = EVT::getIntegerVT(Context, 2 * EltVT.getSizeInBits());
344 return EVT::getVectorVT(Context, EltVT, getVectorElementCount());
345 }
346
347 // Return a VT for a vector type with the same element type but
348 // half the number of elements. The type returned may be an
349 // extended type.
350 EVT getHalfNumVectorElementsVT(LLVMContext &Context) const {
351 EVT EltVT = getVectorElementType();
352 auto EltCnt = getVectorElementCount();
353 assert(!(EltCnt.Min & 1) && "Splitting vector, but not in half!");
354 return EVT::getVectorVT(Context, EltVT, EltCnt / 2);
355 }
356
357 /// Returns true if the given vector is a power of 2.
358 bool isPow2VectorType() const {
359 unsigned NElts = getVectorNumElements();
360 return !(NElts & (NElts - 1));
361 }
362
363 /// Widens the length of the given vector EVT up to the nearest power of 2
364 /// and returns that type.
365 EVT getPow2VectorType(LLVMContext &Context) const {
366 if (!isPow2VectorType()) {
367 unsigned NElts = getVectorNumElements();
368 unsigned Pow2NElts = 1 << Log2_32_Ceil(NElts);
369 return EVT::getVectorVT(Context, getVectorElementType(), Pow2NElts,
370 isScalableVector());
371 }
372 else {
373 return *this;
374 }
375 }
376
377 /// This function returns value type as a string, e.g. "i32".
378 std::string getEVTString() const;
379
380 /// This method returns an LLVM type corresponding to the specified EVT.
381 /// For integer types, this returns an unsigned type. Note that this will
382 /// abort for types that cannot be represented.
383 Type *getTypeForEVT(LLVMContext &Context) const;
384
385 /// Return the value type corresponding to the specified type.
386 /// This returns all pointers as iPTR. If HandleUnknown is true, unknown
387 /// types are returned as Other, otherwise they are invalid.
388 static EVT getEVT(Type *Ty, bool HandleUnknown = false);
389
390 intptr_t getRawBits() const {
391 if (isSimple())
392 return V.SimpleTy;
393 else
394 return (intptr_t)(LLVMTy);
395 }
396
397 /// A meaningless but well-behaved order, useful for constructing
398 /// containers.
399 struct compareRawBits {
400 bool operator()(EVT L, EVT R) const {
401 if (L.V.SimpleTy == R.V.SimpleTy)
402 return L.LLVMTy < R.LLVMTy;
403 else
404 return L.V.SimpleTy < R.V.SimpleTy;
405 }
406 };
407
408 private:
409 // Methods for handling the Extended-type case in functions above.
410 // These are all out-of-line to prevent users of this header file
411 // from having a dependency on Type.h.
412 EVT changeExtendedTypeToInteger() const;
413 EVT changeExtendedVectorElementTypeToInteger() const;
414 static EVT getExtendedIntegerVT(LLVMContext &C, unsigned BitWidth);
415 static EVT getExtendedVectorVT(LLVMContext &C, EVT VT,
416 unsigned NumElements);
417 bool isExtendedFloatingPoint() const LLVM_READONLY;
418 bool isExtendedInteger() const LLVM_READONLY;
419 bool isExtendedScalarInteger() const LLVM_READONLY;
420 bool isExtendedVector() const LLVM_READONLY;
421 bool isExtended16BitVector() const LLVM_READONLY;
422 bool isExtended32BitVector() const LLVM_READONLY;
423 bool isExtended64BitVector() const LLVM_READONLY;
424 bool isExtended128BitVector() const LLVM_READONLY;
425 bool isExtended256BitVector() const LLVM_READONLY;
426 bool isExtended512BitVector() const LLVM_READONLY;
427 bool isExtended1024BitVector() const LLVM_READONLY;
428 bool isExtended2048BitVector() const LLVM_READONLY;
429 EVT getExtendedVectorElementType() const;
430 unsigned getExtendedVectorNumElements() const LLVM_READONLY;
431 unsigned getExtendedSizeInBits() const LLVM_READONLY;
432 };
433
434 } // end namespace llvm
435
436 #endif // LLVM_CODEGEN_VALUETYPES_H
2222 #include "llvm/CodeGen/TargetLowering.h"
2323 #include "llvm/CodeGen/TargetPassConfig.h"
2424 #include "llvm/CodeGen/TargetSubtargetInfo.h"
25 #include "llvm/CodeGen/ValueTypes.h"
2526 #include "llvm/IR/Attributes.h"
2627 #include "llvm/IR/BasicBlock.h"
2728 #include "llvm/IR/Constant.h"
3738 #include "llvm/IR/Type.h"
3839 #include "llvm/IR/User.h"
3940 #include "llvm/IR/Value.h"
40 #include "llvm/IR/ValueTypes.h"
4141 #include "llvm/Pass.h"
4242 #include "llvm/Support/AtomicOrdering.h"
4343 #include "llvm/Support/Casting.h"
154154 TargetSubtargetInfo.cpp
155155 TwoAddressInstructionPass.cpp
156156 UnreachableBlockElim.cpp
157 ValueTypes.cpp
157158 VirtRegMap.cpp
158159 WinEHPrepare.cpp
159160 XRayInstrumentation.cpp
3737 #include "llvm/CodeGen/TargetLowering.h"
3838 #include "llvm/CodeGen/TargetPassConfig.h"
3939 #include "llvm/CodeGen/TargetSubtargetInfo.h"
40 #include "llvm/CodeGen/ValueTypes.h"
4041 #include "llvm/IR/Argument.h"
4142 #include "llvm/IR/Attributes.h"
4243 #include "llvm/IR/BasicBlock.h"
6970 #include "llvm/IR/Value.h"
7071 #include "llvm/IR/ValueHandle.h"
7172 #include "llvm/IR/ValueMap.h"
72 #include "llvm/IR/ValueTypes.h"
7373 #include "llvm/Pass.h"
7474 #include "llvm/Support/BlockFrequency.h"
7575 #include "llvm/Support/BranchProbability.h"
4343 #include "llvm/CodeGen/TargetLowering.h"
4444 #include "llvm/CodeGen/TargetRegisterInfo.h"
4545 #include "llvm/CodeGen/TargetSubtargetInfo.h"
46 #include "llvm/CodeGen/ValueTypes.h"
4647 #include "llvm/IR/Attributes.h"
4748 #include "llvm/IR/Constant.h"
4849 #include "llvm/IR/DataLayout.h"
5051 #include "llvm/IR/Function.h"
5152 #include "llvm/IR/LLVMContext.h"
5253 #include "llvm/IR/Metadata.h"
53 #include "llvm/IR/ValueTypes.h"
5454 #include "llvm/Support/Casting.h"
5555 #include "llvm/Support/CodeGen.h"
5656 #include "llvm/Support/CommandLine.h"
6464 #include "llvm/CodeGen/TargetInstrInfo.h"
6565 #include "llvm/CodeGen/TargetLowering.h"
6666 #include "llvm/CodeGen/TargetSubtargetInfo.h"
67 #include "llvm/CodeGen/ValueTypes.h"
6768 #include "llvm/IR/Argument.h"
6869 #include "llvm/IR/Attributes.h"
6970 #include "llvm/IR/BasicBlock.h"
9091 #include "llvm/IR/Type.h"
9192 #include "llvm/IR/User.h"
9293 #include "llvm/IR/Value.h"
93 #include "llvm/IR/ValueTypes.h"
9494 #include "llvm/MC/MCContext.h"
9595 #include "llvm/MC/MCInstrDesc.h"
9696 #include "llvm/MC/MCRegisterInfo.h"
2727 #include "llvm/CodeGen/TargetFrameLowering.h"
2828 #include "llvm/CodeGen/TargetLowering.h"
2929 #include "llvm/CodeGen/TargetSubtargetInfo.h"
30 #include "llvm/CodeGen/ValueTypes.h"
3031 #include "llvm/IR/CallingConv.h"
3132 #include "llvm/IR/Constants.h"
3233 #include "llvm/IR/DataLayout.h"
3435 #include "llvm/IR/Function.h"
3536 #include "llvm/IR/Metadata.h"
3637 #include "llvm/IR/Type.h"
37 #include "llvm/IR/ValueTypes.h"
3838 #include "llvm/Support/Casting.h"
3939 #include "llvm/Support/Compiler.h"
4040 #include "llvm/Support/Debug.h"
3434 #include "llvm/CodeGen/SelectionDAG.h"
3535 #include "llvm/CodeGen/SelectionDAGNodes.h"
3636 #include "llvm/CodeGen/TargetLowering.h"
37 #include "llvm/CodeGen/ValueTypes.h"
3738 #include "llvm/IR/DataLayout.h"
38 #include "llvm/IR/ValueTypes.h"
3939 #include "llvm/Support/Casting.h"
4040 #include "llvm/Support/Compiler.h"
4141 #include "llvm/Support/ErrorHandling.h"
3838 #include "llvm/CodeGen/TargetLowering.h"
3939 #include "llvm/CodeGen/TargetRegisterInfo.h"
4040 #include "llvm/CodeGen/TargetSubtargetInfo.h"
41 #include "llvm/CodeGen/ValueTypes.h"
4142 #include "llvm/IR/Constant.h"
4243 #include "llvm/IR/Constants.h"
4344 #include "llvm/IR/DataLayout.h"
4950 #include "llvm/IR/Metadata.h"
5051 #include "llvm/IR/Type.h"
5152 #include "llvm/IR/Value.h"
52 #include "llvm/IR/ValueTypes.h"
5353 #include "llvm/Support/Casting.h"
5454 #include "llvm/Support/CodeGen.h"
5555 #include "llvm/Support/Compiler.h"
6060 #include "llvm/CodeGen/TargetOpcodes.h"
6161 #include "llvm/CodeGen/TargetRegisterInfo.h"
6262 #include "llvm/CodeGen/TargetSubtargetInfo.h"
63 #include "llvm/CodeGen/ValueTypes.h"
6364 #include "llvm/CodeGen/WinEHFuncInfo.h"
6465 #include "llvm/IR/Argument.h"
6566 #include "llvm/IR/Attributes.h"
9091 #include "llvm/IR/Type.h"
9192 #include "llvm/IR/User.h"
9293 #include "llvm/IR/Value.h"
93 #include "llvm/IR/ValueTypes.h"
9494 #include "llvm/MC/MCContext.h"
9595 #include "llvm/MC/MCSymbol.h"
9696 #include "llvm/Support/AtomicOrdering.h"
2323 #include "llvm/CodeGen/SelectionDAG.h"
2424 #include "llvm/CodeGen/SelectionDAGNodes.h"
2525 #include "llvm/CodeGen/TargetLowering.h"
26 #include "llvm/CodeGen/ValueTypes.h"
2627 #include "llvm/IR/CallSite.h"
2728 #include "llvm/IR/DebugLoc.h"
2829 #include "llvm/IR/Instruction.h"
2930 #include "llvm/IR/Statepoint.h"
30 #include "llvm/IR/ValueTypes.h"
3131 #include "llvm/Support/BranchProbability.h"
3232 #include "llvm/Support/CodeGen.h"
3333 #include "llvm/Support/ErrorHandling.h"
2525 #include "llvm/CodeGen/TargetLowering.h"
2626 #include "llvm/CodeGen/TargetRegisterInfo.h"
2727 #include "llvm/CodeGen/TargetSubtargetInfo.h"
28 #include "llvm/CodeGen/ValueTypes.h"
2829 #include "llvm/IR/BasicBlock.h"
2930 #include "llvm/IR/Constants.h"
3031 #include "llvm/IR/DebugInfoMetadata.h"
3334 #include "llvm/IR/Intrinsics.h"
3435 #include "llvm/IR/ModuleSlotTracker.h"
3536 #include "llvm/IR/Value.h"
36 #include "llvm/IR/ValueTypes.h"
3737 #include "llvm/Support/Casting.h"
3838 #include "llvm/Support/CommandLine.h"
3939 #include "llvm/Support/Compiler.h"
5151 #include "llvm/CodeGen/TargetLowering.h"
5252 #include "llvm/CodeGen/TargetRegisterInfo.h"
5353 #include "llvm/CodeGen/TargetSubtargetInfo.h"
54 #include "llvm/CodeGen/ValueTypes.h"
5455 #include "llvm/IR/BasicBlock.h"
5556 #include "llvm/IR/Constants.h"
5657 #include "llvm/IR/DataLayout.h"
6970 #include "llvm/IR/Type.h"
7071 #include "llvm/IR/User.h"
7172 #include "llvm/IR/Value.h"
72 #include "llvm/IR/ValueTypes.h"
7373 #include "llvm/MC/MCInstrDesc.h"
7474 #include "llvm/MC/MCRegisterInfo.h"
7575 #include "llvm/Pass.h"
1919 #include "llvm/ADT/SmallBitVector.h"
2020 #include "llvm/ADT/SmallVector.h"
2121 #include "llvm/CodeGen/SelectionDAGNodes.h"
22 #include "llvm/IR/ValueTypes.h"
22 #include "llvm/CodeGen/ValueTypes.h"
2323 #include
2424
2525 namespace llvm {
3232 #include "llvm/CodeGen/TargetLowering.h"
3333 #include "llvm/CodeGen/TargetOpcodes.h"
3434 #include "llvm/CodeGen/TargetRegisterInfo.h"
35 #include "llvm/CodeGen/ValueTypes.h"
3536 #include "llvm/IR/Attributes.h"
3637 #include "llvm/IR/CallingConv.h"
3738 #include "llvm/IR/DataLayout.h"
4243 #include "llvm/IR/IRBuilder.h"
4344 #include "llvm/IR/Module.h"
4445 #include "llvm/IR/Type.h"
45 #include "llvm/IR/ValueTypes.h"
4646 #include "llvm/Support/BranchProbability.h"
4747 #include "llvm/Support/Casting.h"
4848 #include "llvm/Support/CommandLine.h"
0 //===----------- ValueTypes.cpp - Implementation of EVT methods -----------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/CodeGen/ValueTypes.h"
10 #include "llvm/ADT/StringExtras.h"
11 #include "llvm/IR/DerivedTypes.h"
12 #include "llvm/IR/Type.h"
13 #include "llvm/Support/ErrorHandling.h"
14 using namespace llvm;
15
16 EVT EVT::changeExtendedTypeToInteger() const {
17 LLVMContext &Context = LLVMTy->getContext();
18 return getIntegerVT(Context, getSizeInBits());
19 }
20
21 EVT EVT::changeExtendedVectorElementTypeToInteger() const {
22 LLVMContext &Context = LLVMTy->getContext();
23 EVT IntTy = getIntegerVT(Context, getScalarSizeInBits());
24 return getVectorVT(Context, IntTy, getVectorNumElements());
25 }
26
27 EVT EVT::getExtendedIntegerVT(LLVMContext &Context, unsigned BitWidth) {
28 EVT VT;
29 VT.LLVMTy = IntegerType::get(Context, BitWidth);
30 assert(VT.isExtended() && "Type is not extended!");
31 return VT;
32 }
33
34 EVT EVT::getExtendedVectorVT(LLVMContext &Context, EVT VT,
35 unsigned NumElements) {
36 EVT ResultVT;
37 ResultVT.LLVMTy = VectorType::get(VT.getTypeForEVT(Context), NumElements);
38 assert(ResultVT.isExtended() && "Type is not extended!");
39 return ResultVT;
40 }
41
42 bool EVT::isExtendedFloatingPoint() const {
43 assert(isExtended() && "Type is not extended!");
44 return LLVMTy->isFPOrFPVectorTy();
45 }
46
47 bool EVT::isExtendedInteger() const {
48 assert(isExtended() && "Type is not extended!");
49 return LLVMTy->isIntOrIntVectorTy();
50 }
51
52 bool EVT::isExtendedScalarInteger() const {
53 assert(isExtended() && "Type is not extended!");
54 return LLVMTy->isIntegerTy();
55 }
56
57 bool EVT::isExtendedVector() const {
58 assert(isExtended() && "Type is not extended!");
59 return LLVMTy->isVectorTy();
60 }
61
62 bool EVT::isExtended16BitVector() const {
63 return isExtendedVector() && getExtendedSizeInBits() == 16;
64 }
65
66 bool EVT::isExtended32BitVector() const {
67 return isExtendedVector() && getExtendedSizeInBits() == 32;
68 }
69
70 bool EVT::isExtended64BitVector() const {
71 return isExtendedVector() && getExtendedSizeInBits() == 64;
72 }
73
74 bool EVT::isExtended128BitVector() const {
75 return isExtendedVector() && getExtendedSizeInBits() == 128;
76 }
77
78 bool EVT::isExtended256BitVector() const {
79 return isExtendedVector() && getExtendedSizeInBits() == 256;
80 }
81
82 bool EVT::isExtended512BitVector() const {
83 return isExtendedVector() && getExtendedSizeInBits() == 512;
84 }
85
86 bool EVT::isExtended1024BitVector() const {
87 return isExtendedVector() && getExtendedSizeInBits() == 1024;
88 }
89
90 bool EVT::isExtended2048BitVector() const {
91 return isExtendedVector() && getExtendedSizeInBits() == 2048;
92 }
93
94 EVT EVT::getExtendedVectorElementType() const {
95 assert(isExtended() && "Type is not extended!");
96 return EVT::getEVT(cast(LLVMTy)->getElementType());
97 }
98
99 unsigned EVT::getExtendedVectorNumElements() const {
100 assert(isExtended() && "Type is not extended!");
101 return cast(LLVMTy)->getNumElements();
102 }
103
104 unsigned EVT::getExtendedSizeInBits() const {
105 assert(isExtended() && "Type is not extended!");
106 if (IntegerType *ITy = dyn_cast(LLVMTy))
107 return ITy->getBitWidth();
108 if (VectorType *VTy = dyn_cast(LLVMTy))
109 return VTy->getBitWidth();
110 llvm_unreachable("Unrecognized extended type!");
111 }
112
113 /// getEVTString - This function returns value type as a string, e.g. "i32".
114 std::string EVT::getEVTString() const {
115 switch (V.SimpleTy) {
116 default:
117 if (isVector())
118 return "v" + utostr(getVectorNumElements()) +
119 getVectorElementType().getEVTString();
120 if (isInteger())
121 return "i" + utostr(getSizeInBits());
122 llvm_unreachable("Invalid EVT!");
123 case MVT::i1: return "i1";
124 case MVT::i8: return "i8";
125 case MVT::i16: return "i16";
126 case MVT::i32: return "i32";
127 case MVT::i64: return "i64";
128 case MVT::i128: return "i128";
129 case MVT::f16: return "f16";
130 case MVT::f32: return "f32";
131 case MVT::f64: return "f64";
132 case MVT::f80: return "f80";
133 case MVT::f128: return "f128";
134 case MVT::ppcf128: return "ppcf128";
135 case MVT::isVoid: return "isVoid";
136 case MVT::Other: return "ch";
137 case MVT::Glue: return "glue";
138 case MVT::x86mmx: return "x86mmx";
139 case MVT::v1i1: return "v1i1";
140 case MVT::v2i1: return "v2i1";
141 case MVT::v4i1: return "v4i1";
142 case MVT::v8i1: return "v8i1";
143 case MVT::v16i1: return "v16i1";
144 case MVT::v32i1: return "v32i1";
145 case MVT::v64i1: return "v64i1";
146 case MVT::v128i1: return "v128i1";
147 case MVT::v512i1: return "v512i1";
148 case MVT::v1024i1: return "v1024i1";
149 case MVT::v1i8: return "v1i8";
150 case MVT::v2i8: return "v2i8";
151 case MVT::v4i8: return "v4i8";
152 case MVT::v8i8: return "v8i8";
153 case MVT::v16i8: return "v16i8";
154 case MVT::v32i8: return "v32i8";
155 case MVT::v64i8: return "v64i8";
156 case MVT::v128i8: return "v128i8";
157 case MVT::v256i8: return "v256i8";
158 case MVT::v1i16: return "v1i16";
159 case MVT::v2i16: return "v2i16";
160 case MVT::v4i16: return "v4i16";
161 case MVT::v8i16: return "v8i16";
162 case MVT::v16i16: return "v16i16";
163 case MVT::v32i16: return "v32i16";
164 case MVT::v64i16: return "v64i16";
165 case MVT::v128i16: return "v128i16";
166 case MVT::v1i32: return "v1i32";
167 case MVT::v2i32: return "v2i32";
168 case MVT::v4i32: return "v4i32";
169 case MVT::v8i32: return "v8i32";
170 case MVT::v16i32: return "v16i32";
171 case MVT::v32i32: return "v32i32";
172 case MVT::v64i32: return "v64i32";
173 case MVT::v1i64: return "v1i64";
174 case MVT::v2i64: return "v2i64";
175 case MVT::v4i64: return "v4i64";
176 case MVT::v8i64: return "v8i64";
177 case MVT::v16i64: return "v16i64";
178 case MVT::v32i64: return "v32i64";
179 case MVT::v1i128: return "v1i128";
180 case MVT::v1f32: return "v1f32";
181 case MVT::v2f32: return "v2f32";
182 case MVT::v2f16: return "v2f16";
183 case MVT::v4f16: return "v4f16";
184 case MVT::v8f16: return "v8f16";
185 case MVT::v4f32: return "v4f32";
186 case MVT::v8f32: return "v8f32";
187 case MVT::v16f32: return "v16f32";
188 case MVT::v1f64: return "v1f64";
189 case MVT::v2f64: return "v2f64";
190 case MVT::v4f64: return "v4f64";
191 case MVT::v8f64: return "v8f64";
192 case MVT::Metadata:return "Metadata";
193 case MVT::Untyped: return "Untyped";
194 case MVT::ExceptRef: return "ExceptRef";
195 }
196 }
197
198 /// getTypeForEVT - This method returns an LLVM type corresponding to the
199 /// specified EVT. For integer types, this returns an unsigned type. Note
200 /// that this will abort for types that cannot be represented.
201 Type *EVT::getTypeForEVT(LLVMContext &Context) const {
202 switch (V.SimpleTy) {
203 default:
204 assert(isExtended() && "Type is not extended!");
205 return LLVMTy;
206 case MVT::isVoid: return Type::getVoidTy(Context);
207 case MVT::i1: return Type::getInt1Ty(Context);
208 case MVT::i8: return Type::getInt8Ty(Context);
209 case MVT::i16: return Type::getInt16Ty(Context);
210 case MVT::i32: return Type::getInt32Ty(Context);
211 case MVT::i64: return Type::getInt64Ty(Context);
212 case MVT::i128: return IntegerType::get(Context, 128);
213 case MVT::f16: return Type::getHalfTy(Context);
214 case MVT::f32: return Type::getFloatTy(Context);
215 case MVT::f64: return Type::getDoubleTy(Context);
216 case MVT::f80: return Type::getX86_FP80Ty(Context);
217 case MVT::f128: return Type::getFP128Ty(Context);
218 case MVT::ppcf128: return Type::getPPC_FP128Ty(Context);
219 case MVT::x86mmx: return Type::getX86_MMXTy(Context);
220 case MVT::v1i1: return VectorType::get(Type::getInt1Ty(Context), 1);
221 case MVT::v2i1: return VectorType::get(Type::getInt1Ty(Context), 2);
222 case MVT::v4i1: return VectorType::get(Type::getInt1Ty(Context), 4);
223 case MVT::v8i1: return VectorType::get(Type::getInt1Ty(Context), 8);
224 case MVT::v16i1: return VectorType::get(Type::getInt1Ty(Context), 16);
225 case MVT::v32i1: return VectorType::get(Type::getInt1Ty(Context), 32);
226 case MVT::v64i1: return VectorType::get(Type::getInt1Ty(Context), 64);
227 case MVT::v128i1: return VectorType::get(Type::getInt1Ty(Context), 128);
228 case MVT::v512i1: return VectorType::get(Type::getInt1Ty(Context), 512);
229 case MVT::v1024i1: return VectorType::get(Type::getInt1Ty(Context), 1024);
230 case MVT::v1i8: return VectorType::get(Type::getInt8Ty(Context), 1);
231 case MVT::v2i8: return VectorType::get(Type::getInt8Ty(Context), 2);
232 case MVT::v4i8: return VectorType::get(Type::getInt8Ty(Context), 4);
233 case MVT::v8i8: return VectorType::get(Type::getInt8Ty(Context), 8);
234 case MVT::v16i8: return VectorType::get(Type::getInt8Ty(Context), 16);
235 case MVT::v32i8: return VectorType::get(Type::getInt8Ty(Context), 32);
236 case MVT::v64i8: return VectorType::get(Type::getInt8Ty(Context), 64);
237 case MVT::v128i8: return VectorType::get(Type::getInt8Ty(Context), 128);
238 case MVT::v256i8: return VectorType::get(Type::getInt8Ty(Context), 256);
239 case MVT::v1i16: return VectorType::get(Type::getInt16Ty(Context), 1);
240 case MVT::v2i16: return VectorType::get(Type::getInt16Ty(Context), 2);
241 case MVT::v4i16: return VectorType::get(Type::getInt16Ty(Context), 4);
242 case MVT::v8i16: return VectorType::get(Type::getInt16Ty(Context), 8);
243 case MVT::v16i16: return VectorType::get(Type::getInt16Ty(Context), 16);
244 case MVT::v32i16: return VectorType::get(Type::getInt16Ty(Context), 32);
245 case MVT::v64i16: return VectorType::get(Type::getInt16Ty(Context), 64);
246 case MVT::v128i16: return VectorType::get(Type::getInt16Ty(Context), 128);
247 case MVT::v1i32: return VectorType::get(Type::getInt32Ty(Context), 1);
248 case MVT::v2i32: return VectorType::get(Type::getInt32Ty(Context), 2);
249 case MVT::v4i32: return VectorType::get(Type::getInt32Ty(Context), 4);
250 case MVT::v8i32: return VectorType::get(Type::getInt32Ty(Context), 8);
251 case MVT::v16i32: return VectorType::get(Type::getInt32Ty(Context), 16);
252 case MVT::v32i32: return VectorType::get(Type::getInt32Ty(Context), 32);
253 case MVT::v64i32: return VectorType::get(Type::getInt32Ty(Context), 64);
254 case MVT::v1i64: return VectorType::get(Type::getInt64Ty(Context), 1);
255 case MVT::v2i64: return VectorType::get(Type::getInt64Ty(Context), 2);
256 case MVT::v4i64: return VectorType::get(Type::getInt64Ty(Context), 4);
257 case MVT::v8i64: return VectorType::get(Type::getInt64Ty(Context), 8);
258 case MVT::v16i64: return VectorType::get(Type::getInt64Ty(Context), 16);
259 case MVT::v32i64: return VectorType::get(Type::getInt64Ty(Context), 32);
260 case MVT::v1i128: return VectorType::get(Type::getInt128Ty(Context), 1);
261 case MVT::v2f16: return VectorType::get(Type::getHalfTy(Context), 2);
262 case MVT::v4f16: return VectorType::get(Type::getHalfTy(Context), 4);
263 case MVT::v8f16: return VectorType::get(Type::getHalfTy(Context), 8);
264 case MVT::v1f32: return VectorType::get(Type::getFloatTy(Context), 1);
265 case MVT::v2f32: return VectorType::get(Type::getFloatTy(Context), 2);
266 case MVT::v4f32: return VectorType::get(Type::getFloatTy(Context), 4);
267 case MVT::v8f32: return VectorType::get(Type::getFloatTy(Context), 8);
268 case MVT::v16f32: return VectorType::get(Type::getFloatTy(Context), 16);
269 case MVT::v1f64: return VectorType::get(Type::getDoubleTy(Context), 1);
270 case MVT::v2f64: return VectorType::get(Type::getDoubleTy(Context), 2);
271 case MVT::v4f64: return VectorType::get(Type::getDoubleTy(Context), 4);
272 case MVT::v8f64: return VectorType::get(Type::getDoubleTy(Context), 8);
273 case MVT::Metadata: return Type::getMetadataTy(Context);
274 }
275 }
276
277 /// Return the value type corresponding to the specified type. This returns all
278 /// pointers as MVT::iPTR. If HandleUnknown is true, unknown types are returned
279 /// as Other, otherwise they are invalid.
280 MVT MVT::getVT(Type *Ty, bool HandleUnknown){
281 switch (Ty->getTypeID()) {
282 default:
283 if (HandleUnknown) return MVT(MVT::Other);
284 llvm_unreachable("Unknown type!");
285 case Type::VoidTyID:
286 return MVT::isVoid;
287 case Type::IntegerTyID:
288 return getIntegerVT(cast(Ty)->getBitWidth());
289 case Type::HalfTyID: return MVT(MVT::f16);
290 case Type::FloatTyID: return MVT(MVT::f32);
291 case Type::DoubleTyID: return MVT(MVT::f64);
292 case Type::X86_FP80TyID: return MVT(MVT::f80);
293 case Type::X86_MMXTyID: return MVT(MVT::x86mmx);
294 case Type::FP128TyID: return MVT(MVT::f128);
295 case Type::PPC_FP128TyID: return MVT(MVT::ppcf128);
296 case Type::PointerTyID: return MVT(MVT::iPTR);
297 case Type::VectorTyID: {
298 VectorType *VTy = cast(Ty);
299 return getVectorVT(
300 getVT(VTy->getElementType(), false), VTy->getNumElements());
301 }
302 }
303 }
304
305 /// getEVT - Return the value type corresponding to the specified type. This
306 /// returns all pointers as MVT::iPTR. If HandleUnknown is true, unknown types
307 /// are returned as Other, otherwise they are invalid.
308 EVT EVT::getEVT(Type *Ty, bool HandleUnknown){
309 switch (Ty->getTypeID()) {
310 default:
311 return MVT::getVT(Ty, HandleUnknown);
312 case Type::IntegerTyID:
313 return getIntegerVT(Ty->getContext(), cast(Ty)->getBitWidth());
314 case Type::VectorTyID: {
315 VectorType *VTy = cast(Ty);
316 return getVectorVT(Ty->getContext(), getEVT(VTy->getElementType(), false),
317 VTy->getNumElements());
318 }
319 }
320 }
5151 User.cpp
5252 Value.cpp
5353 ValueSymbolTable.cpp
54 ValueTypes.cpp
5554 Verifier.cpp
5655
5756 ADDITIONAL_HEADER_DIRS
4343 #include "llvm/IR/User.h"
4444 #include "llvm/IR/Value.h"
4545 #include "llvm/IR/ValueSymbolTable.h"
46 #include "llvm/IR/ValueTypes.h"
4746 #include "llvm/Support/Casting.h"
4847 #include "llvm/Support/Compiler.h"
4948 #include "llvm/Support/ErrorHandling.h"
550549 /// which can't be confused with it's prefix. This ensures we don't have
551550 /// collisions between two unrelated function types. Otherwise, you might
552551 /// parse ffXX as f(fXX) or f(fX)X. (X is a placeholder for any other type.)
553 /// Manglings of integers, floats, and vectors ('i', 'f', and 'v' prefix in most
554 /// cases) fall back to the MVT codepath, where they could be mangled to
555 /// 'x86mmx', for example; matching on derived types is not sufficient to mangle
556 /// everything.
552 ///
557553 static std::string getMangledTypeStr(Type* Ty) {
558554 std::string Result;
559555 if (PointerType* PTyp = dyn_cast(Ty)) {
581577 Result += "vararg";
582578 // Ensure nested function types are distinguishable.
583579 Result += "f";
584 } else if (isa(Ty))
580 } else if (isa(Ty)) {
585581 Result += "v" + utostr(Ty->getVectorNumElements()) +
586582 getMangledTypeStr(Ty->getVectorElementType());
587 else if (Ty)
588 Result += EVT::getEVT(Ty).getEVTString();
583 } else if (Ty) {
584 switch (Ty->getTypeID()) {
585 default: llvm_unreachable("Unhandled type");
586 case Type::VoidTyID: Result += "isVoid"; break;
587 case Type::MetadataTyID: Result += "Metadata"; break;
588 case Type::HalfTyID: Result += "f16"; break;
589 case Type::FloatTyID: Result += "f32"; break;
590 case Type::DoubleTyID: Result += "f64"; break;
591 case Type::X86_FP80TyID: Result += "f80"; break;
592 case Type::FP128TyID: Result += "f128"; break;
593 case Type::PPC_FP128TyID: Result += "ppcf128"; break;
594 case Type::X86_MMXTyID: Result += "x86mmx"; break;
595 case Type::IntegerTyID:
596 Result += "i" + utostr(cast(Ty)->getBitWidth());
597 break;
598 }
599 }
589600 return Result;
590601 }
591602
+0
-321
lib/IR/ValueTypes.cpp less more
None //===----------- ValueTypes.cpp - Implementation of EVT methods -----------===//
1 //
2 // The LLVM Compiler Infrastructure
3 //
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/IR/ValueTypes.h"
10 #include "llvm/ADT/StringExtras.h"
11 #include "llvm/IR/DerivedTypes.h"
12 #include "llvm/IR/Type.h"
13 #include "llvm/Support/ErrorHandling.h"
14 using namespace llvm;
15
16 EVT EVT::changeExtendedTypeToInteger() const {
17 LLVMContext &Context = LLVMTy->getContext();
18 return getIntegerVT(Context, getSizeInBits());
19 }
20
21 EVT EVT::changeExtendedVectorElementTypeToInteger() const {
22 LLVMContext &Context = LLVMTy->getContext();
23 EVT IntTy = getIntegerVT(Context, getScalarSizeInBits());
24 return getVectorVT(Context, IntTy, getVectorNumElements());
25 }
26
27 EVT EVT::getExtendedIntegerVT(LLVMContext &Context, unsigned BitWidth) {
28 EVT VT;
29 VT.LLVMTy = IntegerType::get(Context, BitWidth);
30 assert(VT.isExtended() && "Type is not extended!");
31 return VT;
32 }
33
34 EVT EVT::getExtendedVectorVT(LLVMContext &Context, EVT VT,
35 unsigned NumElements) {
36 EVT ResultVT;
37 ResultVT.LLVMTy = VectorType::get(VT.getTypeForEVT(Context), NumElements);
38 assert(ResultVT.isExtended() && "Type is not extended!");
39 return ResultVT;
40 }
41
42 bool EVT::isExtendedFloatingPoint() const {
43 assert(isExtended() && "Type is not extended!");
44 return LLVMTy->isFPOrFPVectorTy();
45 }
46
47 bool EVT::isExtendedInteger() const {
48 assert(isExtended() && "Type is not extended!");
49 return LLVMTy->isIntOrIntVectorTy();
50 }
51
52 bool EVT::isExtendedScalarInteger() const {
53 assert(isExtended() && "Type is not extended!");
54 return LLVMTy->isIntegerTy();
55 }
56
57 bool EVT::isExtendedVector() const {
58 assert(isExtended() && "Type is not extended!");
59 return LLVMTy->isVectorTy();
60 }
61
62 bool EVT::isExtended16BitVector() const {
63 return isExtendedVector() && getExtendedSizeInBits() == 16;
64 }
65
66 bool EVT::isExtended32BitVector() const {
67 return isExtendedVector() && getExtendedSizeInBits() == 32;
68 }
69
70 bool EVT::isExtended64BitVector() const {
71 return isExtendedVector() && getExtendedSizeInBits() == 64;
72 }
73
74 bool EVT::isExtended128BitVector() const {
75 return isExtendedVector() && getExtendedSizeInBits() == 128;
76 }
77
78 bool EVT::isExtended256BitVector() const {
79 return isExtendedVector() && getExtendedSizeInBits() == 256;
80 }
81
82 bool EVT::isExtended512BitVector() const {
83 return isExtendedVector() && getExtendedSizeInBits() == 512;
84 }
85
86 bool EVT::isExtended1024BitVector() const {
87 return isExtendedVector() && getExtendedSizeInBits() == 1024;
88 }
89
90 bool EVT::isExtended2048BitVector() const {
91 return isExtendedVector() && getExtendedSizeInBits() == 2048;
92 }
93
94 EVT EVT::getExtendedVectorElementType() const {
95 assert(isExtended() && "Type is not extended!");
96 return EVT::getEVT(cast(LLVMTy)->getElementType());
97 }
98
99 unsigned EVT::getExtendedVectorNumElements() const {
100 assert(isExtended() && "Type is not extended!");
101 return cast(LLVMTy)->getNumElements();
102 }
103
104 unsigned EVT::getExtendedSizeInBits() const {
105 assert(isExtended() && "Type is not extended!");
106 if (IntegerType *ITy = dyn_cast(LLVMTy))
107 return ITy->getBitWidth();
108 if (VectorType *VTy = dyn_cast(LLVMTy))
109 return VTy->getBitWidth();
110 llvm_unreachable("Unrecognized extended type!");
111 }
112
113 /// getEVTString - This function returns value type as a string, e.g. "i32".
114 std::string EVT::getEVTString() const {
115 switch (V.SimpleTy) {
116 default:
117 if (isVector())
118 return "v" + utostr(getVectorNumElements()) +
119 getVectorElementType().getEVTString();
120 if (isInteger())
121 return "i" + utostr(getSizeInBits());
122 llvm_unreachable("Invalid EVT!");
123 case MVT::i1: return "i1";
124 case MVT::i8: return "i8";
125 case MVT::i16: return "i16";
126 case MVT::i32: return "i32";
127 case MVT::i64: return "i64";
128 case MVT::i128: return "i128";
129 case MVT::f16: return "f16";
130 case MVT::f32: return "f32";
131 case MVT::f64: return "f64";
132 case MVT::f80: return "f80";
133 case MVT::f128: return "f128";
134 case MVT::ppcf128: return "ppcf128";
135 case MVT::isVoid: return "isVoid";
136 case MVT::Other: return "ch";
137 case MVT::Glue: return "glue";
138 case MVT::x86mmx: return "x86mmx";
139 case MVT::v1i1: return "v1i1";
140 case MVT::v2i1: return "v2i1";
141 case MVT::v4i1: return "v4i1";
142 case MVT::v8i1: return "v8i1";
143 case MVT::v16i1: return "v16i1";
144 case MVT::v32i1: return "v32i1";
145 case MVT::v64i1: return "v64i1";
146 case MVT::v128i1: return "v128i1";
147 case MVT::v512i1: return "v512i1";
148 case MVT::v1024i1: return "v1024i1";
149 case MVT::v1i8: return "v1i8";
150 case MVT::v2i8: return "v2i8";
151 case MVT::v4i8: return "v4i8";
152 case MVT::v8i8: return "v8i8";
153 case MVT::v16i8: return "v16i8";
154 case MVT::v32i8: return "v32i8";
155 case MVT::v64i8: return "v64i8";
156 case MVT::v128i8: return "v128i8";
157 case MVT::v256i8: return "v256i8";
158 case MVT::v1i16: return "v1i16";
159 case MVT::v2i16: return "v2i16";
160 case MVT::v4i16: return "v4i16";
161 case MVT::v8i16: return "v8i16";
162 case MVT::v16i16: return "v16i16";
163 case MVT::v32i16: return "v32i16";
164 case MVT::v64i16: return "v64i16";
165 case MVT::v128i16: return "v128i16";
166 case MVT::v1i32: return "v1i32";
167 case MVT::v2i32: return "v2i32";
168 case MVT::v4i32: return "v4i32";
169 case MVT::v8i32: return "v8i32";
170 case MVT::v16i32: return "v16i32";
171 case MVT::v32i32: return "v32i32";
172 case MVT::v64i32: return "v64i32";
173 case MVT::v1i64: return "v1i64";
174 case MVT::v2i64: return "v2i64";
175 case MVT::v4i64: return "v4i64";
176 case MVT::v8i64: return "v8i64";
177 case MVT::v16i64: return "v16i64";
178 case MVT::v32i64: return "v32i64";
179 case MVT::v1i128: return "v1i128";
180 case MVT::v1f32: return "v1f32";
181 case MVT::v2f32: return "v2f32";
182 case MVT::v2f16: return "v2f16";
183 case MVT::v4f16: return "v4f16";
184 case MVT::v8f16: return "v8f16";
185 case MVT::v4f32: return "v4f32";
186 case MVT::v8f32: return "v8f32";
187 case MVT::v16f32: return "v16f32";
188 case MVT::v1f64: return "v1f64";
189 case MVT::v2f64: return "v2f64";
190 case MVT::v4f64: return "v4f64";
191 case MVT::v8f64: return "v8f64";
192 case MVT::Metadata:return "Metadata";
193 case MVT::Untyped: return "Untyped";
194 case MVT::ExceptRef: return "ExceptRef";
195 }
196 }
197
198 /// getTypeForEVT - This method returns an LLVM type corresponding to the
199 /// specified EVT. For integer types, this returns an unsigned type. Note
200 /// that this will abort for types that cannot be represented.
201 Type *EVT::getTypeForEVT(LLVMContext &Context) const {
202 switch (V.SimpleTy) {
203 default:
204 assert(isExtended() && "Type is not extended!");
205 return LLVMTy;
206 case MVT::isVoid: return Type::getVoidTy(Context);
207 case MVT::i1: return Type::getInt1Ty(Context);
208 case MVT::i8: return Type::getInt8Ty(Context);
209 case MVT::i16: return Type::getInt16Ty(Context);
210 case MVT::i32: return Type::getInt32Ty(Context);
211 case MVT::i64: return Type::getInt64Ty(Context);
212 case MVT::i128: return IntegerType::get(Context, 128);
213 case MVT::f16: return Type::getHalfTy(Context);
214 case MVT::f32: return Type::getFloatTy(Context);
215 case MVT::f64: return Type::getDoubleTy(Context);
216 case MVT::f80: return Type::getX86_FP80Ty(Context);
217 case MVT::f128: return Type::getFP128Ty(Context);
218 case MVT::ppcf128: return Type::getPPC_FP128Ty(Context);
219 case MVT::x86mmx: return Type::getX86_MMXTy(Context);
220 case MVT::v1i1: return VectorType::get(Type::getInt1Ty(Context), 1);
221 case MVT::v2i1: return VectorType::get(Type::getInt1Ty(Context), 2);
222 case MVT::v4i1: return VectorType::get(Type::getInt1Ty(Context), 4);
223 case MVT::v8i1: return VectorType::get(Type::getInt1Ty(Context), 8);
224 case MVT::v16i1: return VectorType::get(Type::getInt1Ty(Context), 16);
225 case MVT::v32i1: return VectorType::get(Type::getInt1Ty(Context), 32);
226 case MVT::v64i1: return VectorType::get(Type::getInt1Ty(Context), 64);
227 case MVT::v128i1: return VectorType::get(Type::getInt1Ty(Context), 128);
228 case MVT::v512i1: return VectorType::get(Type::getInt1Ty(Context), 512);
229 case MVT::v1024i1: return VectorType::get(Type::getInt1Ty(Context), 1024);
230 case MVT::v1i8: return VectorType::get(Type::getInt8Ty(Context), 1);
231 case MVT::v2i8: return VectorType::get(Type::getInt8Ty(Context), 2);
232 case MVT::v4i8: return VectorType::get(Type::getInt8Ty(Context), 4);
233 case MVT::v8i8: return VectorType::get(Type::getInt8Ty(Context), 8);
234 case MVT::v16i8: return VectorType::get(Type::getInt8Ty(Context), 16);
235 case MVT::v32i8: return VectorType::get(Type::getInt8Ty(Context), 32);
236 case MVT::v64i8: return VectorType::get(Type::getInt8Ty(Context), 64);
237 case MVT::v128i8: return VectorType::get(Type::getInt8Ty(Context), 128);
238 case MVT::v256i8: return VectorType::get(Type::getInt8Ty(Context), 256);
239 case MVT::v1i16: return VectorType::get(Type::getInt16Ty(Context), 1);
240 case MVT::v2i16: return VectorType::get(Type::getInt16Ty(Context), 2);
241 case MVT::v4i16: return VectorType::get(Type::getInt16Ty(Context), 4);
242 case MVT::v8i16: return VectorType::get(Type::getInt16Ty(Context), 8);
243 case MVT::v16i16: return VectorType::get(Type::getInt16Ty(Context), 16);
244 case MVT::v32i16: return VectorType::get(Type::getInt16Ty(Context), 32);
245 case MVT::v64i16: return VectorType::get(Type::getInt16Ty(Context), 64);
246 case MVT::v128i16: return VectorType::get(Type::getInt16Ty(Context), 128);
247 case MVT::v1i32: return VectorType::get(Type::getInt32Ty(Context), 1);
248 case MVT::v2i32: return VectorType::get(Type::getInt32Ty(Context), 2);
249 case MVT::v4i32: return VectorType::get(Type::getInt32Ty(Context), 4);
250 case MVT::v8i32: return VectorType::get(Type::getInt32Ty(Context), 8);
251 case MVT::v16i32: return VectorType::get(Type::getInt32Ty(Context), 16);
252 case MVT::v32i32: return VectorType::get(Type::getInt32Ty(Context), 32);
253 case MVT::v64i32: return VectorType::get(Type::getInt32Ty(Context), 64);
254 case MVT::v1i64: return VectorType::get(Type::getInt64Ty(Context), 1);
255 case MVT::v2i64: return VectorType::get(Type::getInt64Ty(Context), 2);
256 case MVT::v4i64: return VectorType::get(Type::getInt64Ty(Context), 4);
257 case MVT::v8i64: return VectorType::get(Type::getInt64Ty(Context), 8);
258 case MVT::v16i64: return VectorType::get(Type::getInt64Ty(Context), 16);
259 case MVT::v32i64: return VectorType::get(Type::getInt64Ty(Context), 32);
260 case MVT::v1i128: return VectorType::get(Type::getInt128Ty(Context), 1);
261 case MVT::v2f16: return VectorType::get(Type::getHalfTy(Context), 2);
262 case MVT::v4f16: return VectorType::get(Type::getHalfTy(Context), 4);
263 case MVT::v8f16: return VectorType::get(Type::getHalfTy(Context), 8);
264 case MVT::v1f32: return VectorType::get(Type::getFloatTy(Context), 1);
265 case MVT::v2f32: return VectorType::get(Type::getFloatTy(Context), 2);
266 case MVT::v4f32: return VectorType::get(Type::getFloatTy(Context), 4);
267 case MVT::v8f32: return VectorType::get(Type::getFloatTy(Context), 8);
268 case MVT::v16f32: return VectorType::get(Type::getFloatTy(Context), 16);
269 case MVT::v1f64: return VectorType::get(Type::getDoubleTy(Context), 1);
270 case MVT::v2f64: return VectorType::get(Type::getDoubleTy(Context), 2);
271 case MVT::v4f64: return VectorType::get(Type::getDoubleTy(Context), 4);
272 case MVT::v8f64: return VectorType::get(Type::getDoubleTy(Context), 8);
273 case MVT::Metadata: return Type::getMetadataTy(Context);
274 }
275 }
276
277 /// Return the value type corresponding to the specified type. This returns all
278 /// pointers as MVT::iPTR. If HandleUnknown is true, unknown types are returned
279 /// as Other, otherwise they are invalid.
280 MVT MVT::getVT(Type *Ty, bool HandleUnknown){
281 switch (Ty->getTypeID()) {
282 default:
283 if (HandleUnknown) return MVT(MVT::Other);
284 llvm_unreachable("Unknown type!");
285 case Type::VoidTyID:
286 return MVT::isVoid;
287 case Type::IntegerTyID:
288 return getIntegerVT(cast(Ty)->getBitWidth());
289 case Type::HalfTyID: return MVT(MVT::f16);
290 case Type::FloatTyID: return MVT(MVT::f32);
291 case Type::DoubleTyID: return MVT(MVT::f64);
292 case Type::X86_FP80TyID: return MVT(MVT::f80);
293 case Type::X86_MMXTyID: return MVT(MVT::x86mmx);
294 case Type::FP128TyID: return MVT(MVT::f128);
295 case Type::PPC_FP128TyID: return MVT(MVT::ppcf128);
296 case Type::PointerTyID: return MVT(MVT::iPTR);
297 case Type::VectorTyID: {
298 VectorType *VTy = cast(Ty);
299 return getVectorVT(
300 getVT(VTy->getElementType(), false), VTy->getNumElements());
301 }
302 }
303 }
304
305 /// getEVT - Return the value type corresponding to the specified type. This
306 /// returns all pointers as MVT::iPTR. If HandleUnknown is true, unknown types
307 /// are returned as Other, otherwise they are invalid.
308 EVT EVT::getEVT(Type *Ty, bool HandleUnknown){
309 switch (Ty->getTypeID()) {
310 default:
311 return MVT::getVT(Ty, HandleUnknown);
312 case Type::IntegerTyID:
313 return getIntegerVT(Ty->getContext(), cast(Ty)->getBitWidth());
314 case Type::VectorTyID: {
315 VectorType *VTy = cast(Ty);
316 return getVectorVT(Ty->getContext(), getEVT(VTy->getElementType(), false),
317 VTy->getNumElements());
318 }
319 }
320 }
3232 #include "llvm/CodeGen/MachineRegisterInfo.h"
3333 #include "llvm/CodeGen/TargetRegisterInfo.h"
3434 #include "llvm/CodeGen/TargetSubtargetInfo.h"
35 #include "llvm/CodeGen/ValueTypes.h"
3536 #include "llvm/IR/Argument.h"
3637 #include "llvm/IR/Attributes.h"
3738 #include "llvm/IR/Function.h"
3839 #include "llvm/IR/Type.h"
3940 #include "llvm/IR/Value.h"
40 #include "llvm/IR/ValueTypes.h"
4141 #include "llvm/Support/MachineValueType.h"
4242 #include
4343 #include
3535 #include "llvm/CodeGen/MachineMemOperand.h"
3636 #include "llvm/CodeGen/MachineRegisterInfo.h"
3737 #include "llvm/CodeGen/RuntimeLibcalls.h"
38 #include "llvm/CodeGen/ValueTypes.h"
3839 #include "llvm/IR/Argument.h"
3940 #include "llvm/IR/Attributes.h"
4041 #include "llvm/IR/BasicBlock.h"
5556 #include "llvm/IR/Type.h"
5657 #include "llvm/IR/User.h"
5758 #include "llvm/IR/Value.h"
58 #include "llvm/IR/ValueTypes.h"
5959 #include "llvm/MC/MCInstrDesc.h"
6060 #include "llvm/MC/MCRegisterInfo.h"
6161 #include "llvm/MC/MCSymbol.h"
4242 #include "llvm/CodeGen/SelectionDAGNodes.h"
4343 #include "llvm/CodeGen/TargetCallingConv.h"
4444 #include "llvm/CodeGen/TargetInstrInfo.h"
45 #include "llvm/CodeGen/ValueTypes.h"
4546 #include "llvm/IR/Attributes.h"
4647 #include "llvm/IR/Constants.h"
4748 #include "llvm/IR/DataLayout.h"
5960 #include "llvm/IR/Type.h"
6061 #include "llvm/IR/Use.h"
6162 #include "llvm/IR/Value.h"
62 #include "llvm/IR/ValueTypes.h"
6363 #include "llvm/MC/MCRegisterInfo.h"
6464 #include "llvm/Support/Casting.h"
6565 #include "llvm/Support/CodeGen.h"
1717 #include "llvm/CodeGen/MachineInstr.h"
1818 #include "llvm/CodeGen/MachineRegisterInfo.h"
1919 #include "llvm/CodeGen/TargetOpcodes.h"
20 #include "llvm/CodeGen/ValueTypes.h"
2021 #include "llvm/IR/DerivedTypes.h"
2122 #include "llvm/IR/Type.h"
22 #include "llvm/IR/ValueTypes.h"
2323
2424 using namespace llvm;
2525 using namespace LegalizeActions;
3535 #include "llvm/CodeGen/SelectionDAG.h"
3636 #include "llvm/CodeGen/SelectionDAGISel.h"
3737 #include "llvm/CodeGen/SelectionDAGNodes.h"
38 #include "llvm/CodeGen/ValueTypes.h"
3839 #include "llvm/IR/BasicBlock.h"
3940 #include "llvm/IR/Instruction.h"
40 #include "llvm/IR/ValueTypes.h"
4141 #include "llvm/MC/MCInstrDesc.h"
4242 #include "llvm/Support/Casting.h"
4343 #include "llvm/Support/CodeGen.h"
1111 /// \todo This should be generated by TableGen.
1212 //===----------------------------------------------------------------------===//
1313
14 #include "AMDGPU.h"
1415 #include "AMDGPULegalizerInfo.h"
15 #include "AMDGPU.h"
1616 #include "AMDGPUTargetMachine.h"
1717 #include "llvm/CodeGen/TargetOpcodes.h"
18 #include "llvm/CodeGen/ValueTypes.h"
1819 #include "llvm/IR/DerivedTypes.h"
1920 #include "llvm/IR/Type.h"
20 #include "llvm/IR/ValueTypes.h"
2121 #include "llvm/Support/Debug.h"
2222
2323 using namespace llvm;
2222 #include "llvm/Analysis/TargetTransformInfo.h"
2323 #include "llvm/Analysis/ValueTracking.h"
2424 #include "llvm/CodeGen/ISDOpcodes.h"
25 #include "llvm/CodeGen/ValueTypes.h"
2526 #include "llvm/IR/Argument.h"
2627 #include "llvm/IR/Attributes.h"
2728 #include "llvm/IR/BasicBlock.h"
3637 #include "llvm/IR/PatternMatch.h"
3738 #include "llvm/IR/Type.h"
3839 #include "llvm/IR/Value.h"
39 #include "llvm/IR/ValueTypes.h"
4040 #include "llvm/MC/SubtargetFeature.h"
4141 #include "llvm/Support/Casting.h"
4242 #include "llvm/Support/CommandLine.h"
5252 #include "llvm/CodeGen/SelectionDAGNodes.h"
5353 #include "llvm/CodeGen/TargetCallingConv.h"
5454 #include "llvm/CodeGen/TargetRegisterInfo.h"
55 #include "llvm/CodeGen/ValueTypes.h"
5556 #include "llvm/IR/Constants.h"
5657 #include "llvm/IR/DataLayout.h"
5758 #include "llvm/IR/DebugLoc.h"
6465 #include "llvm/IR/Instructions.h"
6566 #include "llvm/IR/IntrinsicInst.h"
6667 #include "llvm/IR/Type.h"
67 #include "llvm/IR/ValueTypes.h"
6868 #include "llvm/Support/Casting.h"
6969 #include "llvm/Support/CodeGen.h"
7070 #include "llvm/Support/CommandLine.h"
2323 #include "llvm/CodeGen/MachineJumpTableInfo.h"
2424 #include "llvm/CodeGen/MachineRegisterInfo.h"
2525 #include "llvm/CodeGen/SelectionDAGISel.h"
26 #include "llvm/CodeGen/ValueTypes.h"
2627 #include "llvm/IR/CallingConv.h"
2728 #include "llvm/IR/Intrinsics.h"
28 #include "llvm/IR/ValueTypes.h"
2929 #include "llvm/Support/Debug.h"
3030 #include
3131
3232 #include "llvm/CodeGen/MachineRegisterInfo.h"
3333 #include "llvm/CodeGen/TargetRegisterInfo.h"
3434 #include "llvm/CodeGen/TargetSubtargetInfo.h"
35 #include "llvm/CodeGen/ValueTypes.h"
3536 #include "llvm/IR/Attributes.h"
3637 #include "llvm/IR/DataLayout.h"
3738 #include "llvm/IR/DerivedTypes.h"
3839 #include "llvm/IR/Function.h"
3940 #include "llvm/IR/Type.h"
4041 #include "llvm/IR/Value.h"
41 #include "llvm/IR/ValueTypes.h"
4242 #include "llvm/Support/Casting.h"
4343 #include "llvm/Support/LowLevelTypeImpl.h"
4444 #include "llvm/Support/MachineValueType.h"
4545 #include "llvm/CodeGen/TargetLowering.h"
4646 #include "llvm/CodeGen/TargetOpcodes.h"
4747 #include "llvm/CodeGen/TargetRegisterInfo.h"
48 #include "llvm/CodeGen/ValueTypes.h"
4849 #include "llvm/IR/Argument.h"
4950 #include "llvm/IR/Attributes.h"
5051 #include "llvm/IR/CallSite.h"
6768 #include "llvm/IR/Type.h"
6869 #include "llvm/IR/User.h"
6970 #include "llvm/IR/Value.h"
70 #include "llvm/IR/ValueTypes.h"
7171 #include "llvm/MC/MCInstrDesc.h"
7272 #include "llvm/MC/MCRegisterInfo.h"
7373 #include "llvm/Support/Casting.h"
6060 #include "llvm/CodeGen/TargetOpcodes.h"
6161 #include "llvm/CodeGen/TargetRegisterInfo.h"
6262 #include "llvm/CodeGen/TargetSubtargetInfo.h"
63 #include "llvm/CodeGen/ValueTypes.h"
6364 #include "llvm/IR/Attributes.h"
6465 #include "llvm/IR/CallingConv.h"
6566 #include "llvm/IR/Constant.h"
8182 #include "llvm/IR/Type.h"
8283 #include "llvm/IR/User.h"
8384 #include "llvm/IR/Value.h"
84 #include "llvm/IR/ValueTypes.h"
8585 #include "llvm/MC/MCInstrDesc.h"
8686 #include "llvm/MC/MCInstrItineraries.h"
8787 #include "llvm/MC/MCRegisterInfo.h"
2222 #include "llvm/CodeGen/MachineFunction.h"
2323 #include "llvm/CodeGen/SelectionDAGNodes.h"
2424 #include "llvm/CodeGen/TargetLowering.h"
25 #include "llvm/CodeGen/ValueTypes.h"
2526 #include "llvm/IR/Attributes.h"
2627 #include "llvm/IR/CallingConv.h"
2728 #include "llvm/IR/Function.h"
2829 #include "llvm/IR/IRBuilder.h"
2930 #include "llvm/IR/InlineAsm.h"
30 #include "llvm/IR/ValueTypes.h"
3131 #include "llvm/Support/CodeGen.h"
3232 #include "llvm/Support/MachineValueType.h"
3333 #include
1717 #include "llvm/CodeGen/LowLevelType.h"
1818 #include "llvm/CodeGen/MachineRegisterInfo.h"
1919 #include "llvm/CodeGen/TargetOpcodes.h"
20 #include "llvm/CodeGen/ValueTypes.h"
2021 #include "llvm/IR/DerivedTypes.h"
2122 #include "llvm/IR/Type.h"
22 #include "llvm/IR/ValueTypes.h"
2323
2424 using namespace llvm;
2525 using namespace LegalizeActions;
1414 #include "llvm/Analysis/LoopInfo.h"
1515 #include "llvm/CodeGen/CostTable.h"
1616 #include "llvm/CodeGen/ISDOpcodes.h"
17 #include "llvm/CodeGen/ValueTypes.h"
1718 #include "llvm/IR/BasicBlock.h"
1819 #include "llvm/IR/CallSite.h"
1920 #include "llvm/IR/DataLayout.h"
2122 #include "llvm/IR/Instruction.h"
2223 #include "llvm/IR/Instructions.h"
2324 #include "llvm/IR/Type.h"
24 #include "llvm/IR/ValueTypes.h"
2525 #include "llvm/MC/SubtargetFeature.h"
2626 #include "llvm/Support/Casting.h"
2727 #include "llvm/Support/MachineValueType.h"
2222 #include "llvm/CodeGen/MachineRegisterInfo.h"
2323 #include "llvm/CodeGen/SelectionDAGISel.h"
2424 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
25 #include "llvm/CodeGen/ValueTypes.h"
2526 #include "llvm/IR/DiagnosticInfo.h"
2627 #include "llvm/IR/DiagnosticPrinter.h"
27 #include "llvm/IR/ValueTypes.h"
2828 #include "llvm/Support/Debug.h"
2929 #include "llvm/Support/ErrorHandling.h"
3030 #include "llvm/Support/raw_ostream.h"
2929 #include "llvm/CodeGen/RuntimeLibcalls.h"
3030 #include "llvm/CodeGen/SelectionDAG.h"
3131 #include "llvm/CodeGen/TargetCallingConv.h"
32 #include "llvm/CodeGen/ValueTypes.h"
3233 #include "llvm/IR/BasicBlock.h"
3334 #include "llvm/IR/CallingConv.h"
3435 #include "llvm/IR/DataLayout.h"
4243 #include "llvm/IR/Module.h"
4344 #include "llvm/IR/Type.h"
4445 #include "llvm/IR/Value.h"
45 #include "llvm/IR/ValueTypes.h"
4646 #include "llvm/MC/MCRegisterInfo.h"
4747 #include "llvm/Support/Casting.h"
4848 #include "llvm/Support/CodeGen.h"
1919 #include "llvm/CodeGen/ISDOpcodes.h"
2020 #include "llvm/CodeGen/SelectionDAGNodes.h"
2121 #include "llvm/CodeGen/TargetLowering.h"
22 #include "llvm/CodeGen/ValueTypes.h"
2223 #include "llvm/IR/CallingConv.h"
2324 #include "llvm/IR/InlineAsm.h"
24 #include "llvm/IR/ValueTypes.h"
2525 #include "llvm/Support/MachineValueType.h"
2626 #include
2727 #include
1818 #include "llvm/ADT/SmallVector.h"
1919 #include "llvm/CodeGen/MachineBasicBlock.h"
2020 #include "llvm/CodeGen/TargetInstrInfo.h"
21 #include "llvm/IR/ValueTypes.h"
21 #include "llvm/CodeGen/ValueTypes.h"
2222 #include "llvm/Support/MachineValueType.h"
2323 #include
2424 #include
3131 #include "llvm/CodeGen/SelectionDAG.h"
3232 #include "llvm/CodeGen/SelectionDAGNodes.h"
3333 #include "llvm/CodeGen/TargetCallingConv.h"
34 #include "llvm/CodeGen/ValueTypes.h"
3435 #include "llvm/IR/CallingConv.h"
3536 #include "llvm/IR/DerivedTypes.h"
3637 #include "llvm/IR/Function.h"
3738 #include "llvm/IR/GlobalValue.h"
38 #include "llvm/IR/ValueTypes.h"
3939 #include "llvm/Support/Casting.h"
4040 #include "llvm/Support/CodeGen.h"
4141 #include "llvm/Support/CommandLine.h"
2222 #include "llvm/CodeGen/MachineRegisterInfo.h"
2323 #include "llvm/CodeGen/SelectionDAGISel.h"
2424 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
25 #include "llvm/CodeGen/ValueTypes.h"
2526 #include "llvm/IR/CallingConv.h"
2627 #include "llvm/IR/DerivedTypes.h"
2728 #include "llvm/IR/Function.h"
2829 #include "llvm/IR/GlobalAlias.h"
2930 #include "llvm/IR/GlobalVariable.h"
3031 #include "llvm/IR/Intrinsics.h"
31 #include "llvm/IR/ValueTypes.h"
3232 #include "llvm/Support/CommandLine.h"
3333 #include "llvm/Support/Debug.h"
3434 #include "llvm/Support/ErrorHandling.h"
1616
1717 #include "llvm/CodeGen/CallingConvLower.h"
1818 #include "llvm/CodeGen/GlobalISel/CallLowering.h"
19 #include "llvm/IR/ValueTypes.h"
19 #include "llvm/CodeGen/ValueTypes.h"
2020
2121 namespace llvm {
2222
3737 #include "llvm/CodeGen/MachineRegisterInfo.h"
3838 #include "llvm/CodeGen/TargetInstrInfo.h"
3939 #include "llvm/CodeGen/TargetLowering.h"
40 #include "llvm/CodeGen/ValueTypes.h"
4041 #include "llvm/IR/Attributes.h"
4142 #include "llvm/IR/CallingConv.h"
4243 #include "llvm/IR/Constant.h"
5455 #include "llvm/IR/Type.h"
5556 #include "llvm/IR/User.h"
5657 #include "llvm/IR/Value.h"
57 #include "llvm/IR/ValueTypes.h"
5858 #include "llvm/MC/MCInstrDesc.h"
5959 #include "llvm/MC/MCRegisterInfo.h"
6060 #include "llvm/MC/MCSymbol.h"
4646 #include "llvm/CodeGen/TargetFrameLowering.h"
4747 #include "llvm/CodeGen/TargetInstrInfo.h"
4848 #include "llvm/CodeGen/TargetRegisterInfo.h"
49 #include "llvm/CodeGen/ValueTypes.h"
4950 #include "llvm/IR/CallingConv.h"
5051 #include "llvm/IR/Constants.h"
5152 #include "llvm/IR/DataLayout.h"
5556 #include "llvm/IR/GlobalValue.h"
5657 #include "llvm/IR/Type.h"
5758 #include "llvm/IR/Value.h"
58 #include "llvm/IR/ValueTypes.h"
5959 #include "llvm/MC/MCRegisterInfo.h"
6060 #include "llvm/Support/Casting.h"
6161 #include "llvm/Support/CodeGen.h"
2323 #include "llvm/CodeGen/SelectionDAG.h"
2424 #include "llvm/CodeGen/SelectionDAGNodes.h"
2525 #include "llvm/CodeGen/TargetLowering.h"
26 #include "llvm/CodeGen/ValueTypes.h"
2627 #include "llvm/IR/CallingConv.h"
2728 #include "llvm/IR/InlineAsm.h"
2829 #include "llvm/IR/Type.h"
29 #include "llvm/IR/ValueTypes.h"
3030 #include "llvm/Support/MachineValueType.h"
3131 #include "llvm/Target/TargetMachine.h"
3232 #include
1212
1313 #include "MipsLegalizerInfo.h"
1414 #include "llvm/CodeGen/TargetOpcodes.h"
15 #include "llvm/CodeGen/ValueTypes.h"
1516 #include "llvm/IR/DerivedTypes.h"
1617 #include "llvm/IR/Type.h"
17 #include "llvm/IR/ValueTypes.h"
1818
1919 using namespace llvm;
2020
3131 #include "llvm/CodeGen/SelectionDAGNodes.h"
3232 #include "llvm/CodeGen/TargetInstrInfo.h"
3333 #include "llvm/CodeGen/TargetSubtargetInfo.h"
34 #include "llvm/CodeGen/ValueTypes.h"
3435 #include "llvm/IR/DebugLoc.h"
3536 #include "llvm/IR/Intrinsics.h"
36 #include "llvm/IR/ValueTypes.h"
3737 #include "llvm/Support/Casting.h"
3838 #include "llvm/Support/CommandLine.h"
3939 #include "llvm/Support/Debug.h"
4545 #include "llvm/CodeGen/MachineRegisterInfo.h"
4646 #include "llvm/CodeGen/TargetLowering.h"
4747 #include "llvm/CodeGen/TargetRegisterInfo.h"
48 #include "llvm/CodeGen/ValueTypes.h"
4849 #include "llvm/IR/Attributes.h"
4950 #include "llvm/IR/BasicBlock.h"
5051 #include "llvm/IR/Constant.h"
6364 #include "llvm/IR/Operator.h"
6465 #include "llvm/IR/Type.h"
6566 #include "llvm/IR/User.h"
66 #include "llvm/IR/ValueTypes.h"
6767 #include "llvm/MC/MCExpr.h"
6868 #include "llvm/MC/MCInst.h"
6969 #include "llvm/MC/MCInstrDesc.h"
1414 #include "MCTargetDesc/NVPTXBaseInfo.h"
1515 #include "NVPTX.h"
1616 #include "NVPTXUtilities.h"
17 #include "llvm/CodeGen/ValueTypes.h"
1718 #include "llvm/IR/Constants.h"
1819 #include "llvm/IR/DerivedTypes.h"
1920 #include "llvm/IR/IRBuilder.h"
2324 #include "llvm/IR/Module.h"
2425 #include "llvm/IR/Operator.h"
2526 #include "llvm/IR/ValueMap.h"
26 #include "llvm/IR/ValueTypes.h"
2727 #include "llvm/Transforms/Utils/ValueMapper.h"
2828
2929 using namespace llvm;
2929 #include "llvm/CodeGen/SelectionDAGNodes.h"
3030 #include "llvm/CodeGen/TargetCallingConv.h"
3131 #include "llvm/CodeGen/TargetLowering.h"
32 #include "llvm/CodeGen/ValueTypes.h"
3233 #include "llvm/IR/Argument.h"
3334 #include "llvm/IR/Attributes.h"
3435 #include "llvm/IR/CallSite.h"
4243 #include "llvm/IR/Module.h"
4344 #include "llvm/IR/Type.h"
4445 #include "llvm/IR/Value.h"
45 #include "llvm/IR/ValueTypes.h"
4646 #include "llvm/Support/Casting.h"
4747 #include "llvm/Support/CodeGen.h"
4848 #include "llvm/Support/CommandLine.h"
3636 #include "llvm/CodeGen/SelectionDAGNodes.h"
3737 #include "llvm/CodeGen/TargetInstrInfo.h"
3838 #include "llvm/CodeGen/TargetRegisterInfo.h"
39 #include "llvm/CodeGen/ValueTypes.h"
3940 #include "llvm/IR/BasicBlock.h"
4041 #include "llvm/IR/DebugLoc.h"
4142 #include "llvm/IR/Function.h"
4344 #include "llvm/IR/InlineAsm.h"
4445 #include "llvm/IR/InstrTypes.h"
4546 #include "llvm/IR/Module.h"
46 #include "llvm/IR/ValueTypes.h"
4747 #include "llvm/Support/Casting.h"
4848 #include "llvm/Support/CodeGen.h"
4949 #include "llvm/Support/CommandLine.h"
5252 #include "llvm/CodeGen/TargetInstrInfo.h"
5353 #include "llvm/CodeGen/TargetLowering.h"
5454 #include "llvm/CodeGen/TargetRegisterInfo.h"
55 #include "llvm/CodeGen/ValueTypes.h"
5556 #include "llvm/IR/CallSite.h"
5657 #include "llvm/IR/CallingConv.h"
5758 #include "llvm/IR/Constant.h"
6869 #include "llvm/IR/Type.h"
6970 #include "llvm/IR/Use.h"
7071 #include "llvm/IR/Value.h"
71 #include "llvm/IR/ValueTypes.h"
7272 #include "llvm/MC/MCExpr.h"
7373 #include "llvm/MC/MCRegisterInfo.h"
7474 #include "llvm/Support/AtomicOrdering.h"
2222 #include "llvm/CodeGen/SelectionDAG.h"
2323 #include "llvm/CodeGen/SelectionDAGNodes.h"
2424 #include "llvm/CodeGen/TargetLowering.h"
25 #include "llvm/CodeGen/ValueTypes.h"
2526 #include "llvm/IR/Attributes.h"
2627 #include "llvm/IR/CallingConv.h"
2728 #include "llvm/IR/Function.h"
2829 #include "llvm/IR/InlineAsm.h"
2930 #include "llvm/IR/Metadata.h"
3031 #include "llvm/IR/Type.h"
31 #include "llvm/IR/ValueTypes.h"
3232 #include "llvm/Support/MachineValueType.h"
3333 #include
3434
2424 #include "llvm/CodeGen/MachineRegisterInfo.h"
2525 #include "llvm/CodeGen/SelectionDAGISel.h"
2626 #include "llvm/CodeGen/TargetLoweringObjectFileImpl.h"
27 #include "llvm/CodeGen/ValueTypes.h"
2728 #include "llvm/IR/DiagnosticInfo.h"
2829 #include "llvm/IR/DiagnosticPrinter.h"
29 #include "llvm/IR/ValueTypes.h"
3030 #include "llvm/Support/Debug.h"
3131 #include "llvm/Support/ErrorHandling.h"
3232 #include "llvm/Support/raw_ostream.h"
3434 #include "llvm/CodeGen/MachineRegisterInfo.h"
3535 #include "llvm/CodeGen/TargetInstrInfo.h"
3636 #include "llvm/CodeGen/TargetSubtargetInfo.h"
37 #include "llvm/CodeGen/ValueTypes.h"
3738 #include "llvm/IR/Attributes.h"
3839 #include "llvm/IR/DataLayout.h"
3940 #include "llvm/IR/Function.h"
4041 #include "llvm/IR/Value.h"
41 #include "llvm/IR/ValueTypes.h"
4242 #include "llvm/MC/MCRegisterInfo.h"
4343 #include "llvm/Support/LowLevelTypeImpl.h"
4444 #include "llvm/Support/MachineValueType.h"
1414 #include "X86Subtarget.h"
1515 #include "X86TargetMachine.h"
1616 #include "llvm/CodeGen/TargetOpcodes.h"
17 #include "llvm/CodeGen/ValueTypes.h"
1718 #include "llvm/IR/DerivedTypes.h"
1819 #include "llvm/IR/Type.h"
19 #include "llvm/IR/ValueTypes.h"
2020
2121 using namespace llvm;
2222 using namespace TargetOpcode;
2323 #include "llvm/CodeGen/MachineJumpTableInfo.h"
2424 #include "llvm/CodeGen/MachineRegisterInfo.h"
2525 #include "llvm/CodeGen/SelectionDAGISel.h"
26 #include "llvm/CodeGen/ValueTypes.h"
2627 #include "llvm/IR/CallingConv.h"
2728 #include "llvm/IR/Constants.h"
2829 #include "llvm/IR/DerivedTypes.h"
3031 #include "llvm/IR/GlobalAlias.h"
3132 #include "llvm/IR/GlobalVariable.h"
3233 #include "llvm/IR/Intrinsics.h"
33 #include "llvm/IR/ValueTypes.h"
3434 #include "llvm/Support/Debug.h"
3535 #include "llvm/Support/ErrorHandling.h"
3636 #include "llvm/Support/KnownBits.h"
66 //
77 //===----------------------------------------------------------------------===//
88
9 #include "llvm/CodeGen/ValueTypes.h"
910 #include "llvm/IR/LLVMContext.h"
10 #include "llvm/IR/ValueTypes.h"
1111 #include "llvm/Support/MachineValueType.h"
1212 #include "gtest/gtest.h"
1313