parent
44792f1089
commit
0db605040e
@ -26,8 +26,8 @@ fn clif_sig_from_fn_sig<'tcx>(
|
||||
abi => abi,
|
||||
};
|
||||
let (call_conv, inputs, output): (CallConv, Vec<Ty>, Ty) = match abi {
|
||||
Abi::Rust => (CallConv::SystemV, sig.inputs().to_vec(), sig.output()),
|
||||
Abi::C => (CallConv::SystemV, sig.inputs().to_vec(), sig.output()),
|
||||
Abi::Rust => (crate::default_call_conv(tcx.sess), sig.inputs().to_vec(), sig.output()),
|
||||
Abi::C => (crate::default_call_conv(tcx.sess), sig.inputs().to_vec(), sig.output()),
|
||||
Abi::RustCall => {
|
||||
assert_eq!(sig.inputs().len(), 2);
|
||||
let extra_args = match sig.inputs().last().unwrap().kind {
|
||||
@ -36,10 +36,10 @@ fn clif_sig_from_fn_sig<'tcx>(
|
||||
};
|
||||
let mut inputs: Vec<Ty> = vec![sig.inputs()[0]];
|
||||
inputs.extend(extra_args.types());
|
||||
(CallConv::SystemV, inputs, sig.output())
|
||||
(crate::default_call_conv(tcx.sess), inputs, sig.output())
|
||||
}
|
||||
Abi::System => unreachable!(),
|
||||
Abi::RustIntrinsic => (CallConv::SystemV, sig.inputs().to_vec(), sig.output()),
|
||||
Abi::RustIntrinsic => (crate::default_call_conv(tcx.sess), sig.inputs().to_vec(), sig.output()),
|
||||
_ => unimplemented!("unsupported abi {:?}", sig.abi),
|
||||
};
|
||||
|
||||
@ -142,7 +142,7 @@ fn lib_call(
|
||||
let sig = Signature {
|
||||
params: input_tys.iter().cloned().map(AbiParam::new).collect(),
|
||||
returns: output_tys.iter().cloned().map(AbiParam::new).collect(),
|
||||
call_conv: CallConv::SystemV,
|
||||
call_conv: crate::default_call_conv(self.tcx.sess),
|
||||
};
|
||||
let func_id = self
|
||||
.module
|
||||
|
@ -21,14 +21,14 @@ pub fn codegen(tcx: TyCtxt<'_>, module: &mut Module<impl Backend + 'static>) ->
|
||||
if any_dynamic_crate {
|
||||
false
|
||||
} else if let Some(kind) = *tcx.sess.allocator_kind.get() {
|
||||
codegen_inner(module, kind);
|
||||
codegen_inner(tcx.sess, module, kind);
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub fn codegen_inner(module: &mut Module<impl Backend + 'static>, kind: AllocatorKind) {
|
||||
pub fn codegen_inner(sess: &Session, module: &mut Module<impl Backend + 'static>, kind: AllocatorKind) {
|
||||
let usize_ty = module.target_config().pointer_type();
|
||||
|
||||
for method in ALLOCATOR_METHODS {
|
||||
@ -55,7 +55,7 @@ pub fn codegen_inner(module: &mut Module<impl Backend + 'static>, kind: Allocato
|
||||
};
|
||||
|
||||
let sig = Signature {
|
||||
call_conv: CallConv::SystemV,
|
||||
call_conv: crate::default_call_conv(sess),
|
||||
params: arg_tys.iter().cloned().map(AbiParam::new).collect(),
|
||||
returns: output.into_iter().map(AbiParam::new).collect(),
|
||||
};
|
||||
|
@ -61,7 +61,7 @@ fn run_jit(tcx: TyCtxt<'_>, log: &mut Option<File>) -> ! {
|
||||
returns: vec![AbiParam::new(
|
||||
jit_module.target_config().pointer_type(), /*isize*/
|
||||
)],
|
||||
call_conv: CallConv::SystemV,
|
||||
call_conv: crate::default_call_conv(tcx.sess),
|
||||
};
|
||||
let main_func_id = jit_module
|
||||
.declare_function("main", Linkage::Import, &sig)
|
||||
|
@ -1063,7 +1063,7 @@ fn swap(bcx: &mut FunctionBuilder, v: Value) -> Value {
|
||||
try, (v f, v data, v _local_ptr) {
|
||||
// FIXME once unwinding is supported, change this to actually catch panics
|
||||
let f_sig = fx.bcx.func.import_signature(Signature {
|
||||
call_conv: cranelift::codegen::isa::CallConv::SystemV,
|
||||
call_conv: crate::default_call_conv(fx.tcx.sess),
|
||||
params: vec![AbiParam::new(fx.bcx.func.dfg.value_type(data))],
|
||||
returns: vec![],
|
||||
});
|
||||
|
@ -225,7 +225,7 @@ fn join_codegen_and_link(
|
||||
|
||||
sess.profiler(|p| p.start_activity("link_crate"));
|
||||
rustc::util::common::time(sess, "linking", || {
|
||||
let target_cpu = target_triple(sess).to_string();
|
||||
let target_cpu = crate::target_triple(sess).to_string();
|
||||
link_binary::<crate::archive::ArArchiveBuilder<'_>>(
|
||||
sess,
|
||||
&codegen_results,
|
||||
@ -244,6 +244,10 @@ fn target_triple(sess: &Session) -> target_lexicon::Triple {
|
||||
sess.target.target.llvm_target.parse().unwrap()
|
||||
}
|
||||
|
||||
fn default_call_conv(sess: &Session) -> CallConv {
|
||||
CallConv::triple_default(&target_triple(sess))
|
||||
}
|
||||
|
||||
fn build_isa(sess: &Session, enable_pic: bool) -> Box<dyn isa::TargetIsa + 'static> {
|
||||
let mut flags_builder = settings::builder();
|
||||
if enable_pic {
|
||||
@ -279,7 +283,7 @@ fn build_isa(sess: &Session, enable_pic: bool) -> Box<dyn isa::TargetIsa + 'stat
|
||||
}
|
||||
}*/
|
||||
|
||||
let target_triple = target_triple(sess);
|
||||
let target_triple = crate::target_triple(sess);
|
||||
let flags = settings::Flags::new(flags_builder);
|
||||
cranelift::codegen::isa::lookup(target_triple)
|
||||
.unwrap()
|
||||
|
@ -41,7 +41,7 @@ fn create_entry_fn(
|
||||
returns: vec![AbiParam::new(
|
||||
m.target_config().pointer_type(), /*isize*/
|
||||
)],
|
||||
call_conv: CallConv::SystemV,
|
||||
call_conv: crate::default_call_conv(tcx.sess),
|
||||
};
|
||||
|
||||
let cmain_func_id = m
|
||||
|
@ -7,7 +7,7 @@ fn codegen_print(fx: &mut FunctionCx<'_, '_, impl cranelift_module::Backend>, ms
|
||||
"puts",
|
||||
Linkage::Import,
|
||||
&Signature {
|
||||
call_conv: CallConv::SystemV,
|
||||
call_conv: crate::default_call_conv(fx.tcx.sess),
|
||||
params: vec![AbiParam::new(pointer_ty(fx.tcx))],
|
||||
returns: vec![],
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user