2007-11-02 18:56:58 +00:00
|
|
|
|
2017-12-23 03:32:16 +00:00
|
|
|
/* PowerPC table for ACK target optimizer */
|
2007-11-02 18:56:58 +00:00
|
|
|
|
|
|
|
MAXOP 3;
|
2016-10-29 21:37:11 +00:00
|
|
|
LABEL_STARTER '.';
|
2007-11-02 18:56:58 +00:00
|
|
|
|
|
|
|
%%;
|
|
|
|
|
In PowerPC top, don't delete addi r0, r0, 0
Also don't delete addis r0, r0, 0. These instructions are special
cases that set r0 to zero. If we delete them, then r0 keeps its old
value.
I caught this bug because osxppc protects the .text segment against
writing. (linuxppc doesn't protect it.) A program tried to set r0 to
the NULL pointer, but top deleted the instruction, so r0 kept an old
return address pointing into .text. Later the program checked that r0
wasn't NULL, tried to write to address r0, and crashed.
2017-01-26 17:44:32 +00:00
|
|
|
RNZ { strcmp(VAL, "r0") }; /* not r0 */
|
2007-11-02 18:56:58 +00:00
|
|
|
X, Y, Z { TRUE };
|
|
|
|
|
|
|
|
%%;
|
|
|
|
|
|
|
|
/* Whitespace is significant here! */
|
|
|
|
|
In PowerPC top, don't delete addi r0, r0, 0
Also don't delete addis r0, r0, 0. These instructions are special
cases that set r0 to zero. If we delete them, then r0 keeps its old
value.
I caught this bug because osxppc protects the .text segment against
writing. (linuxppc doesn't protect it.) A program tried to set r0 to
the NULL pointer, but top deleted the instruction, so r0 kept an old
return address pointing into .text. Later the program checked that r0
wasn't NULL, tried to write to address r0, and crashed.
2017-01-26 17:44:32 +00:00
|
|
|
addi RNZ, RNZ, 0 -> ;
|
|
|
|
addis RNZ, RNZ, 0 -> ;
|
2007-11-02 18:56:58 +00:00
|
|
|
|
2017-12-23 03:32:16 +00:00
|
|
|
or X, Y, Y -> mr X, Y ;
|
|
|
|
or. X, Y, Y -> mr. X, Y ;
|
|
|
|
|
2016-10-29 21:37:11 +00:00
|
|
|
mr X, X -> ;
|
|
|
|
fmr X, X -> ;
|
|
|
|
|
2017-12-23 03:32:16 +00:00
|
|
|
add X, Y, Z : mr. X, X -> add. X, Y, Z ;
|
|
|
|
and X, Y, Z : mr. X, X -> and. X, Y, Z ;
|
|
|
|
andc X, Y, Z : mr. X, X -> andc. X, Y, Z ;
|
|
|
|
divw X, Y, Z : mr. X, X -> divw. X, Y, Z ;
|
|
|
|
divwu X, Y, Z : mr. X, X -> divwu. X, Y, Z ;
|
|
|
|
extsb X, Y, Z : mr. X, X -> extsb. X, Y, Z ;
|
|
|
|
extsh X, Y, Z : mr. X, X -> extsh. X, Y, Z ;
|
|
|
|
eqv X, Y, Z : mr. X, X -> eqv. X, Y, Z ;
|
|
|
|
mullw X, Y, Z : mr. X, X -> mullw. X, Y, Z ;
|
|
|
|
nand X, Y, Z : mr. X, X -> nand. X, Y, Z ;
|
|
|
|
nor X, Y, Z : mr. X, X -> nor. X, Y, Z ;
|
|
|
|
or X, Y, Z : mr. X, X -> or. X, Y, Z ;
|
|
|
|
orc X, Y, Z : mr. X, X -> orc. X, Y, Z ;
|
|
|
|
slw X, Y, Z : mr. X, X -> slw. X, Y, Z ;
|
|
|
|
slwi X, Y, Z : mr. X, X -> slwi. X, Y, Z ;
|
|
|
|
subf X, Y, Z : mr. X, X -> subf. X, Y, Z ;
|
|
|
|
sraw X, Y, Z : mr. X, X -> sraw. X, Y, Z ;
|
|
|
|
srawi X, Y, Z : mr. X, X -> srawi. X, Y, Z ;
|
|
|
|
srw X, Y, Z : mr. X, X -> srw. X, Y, Z ;
|
|
|
|
srwi X, Y, Z : mr. X, X -> srwi. X, Y, Z ;
|
|
|
|
xor X, Y, Z : mr. X, X -> xor. X, Y, Z ;
|
2007-11-02 18:56:58 +00:00
|
|
|
|
2016-10-29 21:37:11 +00:00
|
|
|
b X : labdef X -> labdef X ;
|
|
|
|
|
|
|
|
/* IFFALSE=4, IFTRUE=12, ALWAYS=20 */
|
|
|
|
/* LT=0, GT=1, EQ=2, OV=3 */
|
|
|
|
|
2007-11-02 18:56:58 +00:00
|
|
|
%%;
|