Removed unnecessary list of registers
This commit is contained in:
@ -24,12 +24,12 @@ func NewFunction(pkg string, name string, file *fs.File) *Function {
|
|||||||
Scopes: []*scope.Scope{{}},
|
Scopes: []*scope.Scope{{}},
|
||||||
},
|
},
|
||||||
CPU: cpu.CPU{
|
CPU: cpu.CPU{
|
||||||
All: x86.AllRegisters,
|
|
||||||
General: x86.GeneralRegisters,
|
General: x86.GeneralRegisters,
|
||||||
Input: x86.InputRegisters,
|
Input: x86.InputRegisters,
|
||||||
Output: x86.OutputRegisters,
|
Output: x86.OutputRegisters,
|
||||||
SyscallInput: x86.SyscallInputRegisters,
|
SyscallInput: x86.SyscallInputRegisters,
|
||||||
SyscallOutput: x86.SyscallOutputRegisters,
|
SyscallOutput: x86.SyscallOutputRegisters,
|
||||||
|
NumRegisters: 16,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ func (f *Function) PrintInstructions() {
|
|||||||
registers := bytes.Buffer{}
|
registers := bytes.Buffer{}
|
||||||
used := f.RegisterHistory[i]
|
used := f.RegisterHistory[i]
|
||||||
|
|
||||||
for _, reg := range f.CPU.All {
|
for reg := range f.CPU.NumRegisters {
|
||||||
if used&(1<<reg) != 0 {
|
if used&(1<<reg) != 0 {
|
||||||
registers.WriteString("● ")
|
registers.WriteString("● ")
|
||||||
} else {
|
} else {
|
||||||
|
@ -2,10 +2,10 @@ package cpu
|
|||||||
|
|
||||||
// CPU represents the processor.
|
// CPU represents the processor.
|
||||||
type CPU struct {
|
type CPU struct {
|
||||||
All []Register
|
|
||||||
General []Register
|
General []Register
|
||||||
Input []Register
|
Input []Register
|
||||||
Output []Register
|
Output []Register
|
||||||
SyscallInput []Register
|
SyscallInput []Register
|
||||||
SyscallOutput []Register
|
SyscallOutput []Register
|
||||||
|
NumRegisters byte
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
AllRegisters = []cpu.Register{RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI, R8, R9, R10, R11, R12, R13, R14, R15}
|
|
||||||
SyscallInputRegisters = []cpu.Register{RAX, RDI, RSI, RDX, R10, R8, R9}
|
SyscallInputRegisters = []cpu.Register{RAX, RDI, RSI, RDX, R10, R8, R9}
|
||||||
SyscallOutputRegisters = []cpu.Register{RAX, RCX, R11}
|
SyscallOutputRegisters = []cpu.Register{RAX, RCX, R11}
|
||||||
GeneralRegisters = []cpu.Register{RBX, R12, R13, R14, R15, RCX, R11}
|
GeneralRegisters = []cpu.Register{RBX, R12, R13, R14, R15, RCX, R11}
|
||||||
|
Reference in New Issue
Block a user