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
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
// 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);
// 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);
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);
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;
// 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);
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],
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())};
: 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();
}
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;
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.
// 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 };
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();
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,