Adds the libcall_call_conv setting and use it for libcall calls expansion;

This commit is contained in:
Benjamin Bouvier
2019-08-05 12:23:39 +02:00
committed by Dan Gohman
parent c7b4b98cac
commit d8d3602257
5 changed files with 63 additions and 4 deletions

View File

@@ -1,3 +1,5 @@
use crate::isa::TargetIsa;
use crate::settings::LibcallCallConv;
use core::fmt;
use core::str;
use target_lexicon::{CallingConvention, Triple};
@@ -29,6 +31,19 @@ impl CallConv {
Ok(CallingConvention::WindowsFastcall) => CallConv::WindowsFastcall,
}
}
/// Returns the calling convention used for libcalls for the given ISA.
pub fn for_libcall(isa: &dyn TargetIsa) -> Self {
match isa.flags().libcall_call_conv() {
LibcallCallConv::IsaDefault => isa.default_call_conv(),
LibcallCallConv::Fast => CallConv::Fast,
LibcallCallConv::Cold => CallConv::Cold,
LibcallCallConv::SystemV => CallConv::SystemV,
LibcallCallConv::WindowsFastcall => CallConv::WindowsFastcall,
LibcallCallConv::Baldrdash => CallConv::Baldrdash,
LibcallCallConv::Probestack => CallConv::Probestack,
}
}
}
impl fmt::Display for CallConv {