Forráskód Böngészése

* fixed sparc compiler compilation

florian 22 éve
szülő
commit
89c93b12c4

+ 4 - 6
compiler/ncgset.pas

@@ -77,8 +77,6 @@ interface
           procedure genlinearlist(hp : pcaserecord); virtual;
           procedure genlinearcmplist(hp : pcaserecord); virtual;
           procedure gentreejmp(p : pcaserecord);
-
-
        end;
 
 
@@ -1116,8 +1114,6 @@ implementation
       end;
 
 
-
-
 begin
    csetelementnode:=tcgsetelementnode;
    cinnode:=tcginnode;
@@ -1125,7 +1121,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.34  2003-05-23 19:52:28  jonas
+  Revision 1.35  2003-05-23 21:10:50  florian
+    * fixed sparc compiler compilation
+
+  Revision 1.34  2003/05/23 19:52:28  jonas
     * corrected fix for endian differences in tcginnode
 
   Revision 1.33  2003/05/17 19:17:35  jonas
@@ -1269,4 +1268,3 @@ end.
 
 }
 
-

+ 5 - 2
compiler/sparc/cpubase.pas

@@ -254,7 +254,7 @@ const
   NR_ASR31=$4000;
 {Floating point status/"front of queue" registers}
   NR_FSR=$5000;
-  NR_FQ=$50001;
+  NR_FQ=$5001; { was $50001, probably typo (FK) }
   NR_CSR=$5000;
   NR_CQ=$5000;
   NR_PSR=$5000;
@@ -678,7 +678,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.31  2003-05-22 16:11:22  florian
+  Revision 1.32  2003-05-23 21:10:50  florian
+    * fixed sparc compiler compilation
+
+  Revision 1.31  2003/05/22 16:11:22  florian
     * fixed sparc compilation partially
 
   Revision 1.30  2003/05/06 14:58:46  mazen

+ 4 - 7
compiler/sparc/cputarg.pas

@@ -39,15 +39,9 @@ implementation
     {$ifndef NOTARGETLINUX}
       ,t_linux
     {$endif}
-    {$ifndef NOTARGETFREEBSD}
-      ,t_fbsd
-    {$endif}
     {$ifndef NOTARGETSUNOS}
       ,t_sunos
     {$endif}
-    {$ifndef NOTARGETBEOS}
-      ,t_beos
-    {$endif}
 
 {**************************************
              Assemblers
@@ -61,7 +55,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.2  2002-09-07 15:25:14  peter
+  Revision 1.3  2003-05-23 21:10:50  florian
+    * fixed sparc compiler compilation
+
+  Revision 1.2  2002/09/07 15:25:14  peter
     * old logs removed and tabs fixed
 
   Revision 1.1  2002/08/22 08:30:50  mazen

+ 224 - 214
compiler/sparc/radirect.pas

@@ -70,6 +70,7 @@ interface
          srsym,sym : tsym;
          srsymtable : tsymtable;
          code : TAAsmoutput;
+         framereg : tregister;
          i,l : longint;
 
        procedure writeasmline;
@@ -95,232 +96,238 @@ interface
        if assigned(current_procdef.funcretsym) and
           is_fpu(current_procdef.rettype.def) then
          tvarsym(current_procdef.funcretsym).varstate:=vs_assigned;
+       framereg:=current_procinfo.framepointer;
+       convert_register_to_enum(framereg);
        if (not is_void(current_procdef.rettype.def)) then
-         retstr:=upper(tostr(current_procinfo.return_offset)+'('+std_reg2str[current_procinfo.framepointer.enum]+')')
+         retstr:=upper(tostr(current_procinfo.return_offset)+'('+std_reg2str[framereg.enum]+')')
        else
          retstr:='';
-         c:=current_scanner.asmgetchar;
-         code:=TAAsmoutput.Create;
-         while not(ende) do
-           begin
-              { wrong placement
-              current_scanner.gettokenpos; }
-              case c of
-                 'A'..'Z','a'..'z','_' : begin
-                      current_scanner.gettokenpos;
-                      i:=0;
-                      hs:='';
-                      while ((ord(c)>=ord('A')) and (ord(c)<=ord('Z')))
-                         or ((ord(c)>=ord('a')) and (ord(c)<=ord('z')))
-                         or ((ord(c)>=ord('0')) and (ord(c)<=ord('9')))
-                         or (c='_') do
-                        begin
-                           inc(i);
-                           hs[i]:=c;
-                           c:=current_scanner.asmgetchar;
-                        end;
-                      hs[0]:=chr(i);
-                      if upper(hs)='END' then
-                         ende:=true
-                      else
-                         begin
-                            if c=':' then
-                              begin
-                                searchsym(upper(hs),srsym,srsymtable);
-                                if srsym<>nil then
-                                  if (srsym.typ = labelsym) then
-                                    Begin
-                                       hs:=tlabelsym(srsym).lab.name;
-                                       tlabelsym(srsym).lab.is_set:=true;
-                                    end
-                                  else
-                                    Message(asmr_w_using_defined_as_local);
-                              end
-                            else
-                            { access to local variables }
-                            if assigned(current_procdef) then
-                              begin
-                                 { is the last written character an special }
-                                 { char ?                                   }
-                                 if (s[length(s)]='%') and
-                                    (not paramanager.ret_in_param(current_procdef.rettype.def,current_procdef.proccalloption)) and
-                                    ((pos('AX',upper(hs))>0) or
-                                    (pos('AL',upper(hs))>0)) then
-                                   tvarsym(current_procdef.funcretsym).varstate:=vs_assigned;
-                                 if (s[length(s)]<>'%') and
-                                   (s[length(s)]<>'$') and
-                                   ((s[length(s)]<>'0') or (hs[1]<>'x')) then
-                                   begin
-                                      if assigned(current_procdef.localst) and
-                                         (current_procdef.localst.symtablelevel >= normal_function_level) then
-                                        sym:=tsym(current_procdef.localst.search(upper(hs)))
-                                      else
-                                        sym:=nil;
-                                      if assigned(sym) then
-                                        begin
-                                           if (sym.typ = labelsym) then
-                                             Begin
-                                                hs:=tlabelsym(sym).lab.name;
-                                             end
-                                           else if sym.typ=varsym then
-                                             begin
-                                             {variables set are after a comma }
-                                             {like in movl %eax,I }
-                                             if pos(',',s) > 0 then
-                                               tvarsym(sym).varstate:=vs_used
-                                             else
-                                             if (pos('MOV',upper(s)) > 0) and (tvarsym(sym).varstate=vs_declared) then
-                                              Message1(sym_n_uninitialized_local_variable,hs);
-                                             if (vo_is_external in tvarsym(sym).varoptions) then
-                                               hs:=tvarsym(sym).mangledname
-                                             else
-                                               hs:='-'+tostr(tvarsym(sym).address)+
-                                                   '('+std_reg2str[current_procinfo.framepointer.enum]+')';
-                                             end
-                                           else
-                                           { call to local function }
-                                           if (sym.typ=procsym) and ((pos('CALL',upper(s))>0) or
-                                              (pos('LEA',upper(s))>0)) then
-                                             begin
-                                                hs:=tprocsym(sym).first_procdef.mangledname;
-                                             end;
-                                        end
-                                      else
+
+
+       c:=current_scanner.asmgetchar;
+       code:=TAAsmoutput.Create;
+       while not(ende) do
+         begin
+            { wrong placement
+            current_scanner.gettokenpos; }
+            case c of
+               'A'..'Z','a'..'z','_':
+                 begin
+                    current_scanner.gettokenpos;
+                    i:=0;
+                    hs:='';
+                    while ((ord(c)>=ord('A')) and (ord(c)<=ord('Z')))
+                       or ((ord(c)>=ord('a')) and (ord(c)<=ord('z')))
+                       or ((ord(c)>=ord('0')) and (ord(c)<=ord('9')))
+                       or (c='_') do
+                      begin
+                         inc(i);
+                         hs[i]:=c;
+                         c:=current_scanner.asmgetchar;
+                      end;
+                    hs[0]:=chr(i);
+                    if upper(hs)='END' then
+                      ende:=true
+                    else
+                      begin
+                         if c=':' then
+                           begin
+                             searchsym(upper(hs),srsym,srsymtable);
+                             if srsym<>nil then
+                               if (srsym.typ = labelsym) then
+                                 begin
+                                    hs:=tlabelsym(srsym).lab.name;
+                                    tlabelsym(srsym).lab.is_set:=true;
+                                 end
+                               else
+                                 Message(asmr_w_using_defined_as_local);
+                           end
+                         else
+                         { access to local variables }
+                         if assigned(current_procdef) then
+                           begin
+                              { is the last written character an special }
+                              { char ?                                   }
+                              if (s[length(s)]='%') and
+                                 (not paramanager.ret_in_param(current_procdef.rettype.def,current_procdef.proccalloption)) and
+                                 ((pos('AX',upper(hs))>0) or
+                                 (pos('AL',upper(hs))>0)) then
+                                tvarsym(current_procdef.funcretsym).varstate:=vs_assigned;
+                              if (s[length(s)]<>'%') and
+                                (s[length(s)]<>'$') and
+                                ((s[length(s)]<>'0') or (hs[1]<>'x')) then
+                                begin
+                                   if assigned(current_procdef.localst) and
+                                      (current_procdef.localst.symtablelevel >= normal_function_level) then
+                                     sym:=tsym(current_procdef.localst.search(upper(hs)))
+                                   else
+                                     sym:=nil;
+                                   if assigned(sym) then
+                                     begin
+                                        if (sym.typ = labelsym) then
+                                          Begin
+                                             hs:=tlabelsym(sym).lab.name;
+                                          end
+                                        else if sym.typ=varsym then
+                                          begin
+                                          {variables set are after a comma }
+                                          {like in movl %eax,I }
+                                          if pos(',',s) > 0 then
+                                            tvarsym(sym).varstate:=vs_used
+                                          else
+                                          if (pos('MOV',upper(s)) > 0) and (tvarsym(sym).varstate=vs_declared) then
+                                           Message1(sym_n_uninitialized_local_variable,hs);
+                                          if (vo_is_external in tvarsym(sym).varoptions) then
+                                            hs:=tvarsym(sym).mangledname
+                                          else
+                                            hs:='-'+tostr(tvarsym(sym).address)+
+                                                '('+std_reg2str[current_procinfo.framepointer.enum]+')';
+                                          end
+                                        else
+                                        { call to local function }
+                                        if (sym.typ=procsym) and ((pos('CALL',upper(s))>0) or
+                                           (pos('LEA',upper(s))>0)) then
+                                          begin
+                                             hs:=tprocsym(sym).first_procdef.mangledname;
+                                          end;
+                                     end
+                                   else
+                                     begin
+                                        if assigned(current_procdef.parast) then
+                                          sym:=tsym(current_procdef.parast.search(upper(hs)))
+                                        else
+                                          sym:=nil;
+                                        if assigned(sym) then
+                                          begin
+                                             if sym.typ=varsym then
+                                               begin
+                                                  l:=tvarsym(sym).address;
+                                                  { set offset }
+                                                  inc(l,current_procdef.parast.address_fixup);
+                                                  hs:=tostr(l)+'('+std_reg2str[current_procinfo.framepointer.enum]+')';
+                                                  if pos(',',s) > 0 then
+                                                    tvarsym(sym).varstate:=vs_used;
+                                               end;
+                                          end
+                                     end
+                                end
+                              else
+                                begin
+                                   uhs:=upper(hs);
+                                   if (uhs='__SELF') then
+                                     begin
+                                       if assigned(current_procdef._class) then
+                                        uhs:='self'
+                                       else
                                         begin
-                                           if assigned(current_procdef.parast) then
-                                             sym:=tsym(current_procdef.parast.search(upper(hs)))
-                                           else
-                                             sym:=nil;
-                                           if assigned(sym) then
-                                             begin
-                                                if sym.typ=varsym then
-                                                  begin
-                                                     l:=tvarsym(sym).address;
-                                                     { set offset }
-                                                     inc(l,current_procdef.parast.address_fixup);
-                                                     hs:=tostr(l)+'('+std_reg2str[current_procinfo.framepointer.enum]+')';
-                                                     if pos(',',s) > 0 then
-                                                       tvarsym(sym).varstate:=vs_used;
-                                                  end;
-                                             end
-                                        end
-                                   end
-                                 else
-                                   begin
-                                      uhs:=upper(hs);
-                                      if (uhs='__SELF') then
+                                          Message(asmr_e_cannot_use_SELF_outside_a_method);
+                                          uhs:='';
+                                        end;
+                                     end
+                                   else
+                                    if (uhs='__OLDEBP') then
+                                      begin
+                                        if current_procdef.parast.symtablelevel>normal_function_level then
+                                         uhs:='parentframe'
+                                        else
+                                         begin
+                                           Message(asmr_e_cannot_use_OLDEBP_outside_nested_procedure);
+                                           uhs:='';
+                                         end;
+                                      end
+                                    else
+                                      if uhs='__RESULT' then
                                         begin
-                                          if assigned(current_procdef._class) then
-                                           uhs:='self'
+                                          if (not is_void(current_procdef.rettype.def)) then
+                                           uhs:='result'
                                           else
                                            begin
-                                             Message(asmr_e_cannot_use_SELF_outside_a_method);
+                                             Message(asmr_e_void_function);
                                              uhs:='';
                                            end;
-                                        end
-                                      else
-                                       if (uhs='__OLDEBP') then
-                                         begin
-                                           if current_procdef.parast.symtablelevel>normal_function_level then
-                                            uhs:='parentframe'
-                                           else
+                                        end;
+
+                                    if uhs<>'' then
+                                      searchsym(upper(hs),sym,srsymtable)
+                                    else
+                                      sym:=nil;
+
+                                    if assigned(sym) then
+                                      begin
+                                        case sym.owner.symtabletype of
+                                          globalsymtable,
+                                          staticsymtable :
                                             begin
-                                              Message(asmr_e_cannot_use_OLDEBP_outside_nested_procedure);
-                                              uhs:='';
-                                            end;
-                                         end
-                                       else
-                                         if uhs='__RESULT' then
-                                           begin
-                                             if (not is_void(current_procdef.rettype.def)) then
-                                              uhs:='result'
-                                             else
-                                              begin
-                                                Message(asmr_e_void_function);
-                                                uhs:='';
+                                              case sym.typ of
+                                                varsym :
+                                                  begin
+                                                    Message2(asmr_h_direct_global_to_mangled,hs,tvarsym(sym).mangledname);
+                                                    hs:=tvarsym(sym).mangledname;
+                                                    inc(tvarsym(sym).refs);
+                                                  end;
+                                                typedconstsym :
+                                                  begin
+                                                    Message2(asmr_h_direct_global_to_mangled,hs,ttypedconstsym(sym).mangledname);
+                                                    hs:=ttypedconstsym(sym).mangledname;
+                                                  end;
+                                                procsym :
+                                                  begin
+                                                    { procs can be called or the address can be loaded }
+                                                    if ((pos('CALL',upper(s))>0) or (pos('LEA',upper(s))>0)) then
+                                                     begin
+                                                       if tprocsym(sym).procdef_count>1 then
+                                                         Message1(asmr_w_direct_global_is_overloaded_func,hs);
+                                                       Message2(asmr_h_direct_global_to_mangled,hs,tprocsym(sym).first_procdef.mangledname);
+                                                       hs:=tprocsym(sym).first_procdef.mangledname;
+                                                     end;
+                                                  end;
+                                                else
+                                                  Message(asmr_e_wrong_sym_type);
                                               end;
-                                           end;
-
-                                       if uhs<>'' then
-                                         searchsym(upper(hs),sym,srsymtable)
-                                       else
-                                         sym:=nil;
-
-                                         if assigned(sym) then
-                                           begin
-                                             case sym.owner.symtabletype of
-                                               globalsymtable,
-                                               staticsymtable :
-                                                 begin
-                                                   case sym.typ of
-                                                     varsym :
-                                                       begin
-                                                         Message2(asmr_h_direct_global_to_mangled,hs,tvarsym(sym).mangledname);
-                                                         hs:=tvarsym(sym).mangledname;
-                                                         inc(tvarsym(sym).refs);
-                                                       end;
-                                                     typedconstsym :
-                                                       begin
-                                                         Message2(asmr_h_direct_global_to_mangled,hs,ttypedconstsym(sym).mangledname);
-                                                         hs:=ttypedconstsym(sym).mangledname;
-                                                       end;
-                                                     procsym :
-                                                       begin
-                                                         { procs can be called or the address can be loaded }
-                                                         if ((pos('CALL',upper(s))>0) or (pos('LEA',upper(s))>0)) then
-                                                          begin
-                                                            if tprocsym(sym).procdef_count>1 then
-                                                              Message1(asmr_w_direct_global_is_overloaded_func,hs);
-                                                            Message2(asmr_h_direct_global_to_mangled,hs,tprocsym(sym).first_procdef.mangledname);
-                                                            hs:=tprocsym(sym).first_procdef.mangledname;
-                                                          end;
-                                                       end;
-                                                     else
-                                                       Message(asmr_e_wrong_sym_type);
-                                                   end;
-                                                 end;
-                                               parasymtable,
-                                               localsymtable :
-                                                 begin
-                                                   case sym.typ of
-                                                     varsym :
-                                                       begin
-                                                         hs:=tostr(tvarsym(sym).adjusted_address)+
-                                                             '('+std_reg2str[framereg.enum]+')';
-                                                         inc(tvarsym(sym).refs);
-                                                       end;
-                                                     typedconstsym :
-                                                       begin
-                                                         Message2(asmr_h_direct_global_to_mangled,hs,ttypedconstsym(sym).mangledname);
-                                                         hs:=ttypedconstsym(sym).mangledname;
-                                                       end;
-                                                     else
-                                                       Message(asmr_e_wrong_sym_type);
-                                                   end;
-                                                 end;
+                                            end;
+                                          parasymtable,
+                                          localsymtable :
+                                            begin
+                                              case sym.typ of
+                                                varsym :
+                                                  begin
+                                                    hs:=tostr(tvarsym(sym).adjusted_address)+
+                                                        '('+std_reg2str[framereg.enum]+')';
+                                                    inc(tvarsym(sym).refs);
+                                                  end;
+                                                typedconstsym :
+                                                  begin
+                                                    Message2(asmr_h_direct_global_to_mangled,hs,ttypedconstsym(sym).mangledname);
+                                                    hs:=ttypedconstsym(sym).mangledname;
+                                                  end;
+                                                else
+                                                  Message(asmr_e_wrong_sym_type);
                                               end;
-                                           end;
+                                            end;
+                                        end;
                                       end;
-                                   end;
-                              end;
-                            s:=s+hs;
-                         end;
-                   end;
- '{',';',#10,#13 : begin
-                      if pos(retstr,s) > 0 then
-                        tvarsym(current_procdef.funcretsym).varstate:=vs_assigned;
-                     writeasmline;
-                     c:=current_scanner.asmgetchar;
-                   end;
-             #26 : Message(scan_f_end_of_file);
-             else
-               begin
-                 current_scanner.gettokenpos;
-                 inc(byte(s[0]));
-                 s[length(s)]:=c;
-                 c:=current_scanner.asmgetchar;
-               end;
-           end;
+                                end;
+                           end;
+                         s:=s+hs;
+                      end;
+                 end;
+               '{',';',#10,#13:
+                 begin
+                    if pos(retstr,s) > 0 then
+                      tvarsym(current_procdef.funcretsym).varstate:=vs_assigned;
+                    writeasmline;
+                    c:=current_scanner.asmgetchar;
+                 end;
+               #26:
+                 Message(scan_f_end_of_file);
+               else
+                 begin
+                   current_scanner.gettokenpos;
+                   inc(byte(s[0]));
+                   s[length(s)]:=c;
+                   c:=current_scanner.asmgetchar;
+                 end;
+             end;
          end;
        writeasmline;
        assemble:=casmnode.create(code);
@@ -343,7 +350,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.8  2003-05-22 16:11:22  florian
+  Revision 1.9  2003-05-23 21:10:50  florian
+    * fixed sparc compiler compilation
+
+  Revision 1.8  2003/05/22 16:11:22  florian
     * fixed sparc compilation partially
 
   Revision 1.7  2003/04/27 11:21:36  peter

+ 10 - 7
compiler/sparc/registers.inc

@@ -1,10 +1,10 @@
 {******************************************************************************
   $Id$
-  Author                 : Mazen NEIFER                                       
-  Project                : Free Pascal Compiler (FPC)                         
-  Creation date          : 2003\04\29                                         
-  Licence                : GPL                                                
-  Bug report             : [email protected]                        
+  Author                 : Mazen NEIFER
+  Project                : Free Pascal Compiler (FPC)
+  Creation date          : 2003\04\29
+  Licence                : GPL
+  Bug report             : [email protected]
 ******************************************************************************}
 (enum:R_NONE;number:NR_NONE)
 {General purpose global registers}
@@ -49,11 +49,14 @@ implementation according to the Assembler Refernce Manual.(MN)}
 ,(enum:R_ASR24;number:NR_ASR24),(enum:R_ASR25;number:NR_ASR25),(enum:R_ASR26;number:NR_ASR26),(enum:R_ASR27;number:NR_ASR27),(enum:R_ASR28;number:NR_ASR28),(enum:R_ASR29;number:NR_ASR29),(enum:R_ASR30;number:NR_ASR30),(enum:R_ASR31;number:NR_ASR31)
 {The following registers are just used with the new register allocator}
 ,(enum:R_INTREGISTER;number:NR_NONE),(enum:R_FLOATREGISTER;number:NR_NONE),(enum:R_MMXREGISTER;number:NR_NONE),(enum:R_KNIREGISTER;number:NR_NONE)
+
 {
   $Log$
-  Revision 1.4  2003-04-29 11:52:52  mazen
+  Revision 1.5  2003-05-23 21:10:50  florian
+    * fixed sparc compiler compilation
+
+  Revision 1.4  2003/04/29 11:52:52  mazen
   * signification of ths faile has changed.
   * It was used to declare the cpu registers physically available
   * Now, it is used to define the register allocators paris (enum,number)
-
 }