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

View File

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

View File

@ -1440,7 +1440,7 @@ Unit raarmgas;
Consume(AS_COMMA); Consume(AS_COMMA);
BuildConstSymbolExpression(true,false,false, val,symval,symtyp); 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 end
else if actasmpattern='.thumb_func' then else if actasmpattern='.thumb_func' then
begin begin

View File

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

View File

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

View File

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