diff options
author | Jay Foad <jay.foad@gmail.com> | 2011-07-11 09:56:20 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@gmail.com> | 2011-07-11 09:56:20 +0000 |
commit | 7c57be3e2b6f3001cdb1e78b921f9e7ccc84f32c (patch) | |
tree | 78c4de58c0ef5727e68c34792646f069b2fde448 /llvm/lib | |
parent | dd8fc04e9bf9b5288bb73bcd0d2a1e079b5a0750 (diff) | |
download | bcm5719-llvm-7c57be3e2b6f3001cdb1e78b921f9e7ccc84f32c.tar.gz bcm5719-llvm-7c57be3e2b6f3001cdb1e78b921f9e7ccc84f32c.zip |
De-constify Types in StructType::get() and TargetData::getIntPtrType().
llvm-svn: 134893
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/SjLjEHPrepare.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Target/ARM/ARMGlobalMerge.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Target/TargetData.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/CodeExtractor.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/VMCore/Core.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/VMCore/Type.cpp | 13 |
9 files changed, 14 insertions, 22 deletions
diff --git a/llvm/lib/CodeGen/SjLjEHPrepare.cpp b/llvm/lib/CodeGen/SjLjEHPrepare.cpp index c2565afe016..65a33da93af 100644 --- a/llvm/lib/CodeGen/SjLjEHPrepare.cpp +++ b/llvm/lib/CodeGen/SjLjEHPrepare.cpp @@ -87,9 +87,8 @@ FunctionPass *llvm::createSjLjEHPass(const TargetLowering *TLI) { bool SjLjEHPass::doInitialization(Module &M) { // Build the function context structure. // builtin_setjmp uses a five word jbuf - const Type *VoidPtrTy = - Type::getInt8PtrTy(M.getContext()); - const Type *Int32Ty = Type::getInt32Ty(M.getContext()); + Type *VoidPtrTy = Type::getInt8PtrTy(M.getContext()); + Type *Int32Ty = Type::getInt32Ty(M.getContext()); FunctionContextTy = StructType::get(VoidPtrTy, // __prev Int32Ty, // call_site diff --git a/llvm/lib/Target/ARM/ARMGlobalMerge.cpp b/llvm/lib/Target/ARM/ARMGlobalMerge.cpp index f8993792bc6..8d77b2d8383 100644 --- a/llvm/lib/Target/ARM/ARMGlobalMerge.cpp +++ b/llvm/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<const Type*> Tys; + std::vector<Type*> Tys; std::vector<Constant*> Inits; for (j = i; j != e; ++j) { - const Type *Ty = Globals[j]->getType()->getElementType(); + Type *Ty = Globals[j]->getType()->getElementType(); MergedSize += TD->getTypeAllocSize(Ty); if (MergedSize > MaxOffset) { break; diff --git a/llvm/lib/Target/TargetData.cpp b/llvm/lib/Target/TargetData.cpp index 6309a1572c5..b2c4b21f680 100644 --- a/llvm/lib/Target/TargetData.cpp +++ b/llvm/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. -const IntegerType *TargetData::getIntPtrType(LLVMContext &C) const { +IntegerType *TargetData::getIntPtrType(LLVMContext &C) const { return IntegerType::get(C, getPointerSizeInBits()); } diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp index 7eb5a487af8..bbb386c0125 100644 --- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -659,13 +659,13 @@ bool DAE::RemoveDeadStuffFromFunction(Function *F) { // Find out the new return value. - const Type *RetTy = FTy->getReturnType(); + 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<const Type*> RetTypes; + std::vector<Type*> RetTypes; if (RetTy->isVoidTy()) { NRetTy = RetTy; } else { diff --git a/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp b/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp index 4224ee303f0..327e423839f 100644 --- a/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp +++ b/llvm/lib/Transforms/Instrumentation/ProfilingUtils.cpp @@ -134,7 +134,7 @@ void llvm::IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum, void llvm::InsertProfilingShutdownCall(Function *Callee, Module *Mod) { // llvm.global_dtors is an array of type { i32, void ()* }. Prepare those // types. - const Type *GlobalDtorElems[2] = { + Type *GlobalDtorElems[2] = { Type::getInt32Ty(Mod->getContext()), FunctionType::get(Type::getVoidTy(Mod->getContext()), false)->getPointerTo() }; diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp index fa6641fae51..9a2e53fd518 100644 --- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp +++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp @@ -403,7 +403,7 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer, AllocaInst *Struct = 0; if (AggregateArgs && (inputs.size() + outputs.size() > 0)) { - std::vector<const Type*> ArgTypes; + std::vector<Type*> ArgTypes; for (Values::iterator v = StructValues.begin(), ve = StructValues.end(); v != ve; ++v) ArgTypes.push_back((*v)->getType()); diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index 57498b48592..1529c4ad481 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/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<const Type*, 16> EltTypes; + SmallVector<Type*, 16> EltTypes; for (unsigned i = 0, e = V.size(); i != e; ++i) EltTypes.push_back(V[i]->getType()); diff --git a/llvm/lib/VMCore/Core.cpp b/llvm/lib/VMCore/Core.cpp index 07caefa1ec4..15d27233f22 100644 --- a/llvm/lib/VMCore/Core.cpp +++ b/llvm/lib/VMCore/Core.cpp @@ -290,7 +290,7 @@ void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest) { LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed) { - std::vector<const Type*> Tys; + std::vector<Type*> Tys; for (LLVMTypeRef *I = ElementTypes, *E = ElementTypes + ElementCount; I != E; ++I) Tys.push_back(unwrap(*I)); diff --git a/llvm/lib/VMCore/Type.cpp b/llvm/lib/VMCore/Type.cpp index 40d232a619f..10467a8d900 100644 --- a/llvm/lib/VMCore/Type.cpp +++ b/llvm/lib/VMCore/Type.cpp @@ -458,22 +458,15 @@ 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<const Type*>(), isPacked); + return get(Context, llvm::ArrayRef<Type*>(), isPacked); } -StructType *StructType::get(const Type *type, ...) { +StructType *StructType::get(Type *type, ...) { assert(type != 0 && "Cannot create a struct type with no elements with this"); LLVMContext &Ctx = type->getContext(); va_list ap; - SmallVector<const llvm::Type*, 8> StructFields; + SmallVector<llvm::Type*, 8> StructFields; va_start(ap, type); while (type) { StructFields.push_back(type); |