Browse Source

* x86: Fixed attributes of the LEAVE instruction - it reads EBP.
This fixes crashes with -O3s in some cases due to an incorrect peephole
optimization.

Yuriy Sydorov 3 năm trước cách đây
mục cha
commit
4a7a113a30

+ 1 - 1
compiler/i386/i386prop.inc

@@ -169,7 +169,7 @@
 (Ch: [Ch_All]),
 (Ch: [Ch_Wop2, Ch_Rop1]),
 (Ch: [Ch_Wop2, Ch_Rop1]),
-(Ch: [Ch_RWESP, Ch_WEBP]),
+(Ch: [Ch_RWESP, Ch_RWEBP]),
 (Ch: [Ch_Wop2, Ch_Rop1]),
 (Ch: [Ch_Wop2, Ch_Rop1]),
 (Ch: []),

+ 1 - 1
compiler/i8086/i8086prop.inc

@@ -169,7 +169,7 @@
 (Ch: [Ch_All]),
 (Ch: [Ch_Wop2, Ch_Rop1]),
 (Ch: [Ch_Wop2, Ch_Rop1]),
-(Ch: [Ch_RWESP, Ch_WEBP]),
+(Ch: [Ch_RWESP, Ch_RWEBP]),
 (Ch: [Ch_Wop2, Ch_Rop1]),
 (Ch: [Ch_Wop2, Ch_Rop1]),
 (Ch: []),

+ 1 - 0
compiler/x86/aoptx86.pas

@@ -3229,6 +3229,7 @@ unit aoptx86;
                                   RegLoadedWithNewValue(CurrentReg, hp2) or
                                   not RegUsedAfterInstruction(CurrentReg, hp2, TmpUsedRegs) then
                                   begin
+                                    RegUsedAfterInstruction(CurrentReg, hp2, TmpUsedRegs);
                                     { We can remove the original MOV }
                                     DebugMsg(SPeepholeOptimization + 'Mov2Nop 3b done',p);
                                     RemoveCurrentp(p, hp1);

+ 1 - 1
compiler/x86/x86ins.dat

@@ -942,7 +942,7 @@ reg16|32,mem          \320\1\xC5\110                  8086,NOX86_64
 reg16|32|64,mem       \320\1\x8D\110              8086
 
 [LEAVE]
-(Ch_RWESP, Ch_WEBP)
+(Ch_RWESP, Ch_RWEBP)
 void                  \1\xC9                          186
 
 [LES,lesX]

+ 1 - 1
compiler/x86_64/x8664pro.inc

@@ -160,7 +160,7 @@
 (Ch: [Ch_Wop2, Ch_WZeroFlag]),
 (Ch: [Ch_All]),
 (Ch: [Ch_Wop2, Ch_Rop1]),
-(Ch: [Ch_RWESP, Ch_WEBP]),
+(Ch: [Ch_RWESP, Ch_RWEBP]),
 (Ch: [Ch_Wop2, Ch_Rop1]),
 (Ch: []),
 (Ch: [Ch_Wop2, Ch_Rop1]),