diff options
author | Duncan Sands <baldrick@free.fr> | 2007-10-16 09:56:48 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2007-10-16 09:56:48 +0000 |
commit | af47b11b959713d70c45bee1922e468adfaeaff0 (patch) | |
tree | 0d2883b1e7a4907af2964de9fc0da56760cf4871 /lib/VMCore/ValueTypes.cpp | |
parent | a7c97a7f5b82778ca5abfc3791c6b7f96b82a5fa (diff) | |
download | external_llvm-af47b11b959713d70c45bee1922e468adfaeaff0.zip external_llvm-af47b11b959713d70c45bee1922e468adfaeaff0.tar.gz external_llvm-af47b11b959713d70c45bee1922e468adfaeaff0.tar.bz2 |
Initial infrastructure for arbitrary precision integer
codegen support. This should have no effect on codegen
for other types. Debatable bits: (1) the use (abuse?)
of a set in SDNode::getValueTypeList; (2) the length of
getTypeToTransformTo, which maybe should be refactored
with a non-inline part for extended value types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43030 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ValueTypes.cpp')
-rw-r--r-- | lib/VMCore/ValueTypes.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/lib/VMCore/ValueTypes.cpp b/lib/VMCore/ValueTypes.cpp index 3d9951b..6089c56 100644 --- a/lib/VMCore/ValueTypes.cpp +++ b/lib/VMCore/ValueTypes.cpp @@ -22,9 +22,11 @@ using namespace llvm; std::string MVT::getValueTypeString(MVT::ValueType VT) { switch (VT) { default: - if (isExtendedVT(VT)) + if (isVector(VT)) return "v" + utostr(getVectorNumElements(VT)) + getValueTypeString(getVectorElementType(VT)); + if (isInteger(VT)) + return "i" + utostr(getSizeInBits(VT)); assert(0 && "Invalid ValueType!"); case MVT::i1: return "i1"; case MVT::i8: return "i8"; @@ -62,9 +64,11 @@ std::string MVT::getValueTypeString(MVT::ValueType VT) { const Type *MVT::getTypeForValueType(MVT::ValueType VT) { switch (VT) { default: - if (isExtendedVT(VT)) + if (isVector(VT)) return VectorType::get(getTypeForValueType(getVectorElementType(VT)), getVectorNumElements(VT)); + if (isInteger(VT)) + return IntegerType::get(getSizeInBits(VT)); assert(0 && "ValueType does not correspond to LLVM type!"); case MVT::isVoid:return Type::VoidTy; case MVT::i1: return Type::Int1Ty; @@ -105,19 +109,7 @@ MVT::ValueType MVT::getValueType(const Type *Ty, bool HandleUnknown) { case Type::VoidTyID: return MVT::isVoid; case Type::IntegerTyID: - switch (cast<IntegerType>(Ty)->getBitWidth()) { - default: - // FIXME: Return MVT::iANY. - if (HandleUnknown) return MVT::Other; - 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; - case 128: return MVT::i128; - } - break; + return getIntegerType(cast<IntegerType>(Ty)->getBitWidth()); case Type::FloatTyID: return MVT::f32; case Type::DoubleTyID: return MVT::f64; case Type::X86_FP80TyID: return MVT::f80; |