Remove a couple of module.isa() calls
This commit is contained in:
parent
6e772b86a8
commit
08ba5d4e80
6 changed files with 17 additions and 12 deletions
|
@ -56,13 +56,13 @@ pub(crate) fn conv_to_call_conv(c: Conv, default_call_conv: CallConv) -> CallCon
|
||||||
|
|
||||||
pub(crate) fn get_function_sig<'tcx>(
|
pub(crate) fn get_function_sig<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
triple: &target_lexicon::Triple,
|
default_call_conv: CallConv,
|
||||||
inst: Instance<'tcx>,
|
inst: Instance<'tcx>,
|
||||||
) -> Signature {
|
) -> Signature {
|
||||||
assert!(!inst.substs.needs_infer());
|
assert!(!inst.substs.needs_infer());
|
||||||
clif_sig_from_fn_abi(
|
clif_sig_from_fn_abi(
|
||||||
tcx,
|
tcx,
|
||||||
CallConv::triple_default(triple),
|
default_call_conv,
|
||||||
&RevealAllLayoutCx(tcx).fn_abi_of_instance(inst, ty::List::empty()),
|
&RevealAllLayoutCx(tcx).fn_abi_of_instance(inst, ty::List::empty()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ pub(crate) fn import_function<'tcx>(
|
||||||
inst: Instance<'tcx>,
|
inst: Instance<'tcx>,
|
||||||
) -> FuncId {
|
) -> FuncId {
|
||||||
let name = tcx.symbol_name(inst).name;
|
let name = tcx.symbol_name(inst).name;
|
||||||
let sig = get_function_sig(tcx, module.isa().triple(), inst);
|
let sig = get_function_sig(tcx, module.target_config().default_call_conv, inst);
|
||||||
match module.declare_function(name, Linkage::Import, &sig) {
|
match module.declare_function(name, Linkage::Import, &sig) {
|
||||||
Ok(func_id) => func_id,
|
Ok(func_id) => func_id,
|
||||||
Err(ModuleError::IncompatibleDeclaration(_)) => tcx.sess.fatal(&format!(
|
Err(ModuleError::IncompatibleDeclaration(_)) => tcx.sess.fatal(&format!(
|
||||||
|
|
|
@ -66,7 +66,7 @@ fn codegen_inner(
|
||||||
};
|
};
|
||||||
|
|
||||||
let sig = Signature {
|
let sig = Signature {
|
||||||
call_conv: CallConv::triple_default(module.isa().triple()),
|
call_conv: module.target_config().default_call_conv,
|
||||||
params: arg_tys.iter().cloned().map(AbiParam::new).collect(),
|
params: arg_tys.iter().cloned().map(AbiParam::new).collect(),
|
||||||
returns: output.into_iter().map(AbiParam::new).collect(),
|
returns: output.into_iter().map(AbiParam::new).collect(),
|
||||||
};
|
};
|
||||||
|
@ -104,7 +104,7 @@ fn codegen_inner(
|
||||||
}
|
}
|
||||||
|
|
||||||
let sig = Signature {
|
let sig = Signature {
|
||||||
call_conv: CallConv::triple_default(module.isa().triple()),
|
call_conv: module.target_config().default_call_conv,
|
||||||
params: vec![AbiParam::new(usize_ty), AbiParam::new(usize_ty)],
|
params: vec![AbiParam::new(usize_ty), AbiParam::new(usize_ty)],
|
||||||
returns: vec![],
|
returns: vec![],
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,7 +59,7 @@ pub(crate) fn codegen_fn<'tcx>(
|
||||||
|
|
||||||
// Declare function
|
// Declare function
|
||||||
let symbol_name = tcx.symbol_name(instance).name.to_string();
|
let symbol_name = tcx.symbol_name(instance).name.to_string();
|
||||||
let sig = get_function_sig(tcx, module.isa().triple(), instance);
|
let sig = get_function_sig(tcx, module.target_config().default_call_conv, instance);
|
||||||
let func_id = module.declare_function(&symbol_name, Linkage::Local, &sig).unwrap();
|
let func_id = module.declare_function(&symbol_name, Linkage::Local, &sig).unwrap();
|
||||||
|
|
||||||
// Make the FunctionBuilder
|
// Make the FunctionBuilder
|
||||||
|
|
|
@ -245,7 +245,11 @@ fn jit_fn(instance_ptr: *const Instance<'static>, trampoline_ptr: *const u8) ->
|
||||||
let backend_config = lazy_jit_state.backend_config.clone();
|
let backend_config = lazy_jit_state.backend_config.clone();
|
||||||
|
|
||||||
let name = tcx.symbol_name(instance).name;
|
let name = tcx.symbol_name(instance).name;
|
||||||
let sig = crate::abi::get_function_sig(tcx, jit_module.isa().triple(), instance);
|
let sig = crate::abi::get_function_sig(
|
||||||
|
tcx,
|
||||||
|
jit_module.target_config().default_call_conv,
|
||||||
|
instance,
|
||||||
|
);
|
||||||
let func_id = jit_module.declare_function(name, Linkage::Export, &sig).unwrap();
|
let func_id = jit_module.declare_function(name, Linkage::Export, &sig).unwrap();
|
||||||
|
|
||||||
let current_ptr = jit_module.read_got_entry(func_id);
|
let current_ptr = jit_module.read_got_entry(func_id);
|
||||||
|
@ -344,7 +348,7 @@ fn codegen_shim<'tcx>(
|
||||||
let pointer_type = module.target_config().pointer_type();
|
let pointer_type = module.target_config().pointer_type();
|
||||||
|
|
||||||
let name = tcx.symbol_name(inst).name;
|
let name = tcx.symbol_name(inst).name;
|
||||||
let sig = crate::abi::get_function_sig(tcx, module.isa().triple(), inst);
|
let sig = crate::abi::get_function_sig(tcx, module.target_config().default_call_conv, inst);
|
||||||
let func_id = module.declare_function(name, Linkage::Export, &sig).unwrap();
|
let func_id = module.declare_function(name, Linkage::Export, &sig).unwrap();
|
||||||
|
|
||||||
let instance_ptr = Box::into_raw(Box::new(inst));
|
let instance_ptr = Box::into_raw(Box::new(inst));
|
||||||
|
|
|
@ -24,7 +24,8 @@ fn predefine_mono_items<'tcx>(
|
||||||
MonoItem::Fn(instance) => {
|
MonoItem::Fn(instance) => {
|
||||||
let name = tcx.symbol_name(instance).name;
|
let name = tcx.symbol_name(instance).name;
|
||||||
let _inst_guard = crate::PrintOnPanic(|| format!("{:?} {}", instance, name));
|
let _inst_guard = crate::PrintOnPanic(|| format!("{:?} {}", instance, name));
|
||||||
let sig = get_function_sig(tcx, module.isa().triple(), instance);
|
let sig =
|
||||||
|
get_function_sig(tcx, module.target_config().default_call_conv, instance);
|
||||||
let linkage = crate::linkage::get_clif_linkage(
|
let linkage = crate::linkage::get_clif_linkage(
|
||||||
mono_item,
|
mono_item,
|
||||||
linkage,
|
linkage,
|
||||||
|
|
|
@ -65,7 +65,7 @@ pub(crate) fn maybe_create_entry_wrapper(
|
||||||
returns: vec![AbiParam::new(m.target_config().pointer_type() /*isize*/)],
|
returns: vec![AbiParam::new(m.target_config().pointer_type() /*isize*/)],
|
||||||
call_conv: crate::conv_to_call_conv(
|
call_conv: crate::conv_to_call_conv(
|
||||||
tcx.sess.target.options.entry_abi,
|
tcx.sess.target.options.entry_abi,
|
||||||
CallConv::triple_default(m.isa().triple()),
|
m.target_config().default_call_conv,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ pub(crate) fn maybe_create_entry_wrapper(
|
||||||
let instance = Instance::mono(tcx, rust_main_def_id).polymorphize(tcx);
|
let instance = Instance::mono(tcx, rust_main_def_id).polymorphize(tcx);
|
||||||
|
|
||||||
let main_name = tcx.symbol_name(instance).name;
|
let main_name = tcx.symbol_name(instance).name;
|
||||||
let main_sig = get_function_sig(tcx, m.isa().triple(), instance);
|
let main_sig = get_function_sig(tcx, m.target_config().default_call_conv, instance);
|
||||||
let main_func_id = m.declare_function(main_name, Linkage::Import, &main_sig).unwrap();
|
let main_func_id = m.declare_function(main_name, Linkage::Import, &main_sig).unwrap();
|
||||||
|
|
||||||
let mut ctx = Context::new();
|
let mut ctx = Context::new();
|
||||||
|
@ -119,7 +119,7 @@ pub(crate) fn maybe_create_entry_wrapper(
|
||||||
.polymorphize(tcx);
|
.polymorphize(tcx);
|
||||||
|
|
||||||
let report_name = tcx.symbol_name(report).name;
|
let report_name = tcx.symbol_name(report).name;
|
||||||
let report_sig = get_function_sig(tcx, m.isa().triple(), report);
|
let report_sig = get_function_sig(tcx, m.target_config().default_call_conv, report);
|
||||||
let report_func_id =
|
let report_func_id =
|
||||||
m.declare_function(report_name, Linkage::Import, &report_sig).unwrap();
|
m.declare_function(report_name, Linkage::Import, &report_sig).unwrap();
|
||||||
let report_func_ref = m.declare_func_in_func(report_func_id, &mut bcx.func);
|
let report_func_ref = m.declare_func_in_func(report_func_id, &mut bcx.func);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue