[llvm-commits] [llvm-gcc-4.2] r45084 - in /llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp llvm-abi.h llvm-backend.cpp llvm-convert.cpp llvm-types.cpp
Christopher Lamb
christopher.lamb at gmail.com
Sun Dec 16 17:16:41 PST 2007
Author: clamb
Date: Sun Dec 16 19:16:41 2007
New Revision: 45084
URL: http://llvm.org/viewvc/llvm-project?rev=45084&view=rev
Log:
Update to use new PointerType::getUnqual() api.
Modified:
llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
llvm-gcc-4.2/trunk/gcc/llvm-abi.h
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=45084&r1=45083&r2=45084&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Sun Dec 16 19:16:41 2007
@@ -382,7 +382,7 @@
return true;
}
case IX86_BUILTIN_LOADQ: {
- PointerType *f64Ptr = PointerType::get(Type::DoubleTy);
+ PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy);
Value *Zero = ConstantFP::get(Type::DoubleTy, APFloat(0.0));
Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp");
Ops[0] = Builder.CreateLoad(Ops[0], "tmp");
@@ -391,7 +391,7 @@
return true;
}
case IX86_BUILTIN_LOADHPS: {
- PointerType *f64Ptr = PointerType::get(Type::DoubleTy);
+ PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy);
Ops[1] = Builder.CreateBitCast(Ops[1], f64Ptr, "tmp");
Value *Load = Builder.CreateLoad(Ops[1], "tmp");
Ops[1] = BuildVector(Load, UndefValue::get(Type::DoubleTy), NULL);
@@ -401,7 +401,7 @@
return true;
}
case IX86_BUILTIN_LOADLPS: {
- PointerType *f64Ptr = PointerType::get(Type::DoubleTy);
+ PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy);
Ops[1] = Builder.CreateBitCast(Ops[1], f64Ptr, "tmp");
Value *Load = Builder.CreateLoad(Ops[1], "tmp");
Ops[1] = BuildVector(Load, UndefValue::get(Type::DoubleTy), NULL);
@@ -412,7 +412,7 @@
}
case IX86_BUILTIN_STOREHPS: {
VectorType *v2f64 = VectorType::get(Type::DoubleTy, 2);
- PointerType *f64Ptr = PointerType::get(Type::DoubleTy);
+ PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy);
Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp");
Value *Idx = ConstantInt::get(Type::Int32Ty, 1);
Ops[1] = Builder.CreateBitCast(Ops[1], v2f64, "tmp");
@@ -422,7 +422,7 @@
}
case IX86_BUILTIN_STORELPS: {
VectorType *v2f64 = VectorType::get(Type::DoubleTy, 2);
- PointerType *f64Ptr = PointerType::get(Type::DoubleTy);
+ PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy);
Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp");
Value *Idx = ConstantInt::get(Type::Int32Ty, 0);
Ops[1] = Builder.CreateBitCast(Ops[1], v2f64, "tmp");
@@ -611,7 +611,7 @@
Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_ldmxcsr);
Value *Ptr = CreateTemporary(Type::Int32Ty);
Builder.CreateStore(Ops[0], Ptr);
- Ptr = Builder.CreateBitCast(Ptr, PointerType::get(Type::Int8Ty), "tmp");
+ Ptr = Builder.CreateBitCast(Ptr, PointerType::getUnqual(Type::Int8Ty), "tmp");
Result = Builder.CreateCall(ldmxcsr, Ptr);
return true;
}
@@ -619,7 +619,7 @@
Function *stmxcsr =
Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_stmxcsr);
Value *Ptr = CreateTemporary(Type::Int32Ty);
- Value *BPtr = Builder.CreateBitCast(Ptr, PointerType::get(Type::Int8Ty),
+ Value *BPtr = Builder.CreateBitCast(Ptr, PointerType::getUnqual(Type::Int8Ty),
"tmp");
Builder.CreateCall(stmxcsr, BPtr);
Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=45084&r1=45083&r2=45084&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Sun Dec 16 19:16:41 2007
@@ -44,7 +44,7 @@
const Type *ResultType,
std::vector<Value*> &Ops,
LLVMBuilder &Builder, Value *&Result) {
- const Type *VoidPtrTy = PointerType::get(Type::Int8Ty);
+ const Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty);
Function *IntFn = Intrinsic::getDeclaration(TheModule, IID);
Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=45084&r1=45083&r2=45084&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Sun Dec 16 19:16:41 2007
@@ -183,7 +183,7 @@
// FIXME: should return the hidden first argument for some targets
// (e.g. ELF i386).
- C.HandleAggregateShadowArgument(PointerType::get(Ty), false);
+ C.HandleAggregateShadowArgument(PointerType::getUnqual(Ty), false);
}
}
@@ -196,7 +196,7 @@
const Type *Ty = ConvertType(type);
if (isPassedByInvisibleReference(type)) { // variable size -> by-ref.
- C.HandleScalarArgument(PointerType::get(Ty), type);
+ C.HandleScalarArgument(PointerType::getUnqual(Ty), type);
} else if (Ty->isFirstClassType()) {
C.HandleScalarArgument(Ty, type);
} else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) {
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=45084&r1=45083&r2=45084&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Sun Dec 16 19:16:41 2007
@@ -483,7 +483,7 @@
if (!AttributeUsedGlobals.empty()) {
std::vector<Constant *> AUGs;
- const Type *SBP= PointerType::get(Type::Int8Ty);
+ const Type *SBP= PointerType::getUnqual(Type::Int8Ty);
for (SmallSetVector<Constant *,32>::iterator AI = AttributeUsedGlobals.begin(),
AE = AttributeUsedGlobals.end(); AI != AE; ++AI) {
Constant *C = *AI;
@@ -501,7 +501,7 @@
// Add llvm.noinline
if (!AttributeNoinlineFunctions.empty()) {
- const Type *SBP= PointerType::get(Type::Int8Ty);
+ const Type *SBP= PointerType::getUnqual(Type::Int8Ty);
ArrayType *AT = ArrayType::get(SBP, AttributeNoinlineFunctions.size());
Constant *Init = ConstantArray::get(AT, AttributeNoinlineFunctions);
GlobalValue *gv = new GlobalVariable(AT, false,
@@ -731,7 +731,7 @@
// Get file and line number
Constant *lineNo = ConstantInt::get(Type::Int32Ty, DECL_SOURCE_LINE(decl));
Constant *file = ConvertMetadataStringToGV(DECL_SOURCE_FILE(decl));
- const Type *SBP= PointerType::get(Type::Int8Ty);
+ const Type *SBP= PointerType::getUnqual(Type::Int8Ty);
file = ConstantExpr::getBitCast(file, SBP);
// There may be multiple annotate attributes. Pass return of lookup_attr
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=45084&r1=45083&r2=45084&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sun Dec 16 19:16:41 2007
@@ -485,7 +485,7 @@
Value *Loc = LocStack.back();
if (cast<PointerType>(Loc->getType())->getElementType() != LLVMTy)
// This cast only involves pointers, therefore BitCast
- Loc = Builder.CreateBitCast(Loc, PointerType::get(LLVMTy), "tmp");
+ Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(LLVMTy), "tmp");
Builder.CreateStore(ArgVal, Loc);
AI->setName(NameStack.back());
@@ -498,7 +498,8 @@
Value *Loc = LocStack.back();
if (cast<PointerType>(Loc->getType())->getElementType() != StructTy)
// This cast only involves pointers, therefore BitCast
- Loc = Builder.CreateBitCast(Loc, PointerType::get(StructTy), "tmp");
+ Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(StructTy),
+ "tmp");
Value *Idxs[] = {
Constant::getNullValue(Type::Int32Ty),
@@ -628,7 +629,7 @@
// Handle noinline Functions
if (lookup_attribute ("noinline", DECL_ATTRIBUTES (FnDecl))) {
- const Type *SBP= PointerType::get(Type::Int8Ty);
+ const Type *SBP= PointerType::getUnqual(Type::Int8Ty);
AttributeNoinlineFunctions.push_back(ConstantExpr::getBitCast(Fn,SBP));
}
@@ -743,7 +744,7 @@
// to the specified scalar type, which we do by casting the pointer and
// loading.
RetVal = BitCastToType(DECL_LLVM(DECL_RESULT(FnDecl)),
- PointerType::get(Fn->getReturnType()));
+ PointerType::getUnqual(Fn->getReturnType()));
RetVal = Builder.CreateLoad(RetVal, "retval");
}
}
@@ -1271,8 +1272,8 @@
if (!TheTypeConverter->GCCTypeOverlapsWithLLVMTypePadding(type, LLVMTy) &&
// Don't copy tons of tiny elements.
CountAggregateElements(LLVMTy) <= 8) {
- DestLoc.Ptr = BitCastToType(DestLoc.Ptr, PointerType::get(LLVMTy));
- SrcLoc.Ptr = BitCastToType(SrcLoc.Ptr, PointerType::get(LLVMTy));
+ DestLoc.Ptr = BitCastToType(DestLoc.Ptr, PointerType::getUnqual(LLVMTy));
+ SrcLoc.Ptr = BitCastToType(SrcLoc.Ptr, PointerType::getUnqual(LLVMTy));
CopyAggregate(DestLoc, SrcLoc, Builder);
return;
}
@@ -1329,7 +1330,7 @@
if (!TheTypeConverter->GCCTypeOverlapsWithLLVMTypePadding(type, LLVMTy) &&
// Don't zero tons of tiny elements.
CountAggregateElements(LLVMTy) <= 8) {
- DestLoc.Ptr = BitCastToType(DestLoc.Ptr, PointerType::get(LLVMTy));
+ DestLoc.Ptr = BitCastToType(DestLoc.Ptr, PointerType::getUnqual(LLVMTy));
ZeroAggregate(DestLoc, Builder);
return;
}
@@ -1341,7 +1342,7 @@
void TreeToLLVM::EmitMemCpy(Value *DestPtr, Value *SrcPtr, Value *Size,
unsigned Align) {
- const Type *SBP = PointerType::get(Type::Int8Ty);
+ const Type *SBP = PointerType::getUnqual(Type::Int8Ty);
const Type *IntPtr = TD.getIntPtrType();
Value *Ops[4] = {
BitCastToType(DestPtr, SBP),
@@ -1357,7 +1358,7 @@
void TreeToLLVM::EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size,
unsigned Align) {
- const Type *SBP = PointerType::get(Type::Int8Ty);
+ const Type *SBP = PointerType::getUnqual(Type::Int8Ty);
const Type *IntPtr = TD.getIntPtrType();
Value *Ops[4] = {
BitCastToType(DestPtr, SBP),
@@ -1373,7 +1374,7 @@
void TreeToLLVM::EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size,
unsigned Align) {
- const Type *SBP = PointerType::get(Type::Int8Ty);
+ const Type *SBP = PointerType::getUnqual(Type::Int8Ty);
const Type *IntPtr = TD.getIntPtrType();
Value *Ops[4] = {
BitCastToType(DestPtr, SBP),
@@ -1397,8 +1398,8 @@
// The idea is that it's a pointer to type "Value"
// which is opaque* but the routine expects i8** and i8*.
- const PointerType *Ty = PointerType::get(Type::Int8Ty);
- V = Builder.CreateBitCast(V, PointerType::get(Ty), "tmp");
+ const PointerType *Ty = PointerType::getUnqual(Type::Int8Ty);
+ V = Builder.CreateBitCast(V, PointerType::getUnqual(Ty), "tmp");
Value *Ops[2] = {
V,
@@ -1423,7 +1424,7 @@
// Get file and line number
Constant *lineNo = ConstantInt::get(Type::Int32Ty, DECL_SOURCE_LINE(decl));
Constant *file = ConvertMetadataStringToGV(DECL_SOURCE_FILE(decl));
- const Type *SBP= PointerType::get(Type::Int8Ty);
+ const Type *SBP= PointerType::getUnqual(Type::Int8Ty);
file = ConstantExpr::getBitCast(file, SBP);
// There may be multiple annotate attributes. Pass return of lookup_attr
@@ -1443,7 +1444,7 @@
// Assert its a string, and then get that string.
assert(TREE_CODE(val) == STRING_CST &&
"Annotate attribute arg should always be a string");
- const Type *SBP = PointerType::get(Type::Int8Ty);
+ const Type *SBP = PointerType::getUnqual(Type::Int8Ty);
Constant *strGV = TreeConstantToLLVM::EmitLV_STRING_CST(val);
Value *Ops[4] = {
BitCastToType(V, SBP),
@@ -1795,7 +1796,7 @@
const Type *IntPtr = TD.getIntPtrType();
- ExceptionValue = CreateTemporary(PointerType::get(Type::Int8Ty));
+ ExceptionValue = CreateTemporary(PointerType::getUnqual(Type::Int8Ty));
ExceptionValue->setName("eh_exception");
ExceptionSelectorValue = CreateTemporary(IntPtr);
@@ -1857,7 +1858,7 @@
assert(llvm_eh_personality_libfunc
&& "no exception handling personality function!");
Args.push_back(BitCastToType(DECL_LLVM(llvm_eh_personality_libfunc),
- PointerType::get(Type::Int8Ty)));
+ PointerType::getUnqual(Type::Int8Ty)));
// Add selections for each handler.
foreach_reachable_handler (i, false, AddHandler, &Handlers);
@@ -1889,7 +1890,7 @@
if (!TypeList) {
// Catch-all - push a null pointer.
Args.push_back(
- Constant::getNullValue(PointerType::get(Type::Int8Ty))
+ Constant::getNullValue(PointerType::getUnqual(Type::Int8Ty))
);
} else {
// Add the type infos.
@@ -1915,7 +1916,7 @@
tree catch_all_type = lang_eh_catch_all();
if (catch_all_type == NULL_TREE)
// Use a C++ style null catch-all object.
- Catch_All = Constant::getNullValue(PointerType::get(Type::Int8Ty));
+ Catch_All = Constant::getNullValue(PointerType::getUnqual(Type::Int8Ty));
else
// This language has a type that catches all others.
Catch_All = Emit(lookup_type_for_runtime(catch_all_type), 0);
@@ -1979,7 +1980,7 @@
Value *Cond = NULL;
for (; TypeList; TypeList = TREE_CHAIN (TypeList)) {
Value *TType = Emit(lookup_type_for_runtime(TREE_VALUE(TypeList)), 0);
- TType = BitCastToType(TType, PointerType::get(Type::Int8Ty));
+ TType = BitCastToType(TType, PointerType::getUnqual(Type::Int8Ty));
// Call get eh type id.
Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, TType, "eh_typeid");
@@ -2087,7 +2088,7 @@
if (!LV.isBitfield()) {
if (!DestLoc) {
// Scalar value: emit a load.
- Value *Ptr = BitCastToType(LV.Ptr, PointerType::get(Ty));
+ Value *Ptr = BitCastToType(LV.Ptr, PointerType::getUnqual(Ty));
LoadInst *LI = Builder.CreateLoad(Ptr, isVolatile, "tmp");
LI->setAlignment(Alignment);
return LI;
@@ -2182,7 +2183,7 @@
// If this is a direct call to a function using a static chain then we need
// to ensure the function type is the one just calculated: it has an extra
// parameter for the chain.
- Callee = BitCastToType(Callee, PointerType::get(Ty));
+ Callee = BitCastToType(Callee, PointerType::getUnqual(Ty));
//EmitCall(exp, DestLoc);
Value *Result = EmitCallOf(Callee, exp, DestLoc, PAL);
@@ -2280,7 +2281,7 @@
Value *Loc = LocStack.back();
if (cast<PointerType>(Loc->getType())->getElementType() != LLVMTy)
// This always deals with pointer types so BitCast is appropriate
- Loc = Builder.CreateBitCast(Loc, PointerType::get(LLVMTy), "tmp");
+ Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(LLVMTy), "tmp");
CallOperands.push_back(Builder.CreateLoad(Loc, "tmp"));
}
@@ -2291,7 +2292,8 @@
Value *Loc = LocStack.back();
if (cast<PointerType>(Loc->getType())->getElementType() != StructTy)
// This always deals with pointer types so BitCast is appropriate
- Loc = Builder.CreateBitCast(Loc, PointerType::get(StructTy), "tmp");
+ Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(StructTy),
+ "tmp");
Value *Idxs[2] = { Zero, FIdx };
LocStack.push_back(Builder.CreateGEP(Loc, Idxs, Idxs + 2, "tmp"));
@@ -2383,7 +2385,7 @@
Value *Ptr = ArgVal.Ptr;
if (CallOperands.size() >= FTy->getNumParams())
- ArgTy = PointerType::get(ArgTy);
+ ArgTy = PointerType::getUnqual(ArgTy);
CallOperands.push_back(BitCastToType(Ptr, ArgTy));
} else if (ActualArgTy->isFirstClassType()) {
Value *V = Emit(TREE_VALUE(arg), 0);
@@ -2449,7 +2451,8 @@
if (!DestLoc)
return Call; // Normal scalar return.
- Value *Ptr = BitCastToType(DestLoc->Ptr, PointerType::get(Call->getType()));
+ Value *Ptr = BitCastToType(DestLoc->Ptr,
+ PointerType::getUnqual(Call->getType()));
StoreInst *St = Builder.CreateStore(Call, Ptr, DestLoc->Volatile);
St->setAlignment(DestLoc->Alignment);
return 0;
@@ -2562,7 +2565,7 @@
if (PT->getElementType()->canLosslesslyBitCastTo(RHS->getType()))
RHS = CastToAnyType(RHS, Op1Signed, PT->getElementType(), Op0Signed);
else
- LV.Ptr = BitCastToType(LV.Ptr, PointerType::get(RHS->getType()));
+ LV.Ptr = BitCastToType(LV.Ptr, PointerType::getUnqual(RHS->getType()));
StoreInst *SI = Builder.CreateStore(RHS, LV.Ptr, isVolatile);
SI->setAlignment(Alignment);
return RHS;
@@ -2644,7 +2647,7 @@
} else if (isAggregateTreeType(TREE_TYPE(Op))) {
// Aggregate to aggregate copy.
MemRef NewLoc = *DestLoc;
- NewLoc.Ptr = BitCastToType(DestLoc->Ptr, PointerType::get(Ty));
+ NewLoc.Ptr = BitCastToType(DestLoc->Ptr, PointerType::getUnqual(Ty));
Value *OpVal = Emit(Op, &NewLoc);
assert(OpVal == 0 && "Shouldn't cast scalar to aggregate!");
return 0;
@@ -2652,7 +2655,8 @@
// Scalar to aggregate copy.
Value *OpVal = Emit(Op, 0);
- Value *Ptr = BitCastToType(DestLoc->Ptr, PointerType::get(OpVal->getType()));
+ Value *Ptr = BitCastToType(DestLoc->Ptr,
+ PointerType::getUnqual(OpVal->getType()));
StoreInst *St = Builder.CreateStore(OpVal, Ptr, DestLoc->Volatile);
St->setAlignment(DestLoc->Alignment);
return 0;
@@ -2675,7 +2679,7 @@
if (DestLoc) {
// This is an aggregate-to-agg VIEW_CONVERT_EXPR, just evaluate in place.
Target = *DestLoc;
- Target.Ptr = BitCastToType(DestLoc->Ptr, PointerType::get(OpTy));
+ Target.Ptr = BitCastToType(DestLoc->Ptr, PointerType::getUnqual(OpTy));
} else {
// This is an aggregate-to-scalar VIEW_CONVERT_EXPR, evaluate, then load.
Target = CreateTempLoc(OpTy);
@@ -2719,7 +2723,8 @@
// Target holds the temporary created above.
const Type *ExpTy = ConvertType(TREE_TYPE(exp));
return Builder.CreateLoad(BitCastToType(Target.Ptr,
- PointerType::get(ExpTy)), "tmp");
+ PointerType::getUnqual(ExpTy)),
+ "tmp");
}
if (DestLoc) {
@@ -2728,7 +2733,7 @@
Value *OpVal = Emit(Op, 0);
assert(OpVal && "Expected a scalar result!");
Value *Ptr = BitCastToType(DestLoc->Ptr,
- PointerType::get(OpVal->getType()));
+ PointerType::getUnqual(OpVal->getType()));
StoreInst *St = Builder.CreateStore(OpVal, Ptr, DestLoc->Volatile);
St->setAlignment(DestLoc->Alignment);
return 0;
@@ -3667,7 +3672,7 @@
TySize == 32 || TySize == 64) {
LLVMTy = IntegerType::get(TySize);
Op = Builder.CreateLoad(BitCastToType(LV.Ptr,
- PointerType::get(LLVMTy)),
+ PointerType::getUnqual(LLVMTy)),
"tmp");
} else {
// Otherwise, emit our value as a lvalue and let the codegen deal with
@@ -4264,7 +4269,7 @@
if (Locality == 0)
Locality = ConstantInt::get(Type::Int32Ty, 3);
- Ptr = BitCastToType(Ptr, PointerType::get(Type::Int8Ty));
+ Ptr = BitCastToType(Ptr, PointerType::getUnqual(Type::Int8Ty));
Value *Ops[3] = { Ptr, ReadWrite, Locality };
Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::prefetch),
@@ -4308,7 +4313,7 @@
// Unfortunately, these constants are defined as RTL expressions and
// should be handled separately.
- Result = BitCastToType(Ptr, PointerType::get(Type::Int8Ty));
+ Result = BitCastToType(Ptr, PointerType::getUnqual(Type::Int8Ty));
return true;
}
@@ -4324,7 +4329,7 @@
// needed for: MIPS, Sparc. Unfortunately, these constants are defined
// as RTL expressions and should be handled separately.
- Result = BitCastToType(Ptr, PointerType::get(Type::Int8Ty));
+ Result = BitCastToType(Ptr, PointerType::getUnqual(Type::Int8Ty));
return true;
}
@@ -4427,7 +4432,7 @@
Value *Offset = Emit(TREE_VALUE(arglist), 0);
Value *Handler = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0);
Offset = Builder.CreateIntCast(Offset, Type::Int32Ty, true, "tmp");
- Handler = BitCastToType(Handler, PointerType::get(Type::Int8Ty));
+ Handler = BitCastToType(Handler, PointerType::getUnqual(Type::Int8Ty));
SmallVector<Value *, 2> Args;
Args.push_back(Offset);
@@ -4457,7 +4462,7 @@
}
Value *Addr = BitCastToType(Emit(TREE_VALUE(arglist), 0),
- PointerType::get(Type::Int8Ty));
+ PointerType::getUnqual(Type::Int8Ty));
Constant *Size, *Idx;
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) {
@@ -4519,7 +4524,7 @@
return false;
Value *Ptr = Emit(TREE_VALUE(arglist), 0);
- Ptr = BitCastToType(Ptr, PointerType::get(Type::Int8Ty));
+ Ptr = BitCastToType(Ptr, PointerType::getUnqual(Type::Int8Ty));
Builder.CreateCall(Intrinsic::getDeclaration(TheModule,
Intrinsic::stackrestore), Ptr);
@@ -4573,14 +4578,14 @@
Intrinsic::vastart);
const Type *FTy =
cast<PointerType>(llvm_va_start_fn->getType())->getElementType();
- ArgVal = BitCastToType(ArgVal, PointerType::get(Type::Int8Ty));
+ ArgVal = BitCastToType(ArgVal, PointerType::getUnqual(Type::Int8Ty));
Builder.CreateCall(llvm_va_start_fn, ArgVal);
return true;
}
bool TreeToLLVM::EmitBuiltinVAEnd(tree exp) {
Value *Arg = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0);
- Arg = BitCastToType(Arg, PointerType::get(Type::Int8Ty));
+ Arg = BitCastToType(Arg, PointerType::getUnqual(Type::Int8Ty));
Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::vaend),
Arg);
return true;
@@ -4607,7 +4612,7 @@
Arg2 = DestLoc.Ptr;
}
- static const Type *VPTy = PointerType::get(Type::Int8Ty);
+ static const Type *VPTy = PointerType::getUnqual(Type::Int8Ty);
// FIXME: This ignores alignment and volatility of the arguments.
SmallVector<Value *, 2> Args;
@@ -4625,7 +4630,7 @@
VOID_TYPE))
return false;
- static const Type *VPTy = PointerType::get(Type::Int8Ty);
+ static const Type *VPTy = PointerType::getUnqual(Type::Int8Ty);
Value *Tramp = Emit(TREE_VALUE(arglist), 0);
Tramp = BitCastToType(Tramp, VPTy);
@@ -4812,7 +4817,8 @@
Value *Decl = DECL_LLVM(exp);
if (Decl == 0) {
if (errorcount || sorrycount) {
- const PointerType *Ty = PointerType::get(ConvertType(TREE_TYPE(exp)));
+ const PointerType *Ty =
+ PointerType::getUnqual(ConvertType(TREE_TYPE(exp)));
return ConstantPointerNull::get(Ty);
}
assert(0 && "INTERNAL ERROR: Referencing decl that hasn't been laid out");
@@ -4850,7 +4856,7 @@
// type void.
if (Ty == Type::VoidTy) Ty = StructType::get(std::vector<const Type*>(),
false);
- const PointerType *PTy = PointerType::get(Ty);
+ const PointerType *PTy = PointerType::getUnqual(Ty);
return BitCastToType(Decl, PTy);
}
@@ -4900,22 +4906,24 @@
if (isArrayCompatible(ArrayType)) {
Value *Idxs[2] = { ConstantInt::get(Type::Int32Ty, 0), IndexVal };
Value *Ptr = Builder.CreateGEP(ArrayAddr, Idxs, Idxs + 2, "tmp");
- return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp))));
+ return BitCastToType(Ptr,
+ PointerType::getUnqual(ConvertType(TREE_TYPE(exp))));
}
// If we are indexing over a fixed-size type, just use a GEP.
if (isSequentialCompatible(ArrayType)) {
- const Type *PtrElementTy = PointerType::get(ConvertType(ElementType));
+ const Type *PtrElementTy = PointerType::getUnqual(ConvertType(ElementType));
ArrayAddr = BitCastToType(ArrayAddr, PtrElementTy);
Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp");
- return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp))));
+ return BitCastToType(Ptr,
+ PointerType::getUnqual(ConvertType(TREE_TYPE(exp))));
}
// Otherwise, just do raw, low-level pointer arithmetic. FIXME: this could be
// much nicer in cases like:
// float foo(int w, float A[][w], int g) { return A[g][0]; }
- ArrayAddr = BitCastToType(ArrayAddr, PointerType::get(Type::Int8Ty));
+ ArrayAddr = BitCastToType(ArrayAddr, PointerType::getUnqual(Type::Int8Ty));
if (VOID_TYPE_P(TREE_TYPE(ArrayType)))
return Builder.CreateGEP(ArrayAddr, IndexVal, "tmp");
@@ -4923,7 +4931,7 @@
TypeSize = CastToUIntType(TypeSize, IntPtrTy);
IndexVal = Builder.CreateMul(IndexVal, TypeSize, "tmp");
Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp");
- return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp))));
+ return BitCastToType(Ptr, PointerType::getUnqual(ConvertType(TREE_TYPE(exp))));
}
/// getFieldOffsetInBits - Return the offset (in bits) of a FIELD_DECL in a
@@ -4968,7 +4976,7 @@
StructAddrLV.BitStart == 0) && "structs cannot be bitfields!");
StructAddrLV.Ptr = BitCastToType(StructAddrLV.Ptr,
- PointerType::get(StructTy));
+ PointerType::getUnqual(StructTy));
const Type *FieldTy = ConvertType(TREE_TYPE(FieldDecl));
// BitStart - This is the actual offset of the field from the start of the
@@ -4998,7 +5006,8 @@
Value *Ptr = CastToType(Instruction::PtrToInt, StructAddrLV.Ptr,
Offset->getType());
Ptr = Builder.CreateAdd(Ptr, Offset, "tmp");
- FieldPtr = CastToType(Instruction::IntToPtr, Ptr,PointerType::get(FieldTy));
+ FieldPtr = CastToType(Instruction::IntToPtr, Ptr,
+ PointerType::getUnqual(FieldTy));
}
if (tree DeclaredType = DECL_BIT_FIELD_TYPE(FieldDecl)) {
@@ -5034,7 +5043,7 @@
// If this is a bitfield, the field may span multiple fields in the LLVM
// type. As such, cast the pointer to be a pointer to the declared type.
- FieldPtr = BitCastToType(FieldPtr, PointerType::get(FieldTy));
+ FieldPtr = BitCastToType(FieldPtr, PointerType::getUnqual(FieldTy));
// If this is a normal bitfield reference, return it as such.
if (DECL_SIZE(FieldDecl) && TREE_CODE(DECL_SIZE(FieldDecl)) == INTEGER_CST){
@@ -5068,7 +5077,7 @@
Offset->getType());
FieldPtr = Builder.CreateAdd(FieldPtr, Offset, "tmp");
FieldPtr = CastToType(Instruction::IntToPtr, FieldPtr,
- PointerType::get(FieldTy));
+ PointerType::getUnqual(FieldTy));
// Adjust bitstart to account for the pointer movement.
BitStart -= ByteOffset*8;
@@ -5087,7 +5096,7 @@
} else {
// Make sure we return a pointer to the right type.
FieldPtr = BitCastToType(FieldPtr,
- PointerType::get(ConvertType(TREE_TYPE(exp))));
+ PointerType::getUnqual(ConvertType(TREE_TYPE(exp))));
}
assert(BitStart == 0 &&
@@ -5114,7 +5123,7 @@
if (unsigned UnitOffset = BitStart / ValueSizeInBits) {
// TODO: If Ptr.Ptr is a struct type or something, we can do much better
// than this. e.g. check out when compiling unwind-dw2-fde-darwin.c.
- Ptr.Ptr = BitCastToType(Ptr.Ptr, PointerType::get(ValTy));
+ Ptr.Ptr = BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy));
Ptr.Ptr = Builder.CreateGEP(Ptr.Ptr,
ConstantInt::get(Type::Int32Ty, UnitOffset),
"tmp");
@@ -5123,9 +5132,9 @@
// If this is referring to the whole field, return the whole thing.
if (BitStart == 0 && BitSize == ValueSizeInBits)
- return LValue(BitCastToType(Ptr.Ptr, PointerType::get(ValTy)));
+ return LValue(BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy)));
- return LValue(BitCastToType(Ptr.Ptr, PointerType::get(ValTy)), BitStart,
+ return LValue(BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy)), BitStart,
BitSize);
}
@@ -5145,14 +5154,16 @@
// If the input is an aggregate, the address is the address of the operand.
LValue LV = EmitLV(Op);
// The type is the type of the expression.
- LV.Ptr = BitCastToType(LV.Ptr, PointerType::get(ConvertType(TREE_TYPE(exp))));
+ LV.Ptr = BitCastToType(LV.Ptr,
+ PointerType::getUnqual(ConvertType(TREE_TYPE(exp))));
return LV;
} else {
// If the input is a scalar, emit to a temporary.
Value *Dest = CreateTemporary(ConvertType(TREE_TYPE(Op)));
Builder.CreateStore(Emit(Op, 0), Dest);
// The type is the type of the expression.
- Dest = BitCastToType(Dest, PointerType::get(ConvertType(TREE_TYPE(exp))));
+ Dest = BitCastToType(Dest,
+ PointerType::getUnqual(ConvertType(TREE_TYPE(exp))));
return LValue(Dest);
}
}
@@ -5235,7 +5246,8 @@
} else {
// Scalar value. Evaluate to a register, then do the store.
Value *V = Emit(tree_value, 0);
- Value *Ptr = BitCastToType(DestLoc->Ptr, PointerType::get(V->getType()));
+ Value *Ptr = BitCastToType(DestLoc->Ptr,
+ PointerType::getUnqual(V->getType()));
StoreInst *St = Builder.CreateStore(V, Ptr, DestLoc->Volatile);
St->setAlignment(DestLoc->Alignment);
}
@@ -6005,7 +6017,7 @@
BasicBlock *BB = getLabelDeclBlock(exp);
Constant *C = TheTreeToLLVM->getIndirectGotoBlockNumber(BB);
- return ConstantExpr::getIntToPtr(C, PointerType::get(Type::Int8Ty));
+ return ConstantExpr::getIntToPtr(C, PointerType::getUnqual(Type::Int8Ty));
}
Constant *TreeConstantToLLVM::EmitLV_COMPLEX_CST(tree exp) {
@@ -6101,7 +6113,7 @@
tree FieldDecl = TREE_OPERAND(exp, 1);
StructAddrLV = ConstantExpr::getBitCast(StructAddrLV,
- PointerType::get(StructTy));
+ PointerType::getUnqual(StructTy));
const Type *FieldTy = ConvertType(TREE_TYPE(FieldDecl));
// BitStart - This is the actual offset of the field from the start of the
@@ -6132,12 +6144,13 @@
Constant *Offset = Convert(field_offset);
Constant *Ptr = ConstantExpr::getPtrToInt(StructAddrLV, Offset->getType());
Ptr = ConstantExpr::getAdd(Ptr, Offset);
- FieldPtr = ConstantExpr::getIntToPtr(Ptr, PointerType::get(FieldTy));
+ FieldPtr = ConstantExpr::getIntToPtr(Ptr, PointerType::getUnqual(FieldTy));
}
if (DECL_BIT_FIELD_TYPE(FieldDecl)) {
FieldTy = ConvertType(DECL_BIT_FIELD_TYPE(FieldDecl));
- FieldPtr = ConstantExpr::getBitCast(FieldPtr, PointerType::get(FieldTy));
+ FieldPtr = ConstantExpr::getBitCast(FieldPtr,
+ PointerType::getUnqual(FieldTy));
}
assert(BitStart == 0 &&
Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=45084&r1=45083&r2=45084&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Sun Dec 16 19:16:41 2007
@@ -811,7 +811,8 @@
Ty = GET_TYPE_LLVM(TYPE_MAIN_VARIANT(TREE_TYPE(type)));
if (Ty == 0) {
PointersToReresolve.push_back(type);
- return TypeDB.setType(type, PointerType::get(OpaqueType::get()));
+ return TypeDB.setType(type,
+ PointerType::getUnqual(OpaqueType::get()));
}
// A type has already been computed. However, this may be some sort of
@@ -829,7 +830,7 @@
if (Ty->getTypeID() == Type::VoidTyID)
Ty = Type::Int8Ty; // void* -> sbyte*
- return TypeDB.setType(type, PointerType::get(Ty));
+ return TypeDB.setType(type, PointerType::getUnqual(Ty));
}
case METHOD_TYPE:
More information about the llvm-commits
mailing list