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:
@@ -459,34 +459,34 @@ mod tests {
|
||||
#[test]
|
||||
fn basic() {
|
||||
let mut f = Function::new();
|
||||
assert_eq!(f.to_string(), "function u0:0() system_v {\n}\n");
|
||||
assert_eq!(f.to_string(), "function u0:0() fast {\n}\n");
|
||||
|
||||
f.name = ExternalName::testcase("foo");
|
||||
assert_eq!(f.to_string(), "function %foo() system_v {\n}\n");
|
||||
assert_eq!(f.to_string(), "function %foo() fast {\n}\n");
|
||||
|
||||
f.create_stack_slot(StackSlotData::new(StackSlotKind::ExplicitSlot, 4));
|
||||
assert_eq!(
|
||||
f.to_string(),
|
||||
"function %foo() system_v {\n ss0 = explicit_slot 4\n}\n"
|
||||
"function %foo() fast {\n ss0 = explicit_slot 4\n}\n"
|
||||
);
|
||||
|
||||
let ebb = f.dfg.make_ebb();
|
||||
f.layout.append_ebb(ebb);
|
||||
assert_eq!(
|
||||
f.to_string(),
|
||||
"function %foo() system_v {\n ss0 = explicit_slot 4\n\nebb0:\n}\n"
|
||||
"function %foo() fast {\n ss0 = explicit_slot 4\n\nebb0:\n}\n"
|
||||
);
|
||||
|
||||
f.dfg.append_ebb_param(ebb, types::I8);
|
||||
assert_eq!(
|
||||
f.to_string(),
|
||||
"function %foo() system_v {\n ss0 = explicit_slot 4\n\nebb0(v0: i8):\n}\n"
|
||||
"function %foo() fast {\n ss0 = explicit_slot 4\n\nebb0(v0: i8):\n}\n"
|
||||
);
|
||||
|
||||
f.dfg.append_ebb_param(ebb, types::F32.by(4).unwrap());
|
||||
assert_eq!(
|
||||
f.to_string(),
|
||||
"function %foo() system_v {\n ss0 = explicit_slot 4\n\nebb0(v0: i8, v1: f32x4):\n}\n"
|
||||
"function %foo() fast {\n ss0 = explicit_slot 4\n\nebb0(v0: i8, v1: f32x4):\n}\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user