Dedicate a throwaway register.
This commit is contained in:
parent
a96d503095
commit
230a50c532
|
@ -90,10 +90,8 @@ module Chalk
|
||||||
generate! tree, entry.function, table, target, free
|
generate! tree, entry.function, table, target, free
|
||||||
when Trees::TreeBlock
|
when Trees::TreeBlock
|
||||||
table = Table.new(table)
|
table = Table.new(table)
|
||||||
throwaway = free
|
|
||||||
free += 1
|
|
||||||
tree.children.each do |child|
|
tree.children.each do |child|
|
||||||
free += generate! child, table, throwaway, free
|
free += generate! child, table, THROWAWAY_REG, free
|
||||||
end
|
end
|
||||||
when Trees::TreeVar
|
when Trees::TreeVar
|
||||||
entry = table[tree.name]?
|
entry = table[tree.name]?
|
||||||
|
|
|
@ -4,6 +4,8 @@ module Chalk
|
||||||
RETURN_REG = 14
|
RETURN_REG = 14
|
||||||
# The register into which the "stack pointer" is stored.
|
# The register into which the "stack pointer" is stored.
|
||||||
STACK_REG = 13
|
STACK_REG = 13
|
||||||
|
# Register used for throwing away values.
|
||||||
|
THROWAWAY_REG = 12
|
||||||
|
|
||||||
# Module to emit instructions and store
|
# Module to emit instructions and store
|
||||||
# them into an existing array.
|
# them into an existing array.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user