LLVM API Documentation

llvm::MachineRelocation Class Reference

#include <MachineRelocation.h>

Collaboration diagram for llvm::MachineRelocation:

Collaboration graph
[legend]

List of all members.

Public Types

enum  RelocationType { VANILLA }

Public Member Functions

intptr_t getMachineCodeOffset () const
unsigned getRelocationType () const
intptr_t getConstantVal () const
void setConstantVal (intptr_t val)
bool isGlobalValue () const
bool isIndirectSymbol () const
bool isBasicBlock () const
bool isExternalSymbol () const
bool isConstantPoolIndex () const
bool isJumpTableIndex () const
bool isGOTRelative () const
bool doesntNeedStub () const
bool letTargetResolve () const
GlobalValuegetGlobalValue () const
MachineBasicBlockgetBasicBlock () const
const char * getExternalSymbol () const
unsigned getConstantPoolIndex () const
unsigned getJumpTableIndex () const
void * getResultPointer () const
void setResultPointer (void *Ptr)
void setGOTIndex (unsigned idx)
 setGOTIndex - Set the GOT index to a specific value.
unsigned getGOTIndex () const

Static Public Member Functions

static MachineRelocation getGV (uintptr_t offset, unsigned RelocationType, GlobalValue *GV, intptr_t cst=0, bool NeedStub=0, bool GOTrelative=0)
static MachineRelocation getIndirectSymbol (uintptr_t offset, unsigned RelocationType, GlobalValue *GV, intptr_t cst=0, bool NeedStub=0, bool GOTrelative=0)
static MachineRelocation getBB (uintptr_t offset, unsigned RelocationType, MachineBasicBlock *MBB, intptr_t cst=0)
static MachineRelocation getExtSym (uintptr_t offset, unsigned RelocationType, const char *ES, intptr_t cst=0, bool GOTrelative=0)
static MachineRelocation getConstPool (uintptr_t offset, unsigned RelocationType, unsigned CPI, intptr_t cst=0, bool letTargetResolve=false)
static MachineRelocation getJumpTable (uintptr_t offset, unsigned RelocationType, unsigned JTI, intptr_t cst=0, bool letTargetResolve=false)


Detailed Description

MachineRelocation - This represents a target-specific relocation value, produced by the code emitter. This relocation is resolved after the has been emitted, either to an object file or to memory, when the target of the relocation can be resolved.

A relocation is made up of the following logical portions: 1. An offset in the machine code buffer, the location to modify. 2. A target specific relocation type (a number from 0 to 63). 3. A symbol being referenced, either as a GlobalValue* or as a string. 4. An optional constant value to be added to the reference. 5. A bit, CanRewrite, which indicates to the JIT that a function stub is not needed for the relocation. 6. An index into the GOT, if the target uses a GOT

Definition at line 38 of file MachineRelocation.h.


Member Enumeration Documentation

Enumerator:
VANILLA 

Definition at line 76 of file MachineRelocation.h.


Member Function Documentation

static MachineRelocation llvm::MachineRelocation::getGV ( uintptr_t  offset,
unsigned  RelocationType,
GlobalValue GV,
intptr_t  cst = 0,
bool  NeedStub = 0,
bool  GOTrelative = 0 
) [inline, static]

MachineRelocation::getGV - Return a relocation entry for a GlobalValue.

Definition at line 82 of file MachineRelocation.h.

References AddrType, ConstantVal, GOTRelative, GV, NeedStub, Offset, Result, Target, TargetReloType, and TargetResolve.

Referenced by llvm::MachOWriter::InitMem().

static MachineRelocation llvm::MachineRelocation::getIndirectSymbol ( uintptr_t  offset,
unsigned  RelocationType,
GlobalValue GV,
intptr_t  cst = 0,
bool  NeedStub = 0,
bool  GOTrelative = 0 
) [inline, static]

MachineRelocation::getIndirectSymbol - Return a relocation entry for an indirect symbol.

Definition at line 101 of file MachineRelocation.h.

References AddrType, ConstantVal, GOTRelative, GV, NeedStub, Offset, Result, Target, TargetReloType, and TargetResolve.

static MachineRelocation llvm::MachineRelocation::getBB ( uintptr_t  offset,
unsigned  RelocationType,
MachineBasicBlock MBB,
intptr_t  cst = 0 
) [inline, static]

MachineRelocation::getBB - Return a relocation entry for a BB.

Definition at line 121 of file MachineRelocation.h.

References AddrType, ConstantVal, GOTRelative, MBB, NeedStub, Offset, Result, Target, TargetReloType, and TargetResolve.

