mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-18 11:22:11 +00:00
Use number rather than enum
This commit is contained in:
@@ -29,12 +29,13 @@ Side_Effects :: distinct bit_set[Side_Effect; u16]
|
||||
|
||||
Clobber_Regs :: distinct bit_set[Clobber_Reg; u16]
|
||||
Clobber_Reg :: enum u8 {
|
||||
RAX, RBX, RCX, RDX, RSI, RDI, RSP, RBP, R11,
|
||||
XMM0, VECTOR, MXCSR, FPU_ST, FPU_SW,
|
||||
RAX, RBX, RCX, RDX,
|
||||
RSI, RDI, RSP, RBP,
|
||||
R11, XMM0, VECTOR, MXCSR,
|
||||
FPU_ST, FPU_SW,
|
||||
}
|
||||
|
||||
Operand_Set :: distinct bit_set[Operand_Slot; u8]
|
||||
Operand_Slot :: enum u8 { OP0, OP1, OP2, OP3 }
|
||||
Operand_Set :: distinct bit_set[0..<4; u8]
|
||||
|
||||
Clobber :: struct {
|
||||
written: Operand_Set,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,6 +23,7 @@ package rexcode_x86_tablegen
|
||||
// before Stage B dumps it to raw bytes, so the blobs can never drift from a
|
||||
// well-typed table.
|
||||
|
||||
import "base:intrinsics"
|
||||
import "core:fmt"
|
||||
import "core:os"
|
||||
import "core:strings"
|
||||
@@ -177,7 +178,11 @@ write_clobber :: proc(sb: ^strings.Builder, c: lib.Clobber, max_name: int) {
|
||||
i := 0
|
||||
for flag in flags {
|
||||
if i > 0 { strings.write_string(sb, ", ") }
|
||||
fmt.sbprintf(sb, ".%s", flag)
|
||||
when intrinsics.type_is_enum(type_of(flag)) {
|
||||
fmt.sbprintf(sb, ".%s", flag)
|
||||
} else {
|
||||
fmt.sbprintf(sb, "%v", flag)
|
||||
}
|
||||
i += 1
|
||||
}
|
||||
strings.write_string(sb, "}")
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user