LLVM 18.0.0git
ValueTypes.cpp
Go to the documentation of this file.
1//===----------- ValueTypes.cpp - Implementation of EVT methods -----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
12#include "llvm/IR/Type.h"
13#include "llvm/Support/Debug.h"
17using namespace llvm;
18
19EVT EVT::changeExtendedTypeToInteger() const {
20 assert(isExtended() && "Type is not extended!");
21 LLVMContext &Context = LLVMTy->getContext();
22 return getIntegerVT(Context, getSizeInBits());
23}
24
25EVT EVT::changeExtendedVectorElementTypeToInteger() const {
26 assert(isExtended() && "Type is not extended!");
27 LLVMContext &Context = LLVMTy->getContext();
28 EVT IntTy = getIntegerVT(Context, getScalarSizeInBits());
29 return getVectorVT(Context, IntTy, getVectorElementCount());
30}
31
32EVT EVT::changeExtendedVectorElementType(EVT EltVT) const {
33 assert(isExtended() && "Type is not extended!");
34 LLVMContext &Context = LLVMTy->getContext();
35 return getVectorVT(Context, EltVT, getVectorElementCount());
36}
37
38EVT EVT::getExtendedIntegerVT(LLVMContext &Context, unsigned BitWidth) {
39 EVT VT;
40 VT.LLVMTy = IntegerType::get(Context, BitWidth);
41 assert(VT.isExtended() && "Type is not extended!");
42 return VT;
43}
44
45EVT EVT::getExtendedVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements,
46 bool IsScalable) {
47 EVT ResultVT;
48 ResultVT.LLVMTy =
49 VectorType::get(VT.getTypeForEVT(Context), NumElements, IsScalable);
50 assert(ResultVT.isExtended() && "Type is not extended!");
51 return ResultVT;
52}
53
54EVT EVT::getExtendedVectorVT(LLVMContext &Context, EVT VT, ElementCount EC) {
55 EVT ResultVT;
56 ResultVT.LLVMTy = VectorType::get(VT.getTypeForEVT(Context), EC);
57 assert(ResultVT.isExtended() && "Type is not extended!");
58 return ResultVT;
59}
60
61bool EVT::isExtendedFloatingPoint() const {
62 assert(isExtended() && "Type is not extended!");
63 return LLVMTy->isFPOrFPVectorTy();
64}
65
66bool EVT::isExtendedInteger() const {
67 assert(isExtended() && "Type is not extended!");
68 return LLVMTy->isIntOrIntVectorTy();
69}
70
71bool EVT::isExtendedScalarInteger() const {
72 assert(isExtended() && "Type is not extended!");
73 return LLVMTy->isIntegerTy();
74}
75
76bool EVT::isExtendedVector() const {
77 assert(isExtended() && "Type is not extended!");
78 return LLVMTy->isVectorTy();
79}
80
81bool EVT::isExtended16BitVector() const {
82 return isExtendedVector() && getExtendedSizeInBits() == 16;
83}
84
85bool EVT::isExtended32BitVector() const {
86 return isExtendedVector() && getExtendedSizeInBits() == 32;
87}
88
89bool EVT::isExtended64BitVector() const {
90 return isExtendedVector() && getExtendedSizeInBits() == 64;
91}
92
93bool EVT::isExtended128BitVector() const {
94 return isExtendedVector() && getExtendedSizeInBits() == 128;
95}
96
97bool EVT::isExtended256BitVector() const {
98 return isExtendedVector() && getExtendedSizeInBits() == 256;
99}
100
101bool EVT::isExtended512BitVector() const {
102 return isExtendedVector() && getExtendedSizeInBits() == 512;
103}
104
105bool EVT::isExtended1024BitVector() const {
106 return isExtendedVector() && getExtendedSizeInBits() == 1024;
107}
108
109bool EVT::isExtended2048BitVector() const {
110 return isExtendedVector() && getExtendedSizeInBits() == 2048;
111}
112
113bool EVT::isExtendedFixedLengthVector() const {
114 return isExtendedVector() && isa<FixedVectorType>(LLVMTy);
115}
116
117bool EVT::isExtendedScalableVector() const {
118 return isExtendedVector() && isa<ScalableVectorType>(LLVMTy);
119}
120
121EVT EVT::getExtendedVectorElementType() const {
122 assert(isExtended() && "Type is not extended!");
123 return EVT::getEVT(cast<VectorType>(LLVMTy)->getElementType());
124}
125
126unsigned EVT::getExtendedVectorNumElements() const {
127 assert(isExtended() && "Type is not extended!");
128 ElementCount EC = cast<VectorType>(LLVMTy)->getElementCount();
129 if (EC.isScalable()) {
131 << "The code that requested the fixed number of elements has made the "
132 "assumption that this vector is not scalable. This assumption was "
133 "not correct, and this may lead to broken code\n";
134 }
135 return EC.getKnownMinValue();
136}
137
138ElementCount EVT::getExtendedVectorElementCount() const {
139 assert(isExtended() && "Type is not extended!");
140 return cast<VectorType>(LLVMTy)->getElementCount();
141}
142
143TypeSize EVT::getExtendedSizeInBits() const {
144 assert(isExtended() && "Type is not extended!");
145 if (IntegerType *ITy = dyn_cast<IntegerType>(LLVMTy))
146 return TypeSize::Fixed(ITy->getBitWidth());
147 if (VectorType *VTy = dyn_cast<VectorType>(LLVMTy))
148 return VTy->getPrimitiveSizeInBits();
149 llvm_unreachable("Unrecognized extended type!");
150}
151
152/// getEVTString - This function returns value type as a string, e.g. "i32".
153std::string EVT::getEVTString() const {
154 switch (V.SimpleTy) {
155 default:
156 if (isVector())
157 return (isScalableVector() ? "nxv" : "v") +
158 utostr(getVectorElementCount().getKnownMinValue()) +
160 if (isInteger())
161 return "i" + utostr(getSizeInBits());
162 if (isFloatingPoint())
163 return "f" + utostr(getSizeInBits());
164 llvm_unreachable("Invalid EVT!");
165 case MVT::bf16: return "bf16";
166 case MVT::ppcf128: return "ppcf128";
167 case MVT::isVoid: return "isVoid";
168 case MVT::Other: return "ch";
169 case MVT::Glue: return "glue";
170 case MVT::x86mmx: return "x86mmx";
171 case MVT::x86amx: return "x86amx";
172 case MVT::i64x8: return "i64x8";
173 case MVT::Metadata: return "Metadata";
174 case MVT::Untyped: return "Untyped";
175 case MVT::funcref: return "funcref";
176 case MVT::externref: return "externref";
177 case MVT::aarch64svcount:
178 return "aarch64svcount";
179 case MVT::spirvbuiltin:
180 return "spirvbuiltin";
181 }
182}
183
184#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
185void EVT::dump() const {
186 print(dbgs());
187 dbgs() << "\n";
188}
189#endif
190
191/// getTypeForEVT - This method returns an LLVM type corresponding to the
192/// specified EVT. For integer types, this returns an unsigned type. Note
193/// that this will abort for types that cannot be represented.
195 // clang-format off
196 switch (V.SimpleTy) {
197 default:
198 assert(isExtended() && "Type is not extended!");
199 return LLVMTy;
200 case MVT::isVoid: return Type::getVoidTy(Context);
201 case MVT::i1: return Type::getInt1Ty(Context);
202 case MVT::i2: return Type::getIntNTy(Context, 2);
203 case MVT::i4: return Type::getIntNTy(Context, 4);
204 case MVT::i8: return Type::getInt8Ty(Context);
205 case MVT::i16: return Type::getInt16Ty(Context);
206 case MVT::i32: return Type::getInt32Ty(Context);
207 case MVT::i64: return Type::getInt64Ty(Context);
208 case MVT::i128: return IntegerType::get(Context, 128);
209 case MVT::f16: return Type::getHalfTy(Context);
210 case MVT::bf16: return Type::getBFloatTy(Context);
211 case MVT::f32: return Type::getFloatTy(Context);
212 case MVT::f64: return Type::getDoubleTy(Context);
213 case MVT::f80: return Type::getX86_FP80Ty(Context);
214 case MVT::f128: return Type::getFP128Ty(Context);
215 case MVT::ppcf128: return Type::getPPC_FP128Ty(Context);
216 case MVT::x86mmx: return Type::getX86_MMXTy(Context);
217 case MVT::aarch64svcount:
218 return TargetExtType::get(Context, "aarch64.svcount");
219 case MVT::x86amx: return Type::getX86_AMXTy(Context);
220 case MVT::i64x8: return IntegerType::get(Context, 512);
221 case MVT::externref: return Type::getWasm_ExternrefTy(Context);
222 case MVT::funcref: return Type::getWasm_FuncrefTy(Context);
223 case MVT::v1i1:
225 case MVT::v2i1:
227 case MVT::v4i1:
229 case MVT::v8i1:
231 case MVT::v16i1:
233 case MVT::v32i1:
235 case MVT::v64i1:
237 case MVT::v128i1:
239 case MVT::v256i1:
241 case MVT::v512i1:
243 case MVT::v1024i1:
245 case MVT::v2048i1:
247 case MVT::v128i2:
249 case MVT::v256i2:
251 case MVT::v64i4:
253 case MVT::v128i4:
255 case MVT::v1i8:
257 case MVT::v2i8:
259 case MVT::v4i8:
261 case MVT::v8i8:
263 case MVT::v16i8:
265 case MVT::v32i8:
267 case MVT::v64i8:
269 case MVT::v128i8:
271 case MVT::v256i8:
273 case MVT::v512i8:
275 case MVT::v1024i8:
277 case MVT::v1i16:
279 case MVT::v2i16:
281 case MVT::v3i16:
283 case MVT::v4i16:
285 case MVT::v8i16:
287 case MVT::v16i16:
289 case MVT::v32i16:
291 case MVT::v64i16:
293 case MVT::v128i16:
295 case MVT::v256i16:
297 case MVT::v512i16:
299 case MVT::v1i32:
301 case MVT::v2i32:
303 case MVT::v3i32:
305 case MVT::v4i32:
307 case MVT::v5i32:
309 case MVT::v6i32:
311 case MVT::v7i32:
313 case MVT::v8i32:
315 case MVT::v9i32:
317 case MVT::v10i32:
319 case MVT::v11i32:
321 case MVT::v12i32:
323 case MVT::v16i32:
325 case MVT::v32i32:
327 case MVT::v64i32:
329 case MVT::v128i32:
331 case MVT::v256i32:
333 case MVT::v512i32:
335 case MVT::v1024i32:
337 case MVT::v2048i32:
339 case MVT::v1i64:
341 case MVT::v2i64:
343 case MVT::v3i64:
345 case MVT::v4i64:
347 case MVT::v8i64:
349 case MVT::v16i64:
351 case MVT::v32i64:
353 case MVT::v64i64:
355 case MVT::v128i64:
357 case MVT::v256i64:
359 case MVT::v1i128:
361 case MVT::v1f16:
363 case MVT::v2f16:
365 case MVT::v3f16:
367 case MVT::v4f16:
369 case MVT::v8f16:
371 case MVT::v16f16:
373 case MVT::v32f16:
375 case MVT::v64f16:
377 case MVT::v128f16:
379 case MVT::v256f16:
381 case MVT::v512f16:
383 case MVT::v2bf16:
385 case MVT::v3bf16:
387 case MVT::v4bf16:
389 case MVT::v8bf16:
391 case MVT::v16bf16:
393 case MVT::v32bf16:
395 case MVT::v64bf16:
397 case MVT::v128bf16:
399 case MVT::v1f32:
401 case MVT::v2f32:
403 case MVT::v3f32:
405 case MVT::v4f32:
407 case MVT::v5f32:
409 case MVT::v6f32:
411 case MVT::v7f32:
413 case MVT::v8f32:
415 case MVT::v9f32:
417 case MVT::v10f32:
419 case MVT::v11f32:
421 case MVT::v12f32:
423 case MVT::v16f32:
425 case MVT::v32f32:
427 case MVT::v64f32:
429 case MVT::v128f32:
431 case MVT::v256f32:
433 case MVT::v512f32:
435 case MVT::v1024f32:
437 case MVT::v2048f32:
439 case MVT::v1f64:
441 case MVT::v2f64:
443 case MVT::v3f64:
445 case MVT::v4f64:
447 case MVT::v8f64:
449 case MVT::v16f64:
451 case MVT::v32f64:
453 case MVT::v64f64:
455 case MVT::v128f64:
457 case MVT::v256f64:
459 case MVT::nxv1i1:
461 case MVT::nxv2i1:
463 case MVT::nxv4i1:
465 case MVT::nxv8i1:
467 case MVT::nxv16i1:
469 case MVT::nxv32i1:
471 case MVT::nxv64i1:
473 case MVT::nxv1i8:
475 case MVT::nxv2i8:
477 case MVT::nxv4i8:
479 case MVT::nxv8i8:
481 case MVT::nxv16i8:
483 case MVT::nxv32i8:
485 case MVT::nxv64i8:
487 case MVT::nxv1i16:
489 case MVT::nxv2i16:
491 case MVT::nxv4i16:
493 case MVT::nxv8i16:
495 case MVT::nxv16i16:
497 case MVT::nxv32i16:
499 case MVT::nxv1i32:
501 case MVT::nxv2i32:
503 case MVT::nxv4i32:
505 case MVT::nxv8i32:
507 case MVT::nxv16i32:
509 case MVT::nxv32i32:
511 case MVT::nxv1i64:
513 case MVT::nxv2i64:
515 case MVT::nxv4i64:
517 case MVT::nxv8i64:
519 case MVT::nxv16i64:
521 case MVT::nxv32i64:
523 case MVT::nxv1f16:
525 case MVT::nxv2f16:
527 case MVT::nxv4f16:
529 case MVT::nxv8f16:
531 case MVT::nxv16f16:
533 case MVT::nxv32f16:
535 case MVT::nxv1bf16:
537 case MVT::nxv2bf16:
539 case MVT::nxv4bf16:
541 case MVT::nxv8bf16:
543 case MVT::nxv16bf16:
545 case MVT::nxv32bf16:
547 case MVT::nxv1f32:
549 case MVT::nxv2f32:
551 case MVT::nxv4f32:
553 case MVT::nxv8f32:
555 case MVT::nxv16f32:
557 case MVT::nxv1f64:
559 case MVT::nxv2f64:
561 case MVT::nxv4f64:
563 case MVT::nxv8f64:
565 case MVT::Metadata: return Type::getMetadataTy(Context);
566 }
567 // clang-format on
568}
569
570/// Return the value type corresponding to the specified type. This returns all
571/// pointers as MVT::iPTR. If HandleUnknown is true, unknown types are returned
572/// as Other, otherwise they are invalid.
573MVT MVT::getVT(Type *Ty, bool HandleUnknown){
574 assert(Ty != nullptr && "Invalid type");
575 switch (Ty->getTypeID()) {
576 default:
577 if (HandleUnknown) return MVT(MVT::Other);
578 llvm_unreachable("Unknown type!");
579 case Type::VoidTyID:
580 return MVT::isVoid;
582 return getIntegerVT(cast<IntegerType>(Ty)->getBitWidth());
583 case Type::HalfTyID: return MVT(MVT::f16);
584 case Type::BFloatTyID: return MVT(MVT::bf16);
585 case Type::FloatTyID: return MVT(MVT::f32);
586 case Type::DoubleTyID: return MVT(MVT::f64);
587 case Type::X86_FP80TyID: return MVT(MVT::f80);
588 case Type::X86_MMXTyID: return MVT(MVT::x86mmx);
589 case Type::TargetExtTyID: {
590 TargetExtType *TargetExtTy = cast<TargetExtType>(Ty);
591 if (TargetExtTy->getName() == "aarch64.svcount")
592 return MVT(MVT::aarch64svcount);
593 else if (TargetExtTy->getName().starts_with("spirv."))
594 return MVT(MVT::spirvbuiltin);
595 if (HandleUnknown)
596 return MVT(MVT::Other);
597 llvm_unreachable("Unknown target ext type!");
598 }
599 case Type::X86_AMXTyID: return MVT(MVT::x86amx);
600 case Type::FP128TyID: return MVT(MVT::f128);
601 case Type::PPC_FP128TyID: return MVT(MVT::ppcf128);
602 case Type::PointerTyID: return MVT(MVT::iPTR);
605 VectorType *VTy = cast<VectorType>(Ty);
606 return getVectorVT(
607 getVT(VTy->getElementType(), /*HandleUnknown=*/ false),
608 VTy->getElementCount());
609 }
610 }
611}
612
613/// getEVT - Return the value type corresponding to the specified type. This
614/// returns all pointers as MVT::iPTR. If HandleUnknown is true, unknown types
615/// are returned as Other, otherwise they are invalid.
616EVT EVT::getEVT(Type *Ty, bool HandleUnknown){
617 switch (Ty->getTypeID()) {
618 default:
619 return MVT::getVT(Ty, HandleUnknown);
621 return getIntegerVT(Ty->getContext(), cast<IntegerType>(Ty)->getBitWidth());
624 VectorType *VTy = cast<VectorType>(Ty);
625 return getVectorVT(Ty->getContext(),
626 getEVT(VTy->getElementType(), /*HandleUnknown=*/ false),
627 VTy->getElementCount());
628 }
629 }
630}
631
632#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
633void MVT::dump() const {
634 print(dbgs());
635 dbgs() << "\n";
636}
637#endif
638
641 OS << "invalid";
642 else
643 OS << EVT(*this).getEVTString();
644}
645
LLVMContext & Context
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
This file contains some functions that are useful when dealing with strings.
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
static FixedVectorType * get(Type *ElementType, unsigned NumElts)
Definition: Type.cpp:693
Class to represent integer types.
Definition: DerivedTypes.h:40
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:279
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
Machine Value Type.
void dump() const
Support for debugging, callable in GDB: VT.dump()
Definition: ValueTypes.cpp:633
SimpleValueType SimpleTy
@ INVALID_SIMPLE_VALUE_TYPE
constexpr MVT()=default
static MVT getVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
Definition: ValueTypes.cpp:573
static MVT getVectorVT(MVT VT, unsigned NumElements)
static MVT getIntegerVT(unsigned BitWidth)
void print(raw_ostream &OS) const
Implement operator<<.
Definition: ValueTypes.cpp:639
static ScalableVectorType * get(Type *ElementType, unsigned MinNumElts)
Definition: Type.cpp:714
bool starts_with(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:257
Class to represent target extensions types, which are generally unintrospectable from target-independ...
Definition: DerivedTypes.h:749
static TargetExtType * get(LLVMContext &Context, StringRef Name, ArrayRef< Type * > Types=std::nullopt, ArrayRef< unsigned > Ints=std::nullopt)
Return a target extension type having the specified name and optional type and integer parameters.
Definition: Type.cpp:797
StringRef getName() const
Return the name for this target extension type.
Definition: DerivedTypes.h:770
static constexpr TypeSize Fixed(ScalarTy ExactSize)
Definition: TypeSize.h:331
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
static Type * getHalfTy(LLVMContext &C)
static Type * getDoubleTy(LLVMContext &C)
bool isVectorTy() const
True if this is an instance of VectorType.
Definition: Type.h:265
static Type * getX86_FP80Ty(LLVMContext &C)
static Type * getBFloatTy(LLVMContext &C)
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Definition: Type.h:234
static IntegerType * getInt1Ty(LLVMContext &C)
static Type * getX86_AMXTy(LLVMContext &C)
static Type * getMetadataTy(LLVMContext &C)
@ X86_MMXTyID
MMX vectors (64 bits, X86 specific)
Definition: Type.h:66
@ X86_AMXTyID
AMX vectors (8192 bits, X86 specific)
Definition: Type.h:67
@ HalfTyID
16-bit floating point type
Definition: Type.h:56
@ TargetExtTyID
Target extension type.
Definition: Type.h:79
@ VoidTyID
type with no size
Definition: Type.h:63
@ ScalableVectorTyID
Scalable SIMD vector type.
Definition: Type.h:77
@ FloatTyID
32-bit floating point type
Definition: Type.h:58
@ IntegerTyID
Arbitrary bit width integers.
Definition: Type.h:71
@ FixedVectorTyID
Fixed width SIMD vector type.
Definition: Type.h:76
@ BFloatTyID
16-bit floating point type (7-bit significand)
Definition: Type.h:57
@ DoubleTyID
64-bit floating point type
Definition: Type.h:59
@ X86_FP80TyID
80-bit floating point type (X87)
Definition: Type.h:60
@ PPC_FP128TyID
128-bit floating point type (two 64-bits, PowerPC)
Definition: Type.h:62
@ PointerTyID
Pointers.
Definition: Type.h:73
@ FP128TyID
128-bit floating point type (112-bit significand)
Definition: Type.h:61
static Type * getX86_MMXTy(LLVMContext &C)
static IntegerType * getIntNTy(LLVMContext &C, unsigned N)
static Type * getVoidTy(LLVMContext &C)
static Type * getFP128Ty(LLVMContext &C)
static IntegerType * getInt16Ty(LLVMContext &C)
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition: Type.h:129
static IntegerType * getInt8Ty(LLVMContext &C)
static IntegerType * getInt128Ty(LLVMContext &C)
static IntegerType * getInt32Ty(LLVMContext &C)
static IntegerType * getInt64Ty(LLVMContext &C)
static Type * getFloatTy(LLVMContext &C)
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition: Type.h:228
TypeID getTypeID() const
Return the type id for the type.
Definition: Type.h:137
static Type * getWasm_FuncrefTy(LLVMContext &C)
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
Definition: Type.h:216
static Type * getPPC_FP128Ty(LLVMContext &C)
static Type * getWasm_ExternrefTy(LLVMContext &C)
Base class of all SIMD vector types.
Definition: DerivedTypes.h:400
ElementCount getElementCount() const
Return an ElementCount instance to represent the (possibly scalable) number of elements in the vector...
Definition: DerivedTypes.h:638
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
Definition: Type.cpp:677
Type * getElementType() const
Definition: DerivedTypes.h:433
static raw_ostream & warning()
Convenience method for printing "warning: " to stderr.
Definition: WithColor.cpp:85
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
constexpr unsigned BitWidth
Definition: BitmaskEnum.h:184
Extended Value Type.
Definition: ValueTypes.h:34
static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements, bool IsScalable=false)
Returns the EVT that represents a vector NumElements in length, where each element is of type VT.
Definition: ValueTypes.h:73
bool isFloatingPoint() const
Return true if this is a FP or a vector FP type.
Definition: ValueTypes.h:139
ElementCount getVectorElementCount() const
Definition: ValueTypes.h:333
TypeSize getSizeInBits() const
Return the size of the specified value type in bits.
Definition: ValueTypes.h:351
uint64_t getScalarSizeInBits() const
Definition: ValueTypes.h:363
static EVT getEVT(Type *Ty, bool HandleUnknown=false)
Return the value type corresponding to the specified type.
Definition: ValueTypes.cpp:616
void dump() const
Support for debugging, callable in GDB: VT.dump()
Definition: ValueTypes.cpp:185
static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)
Returns the EVT that represents an integer with the given number of bits.
Definition: ValueTypes.h:64
std::string getEVTString() const
This function returns value type as a string, e.g. "i32".
Definition: ValueTypes.cpp:153
bool isVector() const
Return true if this is a vector value type.
Definition: ValueTypes.h:160
Type * getTypeForEVT(LLVMContext &Context) const
This method returns an LLVM type corresponding to the specified EVT.
Definition: ValueTypes.cpp:194
bool isScalableVector() const
Return true if this is a vector type where the runtime length is machine dependent.
Definition: ValueTypes.h:166
EVT getVectorElementType() const
Given a vector type, return the type of each element.
Definition: ValueTypes.h:311
bool isExtended() const
Test if the given EVT is extended (as opposed to being simple).
Definition: ValueTypes.h:134
void print(raw_ostream &OS) const
Implement operator<<.
Definition: ValueTypes.h:474
bool isInteger() const
Return true if this is an integer or a vector integer type.
Definition: ValueTypes.h:144