Refactor calling convention settings. (#304)
Add a calling-convention setting to the `Flags` used as part of the `TargetIsa`. This allows Cretonne code that generates calls to use the correct convention, such as when emitting libcalls during legalization or when the wasm frontend is decoding functions. This setting can be overridden per-function. This also adds "fast", "cold", and "fastcall" conventions, with "fast" as the new default. Note that "fast" and "cold" are not intended to be ABI-compatible across Cretonne versions. This will also ensure Windows users will get an `unimplemented!` rather than silent calling-convention mismatches, which reflects the fact that Windows calling conventions are not yet implemented. This also renames SpiderWASM, which isn't camel-case, to Baldrdash, which is, and which is also a more relevant name.
This commit is contained in:
@@ -52,6 +52,7 @@ use isa::enc_tables::Encodings;
|
||||
use regalloc;
|
||||
use result;
|
||||
use settings;
|
||||
use settings::CallConv;
|
||||
use std::boxed::Box;
|
||||
use std::fmt;
|
||||
use timing;
|
||||
@@ -252,8 +253,8 @@ pub trait TargetIsa: fmt::Display {
|
||||
let word_size = if self.flags().is_64bit() { 8 } else { 4 };
|
||||
|
||||
// Account for the SpiderMonkey standard prologue pushes.
|
||||
if func.signature.call_conv == ir::CallConv::SpiderWASM {
|
||||
let bytes = StackSize::from(self.flags().spiderwasm_prologue_words()) * word_size;
|
||||
if func.signature.call_conv == CallConv::Baldrdash {
|
||||
let bytes = StackSize::from(self.flags().baldrdash_prologue_words()) * word_size;
|
||||
let mut ss = ir::StackSlotData::new(ir::StackSlotKind::IncomingArg, bytes);
|
||||
ss.offset = Some(-(bytes as StackOffset));
|
||||
func.stack_slots.push(ss);
|
||||
|
||||
Reference in New Issue
Block a user