[llvm-commits] [dragonegg] r166590 - in /dragonegg/trunk/src: ConstantConversion.cpp Convert.cpp TypeConversion.cpp
Micah Villmow
villmow at gmail.com
Wed Oct 24 10:16:35 PDT 2012
Author: mvillmow
Date: Wed Oct 24 12:16:35 2012
New Revision: 166590
URL: http://llvm.org/viewvc/llvm-project?rev=166590&view=rev
Log:
Commit the files that I missed with r166578 without changes that have not been reviewed yet.
Modified:
dragonegg/trunk/src/ConstantConversion.cpp
dragonegg/trunk/src/Convert.cpp
dragonegg/trunk/src/TypeConversion.cpp
Modified: dragonegg/trunk/src/ConstantConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/ConstantConversion.cpp?rev=166590&r1=166589&r2=166590&view=diff
==============================================================================
--- dragonegg/trunk/src/ConstantConversion.cpp (original)
+++ dragonegg/trunk/src/ConstantConversion.cpp Wed Oct 24 12:16:35 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(Context);
+ IntegerType *IntTy = getDataLayout().getIntPtrType(Ty);
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(Context);
+ IntegerType *IntTy = getDataLayout().getIntPtrType(Ty);
C = InterpretAsType(C, IntTy, StartingBit, Folder);
return Folder.CreateIntToPtr(C, Ty);
}
@@ -559,7 +559,9 @@
unsigned NumElts = TYPE_VECTOR_SUBPARTS(type);
unsigned Stride = GET_MODE_BITSIZE(TYPE_MODE(elt_type));
SmallVector<Constant*, 16> Vals(NumElts);
- IntegerType *IntPtrTy = getDataLayout().getIntPtrType(Context);
+ // FIXME: what is the address space here?
+ unsigned AS = 0;
+ IntegerType *IntPtrTy = getDataLayout().getIntPtrType(Context, AS);
for (unsigned i = 0; i != NumElts; ++i) {
Vals[i] = ExtractRegisterFromConstantImpl(C, elt_type,
StartingBit+i*Stride, Folder);
@@ -983,7 +985,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(Context);
+ IntegerType *IntPtrTy = getDataLayout().getIntPtrType(EltTy);
for (unsigned i = 0, e = Elts.size(); i != e; ++i)
Elts[i] = Folder.CreatePtrToInt(Elts[i], IntPtrTy);
}
@@ -1351,7 +1353,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(Context);
+ Type *PtrIntTy = getDataLayout().getIntPtrType(LHS->getType());
LHS = Folder.CreatePtrToInt(LHS, PtrIntTy);
RHS = Folder.CreatePtrToInt(RHS, PtrIntTy);
}
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=166590&r1=166589&r2=166590&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Wed Oct 24 12:16:35 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(Context);
+ IntegerType *IntPtrTy = getDataLayout().getIntPtrType(EltRegTy);
for (unsigned i = 0; i != NumElts; ++i) {
Value *Idx = Builder.getInt32(i);
Value *Elt = LoadRegisterFromMemory(Loc, elt_type, AliasTag, Builder);
@@ -840,8 +840,10 @@
// 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);
+ Type *IntPtr = getDataLayout().getIntPtrType(Context, AS);
Value *Ops[5] = {
Builder.CreateCast(Instruction::BitCast, Loc, SBP),
Builder.CreateCast(Instruction::BitCast, AI, SBP),
@@ -1355,7 +1357,7 @@
Builder.CreateBitCast(ResultLV.Ptr, Type::getInt8PtrTy(Context));
ResultLV.Ptr =
Builder.CreateGEP(ResultLV.Ptr,
- ConstantInt::get(TD.getIntPtrType(Context),
+ ConstantInt::get(TD.getIntPtrType(ResultLV.Ptr->getType()),
ReturnOffset),
flag_verbose_asm ? "rtvl" : "");
ResultLV.setAlignment(MinAlign(ResultLV.getAlignment(), ReturnOffset));
@@ -1861,7 +1863,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(Context);
+ Type *NewEltTy = TD.getIntPtrType(OrigEltTy);
Type *NewTy = VecElts ? VectorType::get(NewEltTy, VecElts) : NewEltTy;
return Builder.CreatePtrToInt(V, NewTy);
}
@@ -2219,8 +2221,9 @@
Value *TreeToLLVM::EmitMemCpy(Value *DestPtr, Value *SrcPtr, Value *Size,
unsigned Align) {
+
Type *SBP = Type::getInt8PtrTy(Context);
- Type *IntPtr = TD.getIntPtrType(Context);
+ Type *IntPtr = TD.getIntPtrType(DestPtr->getType());
Value *Ops[5] = {
Builder.CreateBitCast(DestPtr, SBP),
Builder.CreateBitCast(SrcPtr, SBP),
@@ -2238,7 +2241,7 @@
Value *TreeToLLVM::EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size,
unsigned Align) {
Type *SBP = Type::getInt8PtrTy(Context);
- Type *IntPtr = TD.getIntPtrType(Context);
+ Type *IntPtr = TD.getIntPtrType(DestPtr->getType());
Value *Ops[5] = {
Builder.CreateBitCast(DestPtr, SBP),
Builder.CreateBitCast(SrcPtr, SBP),
@@ -2256,7 +2259,7 @@
Value *TreeToLLVM::EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size,
unsigned Align) {
Type *SBP = Type::getInt8PtrTy(Context);
- Type *IntPtr = TD.getIntPtrType(Context);
+ Type *IntPtr = TD.getIntPtrType(DestPtr->getType());
Value *Ops[5] = {
Builder.CreateBitCast(DestPtr, SBP),
Builder.CreateIntCast(SrcVal, Type::getInt8Ty(Context), /*isSigned*/true),
@@ -2905,7 +2908,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(Context));
+ Elt = Builder.CreatePtrToInt(Elt, TD.getIntPtrType(Elt->getType()));
assert(Elt->getType() == VTy->getElementType() &&
"Unexpected type for vector constructor!");
BuildVecOps.push_back(Elt);
@@ -3477,7 +3480,7 @@
if (Client.Offset) {
Ptr = Builder.CreateBitCast(Ptr, Type::getInt8PtrTy(Context));
Ptr = Builder.CreateGEP(Ptr,
- ConstantInt::get(TD.getIntPtrType(Context), Client.Offset),
+ ConstantInt::get(TD.getIntPtrType(Ptr->getType()), Client.Offset),
flag_verbose_asm ? "ro" : "");
Align = MinAlign(Align, Client.Offset);
MaxStoreSize -= Client.Offset;
@@ -5674,7 +5677,9 @@
if (!validate_gimple_arglist(stmt, INTEGER_TYPE, POINTER_TYPE, VOID_TYPE))
return false;
- Type *IntPtr = TD.getIntPtrType(Context);
+ // FIXME: Where do I get the address space from here?
+ unsigned AS = 0;
+ Type *IntPtr = TD.getIntPtrType(Context, AS);
Value *Offset = EmitMemory(gimple_call_arg(stmt, 0));
Value *Handler = EmitMemory(gimple_call_arg(stmt, 1));
@@ -6023,7 +6028,7 @@
ArrayAddr = ArrayAddrLV.Ptr;
ArrayAlign = ArrayAddrLV.getAlignment();
- Type *IntPtrTy = getDataLayout().getIntPtrType(Context);
+ Type *IntPtrTy = getDataLayout().getIntPtrType(ArrayAddr->getType());
IndexVal = Builder.CreateIntCast(IndexVal, IntPtrTy,
/*isSigned*/!TYPE_UNSIGNED(IndexType));
@@ -6599,7 +6604,9 @@
// Convert the elements.
SmallVector<Constant*, 16> Elts;
- IntegerType *IntTy = getDataLayout().getIntPtrType(Context);
+ // FIXME: Where do I get the address space from?
+ unsigned AS = 0;
+ IntegerType *IntTy = getDataLayout().getIntPtrType(Context, AS);
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/TypeConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/TypeConversion.cpp?rev=166590&r1=166589&r2=166590&view=diff
==============================================================================
--- dragonegg/trunk/src/TypeConversion.cpp (original)
+++ dragonegg/trunk/src/TypeConversion.cpp Wed Oct 24 12:16:35 2012
@@ -457,7 +457,9 @@
}
case OFFSET_TYPE:
- return getDataLayout().getIntPtrType(Context);
+ // FIXME: Need to get the Address space here.
+ unsigned AS = 0;
+ return getDataLayout().getIntPtrType(Context, AS);
case POINTER_TYPE:
case REFERENCE_TYPE:
@@ -484,9 +486,11 @@
case VECTOR_TYPE: {
// LLVM does not support vectors of pointers, so turn any pointers into
- // integers.
+ // 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;
Type *EltTy = isa<ACCESS_TYPE>(TREE_TYPE(type)) ?
- getDataLayout().getIntPtrType(Context) : getRegType(TREE_TYPE(type));
+ getDataLayout().getIntPtrType(Context, AS) : getRegType(TREE_TYPE(type));
return VectorType::get(EltTy, TYPE_VECTOR_SUBPARTS(type));
}
@@ -1419,7 +1423,9 @@
// which are really just integer offsets. Return the appropriate integer
// type directly.
// Caching the type conversion is not worth it.
- return CheckTypeConversion(type, getDataLayout().getIntPtrType(Context));
+ // FIXME: Need to get the Address space here.
+ unsigned AS = 0;
+ return CheckTypeConversion(type, getDataLayout().getIntPtrType(Context, AS));
case REAL_TYPE:
// Caching the type conversion is not worth it.
@@ -1458,7 +1464,9 @@
// LLVM does not support vectors of pointers, so turn any pointers into
// integers.
if (isa<ACCESS_TYPE>(TREE_TYPE(type)))
- Ty = getDataLayout().getIntPtrType(Context);
+ // FIXME: Need to get the Address space here.
+ unsigned AS = 0;
+ Ty = getDataLayout().getIntPtrType(Context, AS);
else
Ty = ConvertTypeNonRecursive(main_type(type));
Ty = VectorType::get(Ty, TYPE_VECTOR_SUBPARTS(type));
More information about the llvm-commits
mailing list