Browse Source

+ override hlcg.a_call_name for i8086 and dispatch to the appropriate type of
call (near or far), according to whether the procdef is near or far, instead
of relying on the default for the memory model

git-svn-id: trunk@27562 -

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

+ 15 - 3
compiler/i8086/hlcgcpu.pas

@@ -29,7 +29,7 @@ unit hlcgcpu;
 interface
 interface
 
 
   uses
   uses
-    globals,
+    globals,globtype,
     aasmdata,
     aasmdata,
     symtype,symdef,parabase,
     symtype,symdef,parabase,
     cgbase,cgutils,
     cgbase,cgutils,
@@ -67,6 +67,8 @@ interface
 
 
       procedure reference_reset_base(var ref: treference; regsize: tdef; reg: tregister; offset, alignment: longint); override;
       procedure reference_reset_base(var ref: treference; regsize: tdef; reg: tregister; offset, alignment: longint); override;
 
 
+      function a_call_name(list : TAsmList;pd : tprocdef;const s : TSymStr; forceresdef: tdef; weak: boolean): tcgpara;override;
+
       procedure a_load_loc_ref(list : TAsmList;fromsize, tosize: tdef; const loc: tlocation; const ref : treference);override;
       procedure a_load_loc_ref(list : TAsmList;fromsize, tosize: tdef; const loc: tlocation; const ref : treference);override;
       procedure a_loadaddr_ref_reg(list : TAsmList;fromsize, tosize : tdef;const ref : treference;r : tregister);override;
       procedure a_loadaddr_ref_reg(list : TAsmList;fromsize, tosize : tdef;const ref : treference;r : tregister);override;
 
 
@@ -81,11 +83,11 @@ interface
 implementation
 implementation
 
 
   uses
   uses
-    globtype,verbose,
+    verbose,
     paramgr,
     paramgr,
     cpubase,cpuinfo,tgobj,cgobj,cgcpu,
     cpubase,cpuinfo,tgobj,cgobj,cgcpu,
     defutil,
     defutil,
-    symconst,
+    symconst,symcpu,
     procinfo,
     procinfo,
     aasmcpu;
     aasmcpu;
 
 
@@ -256,6 +258,16 @@ implementation
     end;
     end;
 
 
 
 
+  function thlcgcpu.a_call_name(list: TAsmList; pd: tprocdef; const s: TSymStr; forceresdef: tdef; weak: boolean): tcgpara;
+    begin
+      if is_proc_far(pd) then
+        tcg8086(cg).a_call_name_far(list,s,weak)
+      else
+        tcg8086(cg).a_call_name_near(list,s,weak);
+      result:=get_call_result_cgpara(pd,forceresdef);
+    end;
+
+
   procedure thlcgcpu.a_load_loc_ref(list: TAsmList; fromsize, tosize: tdef; const loc: tlocation; const ref: treference);
   procedure thlcgcpu.a_load_loc_ref(list: TAsmList; fromsize, tosize: tdef; const loc: tlocation; const ref: treference);
     var
     var
       tmpref: treference;
       tmpref: treference;