LLVM API Documentation

Public Types | Public Member Functions | Static Public Member Functions
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 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.
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

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 
) [inline, static]

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

Definition at line 121 of file MachineRelocation.h.

References MBB, and Result.

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().

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.

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

References Index, letTargetResolve(), and Result.

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 
) [inline, static]

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

Definition at line 139 of file MachineRelocation.h.

References ExtSym, and Result.

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

Definition at line 280 of file MachineRelocation.h.

References isGlobalValue(), and isIndirectSymbol().

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 
) [inline, static]

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 
) [inline, static]

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 
) [inline, static]

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

Definition at line 178 of file MachineRelocation.h.

References Index, letTargetResolve(), and Result.

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().

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

Definition at line 196 of file MachineRelocation.h.

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

Definition at line 202 of file MachineRelocation.h.

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

Definition at line 314 of file MachineRelocation.h.

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

Definition at line 234 of file MachineRelocation.h.

Referenced by getBasicBlock().

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

Definition at line 246 of file MachineRelocation.h.

Referenced by getConstantPoolIndex().

isExternalSymbol - Return true if this is a constant string.

Definition at line 240 of file MachineRelocation.h.

Referenced by getExternalSymbol().

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().

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.

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

Definition at line 228 of file MachineRelocation.h.

Referenced by getGlobalValue().

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

Definition at line 252 of file MachineRelocation.h.

Referenced by getJumpTableIndex().

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().

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.

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.

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

Definition at line 61 of file MachineRelocation.h.

Referenced by getExtSym().

Definition at line 63 of file MachineRelocation.h.

Definition at line 59 of file MachineRelocation.h.

Referenced by getGV(), and getIndirectSymbol().

Definition at line 62 of file MachineRelocation.h.

Referenced by getConstPool(), and getJumpTable().

Definition at line 60 of file MachineRelocation.h.

Referenced by getBB().


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