Commit bb7e1676 authored by Eduardo Souza's avatar Eduardo Souza

Apply rustfmt.

parent a545719f
Pipeline #5501 failed with stages
in 23 minutes and 24 seconds
...@@ -30,15 +30,19 @@ use llvm_sys::target_machine::*; ...@@ -30,15 +30,19 @@ use llvm_sys::target_machine::*;
use crate::instr::*; use crate::instr::*;
use llvm_sys::initialization::{
LLVMInitializeCodeGen, LLVMInitializeCore, LLVMInitializeScalarOpts
};
use llvm_sys::transforms::scalar::{
LLVMAddCFGSimplificationPass, LLVMAddGVNPass
};
use std::any::Any; use std::any::Any;
use std::borrow::Borrow; use std::borrow::Borrow;
use std::collections::HashMap; use std::collections::HashMap;
use std::ffi::CString; use std::ffi::CString;
use std::os::raw::{c_char, c_double, c_uint, c_ulong}; use std::os::raw::{c_char, c_double, c_uint, c_ulong};
use std::{path, ptr};
use llvm_sys::initialization::{LLVMInitializeCodeGen, LLVMInitializeScalarOpts, LLVMInitializeCore};
use llvm_sys::transforms::scalar::{LLVMAddCFGSimplificationPass, LLVMAddGVNPass};
use std::process::Command; use std::process::Command;
use std::{path, ptr};
pub struct LLVMCodeEmission { pub struct LLVMCodeEmission {
name: &'static str, name: &'static str,
...@@ -276,7 +280,8 @@ fn visit_inst_custom( ...@@ -276,7 +280,8 @@ fn visit_inst_custom(
false false
); );
let function_name = MuName::new(String::from("llvm.experimental.stackmap")); let function_name =
MuName::new(String::from("llvm.experimental.stackmap"));
let i8_type = Arc::new(MuType::new(0, MuType_::Int(8))); let i8_type = Arc::new(MuType::new(0, MuType_::Int(8)));
let refi8_type = let refi8_type =
Arc::new(MuType::new(0, MuType_::Ref(i8_type))); Arc::new(MuType::new(0, MuType_::Ref(i8_type)));
...@@ -300,7 +305,8 @@ fn visit_inst_custom( ...@@ -300,7 +305,8 @@ fn visit_inst_custom(
llvm_internal_context, llvm_internal_context,
function_name, function_name,
llvm_arg_types, llvm_arg_types,
return_type, true return_type,
true
); );
}, },
mu::ast::inst::Instruction_::CommonInst_GetThreadLocal => unsafe { mu::ast::inst::Instruction_::CommonInst_GetThreadLocal => unsafe {
...@@ -668,7 +674,7 @@ impl<'a> AOTLLVMInternalContext<'a> { ...@@ -668,7 +674,7 @@ impl<'a> AOTLLVMInternalContext<'a> {
global_store, global_store,
struct_map, struct_map,
exception_blocks, exception_blocks,
curr_fn : None, curr_fn: None,
vm vm
} }
} }
...@@ -1363,7 +1369,10 @@ unsafe fn gen_llvm_instruction( ...@@ -1363,7 +1369,10 @@ unsafe fn gen_llvm_instruction(
mu::ast::inst::Instruction_::New(mu_type) => { mu::ast::inst::Instruction_::New(mu_type) => {
let llvm_type = gen_llvm_type(llvm_internal_context, mu_type); let llvm_type = gen_llvm_type(llvm_internal_context, mu_type);
gen_instr_new(llvm_internal_context, store, ins, llvm_type); gen_instr_new(llvm_internal_context, store, ins, llvm_type);
LLVMSetGC(llvm_internal_context.curr_fn.unwrap(), "statepoint-example\0".as_ptr() as *const c_char); LLVMSetGC(
llvm_internal_context.curr_fn.unwrap(),
"statepoint-example\0".as_ptr() as *const c_char
);
} }
mu::ast::inst::Instruction_::AllocA(mu_type) => { mu::ast::inst::Instruction_::AllocA(mu_type) => {
let llvm_type = gen_llvm_type(llvm_internal_context, mu_type); let llvm_type = gen_llvm_type(llvm_internal_context, mu_type);
...@@ -1778,10 +1787,9 @@ unsafe fn optimize_ir( ...@@ -1778,10 +1787,9 @@ unsafe fn optimize_ir(
exec_cmd(llc); exec_cmd(llc);
} }
/* FIXME for some reason, I'm getting an error /* FIXME for some reason, I'm getting an error
`LLVM ERROR: unsupported GC: statepoint-example (did you remember to link and initialize the CodeGen library?)` `LLVM ERROR: unsupported GC: statepoint-example (did you remember to link and initialize the CodeGen library?)`
when generating the ASM with MCJIT. For that reason I'm just going to call llc explicitly */ when generating the ASM with MCJIT. For that reason I'm just going to call llc explicitly */
unsafe fn generate_llvm_asm( unsafe fn generate_llvm_asm(
llvm_internal_context: &AOTLLVMInternalContext, llvm_internal_context: &AOTLLVMInternalContext,
...@@ -1847,8 +1855,6 @@ fn get_llvm_optimizer() -> String { ...@@ -1847,8 +1855,6 @@ fn get_llvm_optimizer() -> String {
} }
} }
//unsafe fn generate_llvm_asm( //unsafe fn generate_llvm_asm(
// llvm_internal_context: &AOTLLVMInternalContext, // llvm_internal_context: &AOTLLVMInternalContext,
// func: &mut MuFunctionVersion, // func: &mut MuFunctionVersion,
...@@ -1856,9 +1862,11 @@ fn get_llvm_optimizer() -> String { ...@@ -1856,9 +1862,11 @@ fn get_llvm_optimizer() -> String {
//) { //) {
// let mut ee = 0 as LLVMExecutionEngineRef; // let mut ee = 0 as LLVMExecutionEngineRef;
// let mut error = 0 as *mut c_char; // let mut error = 0 as *mut c_char;
// let mut options = std::mem::MaybeUninit::uninit().assume_init(); //std::mem::uninitialized(); // let mut options = std::mem::MaybeUninit::uninit().assume_init();
// //std::mem::uninitialized();
// //
// let module_provider = LLVMCreateModuleProviderForExistingModule(llvm_internal_context.module); // let module_provider =
// LLVMCreateModuleProviderForExistingModule(llvm_internal_context.module);
// let func_pass_manager = LLVMCreateFunctionPassManager(module_provider); // let func_pass_manager = LLVMCreateFunctionPassManager(module_provider);
// //
// if LLVMVerifyModule( // if LLVMVerifyModule(
...@@ -1873,7 +1881,8 @@ fn get_llvm_optimizer() -> String { ...@@ -1873,7 +1881,8 @@ fn get_llvm_optimizer() -> String {
// unimplemented!(); // unimplemented!();
// } // }
// //
// LLVMRunFunctionPassManager(func_pass_manager, llvm_internal_context.curr_fn.unwrap()); // LLVMRunFunctionPassManager(func_pass_manager,
// llvm_internal_context.curr_fn.unwrap());
// //
// //
// LLVMInitializeMCJITCompilerOptions( // LLVMInitializeMCJITCompilerOptions(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment