aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Support
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-08-13 21:58:54 +0000
committerOwen Anderson <resistor@mac.com>2009-08-13 21:58:54 +0000
commit35b4707edb32008b1a7976dcbf3920b1160fc1c6 (patch)
tree2cdabe223bfce83bd12e10dd557147a2f68c9bf8 /include/llvm/Support
parentdfa78d19236fe2c33733c916f45d25ba46e0773f (diff)
downloadexternal_llvm-35b4707edb32008b1a7976dcbf3920b1160fc1c6.zip
external_llvm-35b4707edb32008b1a7976dcbf3920b1160fc1c6.tar.gz
external_llvm-35b4707edb32008b1a7976dcbf3920b1160fc1c6.tar.bz2
Push LLVMContexts through the IntegerType APIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78948 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r--include/llvm/Support/IRBuilder.h42
-rw-r--r--include/llvm/Support/TypeBuilder.h28
2 files changed, 35 insertions, 35 deletions
diff --git a/include/llvm/Support/IRBuilder.h b/include/llvm/Support/IRBuilder.h
index 9e0073a..e216d4c 100644
--- a/include/llvm/Support/IRBuilder.h
+++ b/include/llvm/Support/IRBuilder.h
@@ -129,14 +129,14 @@ public:
/// CreateRetVoid - Create a 'ret void' instruction.
ReturnInst *CreateRetVoid() {
- return Insert(ReturnInst::Create());
+ return Insert(ReturnInst::Create(getGlobalContext()));
}
/// @verbatim
/// CreateRet - Create a 'ret <val>' instruction.
/// @endverbatim
ReturnInst *CreateRet(Value *V) {
- return Insert(ReturnInst::Create(V));
+ return Insert(ReturnInst::Create(getGlobalContext(), V));
}
/// CreateAggregateRet - Create a sequence of N insertvalue instructions,
@@ -151,7 +151,7 @@ public:
Value *V = UndefValue::get(RetType);
for (unsigned i = 0; i != N; ++i)
V = CreateInsertValue(V, retVals[i], i, "mrv");
- return Insert(ReturnInst::Create(V));
+ return Insert(ReturnInst::Create(getGlobalContext(), V));
}
/// CreateBr - Create an unconditional 'br label X' instruction.
@@ -182,11 +182,11 @@ public:
}
UnwindInst *CreateUnwind() {
- return Insert(new UnwindInst());
+ return Insert(new UnwindInst(Context));
}
UnreachableInst *CreateUnreachable() {
- return Insert(new UnreachableInst());
+ return Insert(new UnreachableInst(Context));
}
//===--------------------------------------------------------------------===//
@@ -406,7 +406,7 @@ public:
return Insert(GetElementPtrInst::CreateInBounds(Ptr, Idx), Name);
}
Value *CreateConstGEP1_32(Value *Ptr, unsigned Idx0, const char *Name = "") {
- Value *Idx = ConstantInt::get(Type::Int32Ty, Idx0);
+ Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), Idx0);
if (Constant *PC = dyn_cast<Constant>(Ptr))
return Folder.CreateGetElementPtr(PC, &Idx, 1);
@@ -415,7 +415,7 @@ public:
}
Value *CreateConstInBoundsGEP1_32(Value *Ptr, unsigned Idx0,
const char *Name = "") {
- Value *Idx = ConstantInt::get(Type::Int32Ty, Idx0);
+ Value *Idx = ConstantInt::get(Type::getInt32Ty(Context), Idx0);
if (Constant *PC = dyn_cast<Constant>(Ptr))
return Folder.CreateInBoundsGetElementPtr(PC, &Idx, 1);
@@ -425,8 +425,8 @@ public:
Value *CreateConstGEP2_32(Value *Ptr, unsigned Idx0, unsigned Idx1,
const char *Name = "") {
Value *Idxs[] = {
- ConstantInt::get(Type::Int32Ty, Idx0),
- ConstantInt::get(Type::Int32Ty, Idx1)
+ ConstantInt::get(Type::getInt32Ty(Context), Idx0),
+ ConstantInt::get(Type::getInt32Ty(Context), Idx1)
};
if (Constant *PC = dyn_cast<Constant>(Ptr))
@@ -437,8 +437,8 @@ public:
Value *CreateConstInBoundsGEP2_32(Value *Ptr, unsigned Idx0, unsigned Idx1,
const char *Name = "") {
Value *Idxs[] = {
- ConstantInt::get(Type::Int32Ty, Idx0),
- ConstantInt::get(Type::Int32Ty, Idx1)
+ ConstantInt::get(Type::getInt32Ty(Context), Idx0),
+ ConstantInt::get(Type::getInt32Ty(Context), Idx1)
};
if (Constant *PC = dyn_cast<Constant>(Ptr))
@@ -447,7 +447,7 @@ public:
return Insert(GetElementPtrInst::CreateInBounds(Ptr, Idxs, Idxs+2), Name);
}
Value *CreateConstGEP1_64(Value *Ptr, uint64_t Idx0, const char *Name = "") {
- Value *Idx = ConstantInt::get(Type::Int64Ty, Idx0);
+ Value *Idx = ConstantInt::get(Type::getInt64Ty(Context), Idx0);
if (Constant *PC = dyn_cast<Constant>(Ptr))
return Folder.CreateGetElementPtr(PC, &Idx, 1);
@@ -456,7 +456,7 @@ public:
}
Value *CreateConstInBoundsGEP1_64(Value *Ptr, uint64_t Idx0,
const char *Name = "") {
- Value *Idx = ConstantInt::get(Type::Int64Ty, Idx0);
+ Value *Idx = ConstantInt::get(Type::getInt64Ty(Context), Idx0);
if (Constant *PC = dyn_cast<Constant>(Ptr))
return Folder.CreateInBoundsGetElementPtr(PC, &Idx, 1);
@@ -466,8 +466,8 @@ public:
Value *CreateConstGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1,
const char *Name = "") {
Value *Idxs[] = {
- ConstantInt::get(Type::Int64Ty, Idx0),
- ConstantInt::get(Type::Int64Ty, Idx1)
+ ConstantInt::get(Type::getInt64Ty(Context), Idx0),
+ ConstantInt::get(Type::getInt64Ty(Context), Idx1)
};
if (Constant *PC = dyn_cast<Constant>(Ptr))
@@ -478,8 +478,8 @@ public:
Value *CreateConstInBoundsGEP2_64(Value *Ptr, uint64_t Idx0, uint64_t Idx1,
const char *Name = "") {
Value *Idxs[] = {
- ConstantInt::get(Type::Int64Ty, Idx0),
- ConstantInt::get(Type::Int64Ty, Idx1)
+ ConstantInt::get(Type::getInt64Ty(Context), Idx0),
+ ConstantInt::get(Type::getInt64Ty(Context), Idx1)
};
if (Constant *PC = dyn_cast<Constant>(Ptr))
@@ -491,7 +491,7 @@ public:
return CreateConstInBoundsGEP2_32(Ptr, 0, Idx, Name);
}
Value *CreateGlobalString(const char *Str = "", const char *Name = "") {
- Constant *StrConstant = ConstantArray::get(Str, true);
+ Constant *StrConstant = ConstantArray::get(Context, Str, true);
Module &M = *BB->getParent()->getParent();
GlobalVariable *gv = new GlobalVariable(M,
StrConstant->getType(),
@@ -506,7 +506,7 @@ public:
}
Value *CreateGlobalStringPtr(const char *Str = "", const char *Name = "") {
Value *gv = CreateGlobalString(Str, Name);
- Value *zero = ConstantInt::get(Type::Int32Ty, 0);
+ Value *zero = ConstantInt::get(Type::getInt32Ty(Context), 0);
Value *Args[] = { zero, zero };
return CreateInBoundsGEP(gv, Args, Args+2, Name);
}
@@ -802,8 +802,8 @@ public:
assert(LHS->getType() == RHS->getType() &&
"Pointer subtraction operand types must match!");
const PointerType *ArgType = cast<PointerType>(LHS->getType());
- Value *LHS_int = CreatePtrToInt(LHS, Type::Int64Ty);
- Value *RHS_int = CreatePtrToInt(RHS, Type::Int64Ty);
+ Value *LHS_int = CreatePtrToInt(LHS, Type::getInt64Ty(Context));
+ Value *RHS_int = CreatePtrToInt(RHS, Type::getInt64Ty(Context));
Value *Difference = CreateSub(LHS_int, RHS_int);
return CreateExactSDiv(Difference,
ConstantExpr::getSizeOf(ArgType->getElementType()),
diff --git a/include/llvm/Support/TypeBuilder.h b/include/llvm/Support/TypeBuilder.h
index 1f85f1d..64af647 100644
--- a/include/llvm/Support/TypeBuilder.h
+++ b/include/llvm/Support/TypeBuilder.h
@@ -161,7 +161,7 @@ template<> class TypeBuilder<T, false> { \
public: \
static const IntegerType *get(LLVMContext &Context) { \
static const IntegerType *const result = \
- IntegerType::get(sizeof(T) * CHAR_BIT); \
+ IntegerType::get(Context, sizeof(T) * CHAR_BIT); \
return result; \
} \
}; \
@@ -190,53 +190,53 @@ DEFINE_INTEGRAL_TYPEBUILDER(unsigned long long);
template<uint32_t num_bits, bool cross>
class TypeBuilder<types::i<num_bits>, cross> {
public:
- static const IntegerType *get(LLVMContext &Context) {
- static const IntegerType *const result = IntegerType::get(num_bits);
+ static const IntegerType *get(LLVMContext &C) {
+ static const IntegerType *const result = IntegerType::get(C, num_bits);
return result;
}
};
template<> class TypeBuilder<float, false> {
public:
- static const Type *get(LLVMContext&) {
- return Type::FloatTy;
+ static const Type *get(LLVMContext& C) {
+ return Type::getFloatTy(C);
}
};
template<> class TypeBuilder<float, true> {};
template<> class TypeBuilder<double, false> {
public:
- static const Type *get(LLVMContext&) {
- return Type::DoubleTy;
+ static const Type *get(LLVMContext& C) {
+ return Type::getDoubleTy(C);
}
};
template<> class TypeBuilder<double, true> {};
template<bool cross> class TypeBuilder<types::ieee_float, cross> {
public:
- static const Type *get(LLVMContext&) { return Type::FloatTy; }
+ static const Type *get(LLVMContext& C) { return Type::getFloatTy(C); }
};
template<bool cross> class TypeBuilder<types::ieee_double, cross> {
public:
- static const Type *get(LLVMContext&) { return Type::DoubleTy; }
+ static const Type *get(LLVMContext& C) { return Type::getDoubleTy(C); }
};
template<bool cross> class TypeBuilder<types::x86_fp80, cross> {
public:
- static const Type *get(LLVMContext&) { return Type::X86_FP80Ty; }
+ static const Type *get(LLVMContext& C) { return Type::getX86_FP80Ty(C); }
};
template<bool cross> class TypeBuilder<types::fp128, cross> {
public:
- static const Type *get(LLVMContext&) { return Type::FP128Ty; }
+ static const Type *get(LLVMContext& C) { return Type::getFP128Ty(C); }
};
template<bool cross> class TypeBuilder<types::ppc_fp128, cross> {
public:
- static const Type *get(LLVMContext&) { return Type::PPC_FP128Ty; }
+ static const Type *get(LLVMContext& C) { return Type::getPPC_FP128Ty(C); }
};
template<bool cross> class TypeBuilder<void, cross> {
public:
- static const Type *get(LLVMContext&) {
- return Type::VoidTy;
+ static const Type *get(LLVMContext &C) {
+ return Type::getVoidTy(C);
}
};