Browse Source

* allow cmov with memory reference if it is a pure symbol or a rip relative symbol: as the symbol is
allocated within the image of the program, this should never cause a seg. fault, so it is save
to use cmov with it

git-svn-id: trunk@43368 -

florian 5 years ago
parent
commit
c3ef42b164
1 changed files with 11 additions and 1 deletions
  1. 11 1
      compiler/x86/aoptx86.pas

+ 11 - 1
compiler/x86/aoptx86.pas

@@ -3184,7 +3184,17 @@ unit aoptx86;
             or ((taicpu(p).oper[0]^.typ = top_ref) and
              (taicpu(p).oper[0]^.ref^.refaddr = addr_no))
            }
-           MatchOpType(taicpu(p),top_reg,top_reg);
+           (MatchOpType(taicpu(p),top_reg,top_reg) or
+            { allow references, but only pure symbols or got rel. addressing with RIP as based,
+              it is not expected that this can cause a seg. violation }
+            (MatchOpType(taicpu(p),top_ref,top_reg) and
+             (((taicpu(p).oper[0]^.ref^.base=NR_NO) and (taicpu(p).oper[0]^.ref^.refaddr=addr_no)) or
+              ((taicpu(p).oper[0]^.ref^.base=NR_RIP) and (taicpu(p).oper[0]^.ref^.refaddr=addr_pic))
+             ) and
+             (taicpu(p).oper[0]^.ref^.index=NR_NO) and
+             (taicpu(p).oper[0]^.ref^.offset=0)
+            )
+           );
       end;