【编译原理笔记】常见处理器寄存器
寄存器是什么,就是全局变量啊。
x86寄存器
{0, x86.REG_AX, 0, "AX"},
{1, x86.REG_CX, 1, "CX"},
{2, x86.REG_DX, 2, "DX"},
{3, x86.REG_BX, 3, "BX"},
{4, x86.REGSP, -1, "SP"},
{5, x86.REG_BP, 4, "BP"},
{6, x86.REG_SI, 5, "SI"},
{7, x86.REG_DI, 6, "DI"},
{8, x86.REG_X0, -1, "X0"},
{9, x86.REG_X1, -1, "X1"},
{10, x86.REG_X2, -1, "X2"},
{11, x86.REG_X3, -1, "X3"},
{12, x86.REG_X4, -1, "X4"},
{13, x86.REG_X5, -1, "X5"},
{14, x86.REG_X6, -1, "X6"},
{15, x86.REG_X7, -1, "X7"},
{16, 0, -1, "SB"},
通用寄存器
数据寄存器(16位):AX 、BX、CX、 DX
指针寄存器(16位):SP、BP
变址寄存器(16位):SI、DI
控制寄存器(16位):IP、FLAGS
段寄存器(16位):CS、DS、ES、SS
AMD64寄存器
{0, x86.REG_AX, 0, "AX"},
{1, x86.REG_CX, 1, "CX"},
{2, x86.REG_DX, 2, "DX"},
{3, x86.REG_BX, 3, "BX"},
{4, x86.REGSP, -1, "SP"},
{5, x86.REG_BP, 4, "BP"},
{6, x86.REG_SI, 5, "SI"},
{7, x86.REG_DI, 6, "DI"},
{8, x86.REG_R8, 7, "R8"},
{9, x86.REG_R9, 8, "R9"},
{10, x86.REG_R10, 9, "R10"},
{11, x86.REG_R11, 10, "R11"},
{12, x86.REG_R12, 11, "R12"},
{13, x86.REG_R13, 12, "R13"},
{14, x86.REGG, -1, "g"},
{15, x86.REG_R15, 13, "R15"},
{16, x86.REG_X0, -1, "X0"},
{17, x86.REG_X1, -1, "X1"},
{18, x86.REG_X2, -1, "X2"},
{19, x86.REG_X3, -1, "X3"},
{20, x86.REG_X4, -1, "X4"},
{21, x86.REG_X5, -1, "X5"},
{22, x86.REG_X6, -1, "X6"},
{23, x86.REG_X7, -1, "X7"},
{24, x86.REG_X8, -1, "X8"},
{25, x86.REG_X9, -1, "X9"},
{26, x86.REG_X10, -1, "X10"},
{27, x86.REG_X11, -1, "X11"},
{28, x86.REG_X12, -1, "X12"},
{29, x86.REG_X13, -1, "X13"},
{30, x86.REG_X14, -1, "X14"},
{31, x86.REG_X15, -1, "X15"},
{32, 0, -1, "SB"},
arm64
{0, x86.REG_AX, 0, "AX"},
{1, x86.REG_CX, 1, "CX"},
{2, x86.REG_DX, 2, "DX"},
{3, x86.REG_BX, 3, "BX"},
{4, x86.REGSP, -1, "SP"},
{5, x86.REG_BP, 4, "BP"},
{6, x86.REG_SI, 5, "SI"},
{7, x86.REG_DI, 6, "DI"},
{8, x86.REG_R8, 7, "R8"},
{9, x86.REG_R9, 8, "R9"},
{10, x86.REG_R10, 9, "R10"},
{11, x86.REG_R11, 10, "R11"},
{12, x86.REG_R12, 11, "R12"},
{13, x86.REG_R13, 12, "R13"},
{14, x86.REGG, -1, "g"},
{15, x86.REG_R15, 13, "R15"},
{16, x86.REG_X0, -1, "X0"},
{17, x86.REG_X1, -1, "X1"},
{18, x86.REG_X2, -1, "X2"},
{19, x86.REG_X3, -1, "X3"},
{20, x86.REG_X4, -1, "X4"},
{21, x86.REG_X5, -1, "X5"},
{22, x86.REG_X6, -1, "X6"},
{23, x86.REG_X7, -1, "X7"},
{24, x86.REG_X8, -1, "X8"},
{25, x86.REG_X9, -1, "X9"},
{26, x86.REG_X10, -1, "X10"},
{27, x86.REG_X11, -1, "X11"},
{28, x86.REG_X12, -1, "X12"},
{29, x86.REG_X13, -1, "X13"},
{30, x86.REG_X14, -1, "X14"},
{31, x86.REG_X15, -1, "X15"},
{32, 0, -1, "SB"},