Trait llvm_rs::ExecutionEngine
source · pub trait ExecutionEngine<'a>: 'a + Sized + DisposeRefwhere
LLVMExecutionEngineRef: From<&'a Self>,{
type Options: Copy;
fn new(
module: &'a Module,
options: Self::Options
) -> Result<CSemiBox<'a, Self>, CBox<str>>;
fn add_module(&'a self, module: &'a Module) { ... }
fn remove_module(&'a self, module: &'a Module) -> &'a Module { ... }
fn run_static_constructors(&'a self) { ... }
fn run_static_destructors(&'a self) { ... }
fn find_function(&'a self, name: &str) -> Option<&'a Function> { ... }
fn run_function(
&'a self,
function: &'a Function,
args: &[&'a GenericValue]
) -> &'a GenericValue { ... }
unsafe fn get_global<T>(&'a self, global: &'a Value) -> &'a T { ... }
unsafe fn find_global<T>(&'a self, name: &str) -> Option<&'a T> { ... }
}Expand description
An abstract interface for implementation execution of LLVM modules.
This is designed to support both interpreter and just-in-time (JIT) compiler implementations.
Required Associated Types§
Required Methods§
Provided Methods§
sourcefn add_module(&'a self, module: &'a Module)
fn add_module(&'a self, module: &'a Module)
Add a module to the list of modules to interpret or compile.
sourcefn remove_module(&'a self, module: &'a Module) -> &'a Module
fn remove_module(&'a self, module: &'a Module) -> &'a Module
Remove a module from the list of modules to interpret or compile.
sourcefn run_static_constructors(&'a self)
fn run_static_constructors(&'a self)
Execute all of the static constructors for this program.
sourcefn run_static_destructors(&'a self)
fn run_static_destructors(&'a self)
Execute all of the static destructors for this program.
sourcefn find_function(&'a self, name: &str) -> Option<&'a Function>
fn find_function(&'a self, name: &str) -> Option<&'a Function>
Attempt to find a function with the name given, or None if there wasn’t
a function with that name.
sourcefn run_function(
&'a self,
function: &'a Function,
args: &[&'a GenericValue]
) -> &'a GenericValue
fn run_function(
&'a self,
function: &'a Function,
args: &[&'a GenericValue]
) -> &'a GenericValue
Run function with the arguments given as ``GenericValue`s, then return the result as one.
Note that if this engine is a JitEngine, it only supports a small fraction of combinations
for the arguments and return value, so be warned.
To convert the arguments to GenericValues, you should use the GenericValueCast::to_generic method.
To convert the return value from a GenericValue, you should use the GenericValueCast::from_generic method.
sourceunsafe fn get_global<T>(&'a self, global: &'a Value) -> &'a T
unsafe fn get_global<T>(&'a self, global: &'a Value) -> &'a T
Returns a pointer to the global value given.
This is marked as unsafe because the type cannot be guranteed to be the same as the type of the global value at this point.
sourceunsafe fn find_global<T>(&'a self, name: &str) -> Option<&'a T>
unsafe fn find_global<T>(&'a self, name: &str) -> Option<&'a T>
Returns a pointer to the global value with the name given.
This is marked as unsafe because the type cannot be guranteed to be the same as the type of the global value at this point.