Browse Source

* refactored tcgtypeconvnode.second_ansistring_to_pchar to use the high level
code generator and work in all i8086 memory models. Removed the i8086-specific
overriden version.

git-svn-id: trunk@27278 -

nickysn 11 years ago
parent
commit
a9f56d2714
2 changed files with 6 additions and 31 deletions
  1. 0 25
      compiler/i8086/n8086cnv.pas
  2. 6 6
      compiler/ncgcnv.pas

+ 0 - 25
compiler/i8086/n8086cnv.pas

@@ -33,7 +33,6 @@ interface
        protected
        protected
          procedure second_proc_to_procvar;override;
          procedure second_proc_to_procvar;override;
          procedure second_nil_to_methodprocvar;override;
          procedure second_nil_to_methodprocvar;override;
-         procedure second_ansistring_to_pchar;override;
        end;
        end;
 
 
 
 
@@ -162,30 +161,6 @@ implementation
       end;
       end;
 
 
 
 
-    procedure t8086typeconvnode.second_ansistring_to_pchar;
-      var
-        l1 : tasmlabel;
-        hr : treference;
-      begin
-        if current_settings.x86memorymodel in x86_far_data_models then
-          begin
-            location_reset(location,LOC_REGISTER,OS_32);
-            current_asmdata.getjumplabel(l1);
-            location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
-            cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_32,
-              left.location,location.register);
-            cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_32,OC_NE,0,location.register,l1);
-            { FPC_EMPTYCHAR is a widechar -> 2 bytes }
-            reference_reset(hr,2);
-            hr.symbol:=current_asmdata.RefAsmSymbol('FPC_EMPTYCHAR');
-            cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register);
-            cg.a_label(current_asmdata.CurrAsmList,l1);
-          end
-        else
-          inherited;
-      end;
-
-
 begin
 begin
   ctypeconvnode:=t8086typeconvnode
   ctypeconvnode:=t8086typeconvnode
 end.
 end.

+ 6 - 6
compiler/ncgcnv.pas

@@ -658,17 +658,17 @@ interface
          l1 : tasmlabel;
          l1 : tasmlabel;
          hr : treference;
          hr : treference;
       begin
       begin
-         location_reset(location,LOC_REGISTER,OS_ADDR);
+         location_reset(location,LOC_REGISTER,def_cgsize(resultdef));
          current_asmdata.getjumplabel(l1);
          current_asmdata.getjumplabel(l1);
-         location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
-         cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_ADDR,
+         location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,resultdef);
+         hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,left.resultdef,resultdef,
            left.location,location.register);
            left.location,location.register);
-         cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_NE,0,location.register,l1);
+         hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,resultdef,OC_NE,0,location.register,l1);
          { FPC_EMPTYCHAR is a widechar -> 2 bytes }
          { FPC_EMPTYCHAR is a widechar -> 2 bytes }
          reference_reset(hr,2);
          reference_reset(hr,2);
          hr.symbol:=current_asmdata.RefAsmSymbol('FPC_EMPTYCHAR');
          hr.symbol:=current_asmdata.RefAsmSymbol('FPC_EMPTYCHAR');
-         cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register);
-         cg.a_label(current_asmdata.CurrAsmList,l1);
+         hlcg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.resultdef,resultdef,hr,location.register);
+         hlcg.a_label(current_asmdata.CurrAsmList,l1);
       end;
       end;