Improved code generation

This commit is contained in:
2024-07-04 12:32:56 +02:00
parent 4d88260333
commit 3340a5824f
9 changed files with 70 additions and 23 deletions

View File

@ -31,13 +31,12 @@ func (c *CPU) FindFree(registers []Register) (Register, bool) {
return 0, false
}
func (c *CPU) MustUseFree(registers []Register) Register {
func (c *CPU) MustFindFree(registers []Register) Register {
register, exists := c.FindFree(registers)
if !exists {
panic("no free registers")
}
c.Use(register)
return register
}