Renames Settings ⚠️ (fixes #976) (#1321)

This is a breaking API change: the following settings have been renamed:

- jump_tables_enabled -> enable_jump_tables
- colocated_libcalls -> use_colocated_libcalls
- probestack_enabled -> enable_probestack
- allones_funcaddrs -> emit_all_ones_funcaddrs
This commit is contained in:
Benjamin Bouvier
2020-01-13 22:42:49 +01:00
committed by Sean Stangl
parent bd88155483
commit dd497c19e1
20 changed files with 37 additions and 38 deletions

View File

@@ -59,16 +59,16 @@ pub(crate) fn define(shared: &SettingGroup) -> SettingGroup {
// back in the shared SettingGroup, and use it in x86 instruction predicates. // back in the shared SettingGroup, and use it in x86 instruction predicates.
let is_pic = shared.get_bool("is_pic"); let is_pic = shared.get_bool("is_pic");
let allones_funcaddrs = shared.get_bool("allones_funcaddrs"); let emit_all_ones_funcaddrs = shared.get_bool("emit_all_ones_funcaddrs");
settings.add_predicate("is_pic", predicate!(is_pic)); settings.add_predicate("is_pic", predicate!(is_pic));
settings.add_predicate("not_is_pic", predicate!(!is_pic)); settings.add_predicate("not_is_pic", predicate!(!is_pic));
settings.add_predicate( settings.add_predicate(
"all_ones_funcaddrs_and_not_is_pic", "all_ones_funcaddrs_and_not_is_pic",
predicate!(allones_funcaddrs && !is_pic), predicate!(emit_all_ones_funcaddrs && !is_pic),
); );
settings.add_predicate( settings.add_predicate(
"not_all_ones_funcaddrs_and_not_is_pic", "not_all_ones_funcaddrs_and_not_is_pic",
predicate!(!allones_funcaddrs && !is_pic), predicate!(!emit_all_ones_funcaddrs && !is_pic),
); );
// Presets corresponding to x86 CPUs. // Presets corresponding to x86 CPUs.

View File

@@ -37,7 +37,7 @@ pub(crate) fn define() -> SettingGroup {
); );
settings.add_bool( settings.add_bool(
"colocated_libcalls", "use_colocated_libcalls",
r#" r#"
Use colocated libcalls. Use colocated libcalls.
@@ -177,7 +177,7 @@ pub(crate) fn define() -> SettingGroup {
// BaldrMonkey requires that not-yet-relocated function addresses be encoded // BaldrMonkey requires that not-yet-relocated function addresses be encoded
// as all-ones bitpatterns. // as all-ones bitpatterns.
settings.add_bool( settings.add_bool(
"allones_funcaddrs", "emit_all_ones_funcaddrs",
"Emit not-yet-relocated function addresses as all-ones bit patterns.", "Emit not-yet-relocated function addresses as all-ones bit patterns.",
false, false,
); );
@@ -185,7 +185,7 @@ pub(crate) fn define() -> SettingGroup {
// Stack probing options. // Stack probing options.
settings.add_bool( settings.add_bool(
"probestack_enabled", "enable_probestack",
r#" r#"
Enable the use of stack probes, for calling conventions which support this Enable the use of stack probes, for calling conventions which support this
functionality. functionality.
@@ -218,7 +218,7 @@ pub(crate) fn define() -> SettingGroup {
// Jump table options. // Jump table options.
settings.add_bool( settings.add_bool(
"jump_tables_enabled", "enable_jump_tables",
"Enable the use of jump tables in generated machine code.", "Enable the use of jump tables in generated machine code.",
true, true,
); );

View File

@@ -22,7 +22,7 @@ use serde::{Deserialize, Serialize};
#[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "enable-serde", derive(Serialize, Deserialize))]
pub enum LibCall { pub enum LibCall {
/// probe for stack overflow. These are emitted for functions which need /// probe for stack overflow. These are emitted for functions which need
/// when the `probestack_enabled` setting is true. /// when the `enable_probestack` setting is true.
Probestack, Probestack,
/// ceil.f32 /// ceil.f32
CeilF32, CeilF32,
@@ -202,7 +202,7 @@ fn make_funcref(
func.import_function(ExtFuncData { func.import_function(ExtFuncData {
name: ExternalName::LibCall(libcall), name: ExternalName::LibCall(libcall),
signature: sigref, signature: sigref,
colocated: isa.flags().colocated_libcalls(), colocated: isa.flags().use_colocated_libcalls(),
}) })
} }

View File

@@ -453,7 +453,7 @@ pub fn prologue_epilogue(func: &mut ir::Function, isa: &dyn TargetIsa) -> Codege
fn baldrdash_prologue_epilogue(func: &mut ir::Function, isa: &dyn TargetIsa) -> CodegenResult<()> { fn baldrdash_prologue_epilogue(func: &mut ir::Function, isa: &dyn TargetIsa) -> CodegenResult<()> {
debug_assert!( debug_assert!(
!isa.flags().probestack_enabled(), !isa.flags().enable_probestack(),
"baldrdash does not expect cranelift to emit stack probes" "baldrdash does not expect cranelift to emit stack probes"
); );
@@ -754,8 +754,7 @@ fn insert_common_prologue(
// Allocate stack frame storage. // Allocate stack frame storage.
if stack_size > 0 { if stack_size > 0 {
if isa.flags().probestack_enabled() if isa.flags().enable_probestack() && stack_size > (1 << isa.flags().probestack_size_log2())
&& stack_size > (1 << isa.flags().probestack_size_log2())
{ {
// Emit a stack probe. // Emit a stack probe.
let rax = RU::rax as RegUnit; let rax = RU::rax as RegUnit;

View File

@@ -191,7 +191,7 @@ pub fn legalize_function(func: &mut ir::Function, cfg: &mut ControlFlowGraph, is
} }
// Now that we've lowered all br_tables, we don't need the jump tables anymore. // Now that we've lowered all br_tables, we don't need the jump tables anymore.
if !isa.flags().jump_tables_enabled() { if !isa.flags().enable_jump_tables() {
pos.func.jump_tables.clear(); pos.func.jump_tables.clear();
} }
} }
@@ -276,7 +276,7 @@ fn expand_br_table(
cfg: &mut ControlFlowGraph, cfg: &mut ControlFlowGraph,
isa: &dyn TargetIsa, isa: &dyn TargetIsa,
) { ) {
if isa.flags().jump_tables_enabled() { if isa.flags().enable_jump_tables() {
expand_br_table_jt(inst, func, cfg, isa); expand_br_table_jt(inst, func, cfg, isa);
} else { } else {
expand_br_table_conds(inst, func, cfg, isa); expand_br_table_conds(inst, func, cfg, isa);

View File

@@ -384,7 +384,7 @@ mod tests {
probestack_size_log2 = 12\n\ probestack_size_log2 = 12\n\
enable_verifier = true\n\ enable_verifier = true\n\
is_pic = false\n\ is_pic = false\n\
colocated_libcalls = false\n\ use_colocated_libcalls = false\n\
avoid_div_traps = false\n\ avoid_div_traps = false\n\
enable_float = true\n\ enable_float = true\n\
enable_nan_canonicalization = false\n\ enable_nan_canonicalization = false\n\
@@ -393,10 +393,10 @@ mod tests {
enable_simd = false\n\ enable_simd = false\n\
enable_atomics = true\n\ enable_atomics = true\n\
enable_safepoints = false\n\ enable_safepoints = false\n\
allones_funcaddrs = false\n\ emit_all_ones_funcaddrs = false\n\
probestack_enabled = true\n\ enable_probestack = true\n\
probestack_func_adjusts_sp = false\n\ probestack_func_adjusts_sp = false\n\
jump_tables_enabled = true\n" enable_jump_tables = true\n"
); );
assert_eq!(f.opt_level(), super::OptLevel::None); assert_eq!(f.opt_level(), super::OptLevel::None);
assert_eq!(f.enable_simd(), false); assert_eq!(f.enable_simd(), false);

View File

@@ -1,7 +1,7 @@
; binary emission of 32-bit code. ; binary emission of 32-bit code.
test binemit test binemit
set opt_level=speed_and_size set opt_level=speed_and_size
set allones_funcaddrs set emit_all_ones_funcaddrs
target i686 haswell target i686 haswell
; The binary encodings can be verified with the command: ; The binary encodings can be verified with the command:
@@ -9,7 +9,7 @@ target i686 haswell
; sed -ne 's/^ *; asm: *//p' filetests/isa/x86/allones_funcaddrs32.clif | llvm-mc -show-encoding -triple=i386 ; sed -ne 's/^ *; asm: *//p' filetests/isa/x86/allones_funcaddrs32.clif | llvm-mc -show-encoding -triple=i386
; ;
; Tests from binary32.clif affected by allones_funcaddrs. ; Tests from binary32.clif affected by emit_all_ones_funcaddrs.
function %I32() { function %I32() {
sig0 = () sig0 = ()
fn0 = %foo() fn0 = %foo()

View File

@@ -1,7 +1,7 @@
; binary emission of 64-bit code. ; binary emission of 64-bit code.
test binemit test binemit
set opt_level=speed_and_size set opt_level=speed_and_size
set allones_funcaddrs set emit_all_ones_funcaddrs
target x86_64 haswell target x86_64 haswell
; The binary encodings can be verified with the command: ; The binary encodings can be verified with the command:
@@ -9,7 +9,7 @@ target x86_64 haswell
; sed -ne 's/^ *; asm: *//p' filetests/isa/x86/allones_funcaddrs64.clif | llvm-mc -show-encoding -triple=x86_64 ; sed -ne 's/^ *; asm: *//p' filetests/isa/x86/allones_funcaddrs64.clif | llvm-mc -show-encoding -triple=x86_64
; ;
; Tests from binary64.clif affected by allones_funcaddrs. ; Tests from binary64.clif affected by emit_all_ones_funcaddrs.
function %I64() { function %I64() {
sig0 = () sig0 = ()
fn0 = %foo() fn0 = %foo()

View File

@@ -1,5 +1,5 @@
test compile test compile
set probestack_enabled=false set enable_probestack=false
target i686 target i686
function u0:0(i32 vmctx) baldrdash_system_v { function u0:0(i32 vmctx) baldrdash_system_v {

View File

@@ -1,6 +1,6 @@
test compile test compile
set enable_simd=true set enable_simd=true
set probestack_enabled=false set enable_probestack=false
target x86_64 haswell target x86_64 haswell
; use baldrdash calling convention here for simplicity (avoids prologue, epilogue) ; use baldrdash calling convention here for simplicity (avoids prologue, epilogue)

View File

@@ -1,6 +1,6 @@
test compile test compile
set enable_simd=true set enable_simd=true
set probestack_enabled=false set enable_probestack=false
target x86_64 haswell target x86_64 haswell
; use baldrdash_system_v calling convention here for simplicity (avoids prologue, epilogue) ; use baldrdash_system_v calling convention here for simplicity (avoids prologue, epilogue)

View File

@@ -1,5 +1,5 @@
test compile test compile
set colocated_libcalls=1 set use_colocated_libcalls=1
set probestack_func_adjusts_sp=1 set probestack_func_adjusts_sp=1
target x86_64 target x86_64

View File

@@ -1,6 +1,6 @@
test compile test compile
set colocated_libcalls=1 set use_colocated_libcalls=1
set probestack_enabled=0 set enable_probestack=0
target x86_64 target x86_64
; Like %big in probestack.clif, but with probes disabled. ; Like %big in probestack.clif, but with probes disabled.

View File

@@ -1,5 +1,5 @@
test compile test compile
set colocated_libcalls=1 set use_colocated_libcalls=1
set probestack_size_log2=13 set probestack_size_log2=13
target x86_64 target x86_64

View File

@@ -1,5 +1,5 @@
test compile test compile
set colocated_libcalls=1 set use_colocated_libcalls=1
target x86_64 target x86_64
; A function with a big stack frame. This should have a stack probe. ; A function with a big stack frame. This should have a stack probe.

View File

@@ -2,8 +2,8 @@ test binemit
set opt_level=speed_and_size set opt_level=speed_and_size
set avoid_div_traps set avoid_div_traps
set baldrdash_prologue_words=3 set baldrdash_prologue_words=3
set allones_funcaddrs set emit_all_ones_funcaddrs
set probestack_enabled=false set enable_probestack=false
target x86_64 haswell target x86_64 haswell
; This checks that a branch that is too far away is getting relaxed. In ; This checks that a branch that is too far away is getting relaxed. In

View File

@@ -1,6 +1,6 @@
test compile test compile
set opt_level=speed_and_size set opt_level=speed_and_size
set probestack_enabled=false set enable_probestack=false
set enable_simd set enable_simd
target x86_64 target x86_64

View File

@@ -1,6 +1,6 @@
test legalizer test legalizer
set probestack_enabled=false set enable_probestack=false
set jump_tables_enabled=false set enable_jump_tables=false
target x86_64 target x86_64
; Test that when jump_tables_enables is false, all jump tables are eliminated. ; Test that when jump_tables_enables is false, all jump tables are eliminated.

View File

@@ -1,6 +1,6 @@
test legalizer test legalizer
set probestack_enabled=false set enable_probestack=false
set jump_tables_enabled=false set enable_jump_tables=false
target x86_64 target x86_64
function u0:0(i64) { function u0:0(i64) {

View File

@@ -1,7 +1,7 @@
; Use "test compile" here otherwise the dead blocks won't be eliminated. ; Use "test compile" here otherwise the dead blocks won't be eliminated.
test compile test compile
set probestack_enabled=0 set enable_probestack=0
target x86_64 haswell target x86_64 haswell
; This function contains unreachable blocks which trip up the register ; This function contains unreachable blocks which trip up the register