Browse Source

- removed unused code (replaced by processor independent code)

Jonas Maebe 24 years ago
parent
commit
170234049b
1 changed files with 4 additions and 614 deletions
  1. 4 614
      compiler/i386/n386flw.pas

+ 4 - 614
compiler/i386/n386flw.pas

@@ -30,39 +30,6 @@ interface
       node,nflw;
       node,nflw;
 
 
     type
     type
-(*
-       ti386whilerepeatnode = class(twhilerepeatnode)
-          procedure pass_2;override;
-       end;
-
-       ti386ifnode = class(tifnode)
-          procedure pass_2;override;
-       end;
-
-       ti386fornode = class(tfornode)
-          procedure pass_2;override;
-       end;
-
-       ti386exitnode = class(texitnode)
-          procedure pass_2;override;
-       end;
-
-       ti386breaknode = class(tbreaknode)
-          procedure pass_2;override;
-       end;
-
-       ti386continuenode = class(tcontinuenode)
-          procedure pass_2;override;
-       end;
-
-       ti386gotonode = class(tgotonode)
-          procedure pass_2;override;
-       end;
-
-       ti386labelnode = class(tlabelnode)
-          procedure pass_2;override;
-       end;
-*)
 
 
        ti386raisenode = class(traisenode)
        ti386raisenode = class(traisenode)
           procedure pass_2;override;
           procedure pass_2;override;
@@ -94,576 +61,6 @@ implementation
       pass_1,nld,ncon,
       pass_1,nld,ncon,
       cga,tgcpu,n386util,regvars;
       cga,tgcpu,n386util,regvars;
 
 
