Cranelift: implement redundant fill removal on tree-shaped CFG regions. Mozilla bug 1570584. (#906)
This commit is contained in:
@@ -367,6 +367,7 @@ pub fn define<'shared>(
|
||||
let f_call = formats.by_name("Call");
|
||||
let f_call_indirect = formats.by_name("CallIndirect");
|
||||
let f_copy_special = formats.by_name("CopySpecial");
|
||||
let f_copy_to_ssa = formats.by_name("CopyToSsa");
|
||||
let f_extract_lane = formats.by_name("ExtractLane"); // TODO this would preferably retrieve a BinaryImm8 format but because formats are compared structurally and ExtractLane has the same structure this is impossible--if we rename ExtractLane, it may even impact parsing
|
||||
let f_float_compare = formats.by_name("FloatCompare");
|
||||
let f_float_cond = formats.by_name("FloatCond");
|
||||
@@ -426,6 +427,22 @@ pub fn define<'shared>(
|
||||
.emit(""),
|
||||
);
|
||||
|
||||
// No-op fills, created by late-stage redundant-fill removal.
|
||||
recipes.add_recipe(
|
||||
EncodingRecipeBuilder::new("fillnull", f_unary, 0)
|
||||
.operands_in(vec![stack_gpr32])
|
||||
.operands_out(vec![gpr])
|
||||
.clobbers_flags(false)
|
||||
.emit(""),
|
||||
);
|
||||
recipes.add_recipe(
|
||||
EncodingRecipeBuilder::new("ffillnull", f_unary, 0)
|
||||
.operands_in(vec![stack_gpr32])
|
||||
.operands_out(vec![fpr])
|
||||
.clobbers_flags(false)
|
||||
.emit(""),
|
||||
);
|
||||
|
||||
recipes
|
||||
.add_recipe(EncodingRecipeBuilder::new("debugtrap", f_nullary, 1).emit("sink.put1(0xcc);"));
|
||||
|
||||
@@ -570,6 +587,20 @@ pub fn define<'shared>(
|
||||
),
|
||||
);
|
||||
|
||||
// Same as umr, but with the source register specified directly.
|
||||
recipes.add_template_recipe(
|
||||
EncodingRecipeBuilder::new("umr_reg_to_ssa", f_copy_to_ssa, 1)
|
||||
// No operands_in to mention, because a source register is specified directly.
|
||||
.operands_out(vec![gpr])
|
||||
.clobbers_flags(false)
|
||||
.emit(
|
||||
r#"
|
||||
{{PUT_OP}}(bits, rex2(out_reg0, src), sink);
|
||||
modrm_rr(out_reg0, src, sink);
|
||||
"#,
|
||||
),
|
||||
);
|
||||
|
||||
// XX /r, but for a unary operator with separate input/output register.
|
||||
// RM form. Clobbers FLAGS.
|
||||
recipes.add_template_recipe(
|
||||
@@ -631,6 +662,20 @@ pub fn define<'shared>(
|
||||
),
|
||||
);
|
||||
|
||||
// Same as furm, but with the source register specified directly.
|
||||
recipes.add_template_recipe(
|
||||
EncodingRecipeBuilder::new("furm_reg_to_ssa", f_copy_to_ssa, 1)
|
||||
// No operands_in to mention, because a source register is specified directly.
|
||||
.operands_out(vec![fpr])
|
||||
.clobbers_flags(false)
|
||||
.emit(
|
||||
r#"
|
||||
{{PUT_OP}}(bits, rex2(src, out_reg0), sink);
|
||||
modrm_rr(src, out_reg0, sink);
|
||||
"#,
|
||||
),
|
||||
);
|
||||
|
||||
// XX /r, RM form, GPR -> FPR.
|
||||
recipes.add_template_recipe(
|
||||
EncodingRecipeBuilder::new("frurm", f_unary, 1)
|
||||
|
||||
Reference in New Issue
Block a user