Parcourir la source

* 8086: More fixes for Ofs() handling.

git-svn-id: trunk@46478 -
yury il y a 5 ans
Parent
commit
e4b717c817
2 fichiers modifiés avec 26 ajouts et 16 suppressions
  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
               internalerror(2018040401);
             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
         else if (tcnf_proc_2_procvar_2_voidpointer in convnodeflags) and
                 (current_settings.x86memorymodel in x86_far_code_models) then
@@ -82,10 +79,7 @@ implementation
             if resultdef.typ<>procvardef then
               internalerror(2018040402);
             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;
 

+ 24 - 8
compiler/i8086/symcpu.pas

@@ -271,6 +271,28 @@ implementation
       result:=(p.typ=pointerdef) and (tcpupointerdef(p).x86pointertyp=x86pt_huge);
     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
 ****************************************************************************}
@@ -337,10 +359,7 @@ implementation
   function tcpuprocdef.getcopyas(newtyp:tdeftyp;copytyp:tproccopytyp;const paraprefix:string):tstoreddef;
     begin
       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;
 
 
@@ -431,10 +450,7 @@ implementation
   function tcpuprocvardef.getcopyas(newtyp:tdeftyp;copytyp:tproccopytyp;const paraprefix:string):tstoreddef;
     begin
       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;