Browse Source

* 8086: More fixes for Ofs() handling.

git-svn-id: trunk@46478 -
yury 5 years ago
parent
commit
e4b717c817
2 changed files with 26 additions and 16 deletions
  1. 2 8
      compiler/i8086/n8086cnv.pas
  2. 24 8
      compiler/i8086/symcpu.pas

+ 2 - 8
compiler/i8086/n8086cnv.pas

@@ -71,10 +71,7 @@ implementation
             if resultdef.typ<>procvardef then
             if resultdef.typ<>procvardef then
               internalerror(2018040401);
               internalerror(2018040401);
             if po_far in tprocvardef(resultdef).procoptions then
             if po_far in tprocvardef(resultdef).procoptions then
-              begin
-                resultdef:=cprocvardef.getreusableprocaddr(tabstractprocdef(left.resultdef),pc_offset);
-                exclude(tprocvardef(resultdef).procoptions,po_far);
-              end;
+              resultdef:=cprocvardef.getreusableprocaddr(tabstractprocdef(left.resultdef),pc_offset);
           end
           end
         else if (tcnf_proc_2_procvar_2_voidpointer in convnodeflags) and
         else if (tcnf_proc_2_procvar_2_voidpointer in convnodeflags) and
                 (current_settings.x86memorymodel in x86_far_code_models) then
                 (current_settings.x86memorymodel in x86_far_code_models) then
@@ -82,10 +79,7 @@ implementation
             if resultdef.typ<>procvardef then
             if resultdef.typ<>procvardef then
               internalerror(2018040402);
               internalerror(2018040402);
             if not (po_far in tprocvardef(resultdef).procoptions) then
             if not (po_far in tprocvardef(resultdef).procoptions) then
-              begin
-                resultdef:=cprocvardef.getreusableprocaddr(tabstractprocdef(left.resultdef),pc_far_address);
-                include(tprocvardef(resultdef).procoptions,po_far);
-              end;
+              resultdef:=cprocvardef.getreusableprocaddr(tabstractprocdef(left.resultdef),pc_far_address);
           end;
           end;
       end;
       end;
 
 

+ 24 - 8
compiler/i8086/symcpu.pas

@@ -271,6 +271,28 @@ implementation
       result:=(p.typ=pointerdef) and (tcpupointerdef(p).x86pointertyp=x86pt_huge);
       result:=(p.typ=pointerdef) and (tcpupointerdef(p).x86pointertyp=x86pt_huge);
     end;
     end;
 
 
+  procedure handle_procdef_copyas(src: tabstractprocdef; is_far: boolean; copytyp:tproccopytyp; var result: tabstractprocdef);
+    begin
+      if is_far then
+        include(result.procoptions,po_far)
+      else
+        exclude(result.procoptions,po_far);
+      case copytyp of
+        pc_far_address:
+          begin
+            include(result.procoptions,po_addressonly);
+            include(result.procoptions,po_far);
+          end;
+        pc_offset:
+          begin
+            include(result.procoptions,po_addressonly);
+            exclude(result.procoptions,po_far);
+          end;
+        else
+          ; {none}
+      end;
+    end;
+
 {****************************************************************************
 {****************************************************************************
                                tcpuclassrefdef
                                tcpuclassrefdef
 ****************************************************************************}
 ****************************************************************************}
@@ -337,10 +359,7 @@ implementation
   function tcpuprocdef.getcopyas(newtyp:tdeftyp;copytyp:tproccopytyp;const paraprefix:string):tstoreddef;
   function tcpuprocdef.getcopyas(newtyp:tdeftyp;copytyp:tproccopytyp;const paraprefix:string):tstoreddef;
     begin
     begin
       result:=inherited;
       result:=inherited;
-      if is_far then
-        include(tabstractprocdef(result).procoptions,po_far)
-      else
-        exclude(tabstractprocdef(result).procoptions,po_far);
+      handle_procdef_copyas(self,is_far,copytyp,tabstractprocdef(result));
     end;
     end;
 
 
 
 
@@ -431,10 +450,7 @@ implementation
   function tcpuprocvardef.getcopyas(newtyp:tdeftyp;copytyp:tproccopytyp;const paraprefix:string):tstoreddef;
   function tcpuprocvardef.getcopyas(newtyp:tdeftyp;copytyp:tproccopytyp;const paraprefix:string):tstoreddef;
     begin
     begin
       result:=inherited;
       result:=inherited;
-      if is_far then
-        include(tabstractprocdef(result).procoptions,po_far)
-      else
-        exclude(tabstractprocdef(result).procoptions,po_far);
+      handle_procdef_copyas(self,is_far,copytyp,tabstractprocdef(result));
     end;
     end;