-(*
-
-   all implemented in ncgflw now (JM)
-
-{*****************************************************************************
-                         Second_While_RepeatN
-*****************************************************************************}
-
-    procedure ti386whilerepeatnode.pass_2;
-      var
-         lcont,lbreak,lloop,
-         oldclabel,oldblabel : tasmlabel;
-         otlabel,oflabel : tasmlabel;
-
-         //start_regvars_loaded,
-         //then_regvars_loaded: regvar_booleanarray;
-
-      begin
-         getlabel(lloop);
-         getlabel(lcont);
-         getlabel(lbreak);
-         { arrange continue and breaklabels: }
-         oldclabel:=aktcontinuelabel;
-         oldblabel:=aktbreaklabel;
-
-         load_all_regvars(exprasmlist);
-         { 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 nodetype=whilen then
-           emitjmp(C_None,lcont);
-
-         { align loop target }
-         exprasmList.concat(Tai_align.Create(aktalignment.loopalign));
-         emitlab(lloop);
-
-         aktcontinuelabel:=lcont;
-         aktbreaklabel:=lbreak;
-         cleartempgen;
-         if assigned(right) then
-           secondpass(right);
-
-         load_all_regvars(exprasmlist);
-
-         emitlab(lcont);
-         otlabel:=truelabel;
-         oflabel:=falselabel;
-         if nodetype=whilen then
-          begin
-            truelabel:=lloop;
-            falselabel:=lbreak;
-          end
-         { repeatn }
-         else
-          begin
-            truelabel:=lbreak;
-            falselabel:=lloop;
-          end;
-         cleartempgen;
-         secondpass(left);
-
-         load_all_regvars(exprasmlist);
-
-         maketojumpbool(left);
-         emitlab(lbreak);
-         truelabel:=otlabel;
-         falselabel:=oflabel;
-
-
-         aktcontinuelabel:=oldclabel;
-         aktbreaklabel:=oldblabel;
-         { a break/continue in a while/repeat block can't be seen outside }
-         flowcontrol:=flowcontrol-[fc_break,fc_continue];
-      end;
-
-
-{*****************************************************************************
-                               TI386IFNODE
-*****************************************************************************}
-
-    procedure ti386ifnode.pass_2;
-
-      var
-         hl,otlabel,oflabel : tasmlabel;
-
-      begin
-         otlabel:=truelabel;
-         oflabel:=falselabel;
-         getlabel(truelabel);
-         getlabel(falselabel);
-         cleartempgen;
-         secondpass(left);
-         load_all_regvars(exprasmlist);
-         maketojumpbool(left);
-         if assigned(right) then
-           begin
-              emitlab(truelabel);
-              cleartempgen;
-              secondpass(right);
-              { automatically done for blocks, but not for statements (JM) }
-              load_all_regvars(exprasmlist);
-           end;
-         if assigned(t1) then
-           begin
-              if assigned(right) then
-                begin
-                   getlabel(hl);
-                   { do go back to if line !! }
-                   aktfilepos:=exprasmList.getlasttaifilepos^;
-                   emitjmp(C_None,hl);
-                end;
-              emitlab(falselabel);
-              cleartempgen;
-              secondpass(t1);
-              load_all_regvars(exprasmlist);
-              if assigned(right) then
-                emitlab(hl);
-           end
-         else
-           begin
-              emitlab(falselabel);
-           end;
-         if not(assigned(right)) then
-           begin
-              emitlab(truelabel);
-           end;
-         truelabel:=otlabel;
-         falselabel:=oflabel;
-      end;
-
-
-{*****************************************************************************
-                              SecondFor
-*****************************************************************************}
-
-    procedure ti386fornode.pass_2;
-      var
-         l3,oldclabel,oldblabel : tasmlabel;
-         omitfirstcomp,temptovalue : boolean;
-         hs : byte;
-         temp1 : treference;
-         hop : tasmop;
-         hcond : tasmcond;
-         cmpreg,cmp32 : tregister;
-         opsize : topsize;
-         count_var_is_signed : boolean;
-
-      begin
-         oldclabel:=aktcontinuelabel;
-         oldblabel:=aktbreaklabel;
-         getlabel(aktcontinuelabel);
-         getlabel(aktbreaklabel);
-         getlabel(l3);
-
-         { could we spare the first comparison ? }
-         omitfirstcomp:=false;
-         if right.nodetype=ordconstn then
-           if tassignmentnode(left).right.nodetype=ordconstn then
-             omitfirstcomp:=((nf_backward in flags) and
-               (tordconstnode(tassignmentnode(left).right).value>=tordconstnode(right).value))
-               or (not(nf_backward in flags) and
-                  (tordconstnode(tassignmentnode(left).right).value<=tordconstnode(right).value));
-
-         { only calculate reference }
-         cleartempgen;
-         secondpass(t2);
-         hs:=t2.resulttype.def.size;
-         if t2.location.loc <> LOC_CREGISTER then
-           cmp32:=getregister32;
-         case hs of
-            1 : begin
-                   opsize:=S_B;
-                   if t2.location.loc <> LOC_CREGISTER then
-                     cmpreg:=reg32toreg8(cmp32);
-                end;
-            2 : begin
-                   opsize:=S_W;
-                   if t2.location.loc <> LOC_CREGISTER then
-                     cmpreg:=reg32toreg16(cmp32);
-                end;
-            4 : begin
-                   opsize:=S_L;
-                   if t2.location.loc <> LOC_CREGISTER then
-                     cmpreg:=cmp32;
-                end;
-         end;
-
-         { first set the to value
-           because the count var can be in the expression !! }
-         cleartempgen;
-         secondpass(right);
-         { calculate pointer value and check if changeable and if so }
-         { load into temporary variable                       }
-         if right.nodetype<>ordconstn then
-           begin
-              temp1.symbol:=nil;
-              gettempofsizereference(hs,temp1);
-              temptovalue:=true;
-              if (right.location.loc=LOC_REGISTER) or
-                 (right.location.loc=LOC_CREGISTER) then
-                begin
-                   emit_reg_ref(A_MOV,opsize,right.location.register,
-                      newreference(temp1));
-                 end
-              else
-                 concatcopy(right.location.reference,temp1,hs,false,false);
-           end
-         else
-           temptovalue:=false;
-
-         { produce start assignment }
-         cleartempgen;
-         secondpass(left);
-         count_var_is_signed:=is_signed(torddef(t2.resulttype.def));
-         if temptovalue then
-             begin
-              if t2.location.loc=LOC_CREGISTER then
-                begin
-                   emit_ref_reg(A_CMP,opsize,newreference(temp1),
-                     t2.location.register);
-                end
-              else
-                begin
-                   emit_ref_reg(A_MOV,opsize,newreference(t2.location.reference),
-                     cmpreg);
-                   emit_ref_reg(A_CMP,opsize,newreference(temp1),
-                     cmpreg);
-                   { temp register not necessary anymore currently (JM) }
-                   ungetregister32(cmp32);
-                end;
-           end
-         else
-             begin
-              if not(omitfirstcomp) then
-                begin
-                   if t2.location.loc=LOC_CREGISTER then
-                     emit_const_reg(A_CMP,opsize,tordconstnode(right).value,
-                       t2.location.register)
-                   else
-                     emit_const_ref(A_CMP,opsize,tordconstnode(right).value,
-                       newreference(t2.location.reference));
-                end;
-           end;
-         if nf_backward in flags then
-           if count_var_is_signed then
-             hcond:=C_L
-           else
-             hcond:=C_B
-         else
-           if count_var_is_signed then
-             hcond:=C_G
-           else
-             hcond:=C_A;
-
-         load_all_regvars(exprasmlist);
-
-         if not(omitfirstcomp) or temptovalue then
-           emitjmp(hcond,aktbreaklabel);
-
-         { align loop target }
-         exprasmList.concat(Tai_align.Create(aktalignment.loopalign));
-         emitlab(l3);
-
-         { help register must not be in instruction block }
-         cleartempgen;
-         if assigned(t1) then
-           begin
-             secondpass(t1);
-             load_all_regvars(exprasmlist);
-           end;
-
-         emitlab(aktcontinuelabel);
-
-         { makes no problems there }
-         cleartempgen;
-
-         if (t2.location.loc <> LOC_CREGISTER) then
-           begin
-             { demand help register again }
-             cmp32:=getregister32;
-             case hs of
-                1 : cmpreg:=reg32toreg8(cmp32);
-                2 : cmpreg:=reg32toreg16(cmp32);
-                4 : cmpreg:=cmp32;
-             end;
-           end;
-
-         { produce comparison and the corresponding }
-         { jump                              }
-         if temptovalue then
-           begin
-              if t2.location.loc=LOC_CREGISTER then
-                begin
-                   emit_ref_reg(A_CMP,opsize,newreference(temp1),
-                     t2.location.register);
-                end
-              else
-                begin
-                   emit_ref_reg(A_MOV,opsize,newreference(t2.location.reference),
-                     cmpreg);
-                   emit_ref_reg(A_CMP,opsize,newreference(temp1),
-                     cmpreg);
-                    end;
-           end
-         else
-           begin
-              if t2.location.loc=LOC_CREGISTER then
-                emit_const_reg(A_CMP,opsize,tordconstnode(right).value,
-                  t2.location.register)
-              else
-                 emit_const_ref(A_CMP,opsize,tordconstnode(right).value,
-                   newreference(t2.location.reference));
-           end;
-         if nf_backward in flags then
-           if count_var_is_signed then
-             hcond:=C_LE
-           else
-             hcond:=C_BE
-          else
-            if count_var_is_signed then
-              hcond:=C_GE
-            else
-              hcond:=C_AE;
-         load_all_regvars(exprasmlist);
-         emitjmp(hcond,aktbreaklabel);
-         { according to count direction DEC or INC... }
-         { must be after the test because of 0 to 255 for bytes !! }
-         if nf_backward in flags then
-           hop:=A_DEC
-         else
-           hop:=A_INC;
-
-         if t2.location.loc=LOC_CREGISTER then
-           emit_reg(hop,opsize,t2.location.register)
-         else
-           emit_ref(hop,opsize,newreference(t2.location.reference));
-         emitjmp(C_None,l3);
-
-         if (t2.location.loc <> LOC_CREGISTER) then
-           ungetregister32(cmp32);
-         if temptovalue then
-           ungetiftemp(temp1);
-
-         { this is the break label: }
-         emitlab(aktbreaklabel);
-
-         aktcontinuelabel:=oldclabel;
-         aktbreaklabel:=oldblabel;
-         { a break/continue in a for block can't be seen outside }
-         flowcontrol:=flowcontrol-[fc_break,fc_continue];
-      end;
-
-
-{*****************************************************************************
-                              SecondExitN
-*****************************************************************************}
-
-    procedure ti386exitnode.pass_2;
-
-      var
-         {op : tasmop;
-         s : topsize;}
-         otlabel,oflabel : tasmlabel;
-         r : preference;
-         is_mem,
-         allocated_eax,
-         allocated_edx: boolean;
-
-      procedure cleanleft;
-        begin
-          if is_mem then
-            begin
-              del_reference(left.location.reference);
-              ungetiftemp(left.location.reference);
-            end
-          else
-            begin
-              ungetregister(left.location.register);
-              if left.location.registerhigh <> R_NO then
-                ungetregister(left.location.registerhigh);
-            end;
-        end;
-
-      label
-         do_jmp;
-      begin
-         load_all_regvars(exprasmlist);
-         include(flowcontrol,fc_exit);
-         if assigned(left) then
-         if left.nodetype=assignn then
-           begin
-              { just do a normal assignment followed by exit }
-              secondpass(left);
-              emitjmp(C_None,aktexitlabel);
-           end
-         else
-           begin
-              allocated_eax := false;
-              allocated_edx := false;
-              otlabel:=truelabel;
-              oflabel:=falselabel;
-              getlabel(truelabel);
-              getlabel(falselabel);
-              secondpass(left);
-              case left.location.loc of
-                 LOC_FPU : goto do_jmp;
-                 LOC_MEM,
-           LOC_REFERENCE : is_mem:=true;
-           LOC_CREGISTER,
-            LOC_REGISTER : is_mem:=false;
-               LOC_FLAGS : begin
-                             exprasmlist.concat(tairegalloc.alloc(R_EAX));
-                             allocated_eax := true;
-                             emit_flag2reg(left.location.resflags,R_AL);
-                             goto do_jmp;
-                           end;
-                LOC_JUMP : begin
-                             exprasmlist.concat(tairegalloc.alloc(R_EAX));
-                             allocated_eax := true;
-                             emitlab(truelabel);
-                             emit_const_reg(A_MOV,S_B,1,R_AL);
-                             emitjmp(C_None,aktexit2label);
-                             emitlab(falselabel);
-                             emit_reg_reg(A_XOR,S_B,R_AL,R_AL);
-                             goto do_jmp;
-                           end;
-              else
-                internalerror(2001);
-              end;
-              case aktprocsym.definition.rettype.def.deftype of
-           pointerdef,
-           procvardef : begin
-                          cleanleft;
-                          exprasmlist.concat(tairegalloc.alloc(R_EAX));
-                          allocated_eax := true;
-                          if is_mem then
-                            emit_ref_reg(A_MOV,S_L,
-                              newreference(left.location.reference),R_EAX)
-                          else
-                            emit_reg_reg(A_MOV,S_L,
-                              left.location.register,R_EAX);
-                        end;
-             floatdef : begin
-                          cleanleft;
-                          if is_mem then
-                           floatload(tfloatdef(aktprocsym.definition.rettype.def).typ,left.location.reference);
-                        end;
-              { orddef,
-              enumdef : }
-              else
-              { it can be anything shorter than 4 bytes PM
-              this caused form bug 711 }
-                       begin
-                          cleanleft;
-                          exprasmlist.concat(tairegalloc.alloc(R_EAX));
-                          allocated_eax := true;
-                          case aktprocsym.definition.rettype.def.size of
-                           { it can be a qword/int64 too ... }
-                           8 : if is_mem then
-                                 begin
-                                    emit_ref_reg(A_MOV,S_L,
-                                      newreference(left.location.reference),R_EAX);
-                                    r:=newreference(left.location.reference);
-                                    inc(r^.offset,4);
-                                    exprasmlist.concat(tairegalloc.alloc(R_EDX));
-                                    allocated_edx := true;
-                                    emit_ref_reg(A_MOV,S_L,r,R_EDX);
-                                 end
-                               else
-                                 begin
-                                    emit_reg_reg(A_MOV,S_L,left.location.registerlow,R_EAX);
-                                    exprasmlist.concat(tairegalloc.alloc(R_EDX));
-                                    allocated_edx := true;
-                                    emit_reg_reg(A_MOV,S_L,left.location.registerhigh,R_EDX);
-                                 end;
-                          { if its 3 bytes only we can still
-                            copy one of garbage ! PM }
-                           4,3 : if is_mem then
-                                 emit_ref_reg(A_MOV,S_L,
-                                   newreference(left.location.reference),R_EAX)
-                               else
-                                 emit_reg_reg(A_MOV,S_L,left.location.register,R_EAX);
-                           2 : if is_mem then
-                                 emit_ref_reg(A_MOV,S_W,
-                                   newreference(left.location.reference),R_AX)
-                               else
-                                 emit_reg_reg(A_MOV,S_W,makereg16(left.location.register),R_AX);
-                           1 : if is_mem then
-                                 emit_ref_reg(A_MOV,S_B,
-                                   newreference(left.location.reference),R_AL)
-                               else
-                                 emit_reg_reg(A_MOV,S_B,makereg8(left.location.register),R_AL);
-                           else internalerror(605001);
-                          end;
-                        end;
-              end;
-do_jmp:
-              truelabel:=otlabel;
-              falselabel:=oflabel;
-              emitjmp(C_None,aktexit2label);
-              if allocated_eax then
-                exprasmlist.concat(tairegalloc.dealloc(R_EAX));
-              if allocated_edx then
-                exprasmlist.concat(tairegalloc.dealloc(R_EDX));
-           end
-         else
-            emitjmp(C_None,aktexitlabel);
-       end;
-
-
-{*****************************************************************************
-                              SecondBreakN
-*****************************************************************************}
-
-    procedure ti386breaknode.pass_2;
-      begin
-         include(flowcontrol,fc_break);
-         if aktbreaklabel<>nil then
-           begin
-             load_all_regvars(exprasmlist);
-             emitjmp(C_None,aktbreaklabel)
-           end
-         else
-           CGMessage(cg_e_break_not_allowed);
-      end;
-
-
-{*****************************************************************************
-                              SecondContinueN
-*****************************************************************************}
-
-    procedure ti386continuenode.pass_2;
-      begin
-         include(flowcontrol,fc_continue);
-         if aktcontinuelabel<>nil then
-           begin
-             load_all_regvars(exprasmlist);
-             emitjmp(C_None,aktcontinuelabel)
-           end
-         else
-           CGMessage(cg_e_continue_not_allowed);
-      end;
-
-
-{*****************************************************************************
-                             SecondGoto
-*****************************************************************************}
-
-    procedure ti386gotonode.pass_2;
-
-       begin
-         load_all_regvars(exprasmlist);
-         emitjmp(C_None,labelnr);
-       end;
-
-
-{*****************************************************************************
-                             SecondLabel
-*****************************************************************************}
-
-    procedure ti386labelnode.pass_2;
-      begin
-         load_all_regvars(exprasmlist);
-         emitlab(labelnr);
-         cleartempgen;
-         secondpass(left);
-      end;
-
-*)
-
-
 {*****************************************************************************
 {*****************************************************************************
                              SecondRaise
                              SecondRaise
 *****************************************************************************}
 *****************************************************************************}
@@ -1332,16 +729,6 @@ do_jmp:
 
 
 
 
 begin
 begin
-(*
-   cwhilerepeatnode:=ti386whilerepeatnode;
-   cifnode:=ti386ifnode;
-   cfornode:=ti386fornode;
-   cexitnode:=ti386exitnode;
-   cbreaknode:=ti386breaknode;
-   ccontinuenode:=ti386continuenode;
-   cgotonode:=ti386gotonode;
-   clabelnode:=ti386labelnode;
-*)
    craisenode:=ti386raisenode;
    craisenode:=ti386raisenode;
    ctryexceptnode:=ti386tryexceptnode;
    ctryexceptnode:=ti386tryexceptnode;
    ctryfinallynode:=ti386tryfinallynode;
    ctryfinallynode:=ti386tryfinallynode;
@@ -1350,7 +737,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2001-09-28 20:39:33  jonas
+  Revision 1.17  2001-09-29 21:34:04  jonas
+    - removed unused code (replaced by processor independent code)
+
+  Revision 1.16  2001/09/28 20:39:33  jonas
     * changed all flow control structures (except for exception handling
     * changed all flow control structures (except for exception handling
       related things) to processor independent code (in new ncgflw unit)
       related things) to processor independent code (in new ncgflw unit)
     + generic cgobj unit which contains lots of code generator helpers with
     + generic cgobj unit which contains lots of code generator helpers with