LLVM API Documentation

JITEmitter.cpp File Reference

#include "JIT.h"
#include "llvm/Constant.h"
#include "llvm/Module.h"
#include "llvm/Type.h"
#include "llvm/CodeGen/MachineCodeEmitter.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineRelocation.h"
#include "llvm/ExecutionEngine/GenericValue.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetJITInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/MutexGuard.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/System/Memory.h"
#include <algorithm>
#include <iostream>

Include dependency graph for JITEmitter.cpp:

Go to the source code of this file.

Defines

#define DEBUG_TYPE   "jit"

Functions

static JITResolver & getJITResolver (MachineCodeEmitter *MCE=0)
void * getPointerToNamedFunction (const char *Name)

Variables

Statistic NumBytes ("jit","Number of bytes of machine code compiled")
Statistic NumRelos ("jit","Number of relocations applied")
JITTheJIT = 0


Define Documentation

#define DEBUG_TYPE   "jit"

Definition at line 15 of file JITEmitter.cpp.


Function Documentation

static JITResolver& getJITResolver ( MachineCodeEmitter MCE = 0  )  [static]

getJITResolver - This function returns the one instance of the JIT resolver.

Definition at line 514 of file JITEmitter.cpp.

References MCE.

Referenced by llvm::JIT::getPointerToFunctionOrStub().

void* getPointerToNamedFunction ( const char *  Name  ) 

Definition at line 965 of file JITEmitter.cpp.

References F, llvm::ExecutionEngine::getModule(), llvm::Module::getNamedFunction(), llvm::JIT::getPointerToFunction(), llvm::JIT::getPointerToNamedFunction(), M, and TheJIT.


Variable Documentation

std::vector<sys::MemoryBlock> Blocks

Definition at line 261 of file JITEmitter.cpp.

Referenced by llvm::ReversePostOrderTraversal< GraphT, GT >::begin(), llvm::ReversePostOrderTraversal< GraphT, GT >::end(), and llvm::ExtractBasicBlock().

uintptr_t BlockSize

BlockSize - This is the size in bytes of this memory block, including this header.

Definition at line 64 of file JITEmitter.cpp.

MachineConstantPool* ConstantPool

ConstantPool - The constant pool for the current function.

Definition at line 658 of file JITEmitter.cpp.

void* ConstantPoolBase

ConstantPoolBase - A pointer to the first entry in the constant pool.

Definition at line 662 of file JITEmitter.cpp.

MemoryRangeHeader* CurBlock

Definition at line 265 of file JITEmitter.cpp.

Referenced by isPathTransparentTo().

unsigned char* CurStubPtr

Definition at line 267 of file JITEmitter.cpp.

std::map<void*, void*> ExternalFnToStubMap

ExternalFnToStubMap - This is the equivalent of FunctionToStubMap for external functions.

Definition at line 470 of file JITEmitter.cpp.

FreeRangeHeader* FreeMemoryList

Definition at line 262 of file JITEmitter.cpp.

std::map<const Function*, MemoryRangeHeader*> FunctionBlocks

Definition at line 273 of file JITEmitter.cpp.

std::map<Function*, void*> FunctionToStubMap

FunctionToStubMap - Keep track of the stub created for a particular function so that we can reuse them if necessary.

Definition at line 438 of file JITEmitter.cpp.

unsigned char* GOTBase

Definition at line 268 of file JITEmitter.cpp.

MachineJumpTableInfo* JumpTable

ConstantPool - The constant pool for the current function.

Definition at line 666 of file JITEmitter.cpp.

void* JumpTableBase

JumpTableBase - A pointer to the first entry in the jump table.

Definition at line 670 of file JITEmitter.cpp.

TargetJITInfo::LazyResolverFn LazyResolverFn

LazyResolverFn - The target lazy resolver function that we actually rewrite instructions to use.

Definition at line 464 of file JITEmitter.cpp.

std::vector<intptr_t> MBBLocations

MBBLocations - This vector is a mapping from MBB ID's to their address. It is filled in by the StartMachineBasicBlock callback and queried by the getMachineBasicBlockAddress callback.

