1dfd5524e4
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.
30 lines
524 B
Plaintext
30 lines
524 B
Plaintext
|
|
/* PowerPC desciptor table for ACK target optimizer */
|
|
|
|
MAXOP 3;
|
|
LABEL_STARTER '.';
|
|
|
|
%%;
|
|
|
|
RNZ { strcmp(VAL, "r0") }; /* not r0 */
|
|
X, Y, Z { TRUE };
|
|
|
|
%%;
|
|
|
|
/* Whitespace is significant here! */
|
|
|
|
addi RNZ, RNZ, 0 -> ;
|
|
addis RNZ, RNZ, 0 -> ;
|
|
|
|
mr X, X -> ;
|
|
fmr X, X -> ;
|
|
|
|
or X, Y, Z : or. X, X, X -> or. X, Y, Z ;
|
|
|
|
b X : labdef X -> labdef X ;
|
|
|
|
/* IFFALSE=4, IFTRUE=12, ALWAYS=20 */
|
|
/* LT=0, GT=1, EQ=2, OV=3 */
|
|
|
|
%%;
|