Browse Source

* merged ait_set and ait_thumb_set into a single tai class
(tai_symbolpair)

git-svn-id: trunk@30197 -

Jonas Maebe 10 years ago
parent
commit
8445381929
6 changed files with 29 additions and 49 deletions
  1. 19 33
      compiler/aasmtai.pas
  2. 6 9
      compiler/aggas.pas
  3. 1 1
      compiler/arm/raarmgas.pas
  4. 1 1
      compiler/avr/aasmcpu.pas
  5. 1 4
      compiler/psystem.pas
  6. 1 1
      compiler/raatt.pas

+ 19 - 33
compiler/aasmtai.pas

@@ -79,10 +79,7 @@ interface
 {$ifdef m68k}
           ait_labeled_instruction,
 {$endif m68k}
-{$ifdef arm}
-          ait_thumb_set,
-{$endif arm}
-          ait_set,
+          ait_symbolpair,
           ait_weak,
           { used to split into tiny assembler files }
           ait_cutobject,
@@ -196,10 +193,7 @@ interface
 {$ifdef m68k}
           'labeled_instr',
 {$endif m68k}
-{$ifdef arm}
-          'thumb_set',
-{$endif arm}
-          'set',
+          'symbolpair',
           'weak',
           'cut',
           'regalloc',
@@ -307,10 +301,7 @@ interface
                      ait_stab,ait_function_name,
                      ait_cutobject,ait_marker,ait_varloc,ait_align,ait_section,ait_comment,
                      ait_const,ait_directive,
-{$ifdef arm}
-                     ait_thumb_set,
-{$endif arm}
-                     ait_set,ait_weak,
+                     ait_symbolpair,ait_weak,
                      ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit,ait_real_128bit,
                      ait_symbol,
 {$ifdef JVM}
@@ -368,6 +359,8 @@ interface
           ash_savereg,ash_savexmm,ash_pushframe
         );
 
+      TSymbolPairKind = (spk_set, spk_thumb_set);
+
 
     const
       regallocstr : array[tregalloctype] of string[10]=('allocated','released','sync','resized','used');
@@ -399,6 +392,9 @@ interface
         '.seh_setframe','.seh_stackalloc','.seh_pushreg',
         '.seh_savereg','.seh_savexmm','.seh_pushframe'
       );
+      symbolpairkindstr: array[TSymbolPairKind] of string[11]=(
+        '.set', '.thumb_set'
+      );
 
     type
        { abstract assembler item }
@@ -863,21 +859,16 @@ interface
         tai_jcatch_class = class of tai_jcatch;
 {$endif JVM}
 
-        tai_set = class(tai)
+        tai_symbolpair = class(tai)
+          kind: TSymbolPairKind;
           sym,
           value: pshortstring;
-          constructor create(const asym, avalue: string);
+          constructor create(akind: TSymbolPairKind; const asym, avalue: string);
           destructor destroy;override;
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
         end;
 
-{$ifdef arm}
-        tai_thumb_set = class(tai_set)
-          constructor create(const asym, avalue: string);
-        end;
-{$endif arm}
-
         tai_weak = class(tai)
           sym: pshortstring;
           constructor create(const asym: string);
@@ -1023,39 +1014,34 @@ implementation
         ppufile.putstring(sym^);
       end;
 
-{$ifdef arm}
-    constructor tai_thumb_set.create(const asym, avalue: string);
-      begin
-        inherited create(asym, avalue);
-        typ:=ait_thumb_set;
-      end;
-{$endif arm}
-
-    constructor tai_set.create(const asym, avalue: string);
+    constructor tai_symbolpair.create(akind: TSymbolPairKind; const asym, avalue: string);
       begin
         inherited create;
-        typ:=ait_set;
+        kind:=akind;
+        typ:=ait_symbolpair;
         sym:=stringdup(asym);
         value:=stringdup(avalue);
       end;
 
-    destructor tai_set.destroy;
+    destructor tai_symbolpair.destroy;
       begin
         stringdispose(sym);
         stringdispose(value);
         inherited destroy;
       end;
 
