Browse Source

+ proper spilling support for R_SUBH (i.e. AH,BH,CH,DH) x86 registers in trgx86.do_spill_replace

git-svn-id: trunk@24476 -
nickysn 12 years ago
parent
commit
2a9d38d878
1 changed files with 4 additions and 0 deletions
  1. 4 0
      compiler/x86/rgx86.pas

+ 4 - 0
compiler/x86/rgx86.pas

@@ -115,6 +115,7 @@ implementation
 
 
       var
       var
         n,replaceoper : longint;
         n,replaceoper : longint;
+        is_subh: Boolean;
       begin
       begin
         result:=false;
         result:=false;
         with instr do
         with instr do
@@ -274,9 +275,12 @@ implementation
             { Replace register with spill reference }
             { Replace register with spill reference }
             if replaceoper<>-1 then
             if replaceoper<>-1 then
               begin
               begin
+                is_subh:=getsubreg(oper[replaceoper]^.reg)=R_SUBH;
                 oper[replaceoper]^.typ:=top_ref;
                 oper[replaceoper]^.typ:=top_ref;
                 new(oper[replaceoper]^.ref);
                 new(oper[replaceoper]^.ref);
                 oper[replaceoper]^.ref^:=spilltemp;
                 oper[replaceoper]^.ref^:=spilltemp;
+                if is_subh then
+                  inc(oper[replaceoper]^.ref^.offset);
                 { memory locations aren't guaranteed to be aligned }
                 { memory locations aren't guaranteed to be aligned }
                 case opcode of
                 case opcode of
                   A_MOVAPS:
                   A_MOVAPS: