[llvm-commits] [dragonegg] r165393 - in /dragonegg/trunk: include/dragonegg/ABI.h include/dragonegg/Internals.h src/Backend.cpp src/ConstantConversion.cpp src/Convert.cpp src/DefaultABI.cpp src/TypeConversion.cpp src/x86/Target.cpp www/disambiguate.diff
Micah Villmow
villmow at gmail.com
Mon Oct 8 09:20:53 PDT 2012
Author: mvillmow
Date: Mon Oct 8 11:20:52 2012
New Revision: 165393
URL: http://llvm.org/viewvc/llvm-project?rev=165393&view=rev
Log:
Move TargetData to DataLayout.
Modified:
dragonegg/trunk/include/dragonegg/ABI.h
dragonegg/trunk/include/dragonegg/Internals.h
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
dragonegg/trunk/www/disambiguate.diff
Modified: dragonegg/trunk/include/dragonegg/ABI.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/ABI.h?rev=165393&r1=165392&r2=165393&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/ABI.h (original)
+++ dragonegg/trunk/include/dragonegg/ABI.h Mon Oct 8 11:20:52 2012
@@ -32,7 +32,7 @@
// LLVM headers
#include "llvm/LLVMContext.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
namespace llvm {
class BasicBlock;
@@ -149,7 +149,7 @@
inline
Type* getLLVMScalarTypeForStructReturn(tree_node *type, unsigned *Offset) {
Type *Ty = ConvertType(type);
- uint64_t Size = getTargetData().getTypeAllocSize(Ty);
+ uint64_t Size = getDataLayout().getTypeAllocSize(Ty);
*Offset = 0;
if (Size == 0)
return Type::getVoidTy(getGlobalContext());
Modified: dragonegg/trunk/include/dragonegg/Internals.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Internals.h?rev=165393&r1=165392&r2=165393&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Internals.h (original)
+++ dragonegg/trunk/include/dragonegg/Internals.h Mon Oct 8 11:20:52 2012
@@ -51,7 +51,7 @@
class ConstantInt;
class Type;
class TargetMachine;
- class TargetData;
+ class DataLayout;
template<typename> class AssertingVH;
template<typename> class TrackingVH;
}
@@ -77,8 +77,8 @@
/// TheFolder - The constant folder to use.
extern TargetFolder *TheFolder;
-/// getTargetData - Return the current TargetData object from TheTarget.
-const TargetData &getTargetData();
+/// getDataLayout - Return the current DataLayout object from TheTarget.
+const DataLayout &getDataLayout();
/// flag_default_initialize_globals - Whether global variables with no explicit
/// initial value should be zero initialized.
@@ -222,7 +222,7 @@
///
class TreeToLLVM {
// State that is initialized when the function starts.
- const TargetData &TD;
+ const DataLayout &TD;
tree_node *FnDecl;
Function *Fn;
BasicBlock *ReturnBB;
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=165393&r1=165392&r2=165393&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Mon Oct 8 11:20:52 2012
@@ -42,7 +42,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/TargetRegistry.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
@@ -275,9 +275,9 @@
// TODO: Change getTypeSizeInBits for aggregate types so it is no longer
// rounded up to the alignment.
uint64_t gcc_size = getInt64(DECL_SIZE(decl), true);
- const TargetData *TD = TheTarget->getTargetData();
+ const DataLayout *TD = TheTarget->getDataLayout();
unsigned Align = 8 * TD->getABITypeAlignment(Ty);
- return TheTarget->getTargetData()->getTypeAllocSizeInBits(Ty) ==
+ return TheTarget->getDataLayout()->getTypeAllocSizeInBits(Ty) ==
((gcc_size + Align - 1) / Align) * Align;
}
#endif
@@ -491,7 +491,7 @@
#endif
TheTarget = TME->createTargetMachine(TargetTriple, CPU, FeatureStr, Options,
RelocModel, CMModel, CodeGenOptLevel());
- assert(TheTarget->getTargetData()->isBigEndian() == BYTES_BIG_ENDIAN);
+ assert(TheTarget->getDataLayout()->isBigEndian() == BYTES_BIG_ENDIAN);
TheTarget->setMCUseCFI(flag_dwarf2_cfi_asm);
// Binutils does not yet support the use of file directives with an explicit
// directory. FIXME: Once GCC learns to detect support for this, condition
@@ -529,7 +529,7 @@
// Install information about the target triple and data layout into the module
// for optimizer use.
TheModule->setTargetTriple(TargetTriple);
- TheModule->setDataLayout(TheTarget->getTargetData()->
+ TheModule->setDataLayout(TheTarget->getDataLayout()->
getStringRepresentation());
}
@@ -589,7 +589,7 @@
// Create a module to hold the generated LLVM IR.
CreateModule(TargetTriple);
- TheFolder = new TargetFolder(TheTarget->getTargetData());
+ TheFolder = new TargetFolder(TheTarget->getDataLayout());
if (debug_info_level > DINFO_LEVEL_NONE)
TheDebugInfo = new DebugInfo(TheModule);
@@ -639,7 +639,7 @@
// Create and set up the per-function pass manager.
// FIXME: Move the code generator to be function-at-a-time.
PerFunctionPasses = new FunctionPassManager(TheModule);
- PerFunctionPasses->add(new TargetData(TheModule));
+ PerFunctionPasses->add(new DataLayout(TheModule));
#ifndef NDEBUG
PerFunctionPasses->add(createVerifierPass());
@@ -682,7 +682,7 @@
return;
PerModulePasses = new PassManager();
- PerModulePasses->add(new TargetData(TheModule));
+ PerModulePasses->add(new DataLayout(TheModule));
bool NeedAlwaysInliner = false;
llvm::Pass *InliningPass = 0;
@@ -733,7 +733,7 @@
if (PerModulePasses || 1) {
FunctionPassManager *PM = CodeGenPasses =
new FunctionPassManager(TheModule);
- PM->add(new TargetData(*TheTarget->getTargetData()));
+ PM->add(new DataLayout(*TheTarget->getDataLayout()));
// Request that addPassesToEmitFile run the Verifier after running
// passes which modify the IR.
@@ -1129,7 +1129,7 @@
// If this is the alignment we would have given the variable anyway then don't
// use an explicit alignment, making the IR look more portable.
if (GV->getAlignment() ==
- getTargetData().getABITypeAlignment(GV->getType()->getElementType()))
+ getDataLayout().getABITypeAlignment(GV->getType()->getElementType()))
GV->setAlignment(0);
// Handle used decls
Modified: dragonegg/trunk/src/ConstantConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/ConstantConversion.cpp?rev=165393&r1=165392&r2=165393&view=diff
==============================================================================
--- dragonegg/trunk/src/ConstantConversion.cpp (original)
+++ dragonegg/trunk/src/ConstantConversion.cpp Mon Oct 8 11:20:52 2012
@@ -32,7 +32,7 @@
#include "llvm/GlobalVariable.h"
#include "llvm/LLVMContext.h"
#include "llvm/Support/Host.h"
-#include "llvm/Target/TargetData.h"
+#include "llvm/DataLayout.h"
// System headers
#include <gmp.h>
@@ -282,7 +282,7 @@
// Sanitize the range to make life easier in what follows.
Type *Ty = C->getType();
- int StoreSize = getTargetData().getTypeStoreSizeInBits(Ty);
+ int StoreSize = getDataLayout().getTypeStoreSizeInBits(Ty);
R = R.Meet(SignedRange(0, StoreSize));
// Quick exit if it is clear that there are no bits in the range.
@@ -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 = getTargetData().getIntPtrType(Context);
+ IntegerType *IntTy = getDataLayout().getIntPtrType(Context);
return BitSlice(0, StoreSize, Folder.CreatePtrToInt(C, IntTy));
}
case Type::DoubleTyID:
@@ -321,7 +321,7 @@
case Type::ArrayTyID: {
ArrayType *ATy = cast<ArrayType>(Ty);
Type *EltTy = ATy->getElementType();
- const unsigned Stride = getTargetData().getTypeAllocSizeInBits(EltTy);
+ const unsigned Stride = getDataLayout().getTypeAllocSizeInBits(EltTy);
assert(Stride > 0 && "Store size smaller than alloc size?");
// Elements with indices in [FirstElt, LastElt) overlap the range.
unsigned FirstElt = R.getFirst() / Stride;
@@ -347,7 +347,7 @@
case Type::StructTyID: {
StructType *STy = cast<StructType>(Ty);
- const StructLayout *SL = getTargetData().getStructLayout(STy);
+ const StructLayout *SL = getDataLayout().getStructLayout(STy);
// Fields with indices in [FirstIdx, LastIdx) overlap the range.
unsigned FirstIdx = SL->getElementContainingOffset(R.getFirst()/8);
unsigned LastIdx = 1 + SL->getElementContainingOffset((R.getLast()-1)/8);
@@ -360,7 +360,7 @@
Constant *Field = Folder.CreateExtractValue(C, i);
// Only part of the field may be needed. Compute which bits they are.
Type *FieldTy = Field->getType();
- unsigned FieldStoreSize = getTargetData().getTypeStoreSizeInBits(FieldTy);
+ unsigned FieldStoreSize = getDataLayout().getTypeStoreSizeInBits(FieldTy);
SignedRange NeededBits(0, FieldStoreSize);
NeededBits = NeededBits.Meet(R.Displace(-FieldOffsetInBits));
// View the needed part of the field as a bunch of bits.
@@ -376,7 +376,7 @@
case Type::VectorTyID: {
VectorType *VTy = cast<VectorType>(Ty);
Type *EltTy = VTy->getElementType();
- const unsigned Stride = getTargetData().getTypeAllocSizeInBits(EltTy);
+ const unsigned Stride = getDataLayout().getTypeAllocSizeInBits(EltTy);
assert(Stride > 0 && "Store size smaller than alloc size?");
// Elements with indices in [FirstElt, LastElt) overlap the range.
unsigned FirstElt = R.getFirst() / Stride;
@@ -426,7 +426,7 @@
llvm_unreachable("Unsupported type!");
case Type::IntegerTyID: {
unsigned BitWidth = Ty->getPrimitiveSizeInBits();
- unsigned StoreSize = getTargetData().getTypeStoreSizeInBits(Ty);
+ unsigned StoreSize = getDataLayout().getTypeStoreSizeInBits(Ty);
// Convert the constant into a bunch of bits. Only the bits to be "loaded"
// out are needed, so rather than converting the entire constant this only
// converts enough to get all of the required bits.
@@ -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 = getTargetData().getIntPtrType(Context);
+ IntegerType *IntTy = getDataLayout().getIntPtrType(Context);
C = InterpretAsType(C, IntTy, StartingBit, Folder);
return Folder.CreateIntToPtr(C, Ty);
}
@@ -467,7 +467,7 @@
// Interpret each array element in turn.
ArrayType *ATy = cast<ArrayType>(Ty);
Type *EltTy = ATy->getElementType();
- const unsigned Stride = getTargetData().getTypeAllocSizeInBits(EltTy);
+ const unsigned Stride = getDataLayout().getTypeAllocSizeInBits(EltTy);
const unsigned NumElts = ATy->getNumElements();
std::vector<Constant*> Vals(NumElts);
for (unsigned i = 0; i != NumElts; ++i)
@@ -478,7 +478,7 @@
case Type::StructTyID: {
// Interpret each struct field in turn.
StructType *STy = cast<StructType>(Ty);
- const StructLayout *SL = getTargetData().getStructLayout(STy);
+ const StructLayout *SL = getDataLayout().getStructLayout(STy);
unsigned NumElts = STy->getNumElements();
std::vector<Constant*> Vals(NumElts);
for (unsigned i = 0; i != NumElts; ++i)
@@ -492,7 +492,7 @@
// Interpret each vector element in turn.
VectorType *VTy = cast<VectorType>(Ty);
Type *EltTy = VTy->getElementType();
- const unsigned Stride = getTargetData().getTypeAllocSizeInBits(EltTy);
+ const unsigned Stride = getDataLayout().getTypeAllocSizeInBits(EltTy);
const unsigned NumElts = VTy->getNumElements();
SmallVector<Constant*, 16> Vals(NumElts);
for (unsigned i = 0; i != NumElts; ++i)
@@ -559,7 +559,7 @@
unsigned NumElts = TYPE_VECTOR_SUBPARTS(type);
unsigned Stride = GET_MODE_BITSIZE(TYPE_MODE(elt_type));
SmallVector<Constant*, 16> Vals(NumElts);
- IntegerType *IntPtrTy = getTargetData().getIntPtrType(Context);
+ IntegerType *IntPtrTy = getDataLayout().getIntPtrType(Context);
for (unsigned i = 0; i != NumElts; ++i) {
Vals[i] = ExtractRegisterFromConstantImpl(C, elt_type,
StartingBit+i*Stride, Folder);
@@ -580,7 +580,7 @@
/// using LoadRegisterFromMemory to load a register value back out starting from
/// byte StartingByte.
Constant *ExtractRegisterFromConstant(Constant *C, tree type, int StartingByte) {
- TargetFolder Folder(&getTargetData());
+ TargetFolder Folder(&getDataLayout());
return ExtractRegisterFromConstantImpl(C, type, StartingByte, Folder);
}
@@ -817,7 +817,7 @@
/// ConvertArrayCONSTRUCTOR - Convert a CONSTRUCTOR with array or vector type.
static Constant *ConvertArrayCONSTRUCTOR(tree exp, TargetFolder &Folder) {
- const TargetData &TD = getTargetData();
+ const DataLayout &TD = getDataLayout();
tree init_type = main_type(exp);
Type *InitTy = ConvertType(init_type);
@@ -983,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 = getTargetData().getIntPtrType(Context);
+ IntegerType *IntPtrTy = getDataLayout().getIntPtrType(Context);
for (unsigned i = 0, e = Elts.size(); i != e; ++i)
Elts[i] = Folder.CreatePtrToInt(Elts[i], IntPtrTy);
}
@@ -1020,7 +1020,7 @@
/// isSafeToReturnContentsDirectly - Return whether the current value for the
/// constant properly represents the bits in the range and so can be handed to
/// the user as is.
- bool isSafeToReturnContentsDirectly(const TargetData &TD) const {
+ bool isSafeToReturnContentsDirectly(const DataLayout &TD) const {
// If there is no constant (allowed when the range is empty) then one needs
// to be created.
if (!C)
@@ -1069,7 +1069,7 @@
/// larger than the width of the range. Unlike the other methods for this
/// class, this one requires that the width of the range be a multiple of an
/// address unit, which usually means a multiple of 8.
- Constant *extractContents(const TargetData &TD) {
+ Constant *extractContents(const DataLayout &TD) {
assert(R.getWidth() % BITS_PER_UNIT == 0 && "Boundaries not aligned?");
/// If the current value for the constant can be used to represent the bits
/// in the range then just return it.
@@ -1135,7 +1135,7 @@
// FIXME: This new logic, especially the handling of bitfields, is untested
// and probably wrong on big-endian machines.
IntervalList<FieldContents, int, 8> Layout;
- const TargetData &TD = getTargetData();
+ const DataLayout &TD = getDataLayout();
tree type = main_type(exp);
Type *Ty = ConvertType(type);
uint64_t TypeSize = TD.getTypeAllocSizeInBits(Ty);
@@ -1351,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 = getTargetData().getIntPtrType(Context);
+ Type *PtrIntTy = getDataLayout().getIntPtrType(Context);
LHS = Folder.CreatePtrToInt(LHS, PtrIntTy);
RHS = Folder.CreatePtrToInt(RHS, PtrIntTy);
}
@@ -1445,14 +1445,14 @@
// sizes should be the same.
Type *Ty = ConvertType(TREE_TYPE(exp));
if (Ty->isSized()) {
- uint64_t InitSize = getTargetData().getTypeAllocSizeInBits(Init->getType());
- uint64_t TypeSize = getTargetData().getTypeAllocSizeInBits(Ty);
+ uint64_t InitSize = getDataLayout().getTypeAllocSizeInBits(Init->getType());
+ uint64_t TypeSize = getDataLayout().getTypeAllocSizeInBits(Ty);
if (InitSize < TypeSize) {
debug_tree(exp);
llvm_unreachable("Constant too small for type!");
}
}
- if (getTargetData().getABITypeAlignment(Init->getType()) * 8 >
+ if (getDataLayout().getABITypeAlignment(Init->getType()) * 8 >
TYPE_ALIGN(main_type(exp))) {
debug_tree(exp);
llvm_unreachable("Constant over aligned!");
@@ -1476,7 +1476,7 @@
/// initial value may exceed the alloc size of the LLVM memory type generated
/// for the GCC type (see ConvertType); it is never smaller than the alloc size.
Constant *ConvertInitializer(tree exp) {
- TargetFolder Folder(&getTargetData());
+ TargetFolder Folder(&getDataLayout());
return ConvertInitializerImpl(exp, Folder);
}
@@ -1706,6 +1706,6 @@
/// type of the pointee is the memory type that corresponds to the type of exp
/// (see ConvertType).
Constant *AddressOf(tree exp) {
- TargetFolder Folder(&getTargetData());
+ TargetFolder Folder(&getDataLayout());
return AddressOfImpl(exp, Folder);
}
Modified: dragonegg/trunk/src/Convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Convert.cpp?rev=165393&r1=165392&r2=165393&view=diff
==============================================================================
--- dragonegg/trunk/src/Convert.cpp (original)
+++ dragonegg/trunk/src/Convert.cpp Mon Oct 8 11:20:52 2012
@@ -363,7 +363,7 @@
return false;
// Check that the field positions agree with GCC.
unsigned StrideBits = GET_MODE_BITSIZE(TYPE_MODE(elt_type));
- return getTargetData().getTypeAllocSizeInBits(EltRegTy) == StrideBits;
+ return getDataLayout().getTypeAllocSizeInBits(EltRegTy) == StrideBits;
}
case OFFSET_TYPE:
@@ -449,7 +449,7 @@
// See if changing the element type to an integer with size equal to the
// mode size gives a vector type that corresponds to the in-memory layout.
Type *MemTy = IntegerType::get(Context, Size);
- if (getTargetData().getTypeAllocSizeInBits(MemTy) == Size) {
+ if (getDataLayout().getTypeAllocSizeInBits(MemTy) == Size) {
// It does! Load out the memory as a vector of that type then truncate
// to the register size.
Type *MemVecTy = VectorType::get(MemTy, NumElts);
@@ -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 = getTargetData().getIntPtrType(Context);
+ 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);
@@ -536,7 +536,7 @@
// See if changing the element type to an integer with size equal to the
// mode size gives a vector type that corresponds to the in-memory layout.
Type *MemTy = IntegerType::get(Context, Size);
- if (getTargetData().getTypeAllocSizeInBits(MemTy) == Size) {
+ if (getDataLayout().getTypeAllocSizeInBits(MemTy) == Size) {
// It does! Extend the register value to a vector of that type then
// store it to memory.
Type *MemVecTy = VectorType::get(MemTy, NumElts);
@@ -568,8 +568,8 @@
/// TheTreeToLLVM - Keep track of the current function being compiled.
TreeToLLVM *TheTreeToLLVM = 0;
-const TargetData &getTargetData() {
- return *TheTarget->getTargetData();
+const DataLayout &getDataLayout() {
+ return *TheTarget->getDataLayout();
}
/// EmitDebugInfo - Return true if debug info is to be emitted for current
@@ -581,7 +581,7 @@
}
TreeToLLVM::TreeToLLVM(tree fndecl) :
- TD(getTargetData()), Builder(Context, *TheFolder) {
+ TD(getDataLayout()), Builder(Context, *TheFolder) {
FnDecl = fndecl;
AllocaInsertionPoint = 0;
Fn = 0;
@@ -841,7 +841,7 @@
// we might need the other bytes. We must also be careful to use
// the smaller alignment.
Type *SBP = Type::getInt8PtrTy(Context);
- Type *IntPtr = getTargetData().getIntPtrType(Context);
+ Type *IntPtr = getDataLayout().getIntPtrType(Context);
Value *Ops[5] = {
Builder.CreateCast(Instruction::BitCast, Loc, SBP),
Builder.CreateCast(Instruction::BitCast, AI, SBP),
@@ -1339,9 +1339,9 @@
RetVals.push_back(Builder.CreateBitCast(Load, Fn->getReturnType()));
} else {
uint64_t ResultSize =
- getTargetData().getTypeAllocSize(ConvertType(TREE_TYPE(TreeRetVal)));
+ getDataLayout().getTypeAllocSize(ConvertType(TREE_TYPE(TreeRetVal)));
uint64_t ReturnSize =
- getTargetData().getTypeAllocSize(Fn->getReturnType());
+ getDataLayout().getTypeAllocSize(Fn->getReturnType());
// The load does not necessarily start at the beginning of the aggregate
// (x86-64).
@@ -2083,7 +2083,7 @@
SrcLoc.Ptr = Builder.CreateBitCast(SrcLoc.Ptr, CompType->getPointerTo());
// Copy each component in turn.
- unsigned ComponentBytes = getTargetData().getTypeAllocSize(CompType);
+ unsigned ComponentBytes = getDataLayout().getTypeAllocSize(CompType);
unsigned ArrayLength = ArrayLengthOf(type);
for (unsigned i = 0; i != ArrayLength; ++i) {
// Get the address of the component.
@@ -2178,7 +2178,7 @@
DestLoc.Ptr = Builder.CreateBitCast(DestLoc.Ptr, CompType->getPointerTo());
// Zero each component in turn.
- unsigned ComponentBytes = getTargetData().getTypeAllocSize(CompType);
+ unsigned ComponentBytes = getDataLayout().getTypeAllocSize(CompType);
unsigned ArrayLength = ArrayLengthOf(type);
for (unsigned i = 0; i != ArrayLength; ++i) {
// Get the address of the component.
@@ -2380,7 +2380,7 @@
// If this is the alignment we would have given the variable anyway then don't
// use an explicit alignment, making the IR look more portable.
- if (Alignment == getTargetData().getABITypeAlignment(Ty))
+ if (Alignment == getDataLayout().getABITypeAlignment(Ty))
Alignment = 0;
// Insert an alloca for this variable.
@@ -6019,7 +6019,7 @@
ArrayAddr = ArrayAddrLV.Ptr;
ArrayAlign = ArrayAddrLV.getAlignment();
- Type *IntPtrTy = getTargetData().getIntPtrType(Context);
+ Type *IntPtrTy = getDataLayout().getIntPtrType(Context);
IndexVal = Builder.CreateIntCast(IndexVal, IntPtrTy,
/*isSigned*/!TYPE_UNSIGNED(IndexType));
@@ -6595,7 +6595,7 @@
// Convert the elements.
SmallVector<Constant*, 16> Elts;
- IntegerType *IntTy = getTargetData().getIntPtrType(Context);
+ 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=165393&r1=165392&r2=165393&view=diff
==============================================================================
--- dragonegg/trunk/src/DefaultABI.cpp (original)
+++ dragonegg/trunk/src/DefaultABI.cpp Mon Oct 8 11:20:52 2012
@@ -354,7 +354,7 @@
// from Int64 alignment. ARM backend needs this.
unsigned Align = TYPE_ALIGN(type)/8;
unsigned Int64Align =
- getTargetData().getABITypeAlignment(Type::getInt64Ty(getGlobalContext()));
+ getDataLayout().getABITypeAlignment(Type::getInt64Ty(getGlobalContext()));
bool UseInt64 = (DontCheckAlignment || Align >= Int64Align);
unsigned ElementSize = UseInt64 ? 8:4;
@@ -384,7 +384,7 @@
LastEltTy = Type::getInt8Ty(getGlobalContext());
}
if (LastEltTy) {
- if (Size != getTargetData().getTypeAllocSize(LastEltTy))
+ if (Size != getDataLayout().getTypeAllocSize(LastEltTy))
LastEltRealSize = Size;
}
@@ -425,7 +425,7 @@
// that occupies storage but has no useful information, and is not passed
// anywhere". Happens on x86-64.
std::vector<Type*> Elts(OrigElts);
- Type* wordType = getTargetData().getPointerSize() == 4 ?
+ Type* wordType = getDataLayout().getPointerSize() == 4 ?
Type::getInt32Ty(getGlobalContext()) : Type::getInt64Ty(getGlobalContext());
for (unsigned i=0, e=Elts.size(); i!=e; ++i)
if (OrigElts[i]->isVoidTy())
@@ -433,19 +433,19 @@
StructType *STy = StructType::get(getGlobalContext(), Elts, false);
- unsigned Size = getTargetData().getTypeAllocSize(STy);
+ unsigned Size = getDataLayout().getTypeAllocSize(STy);
unsigned InSize = 0;
// If Ty and STy size does not match then last element is accessing
// extra bits.
unsigned LastEltSizeDiff = 0;
if (isa<StructType>(Ty) || isa<ArrayType>(Ty)) {
- InSize = getTargetData().getTypeAllocSize(Ty);
+ InSize = getDataLayout().getTypeAllocSize(Ty);
if (InSize < Size) {
unsigned N = STy->getNumElements();
llvm::Type *LastEltTy = STy->getElementType(N-1);
if (LastEltTy->isIntegerTy())
LastEltSizeDiff =
- getTargetData().getTypeAllocSize(LastEltTy) - (Size - InSize);
+ getDataLayout().getTypeAllocSize(LastEltTy) - (Size - InSize);
}
}
for (unsigned i = 0, e = Elts.size(); i != e; ++i) {
Modified: dragonegg/trunk/src/TypeConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/TypeConversion.cpp?rev=165393&r1=165392&r2=165393&view=diff
==============================================================================
--- dragonegg/trunk/src/TypeConversion.cpp (original)
+++ dragonegg/trunk/src/TypeConversion.cpp Mon Oct 8 11:20:52 2012
@@ -277,7 +277,7 @@
// Find the LLVM field that contains the first bit of the GCC field.
uint64_t OffsetInBytes = getFieldOffsetInBits(decl) / 8; // Ignore bit in byte
- const StructLayout *SL = getTargetData().getStructLayout(STy);
+ const StructLayout *SL = getDataLayout().getStructLayout(STy);
Index = SL->getElementContainingOffset(OffsetInBytes);
// The GCC field must start in the first byte of the LLVM field.
@@ -358,7 +358,7 @@
// they do.
if (isSizeCompatible(type) && Ty->isSized()) {
uint64_t GCCSize = getInt64(TYPE_SIZE(type), true);
- uint64_t LLVMSize = getTargetData().getTypeAllocSizeInBits(Ty);
+ uint64_t LLVMSize = getDataLayout().getTypeAllocSizeInBits(Ty);
if (LLVMSize != GCCSize) {
Mismatch = true;
errs() << "GCC size: " << GCCSize << "; LLVM size: " << LLVMSize
@@ -368,7 +368,7 @@
// Check that the LLVM type has the same alignment or less than the GCC type.
if (Ty->isSized()) {
unsigned GCCAlign = TYPE_ALIGN(type);
- unsigned LLVMAlign = getTargetData().getABITypeAlignment(Ty) * 8;
+ unsigned LLVMAlign = getDataLayout().getABITypeAlignment(Ty) * 8;
if (LLVMAlign > GCCAlign) {
Mismatch = true;
errs() << "GCC align: " << GCCAlign << "; LLVM align: " << LLVMAlign
@@ -457,7 +457,7 @@
}
case OFFSET_TYPE:
- return getTargetData().getIntPtrType(Context);
+ return getDataLayout().getIntPtrType(Context);
case POINTER_TYPE:
case REFERENCE_TYPE:
@@ -486,7 +486,7 @@
// LLVM does not support vectors of pointers, so turn any pointers into
// integers.
Type *EltTy = isa<ACCESS_TYPE>(TREE_TYPE(type)) ?
- getTargetData().getIntPtrType(Context) : getRegType(TREE_TYPE(type));
+ getDataLayout().getIntPtrType(Context) : getRegType(TREE_TYPE(type));
return VectorType::get(EltTy, TYPE_VECTOR_SUBPARTS(type));
}
@@ -520,7 +520,7 @@
// gives a constant size.
if (isInt64(TYPE_SIZE(type), true)) {
uint64_t PadBits = getInt64(TYPE_SIZE(type), true) -
- getTargetData().getTypeAllocSizeInBits(Ty);
+ getDataLayout().getTypeAllocSizeInBits(Ty);
if (PadBits) {
Type *Padding = ArrayType::get(Type::getInt8Ty(Context), PadBits / 8);
Ty = StructType::get(Ty, Padding, NULL);
@@ -977,7 +977,7 @@
/// isSafeToReturnContentsDirectly - Return whether the current value for the
/// type properly represents the bits in the range and so can be handed to the
/// user as is.
- bool isSafeToReturnContentsDirectly(const TargetData &TD) const {
+ bool isSafeToReturnContentsDirectly(const DataLayout &TD) const {
// If there is no type (allowed when the range is empty) then one needs to
// be created.
if (!Ty)
@@ -1024,7 +1024,7 @@
/// than the width of the range. Unlike the other methods for this class this
/// one requires that the width of the range be a multiple of an address unit,
/// which usually means a multiple of 8.
- Type *extractContents(const TargetData &TD) {
+ Type *extractContents(const DataLayout &TD) {
assert(R.getWidth() % BITS_PER_UNIT == 0 && "Boundaries not aligned?");
/// If the current value for the type can be used to represent the bits in
/// the range then just return it.
@@ -1086,7 +1086,7 @@
assert(TYPE_SIZE(type) && "Incomplete types should be handled elsewhere!");
IntervalList<TypedRange, uint64_t, 8> Layout;
- const TargetData &TD = getTargetData();
+ const DataLayout &TD = getDataLayout();
// Get the size of the type in bits. If the type has variable or ginormous
// size then it is convenient to pretend it is "infinitely" big.
@@ -1401,7 +1401,7 @@
// which are really just integer offsets. Return the appropriate integer
// type directly.
// Caching the type conversion is not worth it.
- return CheckTypeConversion(type, getTargetData().getIntPtrType(Context));
+ return CheckTypeConversion(type, getDataLayout().getIntPtrType(Context));
case REAL_TYPE:
// Caching the type conversion is not worth it.
@@ -1440,7 +1440,7 @@
// LLVM does not support vectors of pointers, so turn any pointers into
// integers.
if (isa<ACCESS_TYPE>(TREE_TYPE(type)))
- Ty = getTargetData().getIntPtrType(Context);
+ 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=165393&r1=165392&r2=165393&view=diff
==============================================================================
--- dragonegg/trunk/src/x86/Target.cpp (original)
+++ dragonegg/trunk/src/x86/Target.cpp Mon Oct 8 11:20:52 2012
@@ -1426,7 +1426,7 @@
Type *llvm_x86_scalar_type_for_struct_return(tree type, unsigned *Offset) {
*Offset = 0;
Type *Ty = ConvertType(type);
- uint64_t Size = getTargetData().getTypeAllocSize(Ty);
+ uint64_t Size = getDataLayout().getTypeAllocSize(Ty);
if (Size == 0)
return Type::getVoidTy(Context);
else if (Size == 1)
Modified: dragonegg/trunk/www/disambiguate.diff
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/www/disambiguate.diff?rev=165393&r1=165392&r2=165393&view=diff
==============================================================================
--- dragonegg/trunk/www/disambiguate.diff (original)
+++ dragonegg/trunk/www/disambiguate.diff Mon Oct 8 11:20:52 2012
@@ -36,7 +36,7 @@
-
-// LLVM headers
-#include "llvm/LLVMContext.h"
--#include "llvm/Target/TargetData.h"
+-#include "llvm/DataLayout.h"
-
-namespace llvm {
- class BasicBlock;
@@ -152,7 +152,7 @@
-static inline
-const Type* getLLVMScalarTypeForStructReturn(tree_node *type, unsigned *Offset) {
- const Type *Ty = ConvertType(type);
-- unsigned Size = getTargetData().getTypeAllocSize(Ty);
+- unsigned Size = getDataLayout().getTypeAllocSize(Ty);
- *Offset = 0;
- if (Size == 0)
- return Type::getVoidTy(getGlobalContext());
@@ -2308,7 +2308,7 @@
+
+// LLVM headers
+#include "llvm/LLVMContext.h"
-+#include "llvm/Target/TargetData.h"
++#include "llvm/DataLayout.h"
+
+namespace llvm {
+ class BasicBlock;
@@ -2424,7 +2424,7 @@
+static inline
+const Type* getLLVMScalarTypeForStructReturn(tree_node *type, unsigned *Offset) {
+ const Type *Ty = ConvertType(type);
-+ unsigned Size = getTargetData().getTypeAllocSize(Ty);
++ unsigned Size = getDataLayout().getTypeAllocSize(Ty);
+ *Offset = 0;
+ if (Size == 0)
+ return Type::getVoidTy(getGlobalContext());
@@ -4303,7 +4303,7 @@
+ class Type;
+ class FunctionType;
+ class TargetMachine;
-+ class TargetData;
++ class DataLayout;
+ class DebugInfo;
+ template<typename> class AssertingVH;
+ template<typename> class TrackingVH;
@@ -4329,8 +4329,8 @@
+/// TheFolder - The constant folder to use.
+extern TargetFolder *TheFolder;
+
-+/// getTargetData - Return the current TargetData object from TheTarget.
-+const TargetData &getTargetData();
++/// getDataLayout - Return the current DataLayout object from TheTarget.
++const DataLayout &getDataLayout();
+
+/// flag_default_initialize_globals - Whether global variables with no explicit
+/// initial value should be zero initialized.
@@ -4605,7 +4605,7 @@
+///
+class TreeToLLVM {
+ // State that is initialized when the function starts.
-+ const TargetData &TD;
++ const DataLayout &TD;
+ tree_node *FnDecl;
+ Function *Fn;
+ BasicBlock *ReturnBB;
@@ -5221,7 +5221,7 @@
- class Type;
- class FunctionType;
- class TargetMachine;
-- class TargetData;
+- class DataLayout;
- class DebugInfo;
- template<typename> class AssertingVH;
- template<typename> class TrackingVH;
@@ -5247,8 +5247,8 @@
-/// TheFolder - The constant folder to use.
-extern TargetFolder *TheFolder;
-
--/// getTargetData - Return the current TargetData object from TheTarget.
--const TargetData &getTargetData();
+-/// getDataLayout - Return the current DataLayout object from TheTarget.
+-const DataLayout &getDataLayout();
-
-/// flag_default_initialize_globals - Whether global variables with no explicit
-/// initial value should be zero initialized.
@@ -5523,7 +5523,7 @@
-///
-class TreeToLLVM {
- // State that is initialized when the function starts.
-- const TargetData &TD;
+- const DataLayout &TD;
- tree_node *FnDecl;
- Function *Fn;
- BasicBlock *ReturnBB;
More information about the llvm-commits
mailing list