LLVM API Documentation

llvm::TargetData Class Reference

#include <TargetData.h>

Inheritance diagram for llvm::TargetData:

Inheritance graph
[legend]
Collaboration diagram for llvm::TargetData:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TargetData ()
 TargetData (const std::string &TargetDescription)
 TargetData (const Module *M)
 Initialize target data from properties stored in the module.
 TargetData (const TargetData &TD)
 ~TargetData ()
void init (const std::string &TargetDescription)
bool isLittleEndian () const
 Target endianness...
bool isBigEndian () const
unsigned char getBoolAlignment () const
 Target alignment constraints.
unsigned char getByteAlignment () const
unsigned char getShortAlignment () const
unsigned char getIntAlignment () const
unsigned char getLongAlignment () const
unsigned char getFloatAlignment () const
unsigned char getDoubleAlignment () const
unsigned char getPointerAlignment () const
unsigned char getPointerSize () const
unsigned char getPointerSizeInBits () const
std::string getStringRepresentation () const
uint64_t getTypeSize (const Type *Ty) const
unsigned char getTypeAlignment (const Type *Ty) const
unsigned char getTypeAlignmentShift (const Type *Ty) const
const TypegetIntPtrType () const
uint64_t getIndexedOffset (const Type *Ty, const std::vector< Value * > &Indices) const
const StructLayoutgetStructLayout (const StructType *Ty) const
void InvalidateStructLayoutInfo (const StructType *Ty) const

Detailed Description

Definition at line 35 of file TargetData.h.


Constructor & Destructor Documentation

llvm::TargetData::TargetData (  )  [inline]

Default ctor - This has to exist, because this is a pass, but it should never be used.

Definition at line 50 of file TargetData.h.

llvm::TargetData::TargetData ( const std::string &  TargetDescription  )  [inline]

Constructs a TargetData from a string of the following format: "E-p:64:64-d:64-f:32-l:64-i:32-s:16-b:8-B:8" The above string is considered the default, and any values not specified in the string will be assumed to be as above.

Definition at line 60 of file TargetData.h.

References init().

TargetData::TargetData ( const Module M  ) 

Initialize target data from properties stored in the module.

Definition at line 155 of file TargetData.cpp.

References llvm::Module::BigEndian, llvm::Module::getEndianness(), llvm::Module::getPointerSize(), M, and llvm::Module::Pointer64.

llvm::TargetData::TargetData ( const TargetData TD  )  [inline]

Definition at line 67 of file TargetData.h.

TargetData::~TargetData (  ) 

Definition at line 175 of file TargetData.cpp.

References Layouts.


Member Function Documentation

void TargetData::init ( const std::string &  TargetDescription  ) 

init - Specify configuration if not available at ctor time.

Definition at line 98 of file TargetData.cpp.

References llvm::getToken().

Referenced by TargetData().

bool llvm::TargetData::isLittleEndian (  )  const [inline]

Target endianness...

Definition at line 89 of file TargetData.h.

Referenced by llvm::ELFWriter::ELFWriter(), and llvm::TargetLowering::TargetLowering().

bool llvm::TargetData::isBigEndian (  )  const [inline]

Definition at line 90 of file TargetData.h.

Referenced by llvm::AsmPrinter::EmitGlobalConstant(), and llvm::DwarfWriter::EmitInt64().

unsigned char llvm::TargetData::getBoolAlignment (  )  const [inline]

Target alignment constraints.

Definition at line 93 of file TargetData.h.

Referenced by getTypeInfo().

unsigned char llvm::TargetData::getByteAlignment (  )  const [inline]

Definition at line 94 of file TargetData.h.

Referenced by getTypeInfo().

unsigned char llvm::TargetData::getShortAlignment (  )  const [inline]

Definition at line 95 of file TargetData.h.

Referenced by getTypeInfo().

unsigned char llvm::TargetData::getIntAlignment (  )  const [inline]

Definition at line 96 of file TargetData.h.

Referenced by getTypeInfo().

unsigned char llvm::TargetData::getLongAlignment (  )  const [inline]

Definition at line 97 of file TargetData.h.

Referenced by getTypeInfo().

unsigned char llvm::TargetData::getFloatAlignment (  )  const [inline]

Definition at line 98 of file TargetData.h.

Referenced by getTypeInfo().

unsigned char llvm::TargetData::getDoubleAlignment (  )  const [inline]

Definition at line 99 of file TargetData.h.

Referenced by getTypeInfo().

unsigned char llvm::TargetData::getPointerAlignment (  )  const [inline]

Definition at line 100 of file TargetData.h.

Referenced by llvm::AsmPrinter::EmitJumpTableInfo(), llvm::MachineJumpTableInfo::getAlignment(), and getTypeInfo().

unsigned char llvm::TargetData::getPointerSize (  )  const [inline]

Definition at line 101 of file TargetData.h.

Referenced by CreateArgv(), EmitGEPOffset(), llvm::AsmPrinter::EmitGlobalConstant(), llvm::AsmPrinter::EmitJumpTableInfo(), llvm::MachineJumpTableInfo::getEntrySize(), getIntPtrType(), getTypeInfo(), and llvm::ExecutionEngine::LoadValueFromMemory().

unsigned char llvm::TargetData::getPointerSizeInBits (  )  const [inline]