-    constructor tai_set.ppuload(t: taitype; ppufile: tcompilerppufile);
+    constructor tai_symbolpair.ppuload(t: taitype; ppufile: tcompilerppufile);
       begin
         inherited ppuload(t,ppufile);
+        kind:=TSymbolPairKind(ppufile.getbyte);;
         sym:=stringdup(ppufile.getstring);
         value:=stringdup(ppufile.getstring);
       end;
 
-    procedure tai_set.ppuwrite(ppufile: tcompilerppufile);
+    procedure tai_symbolpair.ppuwrite(ppufile: tcompilerppufile);
       begin
         inherited ppuwrite(ppufile);
+        ppufile.putbyte(byte(kind));
         ppufile.putstring(sym^);
         ppufile.putstring(value^);
       end;

+ 6 - 9
compiler/aggas.pas

@@ -1354,18 +1354,15 @@ implementation
                else
                  AsmWriteLn(tai_symbol(hp).sym.name + '=' + tostr(tai_symbol(hp).value));
              end;
-{$ifdef arm}
-           ait_thumb_set:
-             begin
-               AsmWriteLn(#9'.thumb_set '+tai_thumb_set(hp).sym^+', '+tai_thumb_set(hp).value^);
-             end;
-{$endif arm}
-           ait_set:
+           ait_symbolpair:
              begin
+               AsmWrite(#9);
+               AsmWrite(symbolpairkindstr[tai_symbolpair(hp).kind]);
+               AsmWrite(' ');
                if replaceforbidden then
-                 AsmWriteLn(#9'.set '+ReplaceForbiddenAsmSymbolChars(tai_set(hp).sym^)+', '+ReplaceForbiddenAsmSymbolChars(tai_set(hp).value^))
+                 AsmWriteLn(ReplaceForbiddenAsmSymbolChars(tai_symbolpair(hp).sym^)+', '+ReplaceForbiddenAsmSymbolChars(tai_symbolpair(hp).value^))
                else
-                 AsmWriteLn(#9'.set '+tai_set(hp).sym^+', '+tai_set(hp).value^);
+                 AsmWriteLn(tai_symbolpair(hp).sym^+', '+tai_symbolpair(hp).value^);
              end;
            ait_weak:
              begin

+ 1 - 1
compiler/arm/raarmgas.pas

@@ -1440,7 +1440,7 @@ Unit raarmgas;
             Consume(AS_COMMA);
             BuildConstSymbolExpression(true,false,false, val,symval,symtyp);
 
-            curList.concat(tai_thumb_set.create(symname,symval));
+            curList.concat(tai_symbolpair.create(spk_thumb_set,symname,symval));
           end
         else if actasmpattern='.thumb_func' then
           begin

+ 1 - 1
compiler/avr/aasmcpu.pas

@@ -421,7 +421,7 @@ implementation
                     ait_align:
                       inc(CurrOffset,tai_align(curtai).aligntype);
                     ait_weak,
-                    ait_set,
+                    ait_symbolpair,
                     ait_marker:
                       ;
                     ait_label:

+ 1 - 4
compiler/psystem.pas

@@ -737,10 +737,7 @@ implementation
 {$ifdef SPARC}
 //        aiclass[ait_labeled_instruction]:=tai_labeled_instruction;
 {$endif SPARC}
-{$ifdef arm}
-        aiclass[ait_thumb_set]:=tai_thumb_set;
-{$endif arm}
-        aiclass[ait_set]:=tai_set;
+        aiclass[ait_symbolpair]:=tai_symbolpair;
         aiclass[ait_weak]:=tai_weak;
         aiclass[ait_cutobject]:=tai_cutobject;
         aiclass[ait_regalloc]:=tai_regalloc;

+ 1 - 1
compiler/raatt.pas

@@ -1242,7 +1242,7 @@ unit raatt;
                Consume(AS_COMMA);
                BuildConstSymbolExpression(true,false,false, symofs,symval,symtyp);
 
-               curList.concat(tai_set.create(symname,symval));
+               curList.concat(tai_symbolpair.create(spk_set,symname,symval));
              end;
 
            AS_WEAK: