Fix stack corruption when adjusting SP. Be a bit more rigorous about clearing the pseudostack on branch/labels.

--HG--
branch : dtrg-videocore
This commit is contained in:
David Given 2013-06-07 21:25:38 +01:00
parent ed6c4a85d1
commit bbd4b46850

View file

@ -117,7 +117,7 @@ INSTRUCTIONS
beq "b.eq" LABEL:ro. beq "b.eq" LABEL:ro.
bne "b.ne" LABEL:ro. bne "b.ne" LABEL:ro.
bgt "b.gt" LABEL:ro. bgt "b.gt" LABEL:ro.
bgt "b.gt" LABEL:ro. blt "b.lt" LABEL:ro.
bhi "b.hi" LABEL:ro. bhi "b.hi" LABEL:ro.
bset GPR:rw, GPR+CONST:ro. bset GPR:rw, GPR+CONST:ro.
b GPR+LABEL:ro. b GPR+LABEL:ro.
@ -266,14 +266,18 @@ PATTERNS
with ANY with ANY
yields %1 %1 yields %1 %1
pat dup $1<=(2*QUAD) /* Duplicate word pair on top of stack */ pat dup $1==(2*QUAD) /* Duplicate word pair on top of stack */
with ANY ANY with ANY ANY
yields %1 %2 %1 %2 yields %1 %2 %1 %2
pat exg $1==QUAD /* Exchange top two words on stack */ pat exg $1<=QUAD /* Exchange top two words on stack */
with ANY ANY with ANY ANY
yields %1 %2 yields %1 %2
pat exg $1==(2*QUAD) /* Exchange top two word pairs on stack */
with ANY ANY ANY ANY
yields %2 %1 %4 %3
pat stl lol $1==$2 /* Store then load local */ pat stl lol $1==$2 /* Store then load local */
leaving leaving
dup QUAD dup QUAD
@ -287,7 +291,7 @@ PATTERNS
pat ste loe $1==$2 /* Store then load external */ pat ste loe $1==$2 /* Store then load external */
leaving leaving
dup 4 dup QUAD
ste $1 ste $1
@ -1126,7 +1130,7 @@ PATTERNS
pat cmf tne call cmf_t("add.ne") /* top = float (second != top) */ pat cmf tne call cmf_t("add.ne") /* top = float (second != top) */
pat cmf tlt call cmf_t("add.lo") /* top = float (second < top) */ pat cmf tlt call cmf_t("add.lo") /* top = float (second < top) */
pat cmf tle call cmf_t("add.ls") /* top = float (second <= top) */ pat cmf tle call cmf_t("add.ls") /* top = float (second <= top) */
pat cmf tgt call cmf_t("add.hi") /* top = float (second < top) */ pat cmf tgt call cmf_t("add.hi") /* top = float (second > top) */
pat cmf tge call cmf_t("add.hs") /* top = float (second >= top) */ pat cmf tge call cmf_t("add.hs") /* top = float (second >= top) */
proc fallback_t example teq proc fallback_t example teq
@ -1142,7 +1146,7 @@ PATTERNS
pat tne call fallback_t("add.ne") /* top = float (top != 0) */ pat tne call fallback_t("add.ne") /* top = float (top != 0) */
pat tlt call fallback_t("add.lo") /* top = float (top < 0) */ pat tlt call fallback_t("add.lo") /* top = float (top < 0) */
pat tle call fallback_t("add.ls") /* top = float (top <= 0) */ pat tle call fallback_t("add.ls") /* top = float (top <= 0) */
pat tgt call fallback_t("add.hi") /* top = float (top < 0) */ pat tgt call fallback_t("add.hi") /* top = float (top > 0) */
pat tge call fallback_t("add.hs") /* top = float (top >= 0) */ pat tge call fallback_t("add.hs") /* top = float (top >= 0) */
@ -1151,6 +1155,7 @@ PATTERNS
proc anyz example zeq proc anyz example zeq
with GPR STACK with GPR STACK
kills ALL
gen gen
cmp %1, {CONST, 0} cmp %1, {CONST, 0}
beq[1] {LABEL, $1} beq[1] {LABEL, $1}
@ -1164,6 +1169,7 @@ PATTERNS
proc anyb example beq proc anyb example beq
with GPR+CONST GPR STACK with GPR+CONST GPR STACK
kills ALL
gen gen
cmp %2, %1 cmp %2, %1
beq[1] {LABEL, $1} beq[1] {LABEL, $1}
@ -1177,6 +1183,7 @@ PATTERNS
proc cmu_z example cmu zeq proc cmu_z example cmu zeq
with GPR+CONST GPR STACK with GPR+CONST GPR STACK
kills ALL
gen gen
cmp %2, %1 cmp %2, %1
beq[1] {LABEL, $2} beq[1] {LABEL, $2}
@ -1196,6 +1203,7 @@ PATTERNS
proc cmf_z example cmu zeq proc cmf_z example cmu zeq
with GPR GPR STACK with GPR GPR STACK
kills ALL
gen gen
fcmp %2, %2, %1 fcmp %2, %2, %1
beq[1] {LABEL, $2} beq[1] {LABEL, $2}
@ -1258,6 +1266,7 @@ PATTERNS
pat bra pat bra
with STACK with STACK
kills ALL
gen gen
b {LABEL, $1} b {LABEL, $1}
@ -1452,13 +1461,23 @@ PATTERNS
ste ".reghp" ste ".reghp"
pat ass /* Adjust stack by variable amount */ pat ass /* Adjust stack by variable amount */
with CONST+GPR with CONST+GPR STACK
gen gen
add SP, %1 add SP, %1
pat asp $1==QUAD /* Adjust stack by constant amount */ pat asp $1==QUAD /* Adjust stack by constant amount */
gen with GPR
pop SCRATCH /* silently ignore GPR */
with STACK
gen
pop SCRATCH
pat asp $1==(2*QUAD) /* Adjust stack by constant amount */
with GPR GPR
/* silently ignore GPR */
with STACK
gen
add SP, {CONST, 2*QUAD}
pat asp /* Adjust stack by constant amount */ pat asp /* Adjust stack by constant amount */
leaving leaving