Browse Source

+ added a far pointer aware implementation of hlcg.getaddressregister for i8086.
This should allow writing memory model independent code in the FPC code
generator.

git-svn-id: trunk@27274 -

nickysn 11 years ago
parent
commit
3cd9cef182
1 changed files with 11 additions and 0 deletions
  1. 11 0
      compiler/i8086/hlcgcpu.pas

+ 11 - 0
compiler/i8086/hlcgcpu.pas

@@ -41,6 +41,8 @@ interface
      protected
       procedure gen_loadfpu_loc_cgpara(list: TAsmList; size: tdef; const l: tlocation; const cgpara: tcgpara; locintsize: longint); override;
      public
+      function getaddressregister(list:TAsmList;size:tdef):Tregister;override;
+
       procedure g_copyvaluepara_openarray(list: TAsmList; const ref: treference; const lenloc: tlocation; arrdef: tarraydef; destreg: tregister); override;
       procedure g_releasevaluepara_openarray(list: TAsmList; arrdef: tarraydef; const l: tlocation); override;
 
@@ -175,6 +177,15 @@ implementation
     end;
 
 
+  function thlcgcpu.getaddressregister(list: TAsmList; size: tdef): Tregister;
+    begin
+      if is_farpointer(size) or is_hugepointer(size) then
+        Result:=cg.getintregister(list,OS_32)
+      else
+        Result:=cg.getintregister(list,OS_16);
+    end;
+
+
   procedure thlcgcpu.g_copyvaluepara_openarray(list: TAsmList; const ref: treference; const lenloc: tlocation; arrdef: tarraydef; destreg: tregister);
     begin
       if paramanager.use_fixed_stack then