aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-07-12 01:15:52 +0000
committerBill Wendling <isanbard@gmail.com>2011-07-12 01:15:52 +0000
commit2280ebd61416b73d0b6137f275b25af82e268d1f (patch)
treeae6d1452b9fdbd12da9816f0f79a7128ce0ee4cf /lib/VMCore
parent1852e217019507c6329ee3af227dc05c6e517878 (diff)
downloadexternal_llvm-2280ebd61416b73d0b6137f275b25af82e268d1f.zip
external_llvm-2280ebd61416b73d0b6137f275b25af82e268d1f.tar.gz
external_llvm-2280ebd61416b73d0b6137f275b25af82e268d1f.tar.bz2
Revert r134893 and r134888 (and related patches in other trees). It was causing
an assert on Darwin llvm-gcc builds. Assertion failed: (castIsValid(op, S, Ty) && "Invalid cast!"), function Create, file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.llvm-gcc-i386-darwin9-RA/llvm.src/lib/VMCore/Instructions.cpp, li\ ne 2067. etc. http://smooshlab.apple.com:8013/builders/llvm-gcc-i386-darwin9-RA/builds/2354 --- Reverse-merging r134893 into '.': U include/llvm/Target/TargetData.h U include/llvm/DerivedTypes.h U tools/bugpoint/ExtractFunction.cpp U unittests/Support/TypeBuilderTest.cpp U lib/Target/ARM/ARMGlobalMerge.cpp U lib/Target/TargetData.cpp U lib/VMCore/Constants.cpp U lib/VMCore/Type.cpp U lib/VMCore/Core.cpp U lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Instrumentation/ProfilingUtils.cpp U lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/CodeGen/SjLjEHPrepare.cpp --- Reverse-merging r134888 into '.': G include/llvm/DerivedTypes.h U include/llvm/Support/TypeBuilder.h U include/llvm/Intrinsics.h U unittests/Analysis/ScalarEvolutionTest.cpp U unittests/ExecutionEngine/JIT/JITTest.cpp U unittests/ExecutionEngine/JIT/JITMemoryManagerTest.cpp U unittests/VMCore/PassManagerTest.cpp G unittests/Support/TypeBuilderTest.cpp U lib/Target/MBlaze/MBlazeIntrinsicInfo.cpp U lib/Target/Blackfin/BlackfinIntrinsicInfo.cpp U lib/VMCore/IRBuilder.cpp G lib/VMCore/Type.cpp U lib/VMCore/Function.cpp G lib/VMCore/Core.cpp U lib/VMCore/Module.cpp U lib/AsmParser/LLParser.cpp U lib/Transforms/Utils/CloneFunction.cpp G lib/Transforms/Utils/CodeExtractor.cpp U lib/Transforms/Utils/InlineFunction.cpp U lib/Transforms/Instrumentation/GCOVProfiling.cpp U lib/Transforms/Scalar/ObjCARC.cpp U lib/Transforms/Scalar/SimplifyLibCalls.cpp U lib/Transforms/Scalar/MemCpyOptimizer.cpp G lib/Transforms/IPO/DeadArgumentElimination.cpp U lib/Transforms/IPO/ArgumentPromotion.cpp U lib/Transforms/InstCombine/InstCombineCompares.cpp U lib/Transforms/InstCombine/InstCombineAndOrXor.cpp U lib/Transforms/InstCombine/InstCombineCalls.cpp U lib/CodeGen/DwarfEHPrepare.cpp U lib/CodeGen/IntrinsicLowering.cpp U lib/Bitcode/Reader/BitcodeReader.cpp git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134949 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-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
6 files changed, 32 insertions, 18 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 1529c4a..57498b4 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -619,7 +619,7 @@ Constant *ConstantArray::get(LLVMContext &Context, StringRef Str,
StructType *ConstantStruct::getTypeForElements(LLVMContext &Context,
ArrayRef<Constant*> V,
bool Packed) {
- SmallVector<Type*, 16> EltTypes;
+ SmallVector<const Type*, 16> EltTypes;
for (unsigned i = 0, e = V.size(); i != e; ++i)
EltTypes.push_back(V[i]->getType());
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp
index 15d2723..d9ced94 100644
--- a/lib/VMCore/Core.cpp
+++ b/lib/VMCore/Core.cpp
@@ -260,7 +260,7 @@ LLVMTypeRef LLVMX86MMXType(void) {
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType,
LLVMTypeRef *ParamTypes, unsigned ParamCount,
LLVMBool IsVarArg) {
- std::vector<Type*> Tys;
+ std::vector<const Type*> Tys;
for (LLVMTypeRef *I = ParamTypes, *E = ParamTypes + ParamCount; I != E; ++I)
Tys.push_back(unwrap(*I));
@@ -290,7 +290,7 @@ void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest) {
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes,
unsigned ElementCount, LLVMBool Packed) {
- std::vector<Type*> Tys;
+ std::vector<const Type*> Tys;
for (LLVMTypeRef *I = ElementTypes,
*E = ElementTypes + ElementCount; I != E; ++I)
Tys.push_back(unwrap(*I));
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index bde6a6d..972319e 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -333,7 +333,7 @@ unsigned Function::getIntrinsicID() const {
return 0;
}
-std::string Intrinsic::getName(ID id, Type **Tys, unsigned numTys) {
+std::string Intrinsic::getName(ID id, const Type **Tys, unsigned numTys) {
assert(id < num_intrinsics && "Invalid intrinsic ID!");
static const char * const Table[] = {
"not_intrinsic",
@@ -356,10 +356,10 @@ std::string Intrinsic::getName(ID id, Type **Tys, unsigned numTys) {
}
const FunctionType *Intrinsic::getType(LLVMContext &Context,
- ID id, Type **Tys,
+ ID id, const Type **Tys,
unsigned numTys) {
const Type *ResultTy = NULL;
- std::vector<Type*> ArgTys;
+ std::vector<const Type*> ArgTys;
bool IsVarArg = false;
#define GET_INTRINSIC_GENERATOR
@@ -384,7 +384,7 @@ bool Intrinsic::isOverloaded(ID id) {
#include "llvm/Intrinsics.gen"
#undef GET_INTRINSIC_ATTRIBUTES
-Function *Intrinsic::getDeclaration(Module *M, ID id, Type **Tys,
+Function *Intrinsic::getDeclaration(Module *M, ID id, const Type **Tys,
unsigned numTys) {
// There can never be multiple globals with the same name of different types,
// because intrinsics must be a specific type.
diff --git a/lib/VMCore/IRBuilder.cpp b/lib/VMCore/IRBuilder.cpp
index 0908470..f2d469a 100644
--- a/lib/VMCore/IRBuilder.cpp
+++ b/lib/VMCore/IRBuilder.cpp
@@ -65,7 +65,7 @@ CreateMemSet(Value *Ptr, Value *Val, Value *Size, unsigned Align,
bool isVolatile, MDNode *TBAATag) {
Ptr = getCastedInt8PtrValue(Ptr);
Value *Ops[] = { Ptr, Val, Size, getInt32(Align), getInt1(isVolatile) };
- Type *Tys[] = { Ptr->getType(), Size->getType() };
+ const Type *Tys[] = { Ptr->getType(), Size->getType() };
Module *M = BB->getParent()->getParent();
Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memset, Tys, 2);
@@ -85,7 +85,7 @@ CreateMemCpy(Value *Dst, Value *Src, Value *Size, unsigned Align,
Src = getCastedInt8PtrValue(Src);
Value *Ops[] = { Dst, Src, Size, getInt32(Align), getInt1(isVolatile) };
- Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() };
+ const Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() };
Module *M = BB->getParent()->getParent();
Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memcpy, Tys, 3);
@@ -105,7 +105,7 @@ CreateMemMove(Value *Dst, Value *Src, Value *Size, unsigned Align,
Src = getCastedInt8PtrValue(Src);
Value *Ops[] = { Dst, Src, Size, getInt32(Align), getInt1(isVolatile) };
- Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() };
+ const Type *Tys[] = { Dst->getType(), Src->getType(), Size->getType() };
Module *M = BB->getParent()->getParent();
Value *TheFn = Intrinsic::getDeclaration(M, Intrinsic::memmove, Tys, 3);
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index 8a738cb..1ca7016 100644
--- a/lib/VMCore/Module.cpp
+++ b/lib/VMCore/Module.cpp
@@ -216,8 +216,8 @@ Constant *Module::getOrInsertFunction(StringRef Name,
va_start(Args, RetTy);
// Build the list of argument types...
- std::vector<Type*> ArgTys;
- while (Type *ArgTy = va_arg(Args, Type*))
+ std::vector<const Type*> ArgTys;
+ while (const Type *ArgTy = va_arg(Args, const Type*))
ArgTys.push_back(ArgTy);
va_end(Args);
@@ -234,8 +234,8 @@ Constant *Module::getOrInsertFunction(StringRef Name,
va_start(Args, RetTy);
// Build the list of argument types...
- std::vector<Type*> ArgTys;
- while (Type *ArgTy = va_arg(Args, Type*))
+ std::vector<const Type*> ArgTys;
+ while (const Type *ArgTy = va_arg(Args, const Type*))
ArgTys.push_back(ArgTy);
va_end(Args);
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index 10467a8..ac8b76f 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -325,6 +325,13 @@ FunctionType::FunctionType(const Type *Result, ArrayRef<Type*> Params,
NumContainedTys = Params.size() + 1; // + 1 for result type
}
+// FIXME: Remove this version.
+FunctionType *FunctionType::get(const Type *ReturnType,
+ ArrayRef<const Type*> Params, bool isVarArg) {
+ return get(ReturnType, ArrayRef<Type*>(const_cast<Type**>(Params.data()),
+ Params.size()), isVarArg);
+}
+
// FunctionType::get - The factory function for the FunctionType class.
FunctionType *FunctionType::get(const Type *ReturnType,
ArrayRef<Type*> Params, bool isVarArg) {
@@ -350,7 +357,7 @@ FunctionType *FunctionType::get(const Type *ReturnType,
FunctionType *FunctionType::get(const Type *Result, bool isVarArg) {
- return get(Result, ArrayRef<Type *>(), isVarArg);
+ return get(Result, ArrayRef<const Type *>(), isVarArg);
}
@@ -458,15 +465,22 @@ void StructType::setName(StringRef Name) {
//===----------------------------------------------------------------------===//
// StructType Helper functions.
+// FIXME: Remove this version.
+StructType *StructType::get(LLVMContext &Context, ArrayRef<const Type*>Elements,
+ bool isPacked) {
+ return get(Context, ArrayRef<Type*>(const_cast<Type**>(Elements.data()),
+ Elements.size()), isPacked);
+}
+
StructType *StructType::get(LLVMContext &Context, bool isPacked) {
- return get(Context, llvm::ArrayRef<Type*>(), isPacked);
+ return get(Context, llvm::ArrayRef<const Type*>(), isPacked);
}
-StructType *StructType::get(Type *type, ...) {
+StructType *StructType::get(const Type *type, ...) {
assert(type != 0 && "Cannot create a struct type with no elements with this");
LLVMContext &Ctx = type->getContext();
va_list ap;
- SmallVector<llvm::Type*, 8> StructFields;
+ SmallVector<const llvm::Type*, 8> StructFields;
va_start(ap, type);
while (type) {
StructFields.push_back(type);