diff --git a/src/chalk/codegen.cr b/src/chalk/codegen.cr index 010724d..9c57b78 100644 --- a/src/chalk/codegen.cr +++ b/src/chalk/codegen.cr @@ -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]? diff --git a/src/chalk/emitter.cr b/src/chalk/emitter.cr index 5dd106d..58a6d19 100644 --- a/src/chalk/emitter.cr +++ b/src/chalk/emitter.cr @@ -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.