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