LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
llvm::MachineRelocation Class Reference

#include <MachineRelocation.h>

Collaboration diagram for llvm::MachineRelocation:
Collaboration graph
[legend]

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 mayNeedFarStub () 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. More...
 
unsigned getGOTIndex () const
 

Static Public Member Functions

static MachineRelocation getGV (uintptr_t offset, unsigned RelocationType, GlobalValue *GV, intptr_t cst=0, bool MayNeedFarStub=0, bool GOTrelative=0)
 
static MachineRelocation getIndirectSymbol (uintptr_t offset, unsigned RelocationType, GlobalValue *GV, intptr_t cst=0, bool MayNeedFarStub=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, bool NeedStub=true)
 
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

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

Definition at line 286 of file MachineRelocation.h.

References isBasicBlock().

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

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

Definition at line 121 of file MachineRelocation.h.

References MBB, and Result.

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

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

Definition at line 300 of file MachineRelocation.h.

References isConstantPoolIndex().

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 209 of file MachineRelocation.h.

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

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

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

Definition at line 159 of file MachineRelocation.h.

References Index, letTargetResolve(), and Result.

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

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

Definition at line 293 of file MachineRelocation.h.

References isExternalSymbol().

static MachineRelocation llvm::MachineRelocation::getExtSym ( uintptr_t  offset,
unsigned  RelocationType,
const char *  ES,
intptr_t  cst = 0,
bool  GOTrelative = 0,
bool  NeedStub = true 
)
inlinestatic

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

Definition at line 139 of file MachineRelocation.h.

References ExtSym, and Result.

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

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

Definition at line 280 of file MachineRelocation.h.

References isGlobalValue(), and isIndirectSymbol().

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 335 of file MachineRelocation.h.

static MachineRelocation llvm::MachineRelocation::getGV ( uintptr_t  offset,
unsigned  RelocationType,
GlobalValue GV,
intptr_t  cst = 0,
bool  MayNeedFarStub = 0,
bool  GOTrelative = 0 
)
inlinestatic

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

Definition at line 82 of file MachineRelocation.h.

References GV, and Result.

static MachineRelocation llvm::MachineRelocation::getIndirectSymbol ( uintptr_t  offset,
unsigned  RelocationType,
GlobalValue GV,
intptr_t  cst = 0,
bool  MayNeedFarStub = 0,
bool  GOTrelative = 0 
)
inlinestatic

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

Definition at line 101 of file MachineRelocation.h.

References GV, and Result.

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

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

Definition at line 178 of file MachineRelocation.h.

References Index, letTargetResolve(), and Result.

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

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

Definition at line 307 of file MachineRelocation.h.

References isJumpTableIndex().

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

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

Definition at line 196 of file MachineRelocation.h.

Referenced by llvm::PPCJITInfo::relocate(), llvm::SparcJITInfo::relocate(), llvm::MipsJITInfo::relocate(), llvm::X86JITInfo::relocate(), and llvm::ARMJITInfo::relocate().

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

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

Definition at line 202 of file MachineRelocation.h.

Referenced by llvm::PPCJITInfo::relocate(), llvm::SparcJITInfo::relocate(), llvm::MipsJITInfo::relocate(), llvm::X86JITInfo::relocate(), and llvm::ARMJITInfo::relocate().

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 314 of file MachineRelocation.h.

Referenced by llvm::PPCJITInfo::relocate(), llvm::SparcJITInfo::relocate(), llvm::MipsJITInfo::relocate(), and llvm::X86JITInfo::relocate().

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

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

Definition at line 234 of file MachineRelocation.h.

Referenced by getBasicBlock().

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

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

Definition at line 246 of file MachineRelocation.h.

Referenced by getConstantPoolIndex().

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

isExternalSymbol - Return true if this is a constant string.

Definition at line 240 of file MachineRelocation.h.

Referenced by getExternalSymbol().

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

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

Definition at line 222 of file MachineRelocation.h.

Referenced by getGlobalValue().

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 258 of file MachineRelocation.h.

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

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

Definition at line 228 of file MachineRelocation.h.

Referenced by getGlobalValue().

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

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

Definition at line 252 of file MachineRelocation.h.

Referenced by getJumpTableIndex().

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 274 of file MachineRelocation.h.

Referenced by getConstPool(), and getJumpTable().

bool llvm::MachineRelocation::mayNeedFarStub ( ) const
inline

mayNeedFarStub - This function returns true if the JIT for this target may need either a stub function or an indirect global-variable load to handle the relocated GlobalValue reference. For example, the x86-64 call instruction can only call functions within +/-2GB of the call site. Anything farther away needs a longer mov+call sequence, which can't just be written on top of the existing call.

Definition at line 268 of file MachineRelocation.h.

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 216 of file MachineRelocation.h.

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

setGOTIndex - Set the GOT index to a specific value.

Definition at line 327 of file MachineRelocation.h.

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

setResultPointer - Set the result to the specified pointer value.

Definition at line 321 of file MachineRelocation.h.

Member Data Documentation

const char* llvm::MachineRelocation::ExtSym

Definition at line 61 of file MachineRelocation.h.

Referenced by getExtSym().

unsigned llvm::MachineRelocation::GOTIndex

Definition at line 63 of file MachineRelocation.h.

GlobalValue* llvm::MachineRelocation::GV

Definition at line 59 of file MachineRelocation.h.

Referenced by getGV(), and getIndirectSymbol().

unsigned llvm::MachineRelocation::Index

Definition at line 62 of file MachineRelocation.h.

Referenced by getConstPool(), and getJumpTable().

MachineBasicBlock* llvm::MachineRelocation::MBB

Definition at line 60 of file MachineRelocation.h.

Referenced by getBB().

void* llvm::MachineRelocation::Result

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