Function generate_isle_inst_decls

Source
pub fn generate_isle_inst_decls(f: &mut Formatter, inst: &Inst)
Expand description

Generate a “raw” constructor that simply constructs, but does not emit the assembly instruction:

(decl x64_<inst>_raw (<params>) AssemblerOutputs)
(extern constructor x64_<inst>_raw x64_<inst>_raw)

Using the “raw” constructor, we also generate “emitter” constructors (see IsleConstructor). E.g., instructions that write to a register will return the register:

(decl x64_<inst> (<params>) Gpr)
(rule (x64_<inst> <params>) (emit_ret_gpr (x64_<inst>_raw <params>)))

For instructions that write to memory, we also generate an “emitter” constructor with the _mem suffix:

(decl x64_<inst>_mem (<params>) SideEffectNoResult)
(rule (x64_<inst>_mem <params>) (defer_side_effect (x64_<inst>_raw <params>)))

§Panics

This function panics if the instruction has no operands.