Definition at line 654 of file JITEmitter.cpp.

MachineCodeEmitter& MCE

MCE - The MachineCodeEmitter to use to emit stubs with.

Definition at line 460 of file JITEmitter.cpp.

Referenced by llvm::X86TargetMachine::addPassesToEmitMachineCode(), llvm::PPCTargetMachine::addPassesToEmitMachineCode(), llvm::AlphaTargetMachine::addPassesToEmitMachineCode(), llvm::createAlphaCodeEmitterPass(), llvm::createX86CodeEmitterPass(), llvm::X86JITInfo::emitFunctionStub(), llvm::PPCJITInfo::emitFunctionStub(), llvm::AlphaJITInfo::emitFunctionStub(), getJITResolver(), llvm::X86JITInfo::resolveBBRefs(), llvm::PPCJITInfo::resolveBBRefs(), and llvm::AlphaJITInfo::resolveBBRefs().

JITMemoryManager MemMgr

Definition at line 641 of file JITEmitter.cpp.

FreeRangeHeader* Next

Definition at line 97 of file JITEmitter.cpp.

unsigned nextGOTIndex

Definition at line 474 of file JITEmitter.cpp.

Statistic NumBytes("jit","Number of bytes of machine code compiled") [static]

Referenced by llvm::X86RegisterInfo::emitEpilogue(), llvm::PPCRegisterInfo::emitEpilogue(), llvm::IA64RegisterInfo::emitEpilogue(), llvm::ARMRegisterInfo::emitEpilogue(), llvm::AlphaRegisterInfo::emitEpilogue(), llvm::X86RegisterInfo::emitPrologue(), llvm::SparcRegisterInfo::emitPrologue(), llvm::PPCRegisterInfo::emitPrologue(), llvm::IA64RegisterInfo::emitPrologue(), llvm::ARMRegisterInfo::emitPrologue(), llvm::AlphaRegisterInfo::emitPrologue(), LowerCALL(), llvm::IA64TargetLowering::LowerCallTo(), and llvm::AlphaTargetLowering::LowerCallTo().

Statistic NumRelos("jit","Number of relocations applied") [static]

FreeRangeHeader* Prev

Definition at line 96 of file JITEmitter.cpp.

Referenced by llvm::Instruction::getPrev(), llvm::GlobalVariable::getPrev(), llvm::Function::getPrev(), llvm::BasicBlock::getPrev(), llvm::Argument::getPrev(), llvm::SDNode::SDNode(), llvm::ilist_traits< SDNode >::setPrev(), llvm::ilist_traits< DSNode >::setPrev(), and llvm::Interpreter::visitCallSite().

intptr_t PrevAllocated

PrevAllocated - Keep track of whether the block immediately before us is allocated. If not, the word immediately before this header is the size of the previous block.

Definition at line 60 of file JITEmitter.cpp.

std::vector<MachineRelocation> Relocations

Relocations - These are the relocations that the function needs, as emitted.

Definition at line 649 of file JITEmitter.cpp.

std::map<void*, unsigned> revGOTMap

Definition at line 473 of file JITEmitter.cpp.

unsigned char* SavedBufferBegin

Definition at line 645 of file JITEmitter.cpp.

unsigned char * SavedBufferEnd

Definition at line 645 of file JITEmitter.cpp.

unsigned char * SavedCurBufferPtr

Definition at line 645 of file JITEmitter.cpp.

JITResolverState state

Definition at line 466 of file JITEmitter.cpp.

unsigned char * StubBase

Definition at line 267 of file JITEmitter.cpp.

std::map<void*, Function*> StubToFunctionMap

StubToFunctionMap - Keep track of the function that each stub corresponds to.

Definition at line 442 of file JITEmitter.cpp.

JIT* TheJIT = 0 [static]

Definition at line 39 of file JITEmitter.cpp.

Referenced by getPointerToNamedFunction().

intptr_t ThisAllocated

ThisAllocated - This is true if this block is currently allocated. If not, this can be converted to a FreeRangeHeader.

Definition at line 55 of file JITEmitter.cpp.