瀏覽代碼

* Notranslation changed into -sr functionality

daniel 22 年之前
父節點
當前提交
63e1b70931
共有 4 個文件被更改,包括 42 次插入48 次删除
  1. 7 7
      compiler/aasmtai.pas
  2. 10 10
      compiler/aggas.pas
  3. 21 26
      compiler/powerpc/agppcgas.pas
  4. 4 5
      compiler/regvars.pas

+ 7 - 7
compiler/aasmtai.pas

@@ -532,7 +532,7 @@ implementation
              internalerror(200208182);
            if not assigned(aiclass[t]) then
              internalerror(200208183);
-           //writeln('taiload: ',taitypestr[t]);
+           {writeln('taiload: ',taitypestr[t]);}
            { generate tai of the correct class }
            ppuloadai:=aiclass[t].ppuload(t,ppufile);
          end
@@ -549,7 +549,7 @@ implementation
          begin
            { type, read by ppuloadnode }
            ppufile.putbyte(byte(n.typ));
-           //writeln('taiwrite: ',taitypestr[n.typ]);
+           {writeln('taiwrite: ',taitypestr[n.typ]);}
            n.ppuwrite(ppufile);
          end
         else
@@ -1784,7 +1784,7 @@ implementation
     constructor taasmoutput.create;
       begin
         inherited create;
