Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cranellift: remove Baldrdash support and related features. #4571

Merged
merged 5 commits into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions cranelift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,16 @@ Planned uses

Cranelift is designed to be a code generator for WebAssembly, but it is
general enough to be useful elsewhere too. The initial planned uses that
affected its design are:

- [WebAssembly compiler for the SpiderMonkey engine in
Firefox](spidermonkey.md#phase-1-webassembly).
- [Backend for the IonMonkey JavaScript JIT compiler in
Firefox](spidermonkey.md#phase-2-ionmonkey).
cfallin marked this conversation as resolved.
Show resolved Hide resolved
- [Debug build backend for the Rust compiler](rustc.md).
- [Wasmtime non-Web wasm engine](https://github.com/bytecodealliance/wasmtime).
affected its design were:

- [Wasmtime non-Web wasm engine](https://github.com/bytecodealliance/wasmtime).
- [Debug build backend for the Rust compiler](rustc.md).
- WebAssembly compiler for the SpiderMonkey engine in Firefox
(currently not planned anymore; SpiderMonkey team may re-assess in
the future).
- Backend for the IonMonkey JavaScript JIT compiler in Firefox
(currently not planned anymore; SpiderMonkey team may re-assess in
the future).

Building Cranelift
------------------
Expand Down
9 changes: 0 additions & 9 deletions cranelift/codegen/meta/src/isa/x86.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,17 +170,8 @@ fn define_settings(shared: &SettingGroup) -> SettingGroup {
// back in the shared SettingGroup, and use it in x86 instruction predicates.

let is_pic = shared.get_bool("is_pic");
let emit_all_ones_funcaddrs = shared.get_bool("emit_all_ones_funcaddrs");
settings.add_predicate("is_pic", predicate!(is_pic));
settings.add_predicate("not_is_pic", predicate!(!is_pic));
settings.add_predicate(
"all_ones_funcaddrs_and_not_is_pic",
predicate!(emit_all_ones_funcaddrs && !is_pic),
);
settings.add_predicate(
"not_all_ones_funcaddrs_and_not_is_pic",
predicate!(!emit_all_ones_funcaddrs && !is_pic),
);

// Presets corresponding to x86 CPUs.

Expand Down
18 changes: 0 additions & 18 deletions cranelift/codegen/meta/src/shared/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,24 +332,6 @@ fn define_control_flow(
.is_terminator(true),
);

let rvals = &Operand::new("rvals", &entities.varargs).with_doc("return values");
ig.push(
Inst::new(
"fallthrough_return",
r#"
Return from the function by fallthrough.
This is a specialized instruction for use where one wants to append
a custom epilogue, which will then perform the real return. This
instruction has no encoding.
"#,
&formats.multiary,
)
.operands_in(vec![rvals])
.is_return(true)
.is_terminator(true),
);

let FN = &Operand::new("FN", &entities.func_ref)
.with_doc("function to call, declared by `function`");
let args = &Operand::new("args", &entities.varargs).with_doc("call arguments");
Expand Down
34 changes: 2 additions & 32 deletions cranelift/codegen/meta/src/shared/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ pub(crate) fn define() -> SettingGroup {
"avoid_div_traps",
"Generate explicit checks around native division instructions to avoid their trapping.",
r#"
This is primarily used by SpiderMonkey which doesn't install a signal
handler for SIGFPE, but expects a SIGILL trap for division by zero.
Generate explicit checks around native division instructions to
avoid their trapping.
On ISAs like ARM where the native division instructions don't trap,
this setting has no effect - explicit checks are always inserted.
Expand Down Expand Up @@ -175,8 +175,6 @@ pub(crate) fn define() -> SettingGroup {
vec!["none", "elf_gd", "macho", "coff"],
);

// Settings specific to the `baldrdash` calling convention.

settings.add_enum(
"libcall_call_conv",
"Defines the calling convention to use for LibCalls call expansion.",
Expand All @@ -196,29 +194,10 @@ pub(crate) fn define() -> SettingGroup {
"system_v",
"windows_fastcall",
"apple_aarch64",
"baldrdash_system_v",
"baldrdash_windows",
"baldrdash_2020",
"probestack",
],
);

settings.add_num(
"baldrdash_prologue_words",
"Number of pointer-sized words pushed by the baldrdash prologue.",
r#"
Functions with the `baldrdash` calling convention don't generate their
own prologue and epilogue. They depend on externally generated code
that pushes a fixed number of words in the prologue and restores them
in the epilogue.
This setting configures the number of pointer-sized words pushed on the
stack when the Cranelift-generated code is entered. This includes the
pushed return address on x86.
"#,
0,
);

settings.add_bool(
"enable_llvm_abi_extensions",
"Enable various ABI extensions defined by LLVM's behavior.",
Expand Down Expand Up @@ -277,15 +256,6 @@ pub(crate) fn define() -> SettingGroup {
false,
);

// BaldrMonkey requires that not-yet-relocated function addresses be encoded
// as all-ones bitpatterns.
settings.add_bool(
"emit_all_ones_funcaddrs",
"Emit not-yet-relocated function addresses as all-ones bit patterns.",
"",
false,
);

// Stack probing options.

settings.add_bool(
Expand Down
39 changes: 6 additions & 33 deletions cranelift/codegen/src/ir/extfunc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,6 @@ impl fmt::Display for AbiParam {
/// particulars of the target's ABI, and the CLIF should be platform-independent, these attributes
/// specify *how* to extend (according to the signedness of the original program) rather than
/// *whether* to extend.
///
/// For example, on x86-64, the SystemV ABI does not require extensions of narrow values, so these
/// `ArgumentExtension` attributes are ignored; but in the Baldrdash (SpiderMonkey) ABI on the same
/// platform, all narrow values *are* extended, so these attributes may lead to extra
/// zero/sign-extend instructions in the generated machine code.
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
pub enum ArgumentExtension {
Expand Down Expand Up @@ -297,20 +292,6 @@ pub enum ArgumentPurpose {
/// This is a pointer to a stack limit. It is used to check the current stack pointer
/// against. Can only appear once in a signature.
StackLimit,

/// A callee TLS value.
///
/// In the Baldrdash-2020 calling convention, the stack upon entry to the callee contains the
/// TLS-register values for the caller and the callee. This argument is used to provide the
/// value for the callee.
CalleeTLS,

/// A caller TLS value.
///
/// In the Baldrdash-2020 calling convention, the stack upon entry to the callee contains the
/// TLS-register values for the caller and the callee. This argument is used to provide the
/// value for the caller.
CallerTLS,
}

impl fmt::Display for ArgumentPurpose {
Expand All @@ -325,8 +306,6 @@ impl fmt::Display for ArgumentPurpose {
Self::VMContext => "vmctx",
Self::SignatureId => "sigid",
Self::StackLimit => "stack_limit",
Self::CalleeTLS => "callee_tls",
Self::CallerTLS => "caller_tls",
})
}
}
Expand Down Expand Up @@ -447,28 +426,22 @@ mod tests {
CallConv::Cold,
CallConv::SystemV,
CallConv::WindowsFastcall,
CallConv::BaldrdashSystemV,
CallConv::BaldrdashWindows,
CallConv::Baldrdash2020,
] {
assert_eq!(Ok(cc), cc.to_string().parse())
}
}

#[test]
fn signatures() {
cfallin marked this conversation as resolved.
Show resolved Hide resolved
let mut sig = Signature::new(CallConv::BaldrdashSystemV);
assert_eq!(sig.to_string(), "() baldrdash_system_v");
let mut sig = Signature::new(CallConv::WindowsFastcall);
assert_eq!(sig.to_string(), "() windows_fastcall");
sig.params.push(AbiParam::new(I32));
assert_eq!(sig.to_string(), "(i32) baldrdash_system_v");
assert_eq!(sig.to_string(), "(i32) windows_fastcall");
sig.returns.push(AbiParam::new(F32));
assert_eq!(sig.to_string(), "(i32) -> f32 baldrdash_system_v");
assert_eq!(sig.to_string(), "(i32) -> f32 windows_fastcall");
sig.params.push(AbiParam::new(I32.by(4).unwrap()));
assert_eq!(sig.to_string(), "(i32, i32x4) -> f32 baldrdash_system_v");
assert_eq!(sig.to_string(), "(i32, i32x4) -> f32 windows_fastcall");
sig.returns.push(AbiParam::new(B8));
assert_eq!(
sig.to_string(),
"(i32, i32x4) -> f32, b8 baldrdash_system_v"
);
assert_eq!(sig.to_string(), "(i32, i32x4) -> f32, b8 windows_fastcall");
}
}
Loading