Referenced by llvm::TargetMachOWriterInfo::GetJTRelocation().

static MachineRelocation llvm::MachineRelocation::getExtSym ( uintptr_t  offset,
unsigned  RelocationType,
const char *  ES,
intptr_t  cst = 0,
bool  GOTrelative = 0 
) [inline, static]

MachineRelocation::getExtSym - Return a relocation entry for an external symbol, like "free".

Definition at line 139 of file MachineRelocation.h.

References AddrType, ConstantVal, ExtSym, GOTRelative, NeedStub, Offset, Result, Target, TargetReloType, and TargetResolve.

static MachineRelocation llvm::MachineRelocation::getConstPool ( uintptr_t  offset,
unsigned  RelocationType,
unsigned  CPI,
intptr_t  cst = 0,
bool  letTargetResolve = false 
) [inline, static]

MachineRelocation::getConstPool - Return a relocation entry for a constant pool entry.

Definition at line 158 of file MachineRelocation.h.

References AddrType, ConstantVal, GOTRelative, Index, letTargetResolve(), NeedStub, Offset, Result, Target, TargetReloType, and TargetResolve.

static MachineRelocation llvm::MachineRelocation::getJumpTable ( uintptr_t  offset,
unsigned  RelocationType,
unsigned  JTI,
intptr_t  cst = 0,
bool  letTargetResolve = false 
) [inline, static]

MachineRelocation::getJumpTable - Return a relocation entry for a jump table entry.

Definition at line 177 of file MachineRelocation.h.

References AddrType, ConstantVal, GOTRelative, Index, letTargetResolve(), NeedStub, Offset, Result, Target, TargetReloType, and TargetResolve.

intptr_t llvm::MachineRelocation::getMachineCodeOffset (  )  const [inline]

getMachineCodeOffset - Return the offset into the code buffer that the relocation should be performed.

Definition at line 195 of file MachineRelocation.h.

Referenced by llvm::PPCMachOWriterInfo::GetTargetRelocation(), llvm::X86JITInfo::relocate(), llvm::PPCJITInfo::relocate(), llvm::ARMJITInfo::relocate(), and llvm::AlphaJITInfo::relocate().

unsigned llvm::MachineRelocation::getRelocationType (  )  const [inline]

getRelocationType - Return the target-specific relocation ID for this relocation.

Definition at line 201 of file MachineRelocation.h.

Referenced by llvm::PPCMachOWriterInfo::GetTargetRelocation(), llvm::X86JITInfo::relocate(), llvm::PPCJITInfo::relocate(), llvm::ARMJITInfo::relocate(), and llvm::AlphaJITInfo::relocate().

intptr_t llvm::MachineRelocation::getConstantVal (  )  const [inline]

getConstantVal - Get the constant value associated with this relocation. This is often an offset from the symbol.

Definition at line 208 of file MachineRelocation.h.

Referenced by llvm::PPCMachOWriterInfo::GetTargetRelocation(), llvm::X86JITInfo::relocate(), llvm::PPCJITInfo::relocate(), and llvm::AlphaJITInfo::relocate().

void llvm::MachineRelocation::setConstantVal ( intptr_t  val  )  [inline]

setConstantVal - Set the constant value associated with this relocation. This is often an offset from the symbol.

Definition at line 215 of file MachineRelocation.h.

Referenced by llvm::MachOCodeEmitter::emitJumpTables(), and llvm::MachOCodeEmitter::finishFunction().

bool llvm::MachineRelocation::isGlobalValue (  )  const [inline]

isGlobalValue - Return true if this relocation is a GlobalValue, as opposed to a constant string.

Definition at line 221 of file MachineRelocation.h.

Referenced by llvm::MachOCodeEmitter::finishFunction(), and getGlobalValue().

bool llvm::MachineRelocation::isIndirectSymbol (  )  const [inline]

isIndirectSymbol - Return true if this relocation is the address an indirect symbol

Definition at line 227 of file MachineRelocation.h.

Referenced by getGlobalValue().

bool llvm::MachineRelocation::isBasicBlock (  )  const [inline]

isBasicBlock - Return true if this relocation is a basic block reference.

Definition at line 233 of file MachineRelocation.h.

Referenced by llvm::MachOCodeEmitter::finishFunction(), and getBasicBlock().

bool llvm::MachineRelocation::isExternalSymbol (  )  const [inline]

isExternalSymbol - Return true if this is a constant string.

Definition at line 239 of file MachineRelocation.h.

Referenced by getExternalSymbol().

