File tree Expand file tree Collapse file tree 3 files changed +264
-225
lines changed
Expand file tree Collapse file tree 3 files changed +264
-225
lines changed Original file line number Diff line number Diff line change @@ -779,19 +779,17 @@ pub(crate) unsafe fn llvm_optimize(
779779 let out_obj_c = CString :: new ( "/p/lustre1/drehwald1/prog/offload/r/host.o" ) . unwrap ( ) ;
780780
781781 unsafe {
782- llvm:: LLVMRustBundleImages (
783- module. module_llvm . llmod ( ) ,
784- module. module_llvm . tm . raw ( ) ,
785- host_out_c. as_ptr ( ) ,
786- ) ;
787- }
788- unsafe {
782+ //let buf = llvm::LLVMRustModuleBufferFromFile(lib_bc_c.as_ptr()).unwrap();
783+ let buf = llvm:: LLVMRustModuleBufferCreate ( module. module_llvm . llmod ( ) ) ;
784+
785+ let ok =
786+ llvm:: LLVMRustBundleImages ( buf, module. module_llvm . tm . raw ( ) , host_out_c. as_ptr ( ) ) ;
789787 // 1) Bundle device module into offload image host.out (device TM)
790- let ok = llvm:: LLVMRustBundleImages (
791- module. module_llvm . llmod ( ) ,
792- module. module_llvm . tm . raw ( ) ,
793- host_out_c. as_ptr ( ) ,
794- ) ;
788+ // let ok = llvm::LLVMRustBundleImages(
789+ // module.module_llvm.llmod(),
790+ // module.module_llvm.tm.raw(),
791+ // host_out_c.as_ptr(),
792+ // );
795793 assert ! ( ok, "LLVMRustBundleImages (device -> host.out) failed" ) ;
796794
797795 // 2) Finalize host: lib.bc + host.out -> host.offload.o (host TM created in C++)
Original file line number Diff line number Diff line change @@ -1723,7 +1723,8 @@ mod Offload {
17231723 unsafe extern "C" {
17241724 /// Processes the module and writes it in an offload compatible way into a "host.out" file.
17251725 pub ( crate ) fn LLVMRustBundleImages < ' a > (
1726- M : & ' a Module ,
1726+ p : & ModuleBuffer ,
1727+ //M: &'a Module,
17271728 TM : & ' a TargetMachine ,
17281729 host_out : * const c_char ,
17291730 ) -> bool ;
@@ -1733,6 +1734,11 @@ mod Offload {
17331734 out_obj_path : * const c_char ,
17341735 ) -> bool ;
17351736 pub ( crate ) fn LLVMRustOffloadMapper < ' a > ( OldFn : & ' a Value , NewFn : & ' a Value ) ;
1737+ //pub(crate) fn LLVMCreateMemoryBufferWithContentsOfFile(
1738+ // path: *const c_char,
1739+ // buf: &mut ModuleBuffer,
1740+ // msg: *mut c_char,
1741+ //);
17361742 }
17371743}
17381744
@@ -2500,6 +2506,9 @@ unsafe extern "C" {
25002506 pub ( crate ) fn LLVMRustSetModulePIELevel ( M : & Module ) ;
25012507 pub ( crate ) fn LLVMRustSetModuleCodeModel ( M : & Module , Model : CodeModel ) ;
25022508 pub ( crate ) fn LLVMRustModuleBufferCreate ( M : & Module ) -> & ' static mut ModuleBuffer ;
2509+ pub ( crate ) fn LLVMRustModuleBufferFromFile (
2510+ path : * const c_char ,
2511+ ) -> Option < & ' static mut ModuleBuffer > ;
25032512 pub ( crate ) fn LLVMRustModuleBufferPtr ( p : & ModuleBuffer ) -> * const u8 ;
25042513 pub ( crate ) fn LLVMRustModuleBufferLen ( p : & ModuleBuffer ) -> usize ;
25052514 pub ( crate ) fn LLVMRustModuleBufferFree ( p : & ' static mut ModuleBuffer ) ;
You can’t perform that action at this time.
0 commit comments