Selaa lähdekoodia

* converted non-exception-related nodes to thlcgobj

git-svn-id: branches/jvmbackend@18330 -
Jonas Maebe 14 vuotta sitten
vanhempi
commit
e9f1856a61
1 muutettua tiedostoa jossa 38 lisäystä ja 35 poistoa
  1. 38 35
      compiler/ncgflw.pas

+ 38 - 35
compiler/ncgflw.pas

@@ -98,7 +98,7 @@ implementation
       nld,ncon,
       tgobj,paramgr,
       regvars,
-      cgutils,cgobj
+      cgutils,cgobj,hlcgobj
       ;
 
 {*****************************************************************************
@@ -158,13 +158,13 @@ implementation
          { handling code at the end as it is much more efficient, and makes
            while equal to repeat loop, only the end true/false is swapped (PFV) }
          if lnf_testatbegin in loopflags then
-           cg.a_jmp_always(current_asmdata.CurrAsmList,lcont);
+           hlcg.a_jmp_always(current_asmdata.CurrAsmList,lcont);
 
          if not(cs_opt_size in current_settings.optimizerswitches) then
             { align loop target }
             current_asmdata.CurrAsmList.concat(Tai_align.Create(current_settings.alignment.loopalign));
 
-         cg.a_label(current_asmdata.CurrAsmList,lloop);
+         hlcg.a_label(current_asmdata.CurrAsmList,lloop);
 
          current_procinfo.CurrContinueLabel:=lcont;
          current_procinfo.CurrBreakLabel:=lbreak;
@@ -182,7 +182,7 @@ implementation
          load_all_regvars(current_asmdata.CurrAsmList);
 {$endif OLDREGVARS}
 
-         cg.a_label(current_asmdata.CurrAsmList,lcont);
+         hlcg.a_label(current_asmdata.CurrAsmList,lcont);
          otlabel:=current_procinfo.CurrTrueLabel;
          oflabel:=current_procinfo.CurrFalseLabel;
          if lnf_checknegate in loopflags then
@@ -197,8 +197,8 @@ implementation
           end;
          secondpass(left);
 
-         maketojumpbool(current_asmdata.CurrAsmList,left,lr_load_regvars);
-         cg.a_label(current_asmdata.CurrAsmList,lbreak);
+         hlcg.maketojumpbool(current_asmdata.CurrAsmList,left);
+         hlcg.a_label(current_asmdata.CurrAsmList,lbreak);
 
          sync_regvars(false);
 
@@ -254,7 +254,7 @@ implementation
              current_asmdata.CurrAsmList := TAsmList.create;
            end;
 *)
-         maketojumpbool(current_asmdata.CurrAsmList,left,lr_dont_load_regvars);
+         hlcg.maketojumpbool(current_asmdata.CurrAsmList,left);
 
 (*
          if cs_opt_regvar in current_settings.optimizerswitches then
@@ -271,7 +271,7 @@ implementation
 
          if assigned(right) then
            begin
-              cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel);
+              hlcg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel);
               secondpass(right);
            end;
 
@@ -304,9 +304,9 @@ implementation
                      current_filepos:=then_list.getlasttaifilepos^
 *)
                    ;
-                   cg.a_jmp_always(current_asmdata.CurrAsmList,hl);
+                   hlcg.a_jmp_always(current_asmdata.CurrAsmList,hl);
                 end;
-              cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel);
+              hlcg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel);
               secondpass(t1);
 (*
               { save current asmlist (previous instructions + else-block) }
@@ -320,7 +320,7 @@ implementation
                 end;
 *)
               if assigned(right) then
-                cg.a_label(current_asmdata.CurrAsmList,hl);
+                hlcg.a_label(current_asmdata.CurrAsmList,hl);
            end
          else
            begin
@@ -333,11 +333,11 @@ implementation
                   current_asmdata.CurrAsmList := TAsmList.create;
                 end;
 *)
-              cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel);
+              hlcg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel);
            end;
          if not(assigned(right)) then
            begin
