Skip to content

Commit

Permalink
change findDefinedLevelFP and everything works fine now
Browse files Browse the repository at this point in the history
  • Loading branch information
MilanLi committed Apr 19, 2014
1 parent 856350a commit 4b10036
Show file tree
Hide file tree
Showing 26 changed files with 3,650 additions and 999 deletions.
2 changes: 2 additions & 0 deletions codegen.sml
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ struct
)

)
val labelDebug = T.LABEL(Temp.namedlabel("#FP <- S7 finish here."))

in
emit(A.OPER{
Expand All @@ -480,6 +481,7 @@ struct
dst=[], (*Frame.calldefs,*)(*这里不对 会导致makegraph算进去*)
jump=NONE});
if isLibrary(Symbol.name (label)) then () else munchStm(T.MOVE(T.TEMP Frame.FP, T.TEMP Frame.S7)) ;
munchStm(labelDebug);
munchExp(T.TEMP Frame.RV)
end

Expand Down
8 changes: 5 additions & 3 deletions passtest/TwoLetSL.tig.s
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ lw $t0, 0($sp)
move $fp, $t0
addi $sp, $sp, 100
jr $ra
L1131:
L2335:
.text
addThree:
#save calleesaves:
Expand Down Expand Up @@ -90,6 +90,7 @@ lw $t1, 60($sp)
lw $t0, 56($sp)
#load callersave finish
move $fp, $s7
#FP <- S7 finish here.:
move $v0, $v0
#load calleesaves:
lw $s7, 52($sp)
Expand All @@ -105,7 +106,7 @@ lw $t0, 0($sp)
move $fp, $t0
addi $sp, $sp, 100
jr $ra
L1132:
L2336:
.text
tig_main:
#save calleesaves:
Expand Down Expand Up @@ -165,6 +166,7 @@ lw $t1, 60($sp)
lw $t0, 56($sp)
#load callersave finish
move $fp, $s7
#FP <- S7 finish here.:
move $t0, $v0
sw $t0, 0($t1)
lw $t0, -8($fp)
Expand All @@ -183,7 +185,7 @@ lw $t0, 0($sp)
move $fp, $t0
addi $sp, $sp, 104
jr $ra
L1141:
L2345:



Expand Down
48 changes: 26 additions & 22 deletions passtest/for.tig.s
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
.data
L1826:
L3030:
.word 5
.asciiz "else\n"
.data
L1824:
L3028:
.word 2
.asciiz "7\n"
.data
L1822:
L3026:
.word 2
.asciiz "0\n"
.data
L1820:
L3024:
.word 2
.asciiz ".\n"
.text
Expand Down Expand Up @@ -41,12 +41,12 @@ addi $t1, $zero, 0
addi $t0, $zero, 1
sub $t0, $t1, $t0
sw $t0, -8($fp)
L1834:
L3038:
lw $t0, -8($fp)
addi $t0, $t0, 1
sw $t0, -8($fp)
#save arguments to reg
la $a0, L1820
la $a0, L3024
#save callersave
sw $t0, 56($sp)
sw $t1, 60($sp)
Expand All @@ -72,16 +72,17 @@ lw $t2, 64($sp)
lw $t1, 60($sp)
lw $t0, 56($sp)
#load callersave finish
#FP <- S7 finish here.:
lw $t1, -8($fp)
addi $t0, $zero, 0
beq $t1, $t0, L1830
L1831:
beq $t1, $t0, L3034
L3035:
lw $t1, -8($fp)
addi $t0, $zero, 7
beq $t1, $t0, L1827
L1828:
beq $t1, $t0, L3031
L3032:
#save arguments to reg
la $a0, L1826
la $a0, L3030
#save callersave
sw $t0, 56($sp)
sw $t1, 60($sp)
Expand All @@ -107,18 +108,19 @@ lw $t2, 64($sp)
lw $t1, 60($sp)
lw $t0, 56($sp)
#load callersave finish
#FP <- S7 finish here.:
move $t0, $v0
L1829:
L3033:
move $t0, $t0
L1832:
L3036:
lw $t2, -8($fp)
lw $t1, -4($fp)
addi $t0, $zero, 1
sub $t1, $t1, $t0
addi $t0, $zero, 1
sub $t0, $t1, $t0
ble $t2, $t0, L1834
L1818:
ble $t2, $t0, L3038
L3022:
li $v0, 0
#load calleesaves:
lw $s7, 52($sp)
Expand All @@ -134,9 +136,9 @@ lw $t0, 0($sp)
move $fp, $t0
addi $sp, $sp, 104
jr $ra
L1830:
L3034:
#save arguments to reg
la $a0, L1822
la $a0, L3026
#save callersave
sw $t0, 56($sp)
sw $t1, 60($sp)
Expand All @@ -162,11 +164,12 @@ lw $t2, 64($sp)
lw $t1, 60($sp)
lw $t0, 56($sp)
#load callersave finish
#FP <- S7 finish here.:
move $t0, $v0
j L1832
L1827:
j L3036
L3031:
#save arguments to reg
la $a0, L1824
la $a0, L3028
#save callersave
sw $t0, 56($sp)
sw $t1, 60($sp)
Expand All @@ -192,9 +195,10 @@ lw $t2, 64($sp)
lw $t1, 60($sp)
lw $t0, 56($sp)
#load callersave finish
#FP <- S7 finish here.:
move $t0, $v0
j L1829
L1835:
j L3033
L3039:



Expand Down
8 changes: 5 additions & 3 deletions passtest/globalTest.tig.s
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ lw $t0, 0($sp)
move $fp, $t0
addi $sp, $sp, 100
jr $ra
L1025:
L2229:
.text
dummy:
#save calleesaves:
Expand Down Expand Up @@ -102,6 +102,7 @@ lw $t1, 60($sp)
lw $t0, 56($sp)
#load callersave finish
move $fp, $s7
#FP <- S7 finish here.:
lw $t0, -96($fp)
lw $t0, -4($t0)
move $v0, $t0
Expand All @@ -119,7 +120,7 @@ lw $t0, 0($sp)
move $fp, $t0
addi $sp, $sp, 96
jr $ra
L1026:
L2230:
.text
tig_main:
#save calleesaves:
Expand Down Expand Up @@ -172,6 +173,7 @@ lw $t1, 60($sp)
lw $t0, 56($sp)
#load callersave finish
move $fp, $s7
#FP <- S7 finish here.:
lw $t0, -4($fp)
move $v0, $t0
#load calleesaves:
Expand All @@ -188,7 +190,7 @@ lw $t0, 0($sp)
move $fp, $t0
addi $sp, $sp, 100
jr $ra
L1034:
L2238:



Expand Down
Loading

0 comments on commit 4b10036

Please sign in to comment.