-        // make sure the optimizer won't remove the first tai of this list
+        { make sure the optimizer won't remove the first tai of this list}
         insert(tai_marker.create(marker_blockstart));
       end;
 
@@ -1860,9 +1860,6 @@ implementation
         r:Preference;
 
     begin
-{$ifdef notranslation}
-      exit;
-{$endif notranslation}  
       p:=Tai(first);
       while assigned(p) do
         begin
@@ -1902,7 +1899,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.32  2003-08-17 16:59:20  jonas
+  Revision 1.33  2003-08-17 20:47:47  daniel
+    * Notranslation changed into -sr functionality
+
+  Revision 1.32  2003/08/17 16:59:20  jonas
     * fixed regvars so they work with newra (at least for ppc)
     * fixed some volatile register bugs
     + -dnotranslation option for -dnewra, which causes the registers not to

+ 10 - 10
compiler/aggas.pas

@@ -387,15 +387,12 @@ var
              begin
                if (cs_asm_regalloc in aktglobalswitches) then
                  begin
-{$ifndef notranslation}
-                   if Tai_Regalloc(hp).reg.enum>lastreg then
-                     internalerror(200201081);
-                   AsmWriteLn(target_asm.comment+'Register '+std_reg2str[tai_regalloc(hp).reg.enum]+
-                     allocstr[tai_regalloc(hp).allocation]);
-{$else not notranslation}
-                   AsmWriteLn(target_asm.comment+'Register r'+tostr(ord(tai_regalloc(hp).reg.enum)-1)+
-                     allocstr[tai_regalloc(hp).allocation]);
-{$endif not notranslation}
+                   if Tai_Regalloc(hp).reg.enum=R_INTREGISTER then
+                     AsmWriteLn(target_asm.comment+'Register r'+tostr(byte(tai_regalloc(hp).reg.number shr 8)-1)+
+                       allocstr[tai_regalloc(hp).allocation])
+                   else
+                     AsmWriteLn(target_asm.comment+'Register '+std_reg2str[tai_regalloc(hp).reg.enum]+
+                       allocstr[tai_regalloc(hp).allocation]);
                  end;
              end;
 
@@ -825,7 +822,10 @@ var
 end.
 {
   $Log$
-  Revision 1.25  2003-08-17 16:59:20  jonas
+  Revision 1.26  2003-08-17 20:47:47  daniel
+    * Notranslation changed into -sr functionality
+
+  Revision 1.25  2003/08/17 16:59:20  jonas
     * fixed regvars so they work with newra (at least for ppc)
     * fixed some volatile register bugs
     + -dnotranslation option for -dnewra, which causes the registers not to

+ 21 - 26
compiler/powerpc/agppcgas.pas

@@ -146,6 +146,7 @@ unit agppcgas;
     function getreferencestring(var ref : treference) : string;
     var
       s : string;
+      i,b:boolean;
     begin
        with ref do
         begin
@@ -173,13 +174,9 @@ unit agppcgas;
            if (symaddr <> refs_full) then
              s := s+')'+symaddr2str[symaddr];
 
-{$ifndef notranslation}
-           if (index.enum < firstreg) or (index.enum > lastreg) then
-             internalerror(20030312);
-           if (base.enum < firstreg) or (base.enum > lastreg) then
-             internalerror(200303123);
-{$endif notranslation}
-           if (index.enum=R_NO) and (base.enum<>R_NO) then
+           b:=(base.enum=R_NO) or ((base.enum=R_INTREGISTER) and (base.number=NR_NO));
+           i:=(index.enum=R_NO) or ((index.enum=R_INTREGISTER) and (index.number=NR_NO));
+           if i and not b then
              begin
                 if offset=0 then
                   begin
@@ -188,20 +185,18 @@ unit agppcgas;
                      else
                        s:=s+'0';
                   end;
-{$ifndef notranslation}
-                s:=s+'('+gas_reg2str[base.enum]+')'
-{$else not notranslation}
-                s:=s+'(r'+tostr(ord(base.enum)-1)+')'
-{$endif notranslation}
+                if base.enum=R_INTREGISTER then
+                  s:=s+'(reg'+tostr(byte(base.number shr 8))+')'
+                else
+                  s:=s+'('+gas_reg2str[base.enum]+')';
              end
-           else if (index.enum<>R_NO) and (base.enum<>R_NO) and (offset=0) then
-{$ifndef notranslation}
-             s:=s+gas_reg2str[base.enum]+','+gas_reg2str[index.enum]
+           else if (not i) and (not b) and (offset=0) then
+             if base.enum=R_INTREGISTER then
+               s:=s+'r'+tostr(byte(base.number shr 8))+',r'+tostr(byte(index.number shr 8))
+             else
+               s:=s+gas_reg2str[base.enum]+','+gas_reg2str[index.enum]
            else if ((index.enum<>R_NO) or (base.enum<>R_NO)) then
              internalerror(19992);
-{$else not notranslation}
-             s:=s+'r'+tostr(ord(base.enum)-1)+',r'+tostr(ord(index.enum)-1);
-{$endif notranslation}
         end;
       getreferencestring:=s;
     end;
@@ -245,13 +240,10 @@ unit agppcgas;
       case o.typ of
         top_reg:
           begin
-{$ifndef notranslation}
-            if (o.reg.enum < R_0) or (o.reg.enum > lastreg) then
-              internalerror(200303125);
-            getopstr:=gas_reg2str[o.reg.enum];
-{$else not notranslation}
-            getopstr:='r'+tostr(ord(o.reg.enum)-1);
-{$endif not notranslation}
+            if  o.reg.enum=R_INTREGISTER then
+              getopstr:='reg'+tostr(byte(o.reg.number shr 8))
+            else
+              getopstr:=gas_reg2str[o.reg.enum];
           end;
         top_const:
           getopstr:=tostr(longint(o.val));
@@ -379,7 +371,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.24  2003-08-17 16:59:20  jonas
+  Revision 1.25  2003-08-17 20:47:47  daniel
+    * Notranslation changed into -sr functionality
+
+  Revision 1.24  2003/08/17 16:59:20  jonas
     * fixed regvars so they work with newra (at least for ppc)
     * fixed some volatile register bugs
     + -dnotranslation option for -dnewra, which causes the registers not to

+ 4 - 5
compiler/regvars.pas

@@ -629,12 +629,10 @@ implementation
                       reg.number:=(reg.number and not $ff) or cgsize2subreg(OS_INT);
                       r:=reg;
                       convert_register_to_enum(r);
-{$ifndef notranslation}
                       if r.enum>lastreg then
                         internalerror(200201081);
                       if (rg.regvar_loaded_other[r.enum]) then
                        asml.concat(tai_regalloc.dealloc(reg));
-{$endif notranslation}
                     end;
                 end;
              end;
@@ -666,7 +664,6 @@ implementation
         i: longint;
         r: tregister;
       begin
-{$ifndef notranslation}
         if not assigned(current_procinfo.procdef.regvarinfo) then
           exit;
         with pregvarinfo(current_procinfo.procdef.regvarinfo)^ do
@@ -686,7 +683,6 @@ implementation
                 Message3(cg_d_register_weight,std_reg2str[r.enum],
                   tostr(regvars[i].refs),regvars[i].name);
               end;
-{$endif notranslation}
       end;
 {$endif newra}
 
@@ -694,7 +690,10 @@ end.
 
 {
   $Log$
-  Revision 1.61  2003-08-17 16:59:20  jonas
+  Revision 1.62  2003-08-17 20:47:47  daniel
+    * Notranslation changed into -sr functionality
+
+  Revision 1.61  2003/08/17 16:59:20  jonas
     * fixed regvars so they work with newra (at least for ppc)
     * fixed some volatile register bugs
     + -dnotranslation option for -dnewra, which causes the registers not to