diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-12 07:05:14 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-12 07:05:14 +0000 |
commit | a54b7cbd452b3adb2f51346140d996b29c2cdb30 (patch) | |
tree | 00514e24a3fab3804f1a99557ebd343382d0dc27 /include/llvm/Target/TargetLowering.h | |
parent | ed3098989580ecaee7fc89de548afb4c811bea31 (diff) | |
download | external_llvm-a54b7cbd452b3adb2f51346140d996b29c2cdb30.zip external_llvm-a54b7cbd452b3adb2f51346140d996b29c2cdb30.tar.gz external_llvm-a54b7cbd452b3adb2f51346140d996b29c2cdb30.tar.bz2 |
For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.
This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
bits in an integer. The Type classes SubclassData field is used to
store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
64-bit integers. These are replaced with just IntegerType which is not
a primitive any more.
3. Adjust the rest of LLVM to account for this change.
Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types. Future increments
will rectify this situation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33113 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target/TargetLowering.h')
-rw-r--r-- | include/llvm/Target/TargetLowering.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index 5749d52..fd2caf8 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -22,7 +22,7 @@ #ifndef LLVM_TARGET_TARGETLOWERING_H #define LLVM_TARGET_TARGETLOWERING_H -#include "llvm/Type.h" +#include "llvm/DerivedTypes.h" #include "llvm/CodeGen/SelectionDAGNodes.h" #include <map> @@ -429,11 +429,16 @@ public: switch (Ty->getTypeID()) { default: assert(0 && "Unknown type!"); case Type::VoidTyID: return MVT::isVoid; - case Type::Int1TyID: return MVT::i1; - case Type::Int8TyID: return MVT::i8; - case Type::Int16TyID: return MVT::i16; - case Type::Int32TyID: return MVT::i32; - case Type::Int64TyID: return MVT::i64; + case Type::IntegerTyID: + switch (cast<IntegerType>(Ty)->getBitWidth()) { + default: assert(0 && "Invalid width for value type"); + case 1: return MVT::i1; + case 8: return MVT::i8; + case 16: return MVT::i16; + case 32: return MVT::i32; + case 64: return MVT::i64; + } + break; case Type::FloatTyID: return MVT::f32; case Type::DoubleTyID: return MVT::f64; case Type::PointerTyID: return PointerTy; |