[llvm-commits] [dragonegg] r166589 - in /dragonegg/trunk/src: Backend.cpp ConstantConversion.cpp Convert.cpp DefaultABI.cpp TypeConversion.cpp x86/Target.cpp
Micah Villmow
villmow at gmail.com
Wed Oct 24 10:13:14 PDT 2012
Author: mvillmow
Date: Wed Oct 24 12:13:13 2012
New Revision: 166589
URL: http://llvm.org/viewvc/llvm-project?rev=166589&view=rev
Log:
Backout r166588, checked in wrong changes.
Modified:
dragonegg/trunk/src/Backend.cpp
dragonegg/trunk/src/ConstantConversion.cpp
dragonegg/trunk/src/Convert.cpp
dragonegg/trunk/src/DefaultABI.cpp
dragonegg/trunk/src/TypeConversion.cpp
dragonegg/trunk/src/x86/Target.cpp
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=166589&r1=166588&r2=166589&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Wed Oct 24 12:13:13 2012
@@ -767,7 +767,7 @@
Type *FPTy =
FunctionType::get(Type::getVoidTy(Context),
std::vector<Type*>(), false);
- FPTy = FPTy->getPointerTo(0);
+ FPTy = FPTy->getPointerTo();
for (unsigned i = 0, e = Tors.size(); i != e; ++i) {
StructInit[0] = ConstantInt::get(Type::getInt32Ty(Context), Tors[i].second);
Modified: dragonegg/trunk/src/ConstantConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/ConstantConversion.cpp?rev=166589&r1=166588&r2=166589&view=diff
==============================================================================
--- dragonegg/trunk/src/ConstantConversion.cpp (original)
+++ dragonegg/trunk/src/ConstantConversion.cpp Wed Oct 24 12:13:13 2012
@@ -295,7 +295,7 @@
llvm_unreachable("Unsupported type!");
case Type::PointerTyID: {
// Cast to an integer with the same number of bits and return that.
- IntegerType *IntTy = getDataLayout().getIntPtrType(Ty);
+ IntegerType *IntTy = getDataLayout().getIntPtrType(Context);
return BitSlice(0, StoreSize, Folder.CreatePtrToInt(C, IntTy));
}
case Type::DoubleTyID:
@@ -445,7 +445,7 @@
case Type::PointerTyID: {
// Interpret as an integer with the same number of bits then cast back to
// the original type.
- IntegerType *IntTy = getDataLayout().getIntPtrType(Ty);
+ IntegerType *IntTy = getDataLayout().getIntPtrType(Context);
C = InterpretAsType(C, IntTy, StartingBit, Folder);
return Folder.CreateIntToPtr(C, Ty);
}
@@ -559,9 +559,7 @@
unsigned NumElts = TYPE_VECTOR_SUBPARTS(type);
unsigned Stride = GET_MODE_BITSIZE(TYPE_MODE(elt_type));
SmallVector<Constant*, 16> Vals(NumElts);
- // FIXME: what is the address space here?
- unsigned AS = 0;
- IntegerType *IntPtrTy = getDataLayout().getIntPtrType(Context, AS);
+ IntegerType *IntPtrTy = getDataLayout().getIntPtrType(Context);
for (unsigned i = 0; i != NumElts; ++i) {
Vals[i] = ExtractRegisterFromConstantImpl(C, elt_type,
StartingBit+i*Stride, Folder);
@@ -985,7 +983,7 @@
if (isa<VECTOR_TYPE>(init_type) && ActualEltTy == EltTy) {
// If this is a vector of pointers, convert it to a vector of integers.
if (isa<PointerType>(EltTy)) {
- IntegerType *IntPtrTy = getDataLayout().getIntPtrType(EltTy);
+ IntegerType *IntPtrTy = getDataLayout().getIntPtrType(Context);
for (unsigned i = 0, e = Elts.size(); i != e; ++i)
Elts[i] = Folder.CreatePtrToInt(Elts[i], IntPtrTy);
}
@@ -1353,7 +1351,7 @@
Constant *LHS = getAsRegister(TREE_OPERAND(exp, 0), Folder);
Constant *RHS = getAsRegister(TREE_OPERAND(exp, 1), Folder);
if (LHS->getType()->getScalarType()->isPointerTy()) {
- Type *PtrIntTy = getDataLayout().getIntPtrType(LHS->getType());
+ Type *PtrIntTy = getDataLayout().getIntPtrType(Context);
LHS = Folder.CreatePtrToInt(LHS, PtrIntTy);
RHS = Folder.CreatePtrToInt(RHS, PtrIntTy);
}
@@ -1542,8 +1540,7 @@
// doing the GEP on a pointer to the first array element.
Constant *ArrayAddr = AddressOfImpl(array, Folder);
Type *EltTy = ConvertType(main_type(main_type(array)));
- // FIXME: not sure what to put here.
- ArrayAddr = Folder.CreateBitCast(ArrayAddr, EltTy->getPointerTo(0));
+ ArrayAddr = Folder.CreateBitCast(ArrayAddr, EltTy->getPointerTo());
return POINTER_TYPE_OVERFLOW_UNDEFINED ?
Folder.CreateInBoundsGetElementPtr(ArrayAddr, IndexVal) :
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=166589&r1=166588&r2=166589&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Wed Oct 24 12:13:13 2012
@@ -461,7 +461,7 @@
Value *Res = UndefValue::get(RegTy);
bool isVectorOfPointers = isa<PointerType>(EltRegTy);
unsigned Stride = GET_MODE_SIZE(TYPE_MODE(elt_type));
- IntegerType *IntPtrTy = getDataLayout().getIntPtrType(EltRegTy);
+ IntegerType *IntPtrTy = getDataLayout().getIntPtrType(Context);
for (unsigned i = 0; i != NumElts; ++i) {
Value *Idx = Builder.getInt32(i);
Value *Elt = LoadRegisterFromMemory(Loc, elt_type, AliasTag, Builder);
@@ -840,10 +840,8 @@
// bytes, but only 10 are copied. If the object is really a union
// we might need the other bytes. We must also be careful to use
// the smaller alignment.
- // FIXME: Where do we get the address space?
- unsigned AS = 0;
Type *SBP = Type::getInt8PtrTy(Context);
- Type *IntPtr = getDataLayout().getIntPtrType(Context, AS);
+ Type *IntPtr = getDataLayout().getIntPtrType(Context);
Value *Ops[5] = {
Builder.CreateCast(Instruction::BitCast, Loc, SBP),
Builder.CreateCast(Instruction::BitCast, AI, SBP),
@@ -1357,7 +1355,7 @@
Builder.CreateBitCast(ResultLV.Ptr, Type::getInt8PtrTy(Context));
ResultLV.Ptr =
Builder.CreateGEP(ResultLV.Ptr,
- ConstantInt::get(TD.getIntPtrType(ResultLV.Ptr->getType()),
+ ConstantInt::get(TD.getIntPtrType(Context),
ReturnOffset),
flag_verbose_asm ? "rtvl" : "");
ResultLV.setAlignment(MinAlign(ResultLV.getAlignment(), ReturnOffset));
@@ -1863,7 +1861,7 @@
cast<VectorType>(OrigTy)->getNumElements() : 0;
if (OrigEltTy->isPointerTy()) {
// A pointer/vector of pointer - form a (vector of) pointer sized integers.
- Type *NewEltTy = TD.getIntPtrType(OrigEltTy);
+ Type *NewEltTy = TD.getIntPtrType(Context);
Type *NewTy = VecElts ? VectorType::get(NewEltTy, VecElts) : NewEltTy;
return Builder.CreatePtrToInt(V, NewTy);
}
@@ -2221,9 +2219,8 @@
Value *TreeToLLVM::EmitMemCpy(Value *DestPtr, Value *SrcPtr, Value *Size,
unsigned Align) {
-
Type *SBP = Type::getInt8PtrTy(Context);
- Type *IntPtr = TD.getIntPtrType(DestPtr->getType());
+ Type *IntPtr = TD.getIntPtrType(Context);
Value *Ops[5] = {
Builder.CreateBitCast(DestPtr, SBP),
Builder.CreateBitCast(SrcPtr, SBP),
@@ -2241,7 +2238,7 @@
Value *TreeToLLVM::EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size,
unsigned Align) {
Type *SBP = Type::getInt8PtrTy(Context);
- Type *IntPtr = TD.getIntPtrType(DestPtr->getType());
+ Type *IntPtr = TD.getIntPtrType(Context);
Value *Ops[5] = {
Builder.CreateBitCast(DestPtr, SBP),
Builder.CreateBitCast(SrcPtr, SBP),
@@ -2259,7 +2256,7 @@
Value *TreeToLLVM::EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size,
unsigned Align) {
Type *SBP = Type::getInt8PtrTy(Context);
- Type *IntPtr = TD.getIntPtrType(DestPtr->getType());
+ Type *IntPtr = TD.getIntPtrType(Context);
Value *Ops[5] = {
Builder.CreateBitCast(DestPtr, SBP),
Builder.CreateIntCast(SrcVal, Type::getInt8Ty(Context), /*isSigned*/true),
@@ -2908,7 +2905,7 @@
// LLVM does not support vectors of pointers, so turn any pointers into
// integers.
if (isa<PointerType>(Elt->getType()))
- Elt = Builder.CreatePtrToInt(Elt, TD.getIntPtrType(Elt->getType()));
+ Elt = Builder.CreatePtrToInt(Elt, TD.getIntPtrType(Context));
assert(Elt->getType() == VTy->getElementType() &&
"Unexpected type for vector constructor!");
BuildVecOps.push_back(Elt);
@@ -2974,7 +2971,7 @@
assert(!BYTES_BIG_ENDIAN && "Unsupported case - please report");
assert(LLVMTy->isIntegerTy() && "Expected an integer value!");
Type *LoadType = IntegerType::get(Context, RealSize * 8);
- L = Builder.CreateBitCast(L, LoadType->getPointerTo(LLVMTy));
+ L = Builder.CreateBitCast(L, LoadType->getPointerTo());
Value *Val = Builder.CreateLoad(L);
if (LoadType->getPrimitiveSizeInBits() >= LLVMTy->getPrimitiveSizeInBits())
Val = Builder.CreateTrunc(Val, LLVMTy);
@@ -3480,7 +3477,7 @@
if (Client.Offset) {
Ptr = Builder.CreateBitCast(Ptr, Type::getInt8PtrTy(Context));
Ptr = Builder.CreateGEP(Ptr,
- ConstantInt::get(TD.getIntPtrType(Ptr->getType()), Client.Offset),
+ ConstantInt::get(TD.getIntPtrType(Context), Client.Offset),
flag_verbose_asm ? "ro" : "");
Align = MinAlign(Align, Client.Offset);
MaxStoreSize -= Client.Offset;
@@ -5677,9 +5674,7 @@
if (!validate_gimple_arglist(stmt, INTEGER_TYPE, POINTER_TYPE, VOID_TYPE))
return false;
- // FIXME: Where do I get the address space from here?
- unsigned AS = 0;
- Type *IntPtr = TD.getIntPtrType(Context, AS);
+ Type *IntPtr = TD.getIntPtrType(Context);
Value *Offset = EmitMemory(gimple_call_arg(stmt, 0));
Value *Handler = EmitMemory(gimple_call_arg(stmt, 1));
@@ -6028,7 +6023,7 @@
ArrayAddr = ArrayAddrLV.Ptr;
ArrayAlign = ArrayAddrLV.getAlignment();
- Type *IntPtrTy = getDataLayout().getIntPtrType(ArrayAddr->getType());
+ Type *IntPtrTy = getDataLayout().getIntPtrType(Context);
IndexVal = Builder.CreateIntCast(IndexVal, IntPtrTy,
/*isSigned*/!TYPE_UNSIGNED(IndexType));
@@ -6604,9 +6599,7 @@
// Convert the elements.
SmallVector<Constant*, 16> Elts;
- // FIXME: Where do I get the address space from?
- unsigned AS = 0;
- IntegerType *IntTy = getDataLayout().getIntPtrType(Context, AS);
+ IntegerType *IntTy = getDataLayout().getIntPtrType(Context);
for (tree elt = TREE_VECTOR_CST_ELTS(reg); elt; elt = TREE_CHAIN(elt)) {
Constant *Elt = EmitRegisterConstant(TREE_VALUE(elt));
// LLVM does not support vectors of pointers, so turn any pointers into
Modified: dragonegg/trunk/src/DefaultABI.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/DefaultABI.cpp?rev=166589&r1=166588&r2=166589&view=diff
==============================================================================
--- dragonegg/trunk/src/DefaultABI.cpp (original)
+++ dragonegg/trunk/src/DefaultABI.cpp Wed Oct 24 12:13:13 2012
@@ -148,7 +148,7 @@
if (ScalarType)
C.HandleAggregateResultAsScalar(ConvertType(ScalarType));
else if (LLVM_SHOULD_RETURN_VECTOR_AS_SHADOW(type, isBuiltin))
- C.HandleScalarShadowResult(Ty->getPointerTo(0), false);
+ C.HandleScalarShadowResult(Ty->getPointerTo(), false);
else
C.HandleScalarResult(Ty);
} else if (Ty->isSingleValueType() || Ty->isVoidTy()) {
Modified: dragonegg/trunk/src/TypeConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/TypeConversion.cpp?rev=166589&r1=166588&r2=166589&view=diff
==============================================================================
--- dragonegg/trunk/src/TypeConversion.cpp (original)
+++ dragonegg/trunk/src/TypeConversion.cpp Wed Oct 24 12:13:13 2012
@@ -300,7 +300,7 @@
// void* -> byte*
return GetUnitPointerType(Context);
// FIXME: Handle address spaces.
- return ConvertType(type)->getPointerTo(0);
+ return ConvertType(type)->getPointerTo();
}
/// GetUnitType - Returns an integer one address unit wide if 'NumUnits' is 1;
@@ -457,9 +457,7 @@
}
case OFFSET_TYPE:
- // FIXME: Need to get the Address space here.
- unsigned AS = 0;
- return getDataLayout().getIntPtrType(Context, AS);
+ return getDataLayout().getIntPtrType(Context);
case POINTER_TYPE:
case REFERENCE_TYPE:
@@ -486,11 +484,9 @@
case VECTOR_TYPE: {
// LLVM does not support vectors of pointers, so turn any pointers into
- // integers. <-- This isn't true since at least 3.1 as far as I know - MicahV
- // FIXME: Need to get the Address space here.
- unsigned AS = 0;
+ // integers.
Type *EltTy = isa<ACCESS_TYPE>(TREE_TYPE(type)) ?
- getDataLayout().getIntPtrType(Context, AS) : getRegType(TREE_TYPE(type));
+ getDataLayout().getIntPtrType(Context) : getRegType(TREE_TYPE(type));
return VectorType::get(EltTy, TYPE_VECTOR_SUBPARTS(type));
}
@@ -1423,9 +1419,7 @@
// which are really just integer offsets. Return the appropriate integer
// type directly.
// Caching the type conversion is not worth it.
- // FIXME: Need to get the Address space here.
- unsigned AS = 0;
- return CheckTypeConversion(type, getDataLayout().getIntPtrType(Context, AS));
+ return CheckTypeConversion(type, getDataLayout().getIntPtrType(Context));
case REAL_TYPE:
// Caching the type conversion is not worth it.
@@ -1464,9 +1458,7 @@
// LLVM does not support vectors of pointers, so turn any pointers into
// integers.
if (isa<ACCESS_TYPE>(TREE_TYPE(type)))
- // FIXME: Need to get the Address space here.
- unsigned AS = 0;
- Ty = getDataLayout().getIntPtrType(Context, AS);
+ Ty = getDataLayout().getIntPtrType(Context);
else
Ty = ConvertTypeNonRecursive(main_type(type));
Ty = VectorType::get(Ty, TYPE_VECTOR_SUBPARTS(type));
Modified: dragonegg/trunk/src/x86/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/x86/Target.cpp?rev=166589&r1=166588&r2=166589&view=diff
==============================================================================
--- dragonegg/trunk/src/x86/Target.cpp (original)
+++ dragonegg/trunk/src/x86/Target.cpp Wed Oct 24 12:13:13 2012
@@ -410,42 +410,42 @@
//TODO }
case loadups: {
VectorType *v4f32 = VectorType::get(Type::getFloatTy(Context), 4);
- PointerType *v4f32Ptr = v4f32->getPointerTo(0);
+ PointerType *v4f32Ptr = v4f32->getPointerTo();
Value *BC = Builder.CreateBitCast(Ops[0], v4f32Ptr);
Result = Builder.CreateAlignedLoad(BC, 1);
return true;
}
case loadupd: {
VectorType *v2f64 = VectorType::get(Type::getDoubleTy(Context), 2);
- PointerType *v2f64Ptr = v2f64->getPointerTo(0);
+ PointerType *v2f64Ptr = v2f64->getPointerTo();
Value *BC = Builder.CreateBitCast(Ops[0], v2f64Ptr);
Result = Builder.CreateAlignedLoad(BC, 1);
return true;
}
case loaddqu: {
VectorType *v16i8 = VectorType::get(Type::getInt8Ty(Context), 16);
- PointerType *v16i8Ptr = v16i8->getPointerTo(0);
+ PointerType *v16i8Ptr = v16i8->getPointerTo();
Value *BC = Builder.CreateBitCast(Ops[0], v16i8Ptr);
Result = Builder.CreateAlignedLoad(BC, 1);
return true;
}
case storeups: {
VectorType *v4f32 = VectorType::get(Type::getFloatTy(Context), 4);
- PointerType *v4f32Ptr = v4f32->getPointerTo(0);
+ PointerType *v4f32Ptr = v4f32->getPointerTo();
Value *BC = Builder.CreateBitCast(Ops[0], v4f32Ptr);
Builder.CreateAlignedStore(Ops[1], BC, 1);
return true;
}
case storeupd: {
VectorType *v2f64 = VectorType::get(Type::getDoubleTy(Context), 2);
- PointerType *v2f64Ptr = v2f64->getPointerTo(0);
+ PointerType *v2f64Ptr = v2f64->getPointerTo();
Value *BC = Builder.CreateBitCast(Ops[0], v2f64Ptr);
Builder.CreateAlignedStore(Ops[1], BC, 1);
return true;
}
case storedqu: {
VectorType *v16i8 = VectorType::get(Type::getInt8Ty(Context), 16);
- PointerType *v16i8Ptr = v16i8->getPointerTo(0);
+ PointerType *v16i8Ptr = v16i8->getPointerTo();
Value *BC = Builder.CreateBitCast(Ops[0], v16i8Ptr);
Builder.CreateAlignedStore(Ops[1], BC, 1);
return true;
More information about the llvm-commits
mailing list