Nice. Please email llvmdev about this API change to help reduce the number of people that are surprised. Thanks Christopher!
-Chris http://nondot.org/sabre http://llvm.org On Dec 16, 2007, at 5:12 PM, Christopher Lamb <[EMAIL PROTECTED] > wrote: > Author: clamb > Date: Sun Dec 16 19:12:55 2007 > New Revision: 45082 > > URL: http://llvm.org/viewvc/llvm-project?rev=45082&view=rev > Log: > Change the PointerType api for creating pointer types. The old > functionality of PointerType::get() has become PointerType::getUnqual > (), which returns a pointer in the generic address space. The new > prototype of PointerType::get() requires both a type and an address > space. > > Modified: > llvm/trunk/examples/BrainF/BrainF.cpp > llvm/trunk/examples/BrainF/BrainFDriver.cpp > llvm/trunk/include/llvm/DerivedTypes.h > llvm/trunk/lib/AsmParser/llvmAsmParser.y > llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp > llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp > llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp > llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp > llvm/trunk/lib/Target/MSIL/MSILWriter.cpp > llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp > llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp > llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp > llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp > llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp > llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp > llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp > llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp > llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp > llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp > llvm/trunk/lib/VMCore/ConstantFold.cpp > llvm/trunk/lib/VMCore/Constants.cpp > llvm/trunk/lib/VMCore/Core.cpp > llvm/trunk/lib/VMCore/Function.cpp > llvm/trunk/lib/VMCore/InlineAsm.cpp > llvm/trunk/lib/VMCore/Instructions.cpp > llvm/trunk/lib/VMCore/Module.cpp > llvm/trunk/lib/VMCore/Verifier.cpp > llvm/trunk/tools/bugpoint/Miscompilation.cpp > llvm/trunk/tools/llvm-upgrade/UpgradeParser.y > llvm/trunk/tools/llvm2cpp/CppWriter.cpp > llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp > > Modified: llvm/trunk/examples/BrainF/BrainF.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=45082&r1=45081&r2=45082&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/examples/BrainF/BrainF.cpp (original) > +++ llvm/trunk/examples/BrainF/BrainF.cpp Sun Dec 16 19:12:55 2007 > @@ -54,7 +54,7 @@ > //declare void @llvm.memset.i32(i8 *, i8, i32, i32) > Function *memset_func = cast<Function>(module-> > getOrInsertFunction("llvm.memset.i32", Type::VoidTy, > - PointerType::get(IntegerType::Int8Ty), > + PointerType::getUnqual(IntegerType::Int8Ty), > IntegerType::Int8Ty, IntegerType::Int32Ty, > IntegerType::Int32Ty, NULL)); > > @@ -138,7 +138,7 @@ > //declare i32 @puts(i8 *) > Function *puts_func = cast<Function>(module-> > getOrInsertFunction("puts", IntegerType::Int32Ty, > - PointerType::get(IntegerType::Int8Ty), > NULL)); > + PointerType::getUnqual > (IntegerType::Int8Ty), NULL)); > > //brainf.aberror: > aberrorbb = new BasicBlock(label, brainf_func); > @@ -282,7 +282,7 @@ > builder->SetInsertPoint(bb_1); > > //Make part of PHI instruction now, wait until end of loop > to finish > - PHINode *phi_0 = new PHINode(PointerType::get > (IntegerType::Int8Ty), > + PHINode *phi_0 = new PHINode(PointerType::getUnqual > (IntegerType::Int8Ty), > headreg, testbb); > phi_0->reserveOperandSpace(2); > phi_0->addIncoming(curhead, bb_0); > @@ -439,7 +439,7 @@ > > //%head.%d = phi i8 *[%head.%d, %main.%d] > PHINode *phi_1 = builder-> > - CreatePHI(PointerType::get(IntegerType::Int8Ty), headreg); > + CreatePHI(PointerType::getUnqual(IntegerType::Int8Ty), > headreg); > phi_1->reserveOperandSpace(1); > phi_1->addIncoming(head_0, testbb); > curhead = phi_1; > > Modified: llvm/trunk/examples/BrainF/BrainFDriver.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainFDriver.cpp?rev=45082&r1=45081&r2=45082&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/examples/BrainF/BrainFDriver.cpp (original) > +++ llvm/trunk/examples/BrainF/BrainFDriver.cpp Sun Dec 16 19:12:55 > 2007 > @@ -59,7 +59,7 @@ > //define i32 @main(i32 %argc, i8 **%argv) > Function *main_func = cast<Function>(mod-> > getOrInsertFunction("main", IntegerType::Int32Ty, > IntegerType::Int32Ty, > - PointerType::get(PointerType::get( > + PointerType::getUnqual > (PointerType::getUnqual( > IntegerType::Int8Ty)), NULL)); > { > Function::arg_iterator args = main_func->arg_begin(); > > Modified: llvm/trunk/include/llvm/DerivedTypes.h > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DerivedTypes.h?rev=45082&r1=45081&r2=45082&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/include/llvm/DerivedTypes.h (original) > +++ llvm/trunk/include/llvm/DerivedTypes.h Sun Dec 16 19:12:55 2007 > @@ -369,8 +369,15 @@ > const PointerType &operator=(const PointerType &); // Do not > implement > explicit PointerType(const Type *ElType, unsigned AddrSpace); > public: > - /// PointerType::get - This is the only way to construct a new > pointer type. > - static PointerType *get(const Type *ElementType, unsigned > AddressSpace = 0); > + /// PointerType::get - This constructs a pointer to an object of > the specified > + /// type in a numbered address space. > + static PointerType *get(const Type *ElementType, unsigned > AddressSpace); > + > + /// PointerType::getUnqual - This constructs a pointer to an > object of the > + /// specified type in the generic address space (address space > zero). > + static PointerType *getUnqual(const Type *ElementType) { > + return PointerType::get(ElementType, 0); > + } > > /// @brief Return the address space of the Pointer type. > inline unsigned getAddressSpace() const { return AddressSpace; } > > Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=45082&r1=45081&r2=45082&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) > +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Sun Dec 16 19:12:55 2007 > @@ -2280,7 +2280,7 @@ > PAL = ParamAttrsList::get(Attrs); > > FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg); > - const PointerType *PFT = PointerType::get(FT); > + const PointerType *PFT = PointerType::getUnqual(FT); > delete $2; > > ValID ID; > @@ -2627,7 +2627,7 @@ > ParamTypes.push_back(Ty); > } > Ty = FunctionType::get($3->get(), ParamTypes, false); > - PFTy = PointerType::get(Ty); > + PFTy = PointerType::getUnqual(Ty); > } > > delete $3; > @@ -2954,7 +2954,7 @@ > ParamTypes.push_back(Ty); > } > Ty = FunctionType::get($3->get(), ParamTypes, false); > - PFTy = PointerType::get(Ty); > + PFTy = PointerType::getUnqual(Ty); > } > > Value *V = getVal(PFTy, $4); // Get the function we're > calling... > > Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=45082&r1=45081&r2=45082&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) > +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Sun Dec 16 > 19:12:55 2007 > @@ -1509,7 +1509,7 @@ > unsigned OpNum = 0; > Value *Val, *Ptr; > if (getValueTypePair(Record, OpNum, NextValueNo, Val) || > - getValue(Record, OpNum, PointerType::get(Val->getType()), > Ptr) || > + getValue(Record, OpNum, PointerType::getUnqual(Val- > >getType()), Ptr)|| > OpNum+2 != Record.size()) > return Error("Invalid STORE record"); > > > Modified: llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp?rev=45082&r1=45081&r2=45082&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp (original) > +++ llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp Sun Dec 16 19:12:55 > 2007 > @@ -81,22 +81,23 @@ > break; > case Intrinsic::memcpy_i32: > case Intrinsic::memcpy_i64: > - M.getOrInsertFunction("memcpy", PointerType::get > (Type::Int8Ty), > - PointerType::get(Type::Int8Ty), > - PointerType::get(Type::Int8Ty), > + M.getOrInsertFunction("memcpy", PointerType::getUnqual > (Type::Int8Ty), > + PointerType::getUnqual(Type::Int8Ty), > + PointerType::getUnqual(Type::Int8Ty), > TD.getIntPtrType(), (Type *)0); > break; > case Intrinsic::memmove_i32: > case Intrinsic::memmove_i64: > - M.getOrInsertFunction("memmove", PointerType::get > (Type::Int8Ty), > - PointerType::get(Type::Int8Ty), > - PointerType::get(Type::Int8Ty), > + M.getOrInsertFunction("memmove", PointerType::getUnqual > (Type::Int8Ty), > + PointerType::getUnqual(Type::Int8Ty), > + PointerType::getUnqual(Type::Int8Ty), > TD.getIntPtrType(), (Type *)0); > break; > case Intrinsic::memset_i32: > case Intrinsic::memset_i64: > - M.getOrInsertFunction("memset", PointerType::get > (Type::Int8Ty), > - PointerType::get(Type::Int8Ty), > Type::Int32Ty, > + M.getOrInsertFunction("memset", PointerType::getUnqual > (Type::Int8Ty), > + PointerType::getUnqual(Type::Int8Ty), > + Type::Int32Ty, > TD.getIntPtrType(), (Type *)0); > break; > case Intrinsic::sqrt: > > Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=45082&r1=45081&r2=45082&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) > +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Sun Dec 16 19:12:55 > 2007 > @@ -1262,7 +1262,7 @@ > // If not already defined. > if (!StrPtrTy) { > // Construct the pointer to signed bytes. > - StrPtrTy = PointerType::get(Type::Int8Ty); > + StrPtrTy = PointerType::getUnqual(Type::Int8Ty); > } > > return StrPtrTy; > @@ -1277,7 +1277,7 @@ > const StructType *EmptyStructTy = > StructType::get > (std::vector<const Type*>()); > // Construct the pointer to empty structure type. > - EmptyStructPtrTy = PointerType::get(EmptyStructTy); > + EmptyStructPtrTy = PointerType::getUnqual(EmptyStructTy); > } > > return EmptyStructPtrTy; > > Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=45082&r1=45081&r2=45082&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original) > +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Sun Dec 16 > 19:12:55 2007 > @@ -170,7 +170,7 @@ > char *Result = new char[(InputArgv.size()+1)*PtrSize]; > > DOUT << "ARGV = " << (void*)Result << "\n"; > - const Type *SBytePtr = PointerType::get(Type::Int8Ty); > + const Type *SBytePtr = PointerType::getUnqual(Type::Int8Ty); > > for (unsigned i = 0; i != InputArgv.size(); ++i) { > unsigned Size = InputArgv[i].size()+1; > @@ -255,7 +255,8 @@ > // Check main() type > unsigned NumArgs = Fn->getFunctionType()->getNumParams(); > const FunctionType *FTy = Fn->getFunctionType(); > - const Type* PPInt8Ty = PointerType::get(PointerType::get > (Type::Int8Ty)); > + const Type* PPInt8Ty = > + PointerType::getUnqual(PointerType::getUnqual(Type::Int8Ty)); > switch (NumArgs) { > case 3: > if (FTy->getParamType(2) != PPInt8Ty) { > > Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.cpp?rev=45082&r1=45081&r2=45082&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/lib/Target/MSIL/MSILWriter.cpp (original) > +++ llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Sun Dec 16 19:12:55 2007 > @@ -783,7 +783,7 @@ > // Save as pointer type "void*" > printValueLoad(Inst->getOperand(1)); > printSimpleInstruction("ldloca",Name.c_str()); > - printIndirectSave(PointerType::get(IntegerType::get(8))); > + printIndirectSave(PointerType::getUnqual(IntegerType::get(8))); > break; > case Intrinsic::vaend: > // Close argument list handle. > @@ -1002,7 +1002,8 @@ > printSimpleInstruction("call", > "instance typedref [mscorlib]System.ArgIterator::GetNextArg()"); > printSimpleInstruction("refanyval","void*"); > - std::string Name = "ldind."+getTypePostfix(PointerType::get > (IntegerType::get(8)),false); > + std::string Name = > + "ldind."+getTypePostfix(PointerType::getUnqual(IntegerType::get > (8)),false); > printSimpleInstruction(Name.c_str()); > } > > @@ -1217,7 +1218,7 @@ > const AllocaInst* AI = dyn_cast<AllocaInst>(&*I); > if (AI && !isa<GlobalVariable>(AI)) { > // Local variable allocation. > - Ty = PointerType::get(AI->getAllocatedType()); > + Ty = PointerType::getUnqual(AI->getAllocatedType()); > Name = getValueName(AI); > Out << "\t.locals (" << getTypeName(Ty) << Name << ")\n"; > } else if (I->getType()!=Type::VoidTy) { > > Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=45082&r1=45081&r2=45082&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) > +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Sun Dec 16 19:12:55 > 2007 > @@ -1052,7 +1052,7 @@ > > for (unsigned FieldNo = 0, e = STy->getNumElements(); FieldNo != e; > ++FieldNo){ > const Type *FieldTy = STy->getElementType(FieldNo); > - const Type *PFieldTy = PointerType::get(FieldTy); > + const Type *PFieldTy = PointerType::getUnqual(FieldTy); > > GlobalVariable *NGV = > new GlobalVariable(PFieldTy, false, > GlobalValue::InternalLinkage, > @@ -1618,7 +1618,7 @@ > } else { > const Type *FTy = FunctionType::get(Type::VoidTy, > std::vector<const Type*> > (), false); > - const PointerType *PFTy = PointerType::get(FTy); > + const PointerType *PFTy = PointerType::getUnqual(FTy); > CSVals[1] = Constant::getNullValue(PFTy); > CSVals[0] = ConstantInt::get(Type::Int32Ty, 2147483647); > } > > Modified: llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp > URL: > http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp?rev=45082&r1=45081&r2=45082&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp (original) > +++ llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp Sun Dec 16 > 19:12:55 2007 > @@ -199,8 +199,8 @@ > // This function is always successful, unless it isn't. > bool LowerSetJmp::doInitialization(Module& M) > { > - const Type *SBPTy = PointerType::get(Type::Int8Ty); > - const Type *SBPPTy = PointerType::get(SBPTy); > + const Type *SBPTy = PointerType::getUnqual(Type::Int8Ty); > + const Type *SBPPTy = PointerType::getUnqual(SBPTy); > > // N.B. See llvm/runtime/GCCLibraries/libexception/SJLJ- > Exception.h for > // a description of the following library functions. > @@ -256,7 +256,7 @@ > // throwing the exception for us. > void LowerSetJmp::TransformLong _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits