LLVM API Documentation

Public Member Functions
llvm::MCJIT Class Reference

#include <MCJIT.h>

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

List of all members.

Public Member Functions

 ~MCJIT ()
ExecutionEngine interface implementation
virtual void * getPointerToBasicBlock (BasicBlock *BB)
virtual void * getPointerToFunction (Function *F)
virtual void * recompileAndRelinkFunction (Function *F)
virtual void freeMachineCodeForFunction (Function *F)
virtual GenericValue runFunction (Function *F, const std::vector< GenericValue > &ArgValues)
virtual void * getPointerToNamedFunction (const std::string &Name, bool AbortOnFailure=true)
virtual void mapSectionAddress (void *LocalAddress, uint64_t TargetAddress)

Static Public Member Functions

(Private) Registration Interfaces
static void Register ()
static ExecutionEnginecreateJIT (Module *M, std::string *ErrorStr, JITMemoryManager *JMM, bool GVsWithCode, TargetMachine *TM)

Detailed Description

Definition at line 25 of file lib/ExecutionEngine/MCJIT/MCJIT.h.


Constructor & Destructor Documentation

MCJIT::~MCJIT ( )

Definition at line 86 of file MCJIT.cpp.


Member Function Documentation

ExecutionEngine * MCJIT::createJIT ( Module M,
std::string *  ErrorStr,
JITMemoryManager JMM,
bool  GVsWithCode,
TargetMachine TM 
) [static]
void MCJIT::freeMachineCodeForFunction ( Function F) [virtual]

freeMachineCodeForFunction - Release memory in the ExecutionEngine corresponding to the machine code emitted to execute this function, useful for garbage-collecting generated code.

Implements llvm::ExecutionEngine.

Definition at line 115 of file MCJIT.cpp.

References llvm::report_fatal_error().

void * MCJIT::getPointerToBasicBlock ( BasicBlock BB) [virtual]

getPointerToBasicBlock - The different EE's represent basic blocks in different ways. Return the representation for a blockaddress of the specified block.

Implements llvm::ExecutionEngine.

Definition at line 91 of file MCJIT.cpp.

References llvm::report_fatal_error().

void * MCJIT::getPointerToFunction ( Function F) [virtual]

getPointerToFunction - The different EE's represent function bodies in different ways. They should each implement this to say what a function pointer should look like. When F is destroyed, the ExecutionEngine will remove its global mapping and free any machine code. Be sure no threads are running inside F when that happens.

Implements llvm::ExecutionEngine.

Definition at line 95 of file MCJIT.cpp.

References llvm::ExecutionEngine::addGlobalMapping(), llvm::MCAsmInfo::getGlobalPrefix(), llvm::TargetMachine::getMCAsmInfo(), llvm::Value::getName(), getPointerToNamedFunction(), llvm::RuntimeDyld::getSymbolAddress(), llvm::GlobalValue::hasAvailableExternallyLinkage(), llvm::GlobalValue::hasExternalWeakLinkage(), llvm::GlobalValue::isDeclaration(), and llvm::StringRef::substr().

Referenced by runFunction().

void * MCJIT::getPointerToNamedFunction ( const std::string &  Name,
bool  AbortOnFailure = true 
) [virtual]

getPointerToNamedFunction - This method returns the address of the specified function by using the dlsym function call. As such it is only useful for resolving library symbols, not code generated symbols.

If AbortOnFailure is false and no function with the given name is found, this function silently returns a null pointer. Otherwise, it prints a message to stderr and aborts.

getPointerToNamedFunction - This method returns the address of the specified function by using the dynamic loader interface. As such it is only useful for resolving library symbols, not code generated symbols.

If a LazyFunctionCreator is installed, use it to get/create the function.

Implements llvm::ExecutionEngine.

Definition at line 103 of file MCJIT/Intercept.cpp.

References llvm::ExecutionEngine::isSymbolSearchingDisabled(), jit_atexit(), jit_exit(), jit_noop(), llvm::ExecutionEngine::LazyFunctionCreator, llvm::cl::Prefix, llvm::report_fatal_error(), and llvm::sys::DynamicLibrary::SearchForAddressOfSymbol().

Referenced by getPointerToFunction().

virtual void llvm::MCJIT::mapSectionAddress ( void *  LocalAddress,
uint64_t  TargetAddress 
) [inline, virtual]

mapSectionAddress - map a section to its target address space value. Map the address of a JIT section as returned from the memory manager to the address in the target process as the running code will see it. This is the address which will be used for relocation resolution.

Reimplemented from llvm::ExecutionEngine.

Definition at line 74 of file lib/ExecutionEngine/MCJIT/MCJIT.h.

References llvm::RuntimeDyld::mapSectionAddress().

void * MCJIT::recompileAndRelinkFunction ( Function F) [virtual]

recompileAndRelinkFunction - This method is used to force a function which has already been compiled to be compiled again, possibly after it has been modified. Then the entry to the old copy is overwritten with a branch to the new copy. If there was no old copy, this acts just like VM::getPointerToFunction().

Implements llvm::ExecutionEngine.

Definition at line 111 of file MCJIT.cpp.

References llvm::report_fatal_error().

static void llvm::MCJIT::Register ( ) [inline, static]
GenericValue MCJIT::runFunction ( Function F,
const std::vector< GenericValue > &  ArgValues 
) [virtual]

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