* merged ait_set and ait_thumb_set into a single tai class

(tai_symbolpair)

git-svn-id: trunk@30197 -
This commit is contained in:
Jonas Maebe 2015-03-14 18:35:28 +00:00
parent 1e227f78fe
commit 8445381929
6 changed files with 29 additions and 49 deletions

View File

@ -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;

View File

@ -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

View File

@ -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

View File

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

View File

@ -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;

View File

@ -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: