pub(crate) struct InstructionFormat {
pub name: &'static str,
pub num_value_operands: usize,
pub has_value_list: bool,
pub imm_fields: Vec<FormatField>,
pub num_block_operands: usize,
pub typevar_operand: Option<usize>,
}
Expand description
Every instruction opcode has a corresponding instruction format which determines the number of operands and their kinds. Instruction formats are identified structurally, i.e., the format of an instruction is derived from the kinds of operands used in its declaration.
The instruction format stores two separate lists of operands: Immediates and values. Immediate
operands (including entity references) are represented as explicit members in the
InstructionData
variants. The value operands are stored differently, depending on how many
there are. Beyond a certain point, instruction formats switch to an external value list for
storing value arguments. Value lists can hold an arbitrary number of values.
All instruction formats must be predefined in the meta shared/formats.rs module.
Fields§
§name: &'static str
Instruction format name in CamelCase. This is used as a Rust variant name in both the
InstructionData
and InstructionFormat
enums.
num_value_operands: usize
§has_value_list: bool
§imm_fields: Vec<FormatField>
§num_block_operands: usize
§typevar_operand: Option<usize>
Index of the value input operand that is used to infer the controlling type variable. By
default, this is 0
, the first value
operand. The index is relative to the values only,
ignoring immediate operands.
Implementations§
Source§impl InstructionFormat
impl InstructionFormat
Sourcepub fn structure(&self) -> FormatStructure
pub fn structure(&self) -> FormatStructure
Returns a tuple that uniquely identifies the structure.