Skip to content

Commit

Permalink
Add support for ExecutionEngine::lookup(). (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
azteca1998 authored Dec 19, 2023
1 parent 816e3c9 commit bb4d509
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion melior/src/execution_engine.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::{ir::Module, logical_result::LogicalResult, string_ref::StringRef, Error};
use mlir_sys::{
mlirExecutionEngineCreate, mlirExecutionEngineDestroy, mlirExecutionEngineDumpToObjectFile,
mlirExecutionEngineInvokePacked, mlirExecutionEngineRegisterSymbol, MlirExecutionEngine,
mlirExecutionEngineInvokePacked, mlirExecutionEngineLookup, mlirExecutionEngineRegisterSymbol,
MlirExecutionEngine,
};

/// An execution engine.
Expand Down Expand Up @@ -34,6 +35,11 @@ impl ExecutionEngine {
}
}

/// Searches a symbol in a module and returns a pointer to it.
pub fn lookup(&self, name: &str) -> *mut () {
unsafe { mlirExecutionEngineLookup(self.raw, StringRef::new(name).to_raw()) as *mut () }
}

/// Invokes a function in a module. The `arguments` argument includes
/// pointers to results of the function as well as arguments.
///
Expand Down

0 comments on commit bb4d509

Please sign in to comment.