mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-19 16:42:33 +00:00
Minimize rsp Instruction and Operand
This commit is contained in:
@@ -11,14 +11,14 @@ Instruction_Flags :: bit_field u8 {
|
||||
}
|
||||
|
||||
Instruction :: struct #packed {
|
||||
ops: [4]Operand `fmt:"v,operand_count"`, // 64 bytes
|
||||
ops: [4]Operand `fmt:"v,operand_count"`, // 48 bytes
|
||||
mnemonic: Mnemonic, // 2 bytes
|
||||
operand_count: u8, // 1 byte
|
||||
flags: Instruction_Flags, // 1 byte
|
||||
length: u8, // 1 byte (always 4)
|
||||
_: [3]u8, // 3 bytes
|
||||
_: [11]u8, // 11 bytes
|
||||
}
|
||||
#assert(size_of(Instruction) == 72)
|
||||
#assert(size_of(Instruction) == 64)
|
||||
|
||||
// =============================================================================
|
||||
// Builders (mirror x86/mips conventions)
|
||||
|
||||
@@ -46,7 +46,6 @@ vmem :: #force_inline proc "contextless" (base: Register, element: u8, offset: i
|
||||
return Vector_Mem{base = base, element = element, offset = offset}
|
||||
}
|
||||
|
||||
// Operand: 16-byte tagged union.
|
||||
Operand :: struct #packed {
|
||||
using _: struct #raw_union {
|
||||
reg: Register, // for REGISTER and VECTOR_REG
|
||||
@@ -58,9 +57,9 @@ Operand :: struct #packed {
|
||||
kind: Operand_Kind, // 1 byte
|
||||
size: u8, // 1 byte
|
||||
element: u8, // 1 byte — for VECTOR_REG
|
||||
_: [5]u8,
|
||||
_: [1]u8,
|
||||
}
|
||||
#assert(size_of(Operand) == 16)
|
||||
#assert(size_of(Operand) == 12)
|
||||
|
||||
@(require_results)
|
||||
op_reg :: #force_inline proc "contextless" (r: Register) -> Operand {
|
||||
|
||||
Reference in New Issue
Block a user