#include "register.h"
#include <stddef.h>

struct reg RAX = {
    .qword = "rax",
    .dword = "eax",
    .word = "ax",
    .byte = "al",
    .is_occupied = false,
};
struct reg RBX = {
    .qword = "rbx",
    .dword = "ebx",
    .word = "bx",
    .byte = "bl",
    .is_occupied = false,
};
struct reg RCX = {
    .qword = "rcx",
    .dword = "ecx",
    .word = "cx",
    .byte = "cl",
    .is_occupied = false,
};
struct reg RDX = {
    .qword = "rdx",
    .dword = "edx",
    .word = "dx",
    .byte = "dl",
    .is_occupied = false,
};

struct reg RDI = {
    .qword = "rdi",
    .dword = "edi",
    .word = "di",
    .byte = "dil",
    .is_occupied = false,
};
struct reg RSI = {
    .qword = "rsi",
    .dword = "esi",
    .word = "si",
    .byte = "sil",
    .is_occupied = false,
};
struct reg RSP = {
    .qword = "rsp",
    .dword = "esp",
    .word = "sp",
    .byte = "spl",
    .is_occupied = true,
};
struct reg RBP = {
    .qword = "rbp",
    .dword = "ebp",
    .word = "bp",
    .byte = "bpl",
    .is_occupied = true,
};

struct reg R8 = {
    .qword = "r8",
    .dword = "r8d",
    .word = "r8w",
    .byte = "r8b",
    .is_occupied = false,
};
struct reg R9 = {
    .qword = "r9",
    .dword = "r9d",
    .word = "r9w",
    .byte = "r9b",
    .is_occupied = false,
};
struct reg R10 = {
    .qword = "r10",
    .dword = "r10d",
    .word = "r10w",
    .byte = "r10b",
    .is_occupied = false,
};
struct reg R11 = {
    .qword = "r11",
    .dword = "r11d",
    .word = "r11w",
    .byte = "r11b",
    .is_occupied = false,
};
struct reg R12 = {
    .qword = "r12",
    .dword = "r12d",
    .word = "r12w",
    .byte = "r12b",
    .is_occupied = false,
};
struct reg R13 = {
    .qword = "r13",
    .dword = "r13d",
    .word = "r13w",
    .byte = "r13b",
    .is_occupied = false,
};
struct reg R14 = {
    .qword = "r14",
    .dword = "r14d",
    .word = "r14w",
    .byte = "r14b",
    .is_occupied = false,
};
struct reg R15 = {
    .qword = "r15",
    .dword = "r15d",
    .word = "r15w",
    .byte = "r15b",
    .is_occupied = false,
};

struct reg* const CALLING_CONV[] = {&RDI, &RSI, &RDX, &R10, &R9, &R8, NULL};
struct reg* const DATA_REGS[] = {
    &RDI, &RSI, &RAX, &RBX, &RCX, &RDX,
    &R8, &R9, &R10, &R11, &R12, &R13, &R14, &R15, NULL
};
