Skip to main content

gen_imm_inst_builder

Function gen_imm_inst_builder 

Source
fn gen_imm_inst_builder(inst: &Rc<InstructionContent>, fmt: &mut Formatter)
Expand description

Emit the {name}_imm_s, {name}_imm_u, and (deprecated) {name}_imm convenience methods for inst, requested via .inst_builder_imm_method(true).

Each generated method has the same shape as inst’s normal builder method, except that its trailing value operand is taken as an Into<Imm64> immediate. That immediate is materialized as an iconst (extended to the controlling type as needed, see InstBuilder::build_imm_const) and then inst is built with it. The _imm_s variant sign-extends the immediate while _imm_u zero-extends it; this only matters for i128.

The bare _imm method is kept around for backwards-compatibility, with the sign-/zero-extension behavior the now-removed *_imm instructions used to have. It is deprecated in favor of the explicit _imm_s/_imm_u variants.