-              cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel);
+              hlcg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel);
            end;
 
 (*
@@ -466,7 +466,7 @@ implementation
           end;
         secondpass(t1);
         if t1.location.loc in [LOC_FLAGS,LOC_JUMP] then
-          location_force_reg(current_asmdata.CurrAsmList,t1.location,def_cgsize(t1.resultdef),false);
+          hlcg.location_force_reg(current_asmdata.CurrAsmList,t1.location,t1.resultdef,t1.resultdef,false);
         if isjump then
           begin
             current_procinfo.CurrTrueLabel:=otl;
@@ -477,7 +477,7 @@ implementation
          if t1.nodetype<>ordconstn then
            begin
               do_loopvar_at_end:=false;
-              location_force_reg(current_asmdata.CurrAsmList,t1.location,t1.location.size,false);
+              hlcg.location_force_reg(current_asmdata.CurrAsmList,t1.location,t1.resultdef,t1.resultdef,false);
               temptovalue:=true;
            end
          else
@@ -500,7 +500,7 @@ implementation
            end;
          secondpass(right);
          if right.location.loc in [LOC_FLAGS,LOC_JUMP] then
-           location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(right.resultdef),false);
+           hlcg.location_force_reg(current_asmdata.CurrAsmList,right.location,right.resultdef,right.resultdef,false);
          if isjump then
            begin
              current_procinfo.CurrTrueLabel:=otl;
@@ -514,13 +514,16 @@ implementation
          case left.location.loc of
            LOC_REFERENCE,
            LOC_CREFERENCE :
-             cg.a_load_loc_ref(current_asmdata.CurrAsmList,left.location.size,right.location,left.location.reference);
+             hlcg.a_load_loc_ref(current_asmdata.CurrAsmList,right.resultdef,left.resultdef,right.location,left.location.reference);
            LOC_REGISTER,
            LOC_CREGISTER:
-             cg.a_load_loc_reg(current_asmdata.CurrAsmList,left.location.size,right.location,left.location.register);
+             hlcg.a_load_loc_reg(current_asmdata.CurrAsmList,right.resultdef,left.resultdef,right.location,left.location.register);
+{$ifndef cpuhighleveltarget}
+           { still have to figure out how to handle the subset sizes }
            LOC_SUBSETREG,
            LOC_CSUBSETREG :
              cg.a_load_loc_subsetreg(current_asmdata.CurrAsmList,left.location.size,right.location,left.location.sreg);
+{$endif}
            else
              internalerror(200501311);
          end;
@@ -543,14 +546,14 @@ implementation
 
          if temptovalue then
            begin
-             cg.a_cmp_reg_loc_label(current_asmdata.CurrAsmList,opsize,hcond,
+             hlcg.a_cmp_reg_loc_label(current_asmdata.CurrAsmList,left.resultdef,hcond,
                t1.location.register,left.location,current_procinfo.CurrBreakLabel);
            end
          else
            begin
              if lnf_testatbegin in loopflags then
                begin
-                 cg.a_cmp_const_loc_label(current_asmdata.CurrAsmList,opsize,hcond,
+                 hlcg.a_cmp_const_loc_label(current_asmdata.CurrAsmList,left.resultdef,hcond,
                    tordconstnode(t1).value.svalue,
                    left.location,current_procinfo.CurrBreakLabel);
                end;
@@ -565,16 +568,16 @@ implementation
                 hop:=OP_ADD
               else
                 hop:=OP_SUB;
-              cg.a_op_const_loc(current_asmdata.CurrAsmList,hop,1,left.location);
+              hlcg.a_op_const_loc(current_asmdata.CurrAsmList,hop,left.resultdef,1,left.location);
             end;
 
          if assigned(entrylabel) then
-           cg.a_jmp_always(current_asmdata.CurrAsmList,tcglabelnode(entrylabel).getasmlabel);
+           hlcg.a_jmp_always(current_asmdata.CurrAsmList,tcglabelnode(entrylabel).getasmlabel);
 
          { align loop target }
          if not(cs_opt_size in current_settings.optimizerswitches) then
             current_asmdata.CurrAsmList.concat(Tai_align.Create(current_settings.alignment.loopalign));
-         cg.a_label(current_asmdata.CurrAsmList,l3);
+         hlcg.a_label(current_asmdata.CurrAsmList,l3);
 
          {If the loopvar doesn't mind on exit, we avoid the loopvar inc/dec
           after the loop body instead of here.}
@@ -585,7 +588,7 @@ implementation
                 hop:=OP_SUB
               else
                 hop:=OP_ADD;
-              cg.a_op_const_loc(current_asmdata.CurrAsmList,hop,1,left.location);
+              hlcg.a_op_const_loc(current_asmdata.CurrAsmList,hop,left.resultdef,1,left.location);
             end;
 
          if assigned(t2) then
@@ -609,10 +612,10 @@ implementation
                 hop:=OP_SUB
               else
                 hop:=OP_ADD;
-              cg.a_op_const_loc(current_asmdata.CurrAsmList,hop,1,left.location);
+              hlcg.a_op_const_loc(current_asmdata.CurrAsmList,hop,left.resultdef,1,left.location);
             end;
 
-         cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrContinueLabel);
+         hlcg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrContinueLabel);
 
          if do_loopvar_at_end then
            if lnf_backward in loopflags then
