LLVM API Documentation

llvm::JIT Class Reference

#include <JIT.h>

Inheritance diagram for llvm::JIT:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ~JIT ()
TargetJITInfogetJITInfo () const
virtual void addModuleProvider (ModuleProvider *MP)
virtual ModuleremoveModuleProvider (ModuleProvider *MP, std::string *ErrInfo=0)
virtual GenericValue runFunction (Function *F, const std::vector< GenericValue > &ArgValues)
void * getPointerToNamedFunction (const std::string &Name, bool AbortOnFailure=true)
void * getPointerToFunction (Function *F)
void * getOrEmitGlobalVariable (const GlobalVariable *GV)
void * getPointerToFunctionOrStub (Function *F)
void * recompileAndRelinkFunction (Function *F)
void freeMachineCodeForFunction (Function *F)
MachineCodeEmittergetCodeEmitter () const
 getCodeEmitter - Return the code emitter this JIT is emitting into.

Static Public Member Functions

static void Register ()
static ExecutionEnginecreate (ModuleProvider *MP, std::string *Err, bool Fast=false)
static void CompilationCallback ()
static ExecutionEnginecreateJIT (ModuleProvider *MP, std::string *Err, JITMemoryManager *JMM, bool Fast)

Protected Member Functions

virtual char * getMemoryForGV (const GlobalVariable *GV)
 getMemoryforGV - Allocate memory for a global variable.


Detailed Description

Definition at line 51 of file lib/ExecutionEngine/JIT/JIT.h.


Constructor & Destructor Documentation

JIT::~JIT (  ) 

Definition at line 251 of file JIT.cpp.

References MCE, and TM.


Member Function Documentation

static void llvm::JIT::Register (  )  [inline, static]

Definition at line 63 of file lib/ExecutionEngine/JIT/JIT.h.

References create(), and llvm::ExecutionEngine::JITCtor.

TargetJITInfo& llvm::JIT::getJITInfo (  )  const [inline]

getJITInfo - Return the target JIT information structure.

Definition at line 69 of file lib/ExecutionEngine/JIT/JIT.h.

static ExecutionEngine* llvm::JIT::create ( ModuleProvider MP,
std::string *  Err,
bool  Fast = false 
) [inline, static]

create - Create an return a new JIT compiler if there is one available for the current target. Otherwise, return null.

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

References createJIT().

Referenced by Register().

void JIT::addModuleProvider ( ModuleProvider MP  )  [virtual]

Module * JIT::removeModuleProvider ( ModuleProvider MP,
std::string *  E = 0 
) [virtual]

removeModuleProvider - If we are removing the last ModuleProvider, invalidate the jitstate since the PassManager it contains references a released ModuleProvider.

Reimplemented from llvm::ExecutionEngine.

Definition at line 288 of file JIT.cpp.

References llvm::ExecutionEngine::lock, llvm::ExecutionEngine::Modules, and llvm::ExecutionEngine::removeModuleProvider().

GenericValue JIT::runFunction ( Function F,
const std::vector< GenericValue > &  ArgValues 
) [virtual]

void * JIT::getPointerToNamedFunction ( const std::string &  Name,
bool  AbortOnFailure = true 
)

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.

Definition at line 93 of file Intercept.cpp.

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

Referenced by getPointerToFunction(), and getPointerToNamedFunction().

static void llvm::JIT::CompilationCallback (  )  [static]

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

void * JIT::getOrEmitGlobalVariable ( const GlobalVariable GV  )  [virtual]

void * JIT::getPointerToFunctionOrStub ( Function F  )  [virtual]

getPointerToFunctionOrStub - If the specified function has been code-gen'd, return a pointer to the function. If not, compile it, or use a stub to implement lazy compilation if available.

Reimplemented from llvm::ExecutionEngine.

Definition at line 1240 of file JITEmitter.cpp.

References getCodeEmitter(), and llvm::ExecutionEngine::getPointerToGlobalIfAvailable().

void * JIT::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 JIT::getPointerToFunction().

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 JIT::getPointerToFunction().

Implements llvm::ExecutionEngine.

Definition at line 595 of file JIT.cpp.

References llvm::ExecutionEngine::addGlobalMapping(), getPointerToFunction(), llvm::ExecutionEngine::getPointerToGlobalIfAvailable(), and llvm::TargetJITInfo::replaceMachineCodeForFunction().

void JIT::freeMachineCodeForFunction ( Function F  )  [virtual]

freeMachineCodeForFunction - deallocate memory used to code-generate this Function.

freeMachineCodeForFunction - release machine code memory for given Function.

Implements llvm::ExecutionEngine.

Definition at line 1253 of file JITEmitter.cpp.

References RemoveFunctionFromSymbolTable(), and llvm::ExecutionEngine::updateGlobalMapping().

MachineCodeEmitter* llvm::JIT::getCodeEmitter (  )  const [inline]

getCodeEmitter - Return the code emitter this JIT is emitting into.

Definition at line 134 of file lib/ExecutionEngine/JIT/JIT.h.

Referenced by getPointerToFunctionOrStub().

ExecutionEngine * JIT::createJIT ( ModuleProvider MP,
std::string *  ErrorStr,
JITMemoryManager JMM,
bool  Fast 
) [static]

createInternal - Create an return a new JIT compiler if there is one available for the current target. Otherwise, return null.

Reimplemented from llvm::ExecutionEngine.

Definition at line 43 of file TargetSelect.cpp.

References llvm::SubtargetFeatures::AddFeature(), llvm::cerr(), Error(), llvm::TargetMachineRegistry::getClosestTargetForJIT(), llvm::TargetMachine::getJITInfo(), llvm::ModuleProvider::getModule(), llvm::SubtargetFeatures::getString(), MArch, MAttrs, MCPU, and llvm::SubtargetFeatures::setCPU().

Referenced by create(), and llvm::ExecutionEngine::createJIT().

char * JIT::getMemoryForGV ( const GlobalVariable GV  )  [protected, virtual]

getMemoryforGV - Allocate memory for a global variable.

getMemoryForGV - This method abstracts memory allocation of global variable so that the JIT can allocate thread local variables depending on the target.

Reimplemented from llvm::ExecutionEngine.

Definition at line 618 of file JIT.cpp.

References llvm::TargetJITInfo::allocateThreadLocalMemory(), llvm::TargetData::getABITypeSize(), llvm::SequentialType::getElementType(), llvm::ExecutionEngine::getTargetData(), llvm::GlobalValue::getType(), llvm::GlobalVariable::isThreadLocal(), and llvm::ExecutionEngine::lock.


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



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