From: Chris Lattner Instructions are written out one at a time as distinct units. Each
instruction
record contains at least an opcode and a type field,
-and may contain a list of operands (whose interpretation depends on the opcode).
-Based on the number of operands, the
+and may contain a list of operands (whose
+interpretation depends on the opcode). Based on the number of operands, the
instruction is encoded in a
dense format that tries to encoded each instruction into 32-bits if
possible.
+Based on the instruction opcode and type, the bytecode format implicitly (to +save space) specifies the interpretation of the operand list. For most +instructions, the type of each operand is implicit from the type of the +instruction itself (e.g. the type of operands of a binary operator must match +the type of the instruction). As such, the bytecode format generally only +encodes the value number of the operand, not the type.
+ +In some cases, however, this is not sufficient. This section enumerates +those cases:
+ +Instruction Format 1
This format encodes the opcode, type and a single operand into a single uint32_vbr as follows: