Browse Source

* fixed getting the address of a far proc on i8086 after the hlcgllvm branch merge

git-svn-id: trunk@30354 -
nickysn 10 năm trước cách đây
mục cha
commit
6b0a19c0ab
2 tập tin đã thay đổi với 17 bổ sung1 xóa
  1. 1 1
      compiler/i8086/hlcgcpu.pas
  2. 16 0
      compiler/i8086/symcpu.pas

+ 1 - 1
compiler/i8086/hlcgcpu.pas

@@ -353,7 +353,7 @@ implementation
       cg.a_loadaddr_ref_reg(list, tmpref, r);
 
       { step 2: if destination is a far pointer, we have to pass a segment as well }
-      if is_farpointer(tosize) or is_hugepointer(tosize) then
+      if is_farpointer(tosize) or is_hugepointer(tosize) or is_farprocvar(tosize) then
         begin
           { if a segment register is specified in ref, we use that }
           if ref.segment<>NR_NO then

+ 16 - 0
compiler/i8086/symcpu.pas

@@ -123,6 +123,7 @@ type
    public
     constructor create(level:byte);override;
     function address_type:tdef;override;
+    function size:asizeint;override;
     procedure declared_far;override;
     procedure declared_near;override;
     function is_far:boolean;
@@ -210,6 +211,9 @@ const
 
   function is_proc_far(p: tabstractprocdef): boolean;
 
+  {# Returns true if p is a far proc var }
+  function is_farprocvar(p : tdef): boolean;
+
   {# Returns true if p is a far pointer def }
   function is_farpointer(p : tdef) : boolean;
 
@@ -232,6 +236,12 @@ implementation
       internalerror(2014041301);
   end;
 
+  { true if p is a far proc var }
+  function is_farprocvar(p : tdef): boolean;
+    begin
+      result:=(p.typ=procvardef) and tcpuprocvardef(p).is_far;
+    end;
+
   { true if p is a far pointer def }
   function is_farpointer(p : tdef) : boolean;
     begin
@@ -318,6 +328,12 @@ implementation
     end;
 
 
+  function tcpuprocdef.size: asizeint;
+    begin
+      result:=address_type.size;
+    end;
+
+
   procedure tcpuprocdef.declared_far;
     begin
       if current_settings.x86memorymodel in x86_far_code_models then