Dedicate a throwaway register.

This commit is contained in:
Danila Fedorin 2018-08-05 13:36:54 -07:00
parent a96d503095
commit 230a50c532
2 changed files with 3 additions and 3 deletions

View File

@ -90,10 +90,8 @@ module Chalk
generate! tree, entry.function, table, target, free
when Trees::TreeBlock
table = Table.new(table)
throwaway = free
free += 1
tree.children.each do |child|
free += generate! child, table, throwaway, free
free += generate! child, table, THROWAWAY_REG, free
end
when Trees::TreeVar
entry = table[tree.name]?

View File

@ -4,6 +4,8 @@ module Chalk
RETURN_REG = 14
# The register into which the "stack pointer" is stored.
STACK_REG = 13
# Register used for throwing away values.
THROWAWAY_REG = 12
# Module to emit instructions and store
# them into an existing array.