Add const_addr instruction

This new instruction calculates the effective address of a constant in the constant pool using LEA (x86).
This commit is contained in:
Andrew Brown
2020-03-20 14:15:47 -07:00
parent fa35d88878
commit 65856987cd
4 changed files with 44 additions and 0 deletions

View File

@@ -1463,6 +1463,21 @@ pub(crate) fn define<'shared>(
),
);
// Constant addresses.
recipes.add_template_recipe(
EncodingRecipeBuilder::new("const_addr", &formats.unary_const, 5)
.operands_out(vec![gpr])
.clobbers_flags(false)
.emit(
r#"
{{PUT_OP}}(bits, rex2(0, out_reg0), sink);
modrm_riprel(out_reg0, sink);
const_disp4(constant_handle, func, sink);
"#,
),
);
// Store recipes.
{