diff options
author | Micah Villmow <villmow@gmail.com> | 2012-10-24 17:25:11 +0000 |
---|---|---|
committer | Micah Villmow <villmow@gmail.com> | 2012-10-24 17:25:11 +0000 |
commit | b8bce928f4ffdf50eff69334f3e25b27848536b6 (patch) | |
tree | e334a8f1cd0126aafd8ae6cc2ca13ed654620193 | |
parent | 0873bea3ed2d740208131f7f1706b0628c0aae09 (diff) |
Back out r166591, not sure why this made it through since I cancelled the command. Bleh, sorry about this!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166596 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | examples/ExceptionDemo/ExceptionDemo.cpp | 2 | ||||
-rw-r--r-- | include/llvm/Type.h | 12 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 2 | ||||
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Instrumentation/GCOVProfiling.cpp | 7 | ||||
-rw-r--r-- | lib/Transforms/Instrumentation/ProfilingUtils.cpp | 3 | ||||
-rw-r--r-- | lib/Transforms/Instrumentation/ThreadSanitizer.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/Scalar/SROA.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/Vectorize/LoopVectorize.cpp | 4 | ||||
-rw-r--r-- | lib/VMCore/Constants.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/Type.cpp | 22 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 3 |
12 files changed, 18 insertions, 49 deletions
diff --git a/examples/ExceptionDemo/ExceptionDemo.cpp b/examples/ExceptionDemo/ExceptionDemo.cpp index 89471473cb..215cb4d371 100644 --- a/examples/ExceptionDemo/ExceptionDemo.cpp +++ b/examples/ExceptionDemo/ExceptionDemo.cpp @@ -1268,7 +1268,7 @@ llvm::Function *createCatchWrappedInvokeFunction(llvm::Module &module, llvm::Value *unwindExceptionClass = builder.CreateLoad(builder.CreateStructGEP( builder.CreatePointerCast(unwindException, - ourUnwindExceptionType->getPointerTo(0)), + ourUnwindExceptionType->getPointerTo()), 0)); // Branch to the externalExceptionBlock if the exception is foreign or diff --git a/include/llvm/Type.h b/include/llvm/Type.h index 2c1313afbe..5a867045af 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -389,16 +389,10 @@ public: static PointerType *getInt32PtrTy(LLVMContext &C, unsigned AS = 0); static PointerType *getInt64PtrTy(LLVMContext &C, unsigned AS = 0); - /// getPointerTo - Return a pointer to the current type for the given address space. - /// This is equivalent to PointerType::get(Foo, AddrSpace). - PointerType *getPointerTo(unsigned AddrSpace); + /// getPointerTo - Return a pointer to the current type. This is equivalent + /// to PointerType::get(Foo, AddrSpace). + PointerType *getPointerTo(unsigned AddrSpace = 0); - /// getPointerTo - Return a pointer to the current type for the address space - /// space of the passed in type. - PointerType *getPointerTo(const Type *Ty); - - /// getPointerTo - Retrun a pointer to the current type. - PointerType *getPointerTo(); private: /// isSizedDerivedType - Derived types like structures and arrays are sized /// iff all of the members of the type are sized as well. Since asking for diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index dd8edc2836..abf40b77a1 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -2068,7 +2068,7 @@ SelectionDAGLegalize::ExpandDivRemLibCall(SDNode *Node, // Also pass the return address of the remainder. SDValue FIPtr = DAG.CreateStackTemporary(RetVT); Entry.Node = FIPtr; - Entry.Ty = RetTy->getPointerTo(0); + Entry.Ty = RetTy->getPointerTo(); Entry.isSExt = isSigned; Entry.isZExt = !isSigned; Args.push_back(Entry); diff --git a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp index 7285e88cab..a370faeb23 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp @@ -2320,7 +2320,7 @@ void DAGTypeLegalizer::ExpandIntRes_XMULO(SDNode *N, // Also pass the address of the overflow check. Entry.Node = Temp; - Entry.Ty = PtrTy->getPointerTo(0); + Entry.Ty = PtrTy->getPointerTo(); Entry.isSExt = true; Entry.isZExt = false; Args.push_back(Entry); diff --git a/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 3998c8bb22..e9192e5cdd 100644 --- a/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -586,8 +586,8 @@ Constant *GCOVProfiler::getIncrementIndirectCounterFunc() { Type *Int32Ty = Type::getInt32Ty(*Ctx); Type *Int64Ty = Type::getInt64Ty(*Ctx); Type *Args[] = { - Int32Ty->getPointerTo(Int32Ty), // uint32_t *predecessor - Int64Ty->getPointerTo(Int64Ty)->getPointerTo(Int64Ty) // uint64_t **counters + Int32Ty->getPointerTo(), // uint32_t *predecessor + Int64Ty->getPointerTo()->getPointerTo() // uint64_t **counters }; FunctionType *FTy = FunctionType::get(Type::getVoidTy(*Ctx), Args, false); return M->getOrInsertFunction("__llvm_gcov_indirect_counter_increment", FTy); @@ -733,8 +733,7 @@ void GCOVProfiler::insertIndirectCounterIncrement() { Value *GEP = Builder.CreateGEP(Arg, ZExtPred); Value *Counter = Builder.CreateLoad(GEP, "counter"); Cond = Builder.CreateICmpEQ(Counter, - Constant::getNullValue( - Int64Ty->getPointerTo(Counter->getType()))); + Constant::getNullValue(Int64Ty->getPointerTo())); Builder.CreateCondBr(Cond, Exit, CounterEnd); // ++*counter; diff --git a/lib/Transforms/Instrumentation/ProfilingUtils.cpp b/lib/Transforms/Instrumentation/ProfilingUtils.cpp index 40aa2274a4..de57cd1734 100644 --- a/lib/Transforms/Instrumentation/ProfilingUtils.cpp +++ b/lib/Transforms/Instrumentation/ProfilingUtils.cpp @@ -134,8 +134,7 @@ void llvm::InsertProfilingShutdownCall(Function *Callee, Module *Mod) { // types. Type *GlobalDtorElems[2] = { Type::getInt32Ty(Mod->getContext()), - FunctionType::get(Type::getVoidTy(Mod->getContext()), false) - ->getPointerTo() + FunctionType::get(Type::getVoidTy(Mod->getContext()), false)->getPointerTo() }; StructType *GlobalDtorElemTy = StructType::get(Mod->getContext(), GlobalDtorElems, false); diff --git a/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/lib/Transforms/Instrumentation/ThreadSanitizer.cpp index 8536e9a41a..c6244a55c9 100644 --- a/lib/Transforms/Instrumentation/ThreadSanitizer.cpp +++ b/lib/Transforms/Instrumentation/ThreadSanitizer.cpp @@ -375,7 +375,7 @@ bool ThreadSanitizer::instrumentAtomic(Instruction *I) { const size_t ByteSize = 1 << Idx; const size_t BitSize = ByteSize * 8; Type *Ty = Type::getIntNTy(IRB.getContext(), BitSize); - Type *PtrTy = Ty->getPointerTo(Addr->getType()); + Type *PtrTy = Ty->getPointerTo(); Value *Args[] = {IRB.CreatePointerCast(Addr, PtrTy), createOrdering(&IRB, LI->getOrdering())}; CallInst *C = CallInst::Create(TsanAtomicLoad[Idx], @@ -390,7 +390,7 @@ bool ThreadSanitizer::instrumentAtomic(Instruction *I) { const size_t ByteSize = 1 << Idx; const size_t BitSize = ByteSize * 8; Type *Ty = Type::getIntNTy(IRB.getContext(), BitSize); - Type *PtrTy = Ty->getPointerTo(Addr->getType()); + Type *PtrTy = Ty->getPointerTo(); Value *Args[] = {IRB.CreatePointerCast(Addr, PtrTy), IRB.CreateIntCast(SI->getValueOperand(), Ty, false), createOrdering(&IRB, SI->getOrdering())}; diff --git a/lib/Transforms/Scalar/SROA.cpp b/lib/Transforms/Scalar/SROA.cpp index adf7e7af83..71c62257e7 100644 --- a/lib/Transforms/Scalar/SROA.cpp +++ b/lib/Transforms/Scalar/SROA.cpp @@ -2763,9 +2763,9 @@ private: : II.getRawDest()->getType(); if (!EmitMemCpy) { if (IsVectorElement) - OtherPtrTy = VecTy->getElementType()->getPointerTo(OtherPtrTy); + OtherPtrTy = VecTy->getElementType()->getPointerTo(); else if (IntTy && !IsWholeAlloca) - OtherPtrTy = SubIntTy->getPointerTo(OtherPtrTy); + OtherPtrTy = SubIntTy->getPointerTo(); else OtherPtrTy = NewAI.getType(); } diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp index 4cd171ab14..bead39225b 100644 --- a/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -777,7 +777,7 @@ SingleBlockLoopVectorizer::vectorizeLoop(LoopVectorizationLegality *Legal) { GetElementPtrInst *Gep2 = cast<GetElementPtrInst>(Gep->clone()); Gep2->setOperand(NumOperands - 1, LastIndex); Ptr = Builder.Insert(Gep2); - Ptr = Builder.CreateBitCast(Ptr, StTy->getPointerTo(Ptr->getType())); + Ptr = Builder.CreateBitCast(Ptr, StTy->getPointerTo()); Value *Val = getVectorValue(SI->getValueOperand()); Builder.CreateStore(Val, Ptr)->setAlignment(Alignment); break; @@ -806,7 +806,7 @@ SingleBlockLoopVectorizer::vectorizeLoop(LoopVectorizationLegality *Legal) { GetElementPtrInst *Gep2 = cast<GetElementPtrInst>(Gep->clone()); Gep2->setOperand(NumOperands - 1, LastIndex); Ptr = Builder.Insert(Gep2); - Ptr = Builder.CreateBitCast(Ptr, RetTy->getPointerTo(Ptr->getType())); + Ptr = Builder.CreateBitCast(Ptr, RetTy->getPointerTo()); LI = Builder.CreateLoad(Ptr); LI->setAlignment(Alignment); // Use this vector value for all users of the load. diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index b96257936d..a4e21e16b3 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -1673,7 +1673,7 @@ Constant *ConstantExpr::getAlignOf(Type* Ty) { // Note that a non-inbounds gep is used, as null isn't within any object. Type *AligningTy = StructType::get(Type::getInt1Ty(Ty->getContext()), Ty, NULL); - Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo(Ty)); + Constant *NullPtr = Constant::getNullValue(AligningTy->getPointerTo()); Constant *Zero = ConstantInt::get(Type::getInt64Ty(Ty->getContext()), 0); Constant *One = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1); Constant *Indices[2] = { Zero, One }; diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 13fae3327b..54146e118c 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -779,28 +779,6 @@ PointerType *Type::getPointerTo(unsigned addrs) { return PointerType::get(this, addrs); } -PointerType *Type::getPointerTo(const Type *Ty) { - unsigned AS = 0; - // For pointers, we return a new pointer based on the address space. - if (Ty->isPointerTy()) AS = Ty->getPointerAddressSpace(); - // For vector of pointers, we return a new pointer based on the - // address space of the element pointer type. - if (Ty->isVectorTy()) - AS = Ty->getVectorElementType()->getPointerAddressSpace(); - // Otherwise return a pointer based on the default address space - // since we want a pointer to the current type without having - // a type that can give us the correct address space. - // An example of this occuring is that you want to get a pointer to - // all of the arguments in a function. However, the PointerType - // for a non-pointer type cannot be determined by the type, so - // the default value is used. - return getPointerTo(AS); -} - -PointerType *Type::getPointerTo() { - return getPointerTo(this); -} - bool PointerType::isValidElementType(Type *ElemTy) { return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() && !ElemTy->isMetadataTy(); diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index 23f4e54328..eb40b09d29 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -434,8 +434,7 @@ void Verifier::visitGlobalVariable(GlobalVariable &GV) { if (ArrayType *ATy = dyn_cast<ArrayType>(GV.getType())) { StructType *STy = dyn_cast<StructType>(ATy->getElementType()); PointerType *FuncPtrTy = - FunctionType::get(Type::getVoidTy(*Context), false) - ->getPointerTo(GV.getType()); + FunctionType::get(Type::getVoidTy(*Context), false)->getPointerTo(); Assert1(STy && STy->getNumElements() == 2 && STy->getTypeAtIndex(0u)->isIntegerTy(32) && STy->getTypeAtIndex(1) == FuncPtrTy, |