bool llvm::MachineRelocation::isConstantPoolIndex (  )  const [inline]

isConstantPoolIndex - Return true if this is a constant pool reference.

Definition at line 245 of file MachineRelocation.h.

Referenced by llvm::MachOCodeEmitter::finishFunction(), and getConstantPoolIndex().

bool llvm::MachineRelocation::isJumpTableIndex (  )  const [inline]

isJumpTableIndex - Return true if this is a jump table reference.

Definition at line 251 of file MachineRelocation.h.

Referenced by llvm::MachOCodeEmitter::finishFunction(), and getJumpTableIndex().

bool llvm::MachineRelocation::isGOTRelative (  )  const [inline]

isGOTRelative - Return true the target wants the index into the GOT of the symbol rather than the address of the symbol.

Definition at line 257 of file MachineRelocation.h.

bool llvm::MachineRelocation::doesntNeedStub (  )  const [inline]

doesntNeedStub - This function returns true if the JIT for this target target is capable of directly handling the relocated GlobalValue reference without using either a stub function or issuing an extra load to get the GV address.

Definition at line 265 of file MachineRelocation.h.

bool llvm::MachineRelocation::letTargetResolve (  )  const [inline]

letTargetResolve - Return true if the target JITInfo is usually responsible for resolving the address of this relocation.

Definition at line 271 of file MachineRelocation.h.

Referenced by getConstPool(), and getJumpTable().

GlobalValue* llvm::MachineRelocation::getGlobalValue (  )  const [inline]

getGlobalValue - If this is a global value reference, return the referenced global.

Definition at line 277 of file MachineRelocation.h.

References isGlobalValue(), and isIndirectSymbol().

Referenced by llvm::MachOCodeEmitter::finishFunction().

MachineBasicBlock* llvm::MachineRelocation::getBasicBlock (  )  const [inline]

Definition at line 283 of file MachineRelocation.h.

References isBasicBlock().

Referenced by llvm::MachOCodeEmitter::finishFunction().

const char* llvm::MachineRelocation::getExternalSymbol (  )  const [inline]

getString - If this is a string value, return the string reference.

Definition at line 290 of file MachineRelocation.h.

References isExternalSymbol().

unsigned llvm::MachineRelocation::getConstantPoolIndex (  )  const [inline]

getConstantPoolIndex - If this is a const pool reference, return the index into the constant pool.

Definition at line 297 of file MachineRelocation.h.

References isConstantPoolIndex().

Referenced by llvm::MachOCodeEmitter::finishFunction().

unsigned llvm::MachineRelocation::getJumpTableIndex (  )  const [inline]

getJumpTableIndex - If this is a jump table reference, return the index into the jump table.

Definition at line 304 of file MachineRelocation.h.

References isJumpTableIndex().

Referenced by llvm::MachOCodeEmitter::finishFunction().

void* llvm::MachineRelocation::getResultPointer (  )  const [inline]

getResultPointer - Once this has been resolved to point to an actual address, this returns the pointer.

Definition at line 311 of file MachineRelocation.h.

Referenced by llvm::PPCMachOWriterInfo::GetTargetRelocation(), llvm::X86JITInfo::relocate(), llvm::PPCJITInfo::relocate(), and llvm::AlphaJITInfo::relocate().

void llvm::MachineRelocation::setResultPointer ( void *  Ptr  )  [inline]

setResultPointer - Set the result to the specified pointer value.

Definition at line 318 of file MachineRelocation.h.

Referenced by llvm::MachOCodeEmitter::emitJumpTables(), and llvm::MachOCodeEmitter::finishFunction().

void llvm::MachineRelocation::setGOTIndex ( unsigned  idx  )  [inline]

setGOTIndex - Set the GOT index to a specific value.

Definition at line 324 of file MachineRelocation.h.

unsigned llvm::MachineRelocation::getGOTIndex (  )  const [inline]

getGOTIndex - Once this has been resolved to an entry in the GOT, this returns that index. The index is from the lowest address entry in the GOT.

Definition at line 332 of file MachineRelocation.h.

Referenced by llvm::AlphaJITInfo::relocate().


Member Data Documentation

Definition at line 59 of file MachineRelocation.h.

Referenced by getGV(), and getIndirectSymbol().

Definition at line 60 of file MachineRelocation.h.

Referenced by getBB().

Definition at line 61 of file MachineRelocation.h.

Referenced by getExtSym().

Definition at line 62 of file MachineRelocation.h.

Referenced by getConstPool(), and getJumpTable().

Definition at line 63 of file MachineRelocation.h.


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



This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.