@@ -644,7 +647,7 @@ implementation
          { jump                                     }
          if temptovalue then
            begin
-             cg.a_cmp_reg_loc_label(current_asmdata.CurrAsmList,opsize,hcond,t1.location.register,
+             hlcg.a_cmp_reg_loc_label(current_asmdata.CurrAsmList,left.resultdef,hcond,t1.location.register,
                left.location,l3);
            end
          else
@@ -812,12 +815,12 @@ implementation
                  end;
                end;
 
-             cg.a_cmp_const_loc_label(current_asmdata.CurrAsmList,opsize,hcond,
+             hlcg.a_cmp_const_loc_label(current_asmdata.CurrAsmList,left.resultdef,hcond,
                aint(cmp_const.svalue),left.location,l3);
            end;
 
          { this is the break label: }
-         cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrBreakLabel);
+         hlcg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrBreakLabel);
 
          sync_regvars(false);
 
@@ -840,7 +843,7 @@ implementation
          if assigned(left) then
            secondpass(left);
 
-         cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrExitLabel);
+         hlcg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrExitLabel);
        end;
 
 
@@ -858,7 +861,7 @@ implementation
 {$ifdef OLDREGVARS}
              load_all_regvars(current_asmdata.CurrAsmList);
 {$endif OLDREGVARS}
-             cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrBreakLabel)
+             hlcg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrBreakLabel)
            end
          else
            CGMessage(cg_e_break_not_allowed);
@@ -879,7 +882,7 @@ implementation
 {$ifdef OLDREGVARS}
              load_all_regvars(current_asmdata.CurrAsmList);
 {$endif OLDREGVARS}
-             cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrContinueLabel)
+             hlcg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrContinueLabel)
            end
          else
            CGMessage(cg_e_continue_not_allowed);
@@ -899,7 +902,7 @@ implementation
 {$ifdef OLDREGVARS}
          load_all_regvars(current_asmdata.CurrAsmList);
 {$endif OLDREGVARS}
-         cg.a_jmp_always(current_asmdata.CurrAsmList,tcglabelnode(labelnode).getasmlabel)
+         hlcg.a_jmp_always(current_asmdata.CurrAsmList,tcglabelnode(labelnode).getasmlabel)
        end;
 
 
@@ -929,13 +932,13 @@ implementation
 {$ifdef OLDREGVARS}
          load_all_regvars(current_asmdata.CurrAsmList);
 {$endif OLDREGVARS}
-         cg.a_label(current_asmdata.CurrAsmList,getasmlabel);
+         hlcg.a_label(current_asmdata.CurrAsmList,getasmlabel);
 
          { Write also extra label if this label was referenced from
            assembler block }
          if assigned(labsym) and
             assigned(labsym.asmblocklabel) then
-           cg.a_label(current_asmdata.CurrAsmList,labsym.asmblocklabel);
+           hlcg.a_label(current_asmdata.CurrAsmList,labsym.asmblocklabel);
 
          secondpass(left);
       end;