aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/DerivedTypes.h9
-rw-r--r--include/llvm/Intrinsics.h6
-rw-r--r--include/llvm/Support/TypeBuilder.h74
-rw-r--r--include/llvm/Target/TargetData.h2
-rw-r--r--lib/AsmParser/LLParser.cpp8
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp4
-rw-r--r--lib/CodeGen/DwarfEHPrepare.cpp4
-rw-r--r--lib/CodeGen/IntrinsicLowering.cpp8
-rw-r--r--lib/CodeGen/SjLjEHPrepare.cpp5
-rw-r--r--lib/Target/ARM/ARMGlobalMerge.cpp4
-rw-r--r--lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp2
-rw-r--r--lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp2
-rw-r--r--lib/Target/TargetData.cpp2
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp2
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp8
-rw-r--r--lib/Transforms/InstCombine/InstCombineAndOrXor.cpp4
-rw-r--r--lib/Transforms/InstCombine/InstCombineCalls.cpp10
-rw-r--r--lib/Transforms/InstCombine/InstCombineCompares.cpp4
-rw-r--r--lib/Transforms/Instrumentation/GCOVProfiling.cpp9
-rw-r--r--lib/Transforms/Instrumentation/ProfilingUtils.cpp2
-rw-r--r--lib/Transforms/Scalar/MemCpyOptimizer.cpp6
-rw-r--r--lib/Transforms/Scalar/ObjCARC.cpp28
-rw-r--r--lib/Transforms/Scalar/SimplifyLibCalls.cpp2
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp2
-rw-r--r--lib/Transforms/Utils/CodeExtractor.cpp6
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp4
-rw-r--r--lib/VMCore/Constants.cpp2
-rw-r--r--lib/VMCore/Core.cpp4
-rw-r--r--lib/VMCore/Function.cpp8
-rw-r--r--lib/VMCore/IRBuilder.cpp6
-rw-r--r--lib/VMCore/Module.cpp8
-rw-r--r--lib/VMCore/Type.cpp22
-rw-r--r--tools/bugpoint/ExtractFunction.cpp2
-rw-r--r--unittests/Analysis/ScalarEvolutionTest.cpp2
-rw-r--r--unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp2
-rw-r--r--unittests/ExecutionEngine/JIT/JITTest.cpp4
-rw-r--r--unittests/Support/TypeBuilderTest.cpp6
-rw-r--r--unittests/VMCore/PassManagerTest.cpp4
38 files changed, 156 insertions, 131 deletions
diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h
index 0f1e99f134..0fc2c3a0c3 100644
--- a/include/llvm/DerivedTypes.h
+++ b/include/llvm/DerivedTypes.h
@@ -103,6 +103,8 @@ public:
/// a FunctionType.
///
static FunctionType *get(const Type *Result,
+ ArrayRef<const Type*> Params, bool isVarArg);
+ static FunctionType *get(const Type *Result,
ArrayRef<Type*> Params, bool isVarArg);
/// FunctionType::get - Create a FunctionType taking no parameters.
@@ -204,6 +206,11 @@ public:
/// StructType::get - This static method is the primary way to create a
/// StructType.
+ ///
+ /// FIXME: Remove the 'const Type*' version of this when types are pervasively
+ /// de-constified.
+ static StructType *get(LLVMContext &Context, ArrayRef<const Type*> Elements,
+ bool isPacked = false);
static StructType *get(LLVMContext &Context, ArrayRef<Type*> Elements,
bool isPacked = false);
@@ -215,7 +222,7 @@ public:
/// structure types by specifying the elements as arguments. Note that this
/// method always returns a non-packed struct, and requires at least one
/// element type.
- static StructType *get(Type *elt1, ...) END_WITH_NULL;
+ static StructType *get(const Type *elt1, ...) END_WITH_NULL;
bool isPacked() const { return (getSubclassData() & SCDB_Packed) != 0; }
diff --git a/include/llvm/Intrinsics.h b/include/llvm/Intrinsics.h
index 4885e28611..5cfe55181f 100644
--- a/include/llvm/Intrinsics.h
+++ b/include/llvm/Intrinsics.h
@@ -44,12 +44,12 @@ namespace Intrinsic {
/// Intrinsic::getName(ID) - Return the LLVM name for an intrinsic, such as
/// "llvm.ppc.altivec.lvx".
- std::string getName(ID id, Type **Tys = 0, unsigned numTys = 0);
+ std::string getName(ID id, const Type **Tys = 0, unsigned numTys = 0);
/// Intrinsic::getType(ID) - Return the function type for an intrinsic.
///
const FunctionType *getType(LLVMContext &Context, ID id,
- Type **Tys = 0, unsigned numTys = 0);
+ const Type **Tys = 0, unsigned numTys = 0);
/// Intrinsic::isOverloaded(ID) - Returns true if the intrinsic can be
/// overloaded.
@@ -67,7 +67,7 @@ namespace Intrinsic {
/// overloaded intrinsic, Tys should point to an array of numTys pointers to
/// Type, and must provide exactly one type for each overloaded type in the
/// intrinsic.
- Function *getDeclaration(Module *M, ID id, Type **Tys = 0,
+ Function *getDeclaration(Module *M, ID id, const Type **Tys = 0,
unsigned numTys = 0);
/// Map a GCC builtin name to an intrinsic ID.
diff --git a/include/llvm/Support/TypeBuilder.h b/include/llvm/Support/TypeBuilder.h
index 1800778973..dbe7cfdf6e 100644
--- a/include/llvm/Support/TypeBuilder.h
+++ b/include/llvm/Support/TypeBuilder.h
@@ -51,7 +51,7 @@ namespace llvm {
/// namespace llvm {
/// template<bool xcompile> class TypeBuilder<MyType, xcompile> {
/// public:
-/// static StructType *get(LLVMContext &Context) {
+/// static const StructType *get(LLVMContext &Context) {
/// // If you cache this result, be sure to cache it separately
/// // for each LLVMContext.
/// return StructType::get(
@@ -104,7 +104,7 @@ template<typename T, bool cross> class TypeBuilder<const volatile T, cross>
// Pointers
template<typename T, bool cross> class TypeBuilder<T*, cross> {
public:
- static PointerType *get(LLVMContext &Context) {
+ static const PointerType *get(LLVMContext &Context) {
return PointerType::getUnqual(TypeBuilder<T,cross>::get(Context));
}
};
@@ -115,14 +115,14 @@ template<typename T, bool cross> class TypeBuilder<T&, cross> {};
// Arrays
template<typename T, size_t N, bool cross> class TypeBuilder<T[N], cross> {
public:
- static ArrayType *get(LLVMContext &Context) {
+ static const ArrayType *get(LLVMContext &Context) {
return ArrayType::get(TypeBuilder<T, cross>::get(Context), N);
}
};
/// LLVM uses an array of length 0 to represent an unknown-length array.
template<typename T, bool cross> class TypeBuilder<T[], cross> {
public:
- static ArrayType *get(LLVMContext &Context) {
+ static const ArrayType *get(LLVMContext &Context) {
return ArrayType::get(TypeBuilder<T, cross>::get(Context), 0);
}
};
@@ -152,7 +152,7 @@ public:
#define DEFINE_INTEGRAL_TYPEBUILDER(T) \
template<> class TypeBuilder<T, false> { \
public: \
- static IntegerType *get(LLVMContext &Context) { \
+ static const IntegerType *get(LLVMContext &Context) { \
return IntegerType::get(Context, sizeof(T) * CHAR_BIT); \
} \
}; \
@@ -181,14 +181,14 @@ DEFINE_INTEGRAL_TYPEBUILDER(unsigned long long);
template<uint32_t num_bits, bool cross>
class TypeBuilder<types::i<num_bits>, cross> {
public:
- static IntegerType *get(LLVMContext &C) {
+ static const IntegerType *get(LLVMContext &C) {
return IntegerType::get(C, num_bits);
}
};
template<> class TypeBuilder<float, false> {
public:
- static Type *get(LLVMContext& C) {
+ static const Type *get(LLVMContext& C) {
return Type::getFloatTy(C);
}
};
@@ -196,7 +196,7 @@ template<> class TypeBuilder<float, true> {};
template<> class TypeBuilder<double, false> {
public:
- static Type *get(LLVMContext& C) {
+ static const Type *get(LLVMContext& C) {
return Type::getDoubleTy(C);
}
};
@@ -204,32 +204,32 @@ template<> class TypeBuilder<double, true> {};
template<bool cross> class TypeBuilder<types::ieee_float, cross> {
public:
- static Type *get(LLVMContext& C) { return Type::getFloatTy(C); }
+ static const Type *get(LLVMContext& C) { return Type::getFloatTy(C); }
};
template<bool cross> class TypeBuilder<types::ieee_double, cross> {
public:
- static Type *get(LLVMContext& C) { return Type::getDoubleTy(C); }
+ static const Type *get(LLVMContext& C) { return Type::getDoubleTy(C); }
};
template<bool cross> class TypeBuilder<types::x86_fp80, cross> {
public:
- static Type *get(LLVMContext& C) { return Type::getX86_FP80Ty(C); }
+ static const Type *get(LLVMContext& C) { return Type::getX86_FP80Ty(C); }
};
template<bool cross> class TypeBuilder<types::fp128, cross> {
public:
- static Type *get(LLVMContext& C) { return Type::getFP128Ty(C); }
+ static const Type *get(LLVMContext& C) { return Type::getFP128Ty(C); }
};
template<bool cross> class TypeBuilder<types::ppc_fp128, cross> {
public:
- static Type *get(LLVMContext& C) { return Type::getPPC_FP128Ty(C); }
+ static const Type *get(LLVMContext& C) { return Type::getPPC_FP128Ty(C); }
};
template<bool cross> class TypeBuilder<types::x86_mmx, cross> {
public:
- static Type *get(LLVMContext& C) { return Type::getX86_MMXTy(C); }
+ static const Type *get(LLVMContext& C) { return Type::getX86_MMXTy(C); }
};
template<bool cross> class TypeBuilder<void, cross> {
public:
- static Type *get(LLVMContext &C) {
+ static const Type *get(LLVMContext &C) {
return Type::getVoidTy(C);
}
};
@@ -247,14 +247,14 @@ template<> class TypeBuilder<const volatile void*, false>
template<typename R, bool cross> class TypeBuilder<R(), cross> {
public:
- static FunctionType *get(LLVMContext &Context) {
+ static const FunctionType *get(LLVMContext &Context) {
return FunctionType::get(TypeBuilder<R, cross>::get(Context), false);
}
};
template<typename R, typename A1, bool cross> class TypeBuilder<R(A1), cross> {
public:
- static FunctionType *get(LLVMContext &Context) {
- std::vector<Type*> params;
+ static const FunctionType *get(LLVMContext &Context) {
+ std::vector<const Type*> params;
params.reserve(1);
params.push_back(TypeBuilder<A1, cross>::get(Context));
return FunctionType::get(TypeBuilder<R, cross>::get(Context),
@@ -264,8 +264,8 @@ public:
template<typename R, typename A1, typename A2, bool cross>
class TypeBuilder<R(A1, A2), cross> {
public:
- static FunctionType *get(LLVMContext &Context) {
- std::vector<Type*> params;
+ static const FunctionType *get(LLVMContext &Context) {
+ std::vector<const Type*> params;
params.reserve(2);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -276,8 +276,8 @@ public:
template<typename R, typename A1, typename A2, typename A3, bool cross>
class TypeBuilder<R(A1, A2, A3), cross> {
public:
- static FunctionType *get(LLVMContext &Context) {
- std::vector<Type*> params;
+ static const FunctionType *get(LLVMContext &Context) {
+ std::vector<const Type*> params;
params.reserve(3);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -291,8 +291,8 @@ template<typename R, typename A1, typename A2, typename A3, typename A4,
bool cross>
class TypeBuilder<R(A1, A2, A3, A4), cross> {
public:
- static FunctionType *get(LLVMContext &Context) {
- std::vector<Type*> params;
+ static const FunctionType *get(LLVMContext &Context) {
+ std::vector<const Type*> params;
params.reserve(4);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -307,8 +307,8 @@ template<typename R, typename A1, typename A2, typename A3, typename A4,
typename A5, bool cross>
class TypeBuilder<R(A1, A2, A3, A4, A5), cross> {
public:
- static FunctionType *get(LLVMContext &Context) {
- std::vector<Type*> params;
+ static const FunctionType *get(LLVMContext &Context) {
+ std::vector<const Type*> params;
params.reserve(5);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -322,15 +322,15 @@ public:
template<typename R, bool cross> class TypeBuilder<R(...), cross> {
public:
- static FunctionType *get(LLVMContext &Context) {
+ static const FunctionType *get(LLVMContext &Context) {
return FunctionType::get(TypeBuilder<R, cross>::get(Context), true);
}
};
template<typename R, typename A1, bool cross>
class TypeBuilder<R(A1, ...), cross> {
public:
- static FunctionType *get(LLVMContext &Context) {
- std::vector<Type*> params;
+ static const FunctionType *get(LLVMContext &Context) {
+ std::vector<const Type*> params;
params.reserve(1);
params.push_back(TypeBuilder<A1, cross>::get(Context));
return FunctionType::get(TypeBuilder<R, cross>::get(Context), params, true);
@@ -339,8 +339,8 @@ public:
template<typename R, typename A1, typename A2, bool cross>
class TypeBuilder<R(A1, A2, ...), cross> {
public:
- static FunctionType *get(LLVMContext &Context) {
- std::vector<Type*> params;
+ static const FunctionType *get(LLVMContext &Context) {
+ std::vector<const Type*> params;
params.reserve(2);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -351,8 +351,8 @@ public:
template<typename R, typename A1, typename A2, typename A3, bool cross>
class TypeBuilder<R(A1, A2, A3, ...), cross> {
public:
- static FunctionType *get(LLVMContext &Context) {
- std::vector<Type*> params;
+ static const FunctionType *get(LLVMContext &Context) {
+ std::vector<const Type*> params;
params.reserve(3);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -366,8 +366,8 @@ template<typename R, typename A1, typename A2, typename A3, typename A4,
bool cross>
class TypeBuilder<R(A1, A2, A3, A4, ...), cross> {
public:
- static FunctionType *get(LLVMContext &Context) {
- std::vector<Type*> params;
+ static const FunctionType *get(LLVMContext &Context) {
+ std::vector<const Type*> params;
params.reserve(4);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
@@ -382,8 +382,8 @@ template<typename R, typename A1, typename A2, typename A3, typename A4,
typename A5, bool cross>
class TypeBuilder<R(A1, A2, A3, A4, A5, ...), cross> {
public:
- static FunctionType *get(LLVMContext &Context) {
- std::vector<Type*> params;
+ static const FunctionType *get(LLVMContext &Context) {
+ std::vector<const Type*> params;
params.reserve(5);
params.push_back(TypeBuilder<A1, cross>::get(Context));
params.push_back(TypeBuilder<A2, cross>::get(Context));
diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h
index 10252865c9..32e3e2b0b6 100644
--- a/include/llvm/Target/TargetData.h
+++ b/include/llvm/Target/TargetData.h
@@ -259,7 +259,7 @@ public:
/// getIntPtrType - Return an unsigned integer type that is the same size or
/// greater to the host pointer size.
///
- IntegerType *getIntPtrType(LLVMContext &C) const;
+ const IntegerType *getIntPtrType(LLVMContext &C) const;
/// getIndexedOffset - return the offset from the beginning of the type for
/// the specified indices. This is used to implement getelementptr.
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index 4b066fef72..881b3e943b 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -1442,7 +1442,7 @@ bool LLParser::ParseFunctionType(Type *&Result) {
"argument attributes invalid in function type");
}
- SmallVector<Type*, 16> ArgListTy;
+ SmallVector<const Type*, 16> ArgListTy;
for (unsigned i = 0, e = ArgList.size(); i != e; ++i)
ArgListTy.push_back(ArgList[i].Ty);
@@ -2655,7 +2655,7 @@ bool LLParser::ParseFunctionHeader(Function *&Fn, bool isDefine) {
// Okay, if we got here, the function is syntactically valid. Convert types
// and do semantic checks.
- std::vector<Type*> ParamTypeList;
+ std::vector<const Type*> ParamTypeList;
SmallVector<AttributeWithIndex, 8> Attrs;
if (RetAttrs != Attribute::None)
@@ -3171,7 +3171,7 @@ bool LLParser::ParseInvoke(Instruction *&Inst, PerFunctionState &PFS) {
if (!(PFTy = dyn_cast<PointerType>(RetType)) ||
!(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
// Pull out the types of all of the arguments...
- std::vector<Type*> ParamTypes;
+ std::vector<const Type*> ParamTypes;
for (unsigned i = 0, e = ArgList.size(); i != e; ++i)
ParamTypes.push_back(ArgList[i].V->getType());
@@ -3508,7 +3508,7 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
if (!(PFTy = dyn_cast<PointerType>(RetType)) ||
!(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
// Pull out the types of all of the arguments...
- std::vector<Type*> ParamTypes;
+ std::vector<const Type*> ParamTypes;
for (unsigned i = 0, e = ArgList.size(); i != e; ++i)
ParamTypes.push_back(ArgList[i].V->getType());
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index 0a5ba45fc1..1bdcfe98d4 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -582,7 +582,7 @@ bool BitcodeReader::ParseTypeTableBody() {
// FUNCTION: [vararg, attrid, retty, paramty x N]
if (Record.size() < 3)
return Error("Invalid FUNCTION type record");
- std::vector<Type*> ArgTys;
+ std::vector<const Type*> ArgTys;
for (unsigned i = 3, e = Record.size(); i != e; ++i) {
if (Type *T = getTypeByID(Record[i]))
ArgTys.push_back(T);
@@ -838,7 +838,7 @@ RestartScan:
// FUNCTION: [vararg, attrid, retty, paramty x N]
if (Record.size() < 3)
return Error("Invalid FUNCTION type record");
- std::vector<Type*> ArgTys;
+ std::vector<const Type*> ArgTys;
for (unsigned i = 3, e = Record.size(); i != e; ++i) {
if (Type *Elt = getTypeByIDOrNull(Record[i]))
ArgTys.push_back(Elt);
diff --git a/lib/CodeGen/DwarfEHPrepare.cpp b/lib/CodeGen/DwarfEHPrepare.cpp
index 46a8884298..22c5465bf9 100644
--- a/lib/CodeGen/DwarfEHPrepare.cpp
+++ b/lib/CodeGen/DwarfEHPrepare.cpp
@@ -497,8 +497,10 @@ bool DwarfEHPrepare::LowerUnwindsAndResumes() {
// Find the rewind function if we didn't already.
if (!RewindFunction) {
LLVMContext &Ctx = ResumeInsts[0]->getContext();
+ std::vector<const Type*>
+ Params(1, Type::getInt8PtrTy(Ctx));
FunctionType *FTy = FunctionType::get(Type::getVoidTy(Ctx),
- Type::getInt8PtrTy(Ctx), false);
+ Params, false);
const char *RewindName = TLI->getLibcallName(RTLIB::UNWIND_RESUME);
RewindFunction = F->getParent()->getOrInsertFunction(RewindName, FTy);
}
diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp
index a1166d026a..b0a823042d 100644
--- a/lib/CodeGen/IntrinsicLowering.cpp
+++ b/lib/CodeGen/IntrinsicLowering.cpp
@@ -29,7 +29,7 @@ static void EnsureFunctionExists(Module &M, const char *Name,
ArgIt ArgBegin, ArgIt ArgEnd,
const Type *RetTy) {
// Insert a correctly-typed definition now.
- std::vector<Type *> ParamTys;
+ std::vector<const Type *> ParamTys;
for (ArgIt I = ArgBegin; I != ArgEnd; ++I)
ParamTys.push_back(I->getType());
M.getOrInsertFunction(Name, FunctionType::get(RetTy, ParamTys, false));
@@ -69,7 +69,7 @@ static CallInst *ReplaceCallWith(const char *NewFn, CallInst *CI,
// program already contains a function with this name.
Module *M = CI->getParent()->getParent()->getParent();
// Get or insert the definition now.
- std::vector<Type *> ParamTys;
+ std::vector<const Type *> ParamTys;
for (ArgIt I = ArgBegin; I != ArgEnd; ++I)
ParamTys.push_back((*I)->getType());
Constant* FCache = M->getOrInsertFunction(NewFn,
@@ -553,12 +553,12 @@ bool IntrinsicLowering::LowerToByteSwap(CallInst *CI) {
!CI->getType()->isIntegerTy())
return false;
- IntegerType *Ty = dyn_cast<IntegerType>(CI->getType());
+ const IntegerType *Ty = dyn_cast<IntegerType>(CI->getType());
if (!Ty)
return false;
// Okay, we can do this xform, do so now.
- Type *Tys[] = { Ty };
+ const Type *Tys[] = { Ty };
Module *M = CI->getParent()->getParent()->getParent();
Constant *Int = Intrinsic::getDeclaration(M, Intrinsic::bswap, Tys, 1);
diff --git a/lib/CodeGen/SjLjEHPrepare.cpp b/lib/CodeGen/SjLjEHPrepare.cpp
index 65a33da93a..c2565afe01 100644
--- a/lib/CodeGen/SjLjEHPrepare.cpp
+++ b/lib/CodeGen/SjLjEHPrepare.cpp
@@ -87,8 +87,9 @@ FunctionPass *llvm::createSjLjEHPass(const TargetLowering *TLI) {
bool SjLjEHPass::doInitialization(Module &M) {
// Build the function context structure.
// builtin_setjmp uses a five word jbuf
- Type *VoidPtrTy = Type::getInt8PtrTy(M.getContext());
- Type *Int32Ty = Type::getInt32Ty(M.getContext());
+ const Type *VoidPtrTy =
+ Type::getInt8PtrTy(M.getContext());
+ const Type *Int32Ty = Type::getInt32Ty(M.getContext());
FunctionContextTy =
StructType::get(VoidPtrTy, // __prev
Int32Ty, // call_site
diff --git a/lib/Target/ARM/ARMGlobalMerge.cpp b/lib/Target/ARM/ARMGlobalMerge.cpp
index 8d77b2d838..f8993792bc 100644
--- a/lib/Target/ARM/ARMGlobalMerge.cpp
+++ b/lib/Target/ARM/ARMGlobalMerge.cpp
@@ -128,10 +128,10 @@ bool ARMGlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
for (size_t i = 0, e = Globals.size(); i != e; ) {
size_t j = 0;
uint64_t MergedSize = 0;
- std::vector<Type*> Tys;
+ std::vector<const Type*> Tys;
std::vector<Constant*> Inits;
for (j = i; j != e; ++j) {
- Type *Ty = Globals[j]->getType()->getElementType();
+ const Type *Ty = Globals[j]->getType()->getElementType();
MergedSize += TD->getTypeAllocSize(Ty);
if (MergedSize > MaxOffset) {
break;
diff --git a/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp b/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
index ae8ee9e2a1..34a8d3809e 100644
--- a/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
+++ b/lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp
@@ -83,7 +83,7 @@ bool BlackfinIntrinsicInfo::isOverloaded(unsigned IntrID) const {
static const FunctionType *getType(LLVMContext &Context, unsigned id) {
const Type *ResultTy = NULL;
- std::vector<Type*> ArgTys;
+ std::vector<const Type*> ArgTys;
bool IsVarArg = false;
#define GET_INTRINSIC_GENERATOR
diff --git a/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp b/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
index 32d67b264a..7e4a2f5c94 100644
--- a/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
+++ b/lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp
@@ -92,7 +92,7 @@ bool MBlazeIntrinsicInfo::isOverloaded(unsigned IntrID) const {
static const FunctionType *getType(LLVMContext &Context, unsigned id) {
const Type *ResultTy = NULL;
- std::vector<Type*> ArgTys;
+ std::vector<const Type*> ArgTys;
bool IsVarArg = false;
#define GET_INTRINSIC_GENERATOR
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp
index b2c4b21f68..6309a1572c 100644
--- a/lib/Target/TargetData.cpp
+++ b/lib/Target/TargetData.cpp
@@ -535,7 +535,7 @@ unsigned TargetData::getPreferredTypeAlignmentShift(const Type *Ty) const {
/// getIntPtrType - Return an unsigned integer type that is the same size or
/// greater to the host pointer size.
-IntegerType *TargetData::getIntPtrType(LLVMContext &C) const {
+const IntegerType *TargetData::getIntPtrType(LLVMContext &C) const {
return IntegerType::get(C, getPointerSizeInBits());
}
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index 3288ee57c3..54a7f679e0 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -493,7 +493,7 @@ CallGraphNode *ArgPromotion::DoPromotion(Function *F,
// Start by computing a new prototype for the function, which is the same as
// the old function, but has modified arguments.
const FunctionType *FTy = F->getFunctionType();
- std::vector<Type*> Params;
+ std::vector<const Type*> Params;
typedef std::set<IndicesVector> ScalarizeTable;
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index bbb386c012..d4eaf0c4a3 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -208,7 +208,7 @@ bool DAE::DeleteDeadVarargs(Function &Fn) {
// the old function, but doesn't have isVarArg set.
const FunctionType *FTy = Fn.getFunctionType();
- std::vector<Type*> Params(FTy->param_begin(), FTy->param_end());
+ std::vector<const Type*> Params(FTy->param_begin(), FTy->param_end());
FunctionType *NFTy = FunctionType::get(FTy->getReturnType(),
Params, false);
unsigned NumArgs = Params.size();
@@ -647,7 +647,7 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
// Start by computing a new prototype for the function, which is the same as
// the old function, but has fewer arguments and a different return type.
const FunctionType *FTy = F->getFunctionType();
- std::vector<Type*> Params;
+ std::vector<const Type*> Params;
// Set up to build a new list of parameter attributes.
SmallVector<AttributeWithIndex, 8> AttributesVec;
@@ -659,13 +659,13 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) {
// Find out the new return value.
- Type *RetTy = FTy->getReturnType();
+ const Type *RetTy = FTy->getReturnType();
const Type *NRetTy = NULL;
unsigned RetCount = NumRetVals(F);
// -1 means unused, other numbers are the new index
SmallVector<int, 5> NewRetIdxs(RetCount, -1);
- std::vector<Type*> RetTypes;
+ std::vector<const Type*> RetTypes;
if (RetTy->isVoidTy()) {
NRetTy = RetTy;
} else {
diff --git a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index 1dfbd3e548..a08446e5d5 100644
--- a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -1400,7 +1400,7 @@ static bool CollectBSwapParts(Value *V, int OverallLeftShift, uint32_t ByteMask,
/// MatchBSwap - Given an OR instruction, check to see if this is a bswap idiom.
/// If so, insert the new bswap intrinsic and return it.
Instruction *InstCombiner::MatchBSwap(BinaryOperator &I) {
- IntegerType *ITy = dyn_cast<IntegerType>(I.getType());
+ const IntegerType *ITy = dyn_cast<IntegerType>(I.getType());
if (!ITy || ITy->getBitWidth() % 16 ||
// ByteMask only allows up to 32-byte values.
ITy->getBitWidth() > 32*8)
@@ -1424,7 +1424,7 @@ Instruction *InstCombiner::MatchBSwap(BinaryOperator &I) {
for (unsigned i = 1, e = ByteValues.size(); i != e; ++i)
if (ByteValues[i] != V)
return 0;
- Type *Tys[] = { ITy };
+ const Type *Tys[] = { ITy };
Module *M = I.getParent()->getParent()->getParent();
Function *F = Intrinsic::getDeclaration(M, Intrinsic::bswap, Tys, 1);
return CallInst::Create(F, V);
diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp
index b4843658f5..27e15c3058 100644
--- a/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp