[codegen] Add a pinned register that's entirely under the control of the user;
This commit is contained in:
@@ -964,6 +964,34 @@ pub(crate) fn define(
|
||||
.operands_out(vec![addr]),
|
||||
);
|
||||
|
||||
// Note this instruction is marked as having other side-effects, so GVN won't try to hoist it,
|
||||
// which would result in it being subject to spilling. While not hoisting would generally hurt
|
||||
// performance, since a computed value used many times may need to be regenerated before each
|
||||
// use, it is not the case here: this instruction doesn't generate any code. That's because,
|
||||
// by definition the pinned register is never used by the register allocator, but is written to
|
||||
// and read explicitly and exclusively by set_pinned_reg and get_pinned_reg.
|
||||
ig.push(
|
||||
Inst::new(
|
||||
"get_pinned_reg",
|
||||
r#"
|
||||
Gets the content of the pinned register, when it's enabled.
|
||||
"#,
|
||||
)
|
||||
.operands_out(vec![addr])
|
||||
.other_side_effects(true),
|
||||
);
|
||||
|
||||
ig.push(
|
||||
Inst::new(
|
||||
"set_pinned_reg",
|
||||
r#"
|
||||
Sets the content of the pinned register, when it's enabled.
|
||||
"#,
|
||||
)
|
||||
.operands_in(vec![addr])
|
||||
.other_side_effects(true),
|
||||
);
|
||||
|
||||
let TableOffset = &TypeVar::new(
|
||||
"TableOffset",
|
||||
"An unsigned table offset",
|
||||
|
||||
@@ -84,6 +84,17 @@ pub fn define() -> SettingGroup {
|
||||
false,
|
||||
);
|
||||
|
||||
settings.add_bool(
|
||||
"enable_pinned_reg",
|
||||
r#"Enable the use of the pinned register.
|
||||
|
||||
This register is excluded from register allocation, and is completely under the control of
|
||||
the end-user. It is possible to read it via the get_pinned_reg instruction, and to set it
|
||||
with the set_pinned_reg instruction.
|
||||
"#,
|
||||
false,
|
||||
);
|
||||
|
||||
settings.add_bool("enable_simd", "Enable the use of SIMD instructions.", false);
|
||||
|
||||
settings.add_bool(
|
||||
|
||||
Reference in New Issue
Block a user