Definition at line 102 of file TargetData.h.

Referenced by llvm::ELFWriter::ELFWriter().

std::string TargetData::getStringRepresentation (  )  const

getStringRepresentation - Return the string representation of the TargetData. This representation is in the same format accepted by the string constructor above.

Definition at line 190 of file TargetData.cpp.

uint64_t TargetData::getTypeSize ( const Type Ty  )  const

getTypeSize - Return the number of bytes necessary to hold the specified type.

Definition at line 290 of file TargetData.cpp.

References Align, getTypeInfo(), and Ty.

Referenced by llvm::AliasSetTracker::add(), llvm::X86IntelAsmPrinter::doFinalization(), llvm::X86SharedAsmPrinter::doFinalization(), llvm::AsmPrinter::EmitConstantPool(), llvm::AsmPrinter::EmitConstantValueOnly(), EmitGEPOffset(), llvm::AsmPrinter::EmitGlobalConstant(), llvm::ExecutionEngine::emitGlobals(), llvm::ExecutionEngine::EmitGlobalVariable(), llvm::Interpreter::executeGEPOperation(), llvm::ExpressionConvertibleToType(), llvm::FunctionLoweringInfo::FunctionLoweringInfo(), llvm::MachineConstantPool::getConstantPoolIndex(), getIndexedOffset(), llvm::AliasAnalysis::getModRefInfo(), llvm::JIT::getOrEmitGlobalVariable(), llvm::AsmPrinter::getPreferredAlignmentLog(), getStructOffsetStep(), llvm::getStructOffsetType(), llvm::ExecutionEngine::InitializeMemory(), llvm::DSNode::mergeTypeInfo(), OperandConvertibleToType(), OptimizeGEPExpression(), OptimizeOnceStoredGlobal(), ProcessGlobalsWithSameName(), llvm::AliasSetTracker::remove(), llvm::SelectionDAGLowering::visitAlloca(), llvm::Interpreter::visitAllocationInst(), llvm::SelectionDAGLowering::visitGetElementPtr(), and llvm::SelectionDAGLowering::visitMalloc().

unsigned char TargetData::getTypeAlignment ( const Type Ty  )  const

getTypeAlignment - Return the minimum required alignment for the specified type.

Definition at line 297 of file TargetData.cpp.

References Align, getTypeInfo(), and Ty.

Referenced by llvm::FunctionLoweringInfo::FunctionLoweringInfo(), GetKnownAlignment(), llvm::JIT::getOrEmitGlobalVariable(), getTypeAlignmentShift(), and llvm::SelectionDAGLowering::visitAlloca().

unsigned char TargetData::getTypeAlignmentShift ( const Type Ty  )  const

getTypeAlignmentShift - Return the minimum required alignment for the specified type, returned as log2 of the value (a shift amount).

Definition at line 304 of file TargetData.cpp.

References Align, getTypeAlignment(), llvm::Log2_32(), and Ty.

Referenced by llvm::AsmPrinter::getPreferredAlignmentLog().

const Type * TargetData::getIntPtrType (  )  const

getIntPtrType - Return an unsigned integer type that is the same size or greater to the host pointer size.

Definition at line 312 of file TargetData.cpp.

References getPointerSize(), llvm::Type::UIntTy, llvm::Type::ULongTy, and llvm::Type::UShortTy.

Referenced by EmitGEPOffset(), isEliminableCastOfCast(), OptimizeConstantExpr(), OptimizeGEPExpression(), llvm::TargetLowering::TargetLowering(), llvm::SelectionDAGLowering::visitFree(), and llvm::SelectionDAGLowering::visitMalloc().

uint64_t TargetData::getIndexedOffset ( const Type Ty,
const std::vector< Value * > &  Indices 
) const

getIndexOffset - return the offset from the beginning of the type for the specified indices. This is used to implement getelementptr.

Definition at line 322 of file TargetData.cpp.

References llvm::gep_type_begin(), getStructLayout(), getTypeSize(), llvm::StructLayout::MemberOffsets, Ty, and llvm::Type::UIntTy.

Referenced by llvm::AsmPrinter::EmitConstantValueOnly(), llvm::ExecutionEngine::getConstantValue(), and OptimizeConstantExpr().

const StructLayout * TargetData::getStructLayout ( const StructType Ty  )  const

getStructLayout - Return a StructLayout object, indicating the alignment of the struct, its size, and the offsets of its fields. Note that this information is lazily cached.

Definition at line 210 of file TargetData.cpp.

References Layouts, and Ty.

Referenced by llvm::AsmPrinter::EmitGlobalConstant(), llvm::Interpreter::executeGEPOperation(), getIndexedOffset(), getStructOffsetStep(), getTypeInfo(), llvm::ExecutionEngine::InitializeMemory(), llvm::DSNode::mergeTypeInfo(), OptimizeGEPExpression(), and llvm::SelectionDAGLowering::visitGetElementPtr().

void TargetData::InvalidateStructLayoutInfo ( const StructType Ty  )  const

InvalidateStructLayoutInfo - TargetData speculatively caches StructLayout objects. If a TargetData object is alive when types are being refined and removed, this method must be called whenever a StructType is removed to avoid a dangling pointer in this cache.

Definition at line 229 of file TargetData.cpp.

References Layouts, and Ty.


The documentation for this class was generated from the following files: