aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/ValueTypes.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-08-12 00:36:31 +0000
committerOwen Anderson <resistor@mac.com>2009-08-12 00:36:31 +0000
commit23b9b19b1a5a00faa9fce0788155c7dbfd00bfb1 (patch)
tree54bd83953a63347f013ce92ebb0dd716323d12ca /lib/VMCore/ValueTypes.cpp
parent45563ba9e3667678abf68cdc9e9a536c1df2a43a (diff)
downloadexternal_llvm-23b9b19b1a5a00faa9fce0788155c7dbfd00bfb1.zip
external_llvm-23b9b19b1a5a00faa9fce0788155c7dbfd00bfb1.tar.gz
external_llvm-23b9b19b1a5a00faa9fce0788155c7dbfd00bfb1.tar.bz2
Add contexts to some of the MVT APIs. No functionality change yet, just the infrastructure work needed to get the contexts to where they need to be first.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78759 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ValueTypes.cpp')
-rw-r--r--lib/VMCore/ValueTypes.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/VMCore/ValueTypes.cpp b/lib/VMCore/ValueTypes.cpp
index 952d225..8a046fd 100644
--- a/lib/VMCore/ValueTypes.cpp
+++ b/lib/VMCore/ValueTypes.cpp
@@ -19,16 +19,17 @@
#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
-EVT EVT::getExtendedIntegerVT(unsigned BitWidth) {
+EVT EVT::getExtendedIntegerVT(LLVMContext &Context, unsigned BitWidth) {
EVT VT;
VT.LLVMTy = IntegerType::get(BitWidth);
assert(VT.isExtended() && "Type is not extended!");
return VT;
}
-EVT EVT::getExtendedVectorVT(EVT VT, unsigned NumElements) {
+EVT EVT::getExtendedVectorVT(LLVMContext &Context, EVT VT,
+ unsigned NumElements) {
EVT ResultVT;
- ResultVT.LLVMTy = VectorType::get(VT.getTypeForEVT(), NumElements);
+ ResultVT.LLVMTy = VectorType::get(VT.getTypeForEVT(Context), NumElements);
assert(ResultVT.isExtended() && "Type is not extended!");
return ResultVT;
}
@@ -131,7 +132,7 @@ std::string EVT::getEVTString() const {
/// getTypeForEVT - This method returns an LLVM type corresponding to the
/// specified EVT. For integer types, this returns an unsigned type. Note
/// that this will abort for types that cannot be represented.
-const Type *EVT::getTypeForEVT() const {
+const Type *EVT::getTypeForEVT(LLVMContext &Context) const {
switch (V.SimpleTy) {
default:
assert(isExtended() && "Type is not extended!");
@@ -179,11 +180,11 @@ EVT EVT::getEVT(const Type *Ty, bool HandleUnknown){
default:
if (HandleUnknown) return MVT(MVT::Other);
llvm_unreachable("Unknown type!");
- return MVT(MVT::isVoid);
+ return MVT::isVoid;
case Type::VoidTyID:
- return MVT(MVT::isVoid);
+ return MVT::isVoid;
case Type::IntegerTyID:
- return getIntegerVT(cast<IntegerType>(Ty)->getBitWidth());
+ return getIntegerVT(Ty->getContext(), cast<IntegerType>(Ty)->getBitWidth());
case Type::FloatTyID: return MVT(MVT::f32);
case Type::DoubleTyID: return MVT(MVT::f64);
case Type::X86_FP80TyID: return MVT(MVT::f80);
@@ -192,7 +193,7 @@ EVT EVT::getEVT(const Type *Ty, bool HandleUnknown){
case Type::PointerTyID: return MVT(MVT::iPTR);
case Type::VectorTyID: {
const VectorType *VTy = cast<VectorType>(Ty);
- return getVectorVT(getEVT(VTy->getElementType(), false),
+ return getVectorVT(Ty->getContext(), getEVT(VTy->getElementType(), false),
VTy->getNumElements());
}
}