Optimise direct access to globals, and incrementing and decrementing locals.

--HG--
branch : dtrg-videocore
This commit is contained in:
David Given 2013-05-22 10:55:13 +01:00
parent 0068952bd1
commit 9e556d8b7b

View file

@ -276,12 +276,10 @@ PATTERNS
with GPRI GPRI with GPRI GPRI
yields %1 %2 yields %1 %2
#if 0
pat stl lol $1==$2 /* Store then load local */ pat stl lol $1==$2 /* Store then load local */
leaving leaving
dup QUAD dup QUAD
stl $1 stl $1
#endif
pat lal sti lal loi $1==$3 && $2==$4 /* Store then load local, of a different size */ pat lal sti lal loi $1==$3 && $2==$4 /* Store then load local, of a different size */
leaving leaving
@ -352,8 +350,8 @@ PATTERNS
pat lal /* Load address of local */ pat lal /* Load address of local */
uses REG uses REG
gen gen
add %a, FP, {CONST, $1} sub %a, FP, GP
sub %a, GP add %a, {CONST, $1}
yields %a yields %a
pat lol inreg($1)>0 /* Load from local */ pat lol inreg($1)>0 /* Load from local */
@ -367,8 +365,8 @@ PATTERNS
pat ldl /* Load double-word from local */ pat ldl /* Load double-word from local */
leaving leaving
lal $1 lol $1 + QUAD*0
loi QUAD*2 lol $1 + QUAD*1
pat stl inreg($1)>0 /* Store to local */ pat stl inreg($1)>0 /* Store to local */
with CONST+GPRI with CONST+GPRI
@ -383,8 +381,8 @@ PATTERNS
pat sdl /* Store double-word to local */ pat sdl /* Store double-word to local */
leaving leaving
lal $1 stl $1 + QUAD*1
sti QUAD*2 stl $1 + QUAD*0
pat lil inreg($1)>0 /* Load from indirected local */ pat lil inreg($1)>0 /* Load from indirected local */
uses REG uses REG
@ -404,26 +402,36 @@ PATTERNS
pat stl lol $1==$2 /* Save then load (generated by C compiler) */ pat stl lol $1==$2 /* Save then load (generated by C compiler) */
leaving leaving
dup 4 dup QUAD
stl $1 stl $1
pat zrl /* Zero local */ pat zrl /* Zero local */
leaving leaving
loc 0 loc 0
stl $1 stl $1
pat inl /* Increment local */ pat inl inreg($1)>0 /* Increment local in register */
kills regvar($1)
gen
add {GPRE, regvar($1)}, {CONST, 1}
pat inl inreg($1)<=0 /* Increment local */
leaving leaving
lol $1 lol $1
loc 1 loc 1
adi 4 adi QUAD
stl $1 stl $1
pat del /* Decrement local */ pat del inreg($1)>0 /* Decrement local in register */
kills regvar($1)
gen
sub {GPRE, regvar($1)}, {CONST, 1}
pat del inreg($1)<=0 /* Decrement local */
leaving leaving
lol $1 lol $1
loc 1 loc 1
sbi 4 sbi QUAD
stl $1 stl $1
@ -512,6 +520,11 @@ PATTERNS
/* Loads and stores */ /* Loads and stores */
pat loi $1==BYTE /* Load byte indirect */ pat loi $1==BYTE /* Load byte indirect */
with LABEL
uses REG
gen
ldb %a, %1
yields %a
with GPR with GPR
uses reusing %1, REG uses reusing %1, REG
gen gen
@ -523,51 +536,46 @@ PATTERNS
ldb %a, {GPRGPR, %1.reg, GP} ldb %a, {GPRGPR, %1.reg, GP}
yields %a yields %a
#if 0 pat loi loc loc cii $1==WORD && $2==WORD && $3==QUAD /* Load short indirect and sign extend */
pat loi loc loc cii $1==WORD && $2==WORD && $3==QUAD /* Load half-word indirect and sign extend */ with LABEL
with GPR
uses REG uses REG
gen gen
lha %a, {GPROFFSET, %1, 0} ldhs %a, %1
yields %a yields %a
with SUM_RR with GPRI
uses reusing %1, REG uses reusing %1, REG
gen gen
lhax %a, %1.reg1, %1.reg2 add %a, %1, GP
yields %a ldhs %a, {GPROFFSET, %a, 0}
with SUM_RC
uses REG
gen
move {IND_RC_H_S, %1.reg, %1.off}, %a
yields %a yields %a
pat loi $1==WORD /* Load half-word indirect */ pat loi $1==WORD /* Load short indirect */
with GPR with LABEL
uses REG uses REG
gen gen
lhz %a, {GPROFFSET, %1, 0} ldh %a, %1
yields %a yields %a
with SUM_RR with GPRI
uses reusing %1, REG uses reusing %1, REG
gen gen
lhzx %a, %1.reg1, %1.reg2 add %a, %1, GP
ldh %a, {GPROFFSET, %a, 0}
yields %a yields %a
with SUM_RC
uses REG
gen
move {IND_RC_H, %1.reg, %1.off}, %a
yields %a
#endif
pat loi $1==QUAD /* Load quad indirect */ pat loi $1==QUAD /* Load quad indirect */
with GPR with LABEL
uses REG
gen
ld %a, %1
yields %a
with GPRI
uses reusing %1, REG uses reusing %1, REG
gen gen
add %a, %1, GP add %a, %1, GP
ld %a, {GPROFFSET, %a, 0} ld %a, {GPROFFSET, %a, 0}
yields %a yields %a
pat loi /* Load arbitrary size */ pat loi !nicesize($1) /* Load arbitrary size */
leaving leaving
loc $1 loc $1
los QUAD los QUAD
@ -579,6 +587,9 @@ PATTERNS
bl {LABEL, ".los"} bl {LABEL, ".los"}
pat sti $1==BYTE /* Store byte indirect */ pat sti $1==BYTE /* Store byte indirect */
with LABEL GPRI
gen
stb %2, %1
with GPR GPRI with GPR GPRI
gen gen
stb %2, {GPRGPR, %1, GP} stb %2, {GPRGPR, %1, GP}
@ -587,15 +598,21 @@ PATTERNS
stb %2, {GPRGPR, %1.reg, GP} stb %2, {GPRGPR, %1.reg, GP}
pat sti $1==WORD /* Store half-word indirect */ pat sti $1==WORD /* Store half-word indirect */
with GPR GPR with LABEL GPRI
uses REG gen
sth %2, %1
with GPRI GPRI
uses reusing %1, REG
gen gen
add %a, %1, GP add %a, %1, GP
sth %2, {GPROFFSET, %a, 0} sth %2, {GPROFFSET, %a, 0}
pat sti $1==QUAD /* Store quad indirect */ pat sti $1==QUAD /* Store quad indirect */
with GPR GPR with LABEL GPRI
uses REG gen
st %2, %1
with GPRI GPRI
uses reusing %1, REG
gen gen
add %a, %1, GP add %a, %1, GP
st %2, {GPROFFSET, %a, 0} st %2, {GPROFFSET, %a, 0}