Browse Source

+ remove the segment prefix in make_simple_ref on i8086, in case it is the same
as the default segment for the reference (SS for BP-relative, DS for all
others)

git-svn-id: trunk@27687 -

nickysn 11 years ago
parent
commit
1eb24f9d98
1 changed files with 9 additions and 0 deletions
  1. 9 0
      compiler/x86/cgx86.pas

+ 9 - 0
compiler/x86/cgx86.pas

@@ -619,6 +619,15 @@ unit cgx86;
             list.concat(taicpu.op_reg_reg(A_MOV,S_W,ref.segment,NR_ES));
             ref.segment:=NR_ES;
           end;
+
+        { can the segment override be dropped? }
+        if ref.segment<>NR_NO then
+          begin
+            if (ref.base=NR_BP) and segment_regs_equal(ref.segment,NR_SS) then
+              ref.segment:=NR_NO;
+            if (ref.base<>NR_BP) and segment_regs_equal(ref.segment,NR_DS) then
+              ref.segment:=NR_NO;
+          end;
 {$endif}
       end;