Browse Source

+ added i8086 specific implementation of Tcgtypeconvnode.second_nil_to_methodprocvar, which supports memory models with far code and/or far data

git-svn-id: trunk@25150 -
nickysn 12 years ago
parent
commit
f5a0702f9a
1 changed files with 27 additions and 0 deletions
  1. 27 0
      compiler/i8086/n8086cnv.pas

+ 27 - 0
compiler/i8086/n8086cnv.pas

@@ -32,6 +32,7 @@ interface
        t8086typeconvnode = class(tx86typeconvnode)
        protected
          procedure second_proc_to_procvar;override;
+         procedure second_nil_to_methodprocvar;override;
        end;
 
 
@@ -131,6 +132,32 @@ implementation
       end;
 
 
+    procedure t8086typeconvnode.second_nil_to_methodprocvar;
+      begin
+        location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
+        if current_settings.x86memorymodel in x86_far_data_models then
+          begin
+            location.registerhi:=cg.getintregister(current_asmdata.currasmlist,OS_32);
+            cg.a_load_const_reg(current_asmdata.currasmlist,OS_32,0,location.registerhi);
+          end
+        else
+          begin
+            location.registerhi:=cg.getaddressregister(current_asmdata.currasmlist);
+            cg.a_load_const_reg(current_asmdata.currasmlist,OS_ADDR,0,location.registerhi);
+          end;
+        if (resultdef.typ=procvardef) and (po_far in tprocvardef(resultdef).procoptions) then
+          begin
+            location.register:=cg.getintregister(current_asmdata.currasmlist,OS_32);
+            cg.a_load_const_reg(current_asmdata.currasmlist,OS_32,0,location.register);
+          end
+        else
+          begin
+            location.register:=cg.getaddressregister(current_asmdata.currasmlist);
+            cg.a_load_const_reg(current_asmdata.currasmlist,OS_ADDR,0,location.register);
+          end;
+      end;
+
+
 begin
   ctypeconvnode:=t8086typeconvnode
 end.