1 //===- CodeGen/ValueTypes.h - Low-Level Target independ. types --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines the set of low-level target independent types which various
11 // values in the code generator are. This allows the target specific behavior
12 // of instructions to be described to target independent passes.
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_CODEGEN_VALUETYPES_H
17 #define LLVM_CODEGEN_VALUETYPES_H
24 /// MVT namespace - This namespace defines the ValueType enum, which contains
25 /// the various low-level value types.
27 namespace MVT { // MVT = Machine Value Types
29 // If you change this numbering, you must change the values in Target.td as
31 Other = 0, // This is a non-standard value
32 i1 = 1, // This is a 1 bit integer value
33 i8 = 2, // This is an 8 bit integer value
34 i16 = 3, // This is a 16 bit integer value
35 i32 = 4, // This is a 32 bit integer value
36 i64 = 5, // This is a 64 bit integer value
37 i128 = 6, // This is a 128 bit integer value
39 f32 = 7, // This is a 32 bit floating point value
40 f64 = 8, // This is a 64 bit floating point value
41 f80 = 9, // This is a 80 bit floating point value
42 f128 = 10, // This is a 128 bit floating point value
44 isVoid = 11, // This has no value
46 LAST_VALUETYPE, // This always remains at the end of the list.
49 static inline bool isInteger(ValueType VT) {
50 return VT >= i1 && VT <= i128;
52 static inline bool isFloatingPoint(ValueType VT) {
53 return VT >= f32 && VT <= f128;
56 static inline unsigned getSizeInBits(ValueType VT) {
58 default: assert(0 && "ValueType has no known size!");
59 case MVT::i1 : return 1;
60 case MVT::i8 : return 8;
61 case MVT::i16 : return 16;
63 case MVT::i32 : return 32;
65 case MVT::i64 : return 64;
66 case MVT::f80 : return 80;
68 case MVT::i128: return 128;
72 /// MVT::getValueTypeString - This function returns value type as a string,
74 const char *getValueTypeString(ValueType VT);
76 /// MVT::getTypeForValueType - This method returns an LLVM type corresponding
77 /// to the specified ValueType. For integer types, this returns an unsigned
78 /// type. Note that this will abort for types that cannot be represented.
79 const Type *getTypeForValueType(ValueType VT);
82 } // End llvm namespace