Minimize rsp Instruction and Operand

This commit is contained in:
gingerBill
2026-06-15 14:37:25 +01:00
parent 4f96105520
commit 182f234ed2
2 changed files with 5 additions and 6 deletions

View File

@@ -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)

View File

@@ -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 {