1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2025-08-13 11:24:59 +00:00

Number each temporary uniquely across program. Sweet!

This commit is contained in:
Cat's Eye Technologies
2014-04-12 12:16:09 +01:00
parent 7a7127fc06
commit 915b0cfef0
2 changed files with 10 additions and 7 deletions

View File

@@ -234,17 +234,19 @@ temporaries are not unioned yet, but they could be.
= jsr a = jsr a
= jsr b = jsr b
= rts = rts
=
= a: = a:
= lda _temp_1 = lda _temp_1
= sta _temp_2+1 = sta _temp_2+1
= rts = rts
=
= b: = b:
= lda _temp_3 = lda _temp_3
= sta _temp_4 = sta _temp_4
= rts = rts
= =
= .data = .data
= .space _temp_1 1
= .space _temp_2 2
= .space _temp_3 1 = .space _temp_3 1
= .space _temp_4 2 = .space _temp_4 2
= .space _temp_1 1
= .space _temp_2 2

View File

@@ -147,18 +147,19 @@ fillOutNamedLocationTypes p@(Program decls routines) =
-- TODO: look at all blocks, not just routine's blocks -- TODO: look at all blocks, not just routine's blocks
renameBlockDecls (Program decls routines) = renameBlockDecls (Program decls routines) =
let let
routines' = map renameRoutineDecls routines routines' = renameRoutineDecls 1 routines
in in
Program decls routines' Program decls routines'
renameRoutineDecls (Routine name outputs block) = renameRoutineDecls id [] = []
renameRoutineDecls id ((Routine name outputs block):routs) =
let let
(Block decls _) = block (Block decls _) = block
(id', block') = foldDeclsRenaming decls 0 block (id', block') = foldDeclsRenaming decls id block
rest = renameRoutineDecls id' routs
in in
(Routine name outputs block') ((Routine name outputs block'):rest)
-- TODO accumulator has to range across all routines too!
foldDeclsRenaming [] id block = (id, block) foldDeclsRenaming [] id block = (id, block)
foldDeclsRenaming ((Reserve name typ Nothing):decls) id block = foldDeclsRenaming ((Reserve name typ Nothing):decls) id block =
let let