diff options
| author | peter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2006-03-15 11:40:30 +0000 |
|---|---|---|
| committer | peter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2006-03-15 11:40:30 +0000 |
| commit | cc16c6126a0483ce3d934f2bbc9700a39b3f37e8 (patch) | |
| tree | 1c9295fc12dfefccef175276bc3e18e632b881ef | |
| parent | a20cd34e21f215264afdf47389a2b4391dfc14ed (diff) | |
| download | fpc-cc16c6126a0483ce3d934f2bbc9700a39b3f37e8.tar.gz | |
* refactor asmdata
git-svn-id: http://svn.freepascal.org/svn/fpc/branches/linker@2922 3ad0048d-3df7-0310-abae-a5850022a9f2
135 files changed, 5370 insertions, 5353 deletions
diff --git a/compiler/aasmbase.pas b/compiler/aasmbase.pas index 4d69799313..ab37f31f07 100644 --- a/compiler/aasmbase.pas +++ b/compiler/aasmbase.pas @@ -41,6 +41,15 @@ interface TAsmsymtype=(AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION,AT_LABEL); + { is the label only there for getting an DataOffset (e.g. for i/o + checks -> alt_addr) or is it a jump target (alt_jump), for debug + info alt_dbgline and alt_dbgfile, etc. } + TAsmLabelType = (alt_jump,alt_addr,alt_data,alt_dbgline,alt_dbgfile,alt_dbgtype,alt_dbgframe); + + const + asmlabeltypeprefix : array[tasmlabeltype] of char = ('j','a','d','l','f','t','c'); + + type TAsmSectiontype=(sec_none, sec_code, sec_data, @@ -72,7 +81,7 @@ interface TAsmSymbol = class(TNamedIndexItem) private { this need to be incremented with every symbol loading into the - taasmoutput with loadsym/loadref/const_symbol (PFV) } + TAsmList with loadsym/loadref/const_symbol (PFV) } refs : longint; public bind : TAsmsymbind; @@ -89,11 +98,6 @@ interface function getrefs: longint; end; - { is the label only there for getting an DataOffset (e.g. for i/o - checks -> alt_addr) or is it a jump target (alt_jump), for debug - info alt_dbgline and alt_dbgfile } - TAsmLabelType = (alt_jump,alt_addr,alt_data,alt_dbgline,alt_dbgfile,alt_dbgtype,alt_dbgframe); - TAsmLabel = class(TAsmSymbol) labelnr : longint; labeltype : TAsmLabelType; @@ -103,48 +107,12 @@ interface function getname:string;override; end; - tasmsymbolidxarr = array[0..($7fffffff div sizeof(pointer))-1] of tasmsymbol; - pasmsymbolidxarr = ^tasmsymbolidxarr; - - TObjLibraryData = class(TLinkedListItem) - private - nextaltnr : longint; - nextlabelnr : array[Tasmlabeltype] of longint; - public - name, - realname : string[80]; - symbolsearch : tdictionary; { contains ALL assembler symbols } - AltSymbollist : TFPObjectList; - constructor create(const n:string); - destructor destroy;override; - { asmsymbol } - function newasmsymbol(const s : string;_bind:TAsmSymBind;_typ:TAsmsymtype) : tasmsymbol; - function getasmsymbol(const s : string) : tasmsymbol; - function newasmlabel(nr:longint;alt:tasmlabeltype;is_global:boolean) : tasmlabel; - {# create a new assembler label } - procedure getlabel(var l : tasmlabel;alt:tasmlabeltype); - {# create a new assembler label for jumps } - procedure getjumplabel(var l : tasmlabel); - { make l as a new label and flag is_addr } - procedure getaddrlabel(var l : tasmlabel); - { make l as a new label and flag is_data } - procedure getdatalabel(var l : tasmlabel); - {# return a label number } - { generate an alternative (duplicate) symbol } - procedure GenerateAltSymbol(p:tasmsymbol); - procedure ResetAltSymbols; - end; + function use_smartlink_section:boolean; + function maybe_smartlink_symbol:boolean; function LengthUleb128(a: aword) : byte; function LengthSleb128(a: aint) : byte; - const - { alt_jump,alt_addr,alt_data,alt_dbgline,alt_dbgfile } - asmlabeltypeprefix : array[tasmlabeltype] of char = ('j','a','d','l','f','t','c'); - - var - objectlibrary : TObjLibraryData; - implementation @@ -152,9 +120,19 @@ implementation strings, verbose; - const - sectsgrow = 100; - symbolsgrow = 100; + + function use_smartlink_section:boolean; + begin + result:=(af_smartlink_sections in target_asm.flags) and + (tf_smartlink_sections in target_info.flags); + end; + + + function maybe_smartlink_symbol:boolean; + begin + result:=(cs_create_smart in aktmoduleswitches) or + use_smartlink_section; + end; function LengthUleb128(a: aword) : byte; @@ -272,135 +250,4 @@ implementation increfs; end; - -{**************************************************************************** - TObjLibraryData -****************************************************************************} - - constructor TObjLibraryData.create(const n:string); - var - alt : TAsmLabelType; - begin - inherited create; - realname:=n; - name:=upper(n); - { symbols } - symbolsearch:=tdictionary.create; - symbolsearch.usehash; - AltSymbollist:=TFPObjectList.Create(false); - { labels } - nextaltnr:=1; - for alt:=low(TAsmLabelType) to high(TAsmLabelType) do - nextlabelnr[alt]:=1; - end; - - - destructor TObjLibraryData.destroy; - begin - AltSymbollist.free; - symbolsearch.free; - end; - - - function TObjLibraryData.newasmsymbol(const s : string;_bind:TAsmSymBind;_typ:Tasmsymtype) : tasmsymbol; - var - hp : tasmsymbol; - begin - hp:=tasmsymbol(symbolsearch.search(s)); - if assigned(hp) then - begin - {$IFDEF EXTDEBUG} - if (_typ <> AT_NONE) and - (hp.typ <> _typ) and - not(cs_compilesystem in aktmoduleswitches) and - (target_info.system <> system_powerpc_darwin) then - begin - //Writeln('Error symbol '+hp.name+' type is ',Ord(_typ),', should be ',Ord(hp.typ)); - InternalError(2004031501); - end; - {$ENDIF} - if (_bind<>AB_EXTERNAL) then - hp.bind:=_bind - end - else - begin - { Not found, insert it. } - hp:=tasmsymbol.create(s,_bind,_typ); - symbolsearch.insert(hp); - end; - newasmsymbol:=hp; - end; - - - function TObjLibraryData.getasmsymbol(const s : string) : tasmsymbol; - begin - getasmsymbol:=tasmsymbol(symbolsearch.search(s)); - end; - - - procedure TObjLibraryData.GenerateAltSymbol(p:tasmsymbol); - begin - if not assigned(p.altsymbol) then - begin - p.altsymbol:=tasmsymbol.create(p.name+'_'+tostr(nextaltnr),p.bind,p.typ); - symbolsearch.insert(p.altsymbol); - AltSymbollist.Add(p); - end; - end; - - - procedure TObjLibraryData.ResetAltSymbols; - var - i : longint; - begin - for i:=0 to AltSymbollist.Count-1 do - tasmsymbol(AltSymbollist[i]).altsymbol:=nil; - AltSymbollist.Clear; - end; - - - function TObjLibraryData.newasmlabel(nr:longint;alt:tasmlabeltype;is_global:boolean) : tasmlabel; - var - hp : tasmlabel; - begin - if is_global then - hp:=tasmlabel.createglobal(name,nr,alt) - else - hp:=tasmlabel.createlocal(nr,alt); - symbolsearch.insert(hp); - newasmlabel:=hp; - end; - - - procedure TObjLibraryData.getlabel(var l : tasmlabel;alt:tasmlabeltype); - begin - l:=tasmlabel.createlocal(nextlabelnr[alt],alt); - inc(nextlabelnr[alt]); - symbolsearch.insert(l); - end; - - - procedure TObjLibraryData.getjumplabel(var l : tasmlabel); - begin - l:=tasmlabel.createlocal(nextlabelnr[alt_jump],alt_jump); - inc(nextlabelnr[alt_jump]); - symbolsearch.insert(l); - end; - - - procedure TObjLibraryData.getdatalabel(var l : tasmlabel); - begin - l:=tasmlabel.createglobal(name,nextlabelnr[alt_data],alt_data); - inc(nextlabelnr[alt_data]); - symbolsearch.insert(l); - end; - - - procedure TObjLibraryData.getaddrlabel(var l : tasmlabel); - begin - l:=tasmlabel.createlocal(nextlabelnr[alt_addr],alt_addr); - inc(nextlabelnr[alt_addr]); - symbolsearch.insert(l); - end; - end. diff --git a/compiler/aasmtai.pas b/compiler/aasmtai.pas index 3e985050cc..386507ca0d 100644 --- a/compiler/aasmtai.pas +++ b/compiler/aasmtai.pas @@ -224,21 +224,83 @@ interface type - { cut type, required for alphanumeric ordering of the assembler filenames } - TCutPlace=(cut_normal,cut_begin,cut_end); + { cut type, required for alphanumeric ordering of the assembler filenames } + TCutPlace=(cut_normal,cut_begin,cut_end); + + TAsmMarker = ( + mark_NoPropInfoStart,mark_NoPropInfoEnd, + mark_AsmBlockStart,mark_AsmBlockEnd, + mark_InlineStart,mark_InlineEnd,mark_BlockStart, + mark_Position + ); - TRegAllocType = (ra_alloc,ra_dealloc,ra_sync,ra_resize); + TRegAllocType = (ra_alloc,ra_dealloc,ra_sync,ra_resize); - TMarker = (NoPropInfoStart,NoPropInfoEnd, - AsmBlockStart,AsmBlockEnd, - InlineStart,InlineEnd,marker_blockstart, - marker_position); + TStabType = (stab_stabs,stab_stabn,stab_stabd); - { Buffer type used for alignment } - tfillbuffer = array[0..63] of char; + TAsmDirective=( + asd_non_lazy_symbol_pointer,asd_indirect_symbol,asd_lazy_symbol_pointer, + asd_extern,asd_nasm_import, asd_toc_entry, asd_mod_init_func, asd_mod_term_func + ); - Tspill_temp_list=array[tsuperregister] of Treference; + { Type of AsmLists. The order is important for the layout of the + information in the .o file. The stabs for the types must be defined + before they can be referenced and therefor they need to be written + first (PFV) } + TAsmListType=( + al_start, + al_stabs, + al_procedures, + al_globals, + al_const, + al_typedconsts, + al_rotypedconsts, + al_threadvars, + al_imports, + al_exports, + al_resources, + al_rtti, + al_dwarf, + al_dwarf_info, + al_dwarf_abbrev, + al_dwarf_line, + al_picdata, + al_resourcestrings, + al_end + ); + const + AsmListTypeStr : array[TAsmListType] of string[24] =( + 'al_begin', + 'al_stabs', + 'al_procedures', + 'al_globals', + 'al_const', + 'al_typedconsts', + 'al_rotypedconsts', + 'al_threadvars', + 'al_imports', + 'al_exports', + 'al_resources', + 'al_rtti', + 'al_dwarf', + 'al_dwarf_info', + 'al_dwarf_abbrev', + 'al_dwarf_line', + 'al_picdata', + 'al_resourcestrings', + 'al_end' + ); + + regallocstr : array[tregalloctype] of string[10]=('allocated','released','sync','resized'); + tempallocstr : array[boolean] of string[10]=('released','allocated'); + stabtypestr : array[TStabType] of string[5]=('stabs','stabn','stabd'); + directivestr : array[TAsmDirective] of string[23]=( + 'non_lazy_symbol_pointer','indirect_symbol','lazy_symbol_pointer', + 'extern','nasm_import', 'tc', 'mod_init_func', 'mod_term_func' + ); + + type { abstract assembler item } tai = class(TLinkedListItem) {$ifndef NOOPT} @@ -305,13 +367,10 @@ interface procedure derefimpl;override; end; - tasmdirective=(asd_non_lazy_symbol_pointer,asd_indirect_symbol,asd_lazy_symbol_pointer, - asd_extern,asd_nasm_import, asd_toc_entry, asd_mod_init_func, asd_mod_term_func); - tai_directive = class(tailineinfo) name : pstring; - directive : tasmdirective; - constructor Create(_directive:tasmdirective;const _name:string); + directive : TAsmDirective; + constructor Create(_directive:TAsmDirective;const _name:string); destructor Destroy;override; constructor ppuload(t:taitype;ppufile:tcompilerppufile);override; procedure ppuwrite(ppufile:tcompilerppufile);override; @@ -448,13 +507,11 @@ interface procedure ppuwrite(ppufile:tcompilerppufile);override; end; - tstabtype = (stab_stabs,stab_stabn,stab_stabd); - tai_stab = class(tai) str : pchar; - stabtype : tstabtype; - constructor Create(_stabtype:tstabtype;_str : pchar); - constructor Create_str(_stabtype:tstabtype;const s:string); + stabtype : TStabType; + constructor Create(_stabtype:TStabType;_str : pchar); + constructor Create_str(_stabtype:TStabType;const s:string); destructor Destroy;override; end; @@ -480,8 +537,8 @@ interface { Insert a marker for assembler and inline blocks } tai_marker = class(tai) - Kind: TMarker; - Constructor Create(_Kind: TMarker); + Kind: TAsmMarker; + Constructor Create(_Kind: TAsmMarker); constructor ppuload(t:taitype;ppufile:tcompilerppufile);override; procedure ppuwrite(ppufile:tcompilerppufile);override; end; @@ -539,11 +596,11 @@ interface procedure ppuwrite(ppufile:tcompilerppufile);override; end; - Taasmoutput=class; + TAsmList=class; tadd_reg_instruction_proc=procedure(instr:Tai;r:tregister) of object; - Trggetproc=procedure(list:Taasmoutput;position:Tai;subreg:Tsubregister;var result:Tregister) of object; - Trgungetproc=procedure(list:Taasmoutput;position:Tai;r:Tregister) of object; + Trggetproc=procedure(list:TAsmList;position:Tai;subreg:Tsubregister;var result:Tregister) of object; + Trgungetproc=procedure(list:TAsmList;position:Tai;r:Tregister) of object; { Class template for assembler instructions } @@ -598,6 +655,9 @@ interface end; tai_cpu_class = class of tai_cpu_abstract; + { Buffer type used for alignment } + tfillbuffer = array[0..63] of char; + { alignment for operator } tai_align_abstract = class(tai) aligntype : byte; { 1 = no align, 2 = word align, 4 = dword align } @@ -613,95 +673,60 @@ interface end; tai_align_class = class of tai_align_abstract; - taasmoutput = class(tlinkedlist) + TAsmList = class(tlinkedlist) constructor create; function empty : boolean; function getlasttaifilepos : pfileposinfo; - procedure InsertAfter(Item,Loc : TLinkedListItem);override; end; - { Type of asmlists. The order is important for the layout of the - information in the .o file. The stabs for the types must be defined - before they can be referenced and therefor they need to be written - first (PFV) } - Tasmlist=(al_start, - al_stabs, - al_procedures, - al_globals, - al_const, - al_typedconsts, - al_rotypedconsts, - al_threadvars, - al_imports, - al_exports, - al_resources, - al_rtti, - al_dwarf, - al_dwarf_info, - al_dwarf_abbrev, - al_dwarf_line, - al_picdata, - al_resourcestrings, - al_end); - const - TasmlistStr : array[tasmlist] of string[24] =( - 'al_begin', - 'al_stabs', - 'al_procedures', - 'al_globals', - 'al_const', - 'al_typedconsts', - 'al_rotypedconsts', - 'al_threadvars', - 'al_imports', - 'al_exports', - 'al_resources', - 'al_rtti', - 'al_dwarf', - 'al_dwarf_info', - 'al_dwarf_abbrev', - 'al_dwarf_line', - 'al_picdata', - 'al_resourcestrings', - 'al_end'); - - regallocstr : array[tregalloctype] of string[10]=('allocated','released','sync','resized'); - tempallocstr : array[boolean] of string[10]=('released','allocated'); - stabtypestr : array[tstabtype] of string[5]=('stabs','stabn','stabd'); - directivestr : array[tasmdirective] of string[23]=( - 'non_lazy_symbol_pointer','indirect_symbol','lazy_symbol_pointer', - 'extern','nasm_import', 'tc', 'mod_init_func', 'mod_term_func' - ); + TAsmData = class + private + FAsmSymbolDict : TDictionary; + FAltSymbolList : TFPObjectList; + FNextAltNr : longint; + FNextLabelNr : array[Tasmlabeltype] of longint; + public + name, + realname : string[80]; + { Assembler lists } + AsmLists : array[TAsmListType] of TAsmList; + CurrAsmList : TAsmList; + constructor create(const n:string); + destructor destroy;override; + { asmsymbol } + function newasmsymbol(const s : string;_bind:TAsmSymBind;_typ:TAsmsymtype) : tasmsymbol; + function getasmsymbol(const s : string) : tasmsymbol; + function newasmlabel(nr:longint;alt:tasmlabeltype;is_global:boolean) : tasmlabel; + { create new assembler label } + procedure getlabel(var l : tasmlabel;alt:tasmlabeltype); + procedure getjumplabel(var l : tasmlabel); + procedure getaddrlabel(var l : tasmlabel); + procedure getdatalabel(var l : tasmlabel); + { generate an alternative (duplicate) symbol } + procedure GenerateAltSymbol(p:tasmsymbol); + procedure ResetAltSymbols; + property AsmSymbolDict:TDictionary read FAsmSymbolDict; + end; var { array with all class types for tais } aiclass : taiclassarray; - { Current expression list } - exprasmlist : taasmoutput; - - { labels for BREAK and CONTINUE } - aktbreaklabel,aktcontinuelabel : tasmlabel; - - { label when the result is true or false } - truelabel,falselabel : tasmlabel; + { target specific tais } + cai_align : tai_align_class; + cai_cpu : tai_cpu_class; { hook to notify uses of registers } add_reg_instruction_hook : tadd_reg_instruction_proc; - asmlist:array[Tasmlist] of Taasmoutput; + current_asmdata : TAsmData; - cai_align : tai_align_class; - cai_cpu : tai_cpu_class; - - function use_smartlink_section:boolean; - function maybe_smartlink_symbol:boolean; - procedure maybe_new_object_file(list:taasmoutput); - procedure new_section(list:taasmoutput;Asectype:TAsmSectiontype;Aname:string;Aalign:byte); - procedure section_symbol_start(list:taasmoutput;const Aname:string;Asymtyp:Tasmsymtype; + procedure maybe_new_object_file(list:TAsmList); + procedure new_section(list:TAsmList;Asectype:TAsmSectiontype;Aname:string;Aalign:byte); + procedure section_symbol_start(list:TAsmList;const Aname:string;Asymtyp:Tasmsymtype; Aglobal:boolean;Asectype:TAsmSectiontype;Aalign:byte); - procedure section_symbol_end(list:taasmoutput;const Aname:string); + procedure section_symbol_end(list:TAsmList;const Aname:string); function ppuloadai(ppufile:tcompilerppufile):tai; procedure ppuwriteai(ppufile:tcompilerppufile;n:tai); @@ -763,21 +788,7 @@ implementation end; - function use_smartlink_section:boolean; - begin - result:=(af_smartlink_sections in target_asm.flags) and - (tf_smartlink_sections in target_info.flags); - end; - - - function maybe_smartlink_symbol:boolean; - begin - result:=(cs_create_smart in aktmoduleswitches) or - use_smartlink_section; - end; - - - procedure maybe_new_object_file(list:taasmoutput); + procedure maybe_new_object_file(list:TAsmList); begin if (cs_create_smart in aktmoduleswitches) and (not use_smartlink_section) then @@ -785,14 +796,14 @@ implementation end; - procedure new_section(list:taasmoutput;Asectype:TAsmSectiontype;Aname:string;Aalign:byte); + procedure new_section(list:TAsmList;Asectype:TAsmSectiontype;Aname:string;Aalign:byte); begin list.concat(tai_section.create(Asectype,Aname,Aalign)); list.concat(cai_align.create(Aalign)); end; - procedure section_symbol_start(list:taasmoutput;const Aname:string;Asymtyp:Tasmsymtype; + procedure section_symbol_start(list:TAsmList;const Aname:string;Asymtyp:Tasmsymtype; Aglobal:boolean;Asectype:TAsmSectiontype;Aalign:byte); begin maybe_new_object_file(list); @@ -806,7 +817,7 @@ implementation end; - procedure section_symbol_end(list:taasmoutput;const Aname:string); + procedure section_symbol_end(list:TAsmList;const Aname:string); begin list.concat(tai_symbol_end.createname(Aname)); end; @@ -935,7 +946,7 @@ implementation begin inherited Create; typ:=ait_datablock; - sym:=objectlibrary.newasmsymbol(_name,AB_LOCAL,AT_DATA); + sym:=current_asmdata.newasmsymbol(_name,AB_LOCAL,AT_DATA); { keep things aligned } if _size<=0 then _size:=4; @@ -948,7 +959,7 @@ implementation begin inherited Create; typ:=ait_datablock; - sym:=objectlibrary.newasmsymbol(_name,AB_GLOBAL,AT_DATA); + sym:=current_asmdata.newasmsymbol(_name,AB_GLOBAL,AT_DATA); { keep things aligned } if _size<=0 then _size:=4; @@ -1010,7 +1021,7 @@ implementation begin inherited Create; typ:=ait_symbol; - sym:=objectlibrary.newasmsymbol(_name,AB_LOCAL,_symtyp); + sym:=current_asmdata.newasmsymbol(_name,AB_LOCAL,_symtyp); size:=siz; is_global:=false; end; @@ -1020,7 +1031,7 @@ implementation begin inherited Create; typ:=ait_symbol; - sym:=objectlibrary.newasmsymbol(_name,AB_GLOBAL,_symtyp); + sym:=current_asmdata.newasmsymbol(_name,AB_GLOBAL,_symtyp); size:=siz; is_global:=true; end; @@ -1065,7 +1076,7 @@ implementation begin inherited Create; typ:=ait_symbol_end; - sym:=objectlibrary.newasmsymbol(_name,AB_GLOBAL,AT_NONE); + sym:=current_asmdata.newasmsymbol(_name,AB_GLOBAL,AT_NONE); end; @@ -1092,7 +1103,7 @@ implementation TAI_SYMBOL_END ****************************************************************************} - constructor tai_directive.Create(_directive:tasmdirective;const _name:string); + constructor tai_directive.Create(_directive:TAsmDirective;const _name:string); begin inherited Create; typ:=ait_directive; @@ -1111,7 +1122,7 @@ implementation begin inherited ppuload(t,ppufile); name:=stringdup(ppufile.getstring); - directive:=tasmdirective(ppufile.getbyte); + directive:=TAsmDirective(ppufile.getbyte); end; @@ -1315,7 +1326,7 @@ implementation inherited Create; typ:=ait_const; consttype:=aitconst_ptr; - sym:=objectlibrary.newasmsymbol(name,AB_EXTERNAL,_symtyp); + sym:=current_asmdata.newasmsymbol(name,AB_EXTERNAL,_symtyp); endsym:=nil; value:=ofs; { update sym info } @@ -1328,7 +1339,7 @@ implementation inherited Create; typ:=ait_const; consttype:=aitconst_rva_symbol; - sym:=objectlibrary.newasmsymbol(name,AB_EXTERNAL,AT_FUNCTION); + sym:=current_asmdata.newasmsymbol(name,AB_EXTERNAL,AT_FUNCTION); endsym:=nil; value:=0; { update sym info } @@ -1692,7 +1703,7 @@ implementation TAI_STABS ****************************************************************************} - constructor tai_stab.create(_stabtype:tstabtype;_str : pchar); + constructor tai_stab.create(_stabtype:TStabType;_str : pchar); begin inherited create; typ:=ait_stab; @@ -1700,7 +1711,7 @@ implementation stabtype:=_stabtype; end; - constructor tai_stab.create_str(_stabtype:tstabtype;const s:string); + constructor tai_stab.create_str(_stabtype:TStabType;const s:string); begin self.create(_stabtype,strpnew(s)); end; @@ -1787,7 +1798,7 @@ implementation Tai_Marker ****************************************************************************} - constructor Tai_Marker.Create(_Kind: TMarker); + constructor Tai_Marker.Create(_Kind: TAsmMarker); begin Inherited Create; typ := ait_marker; @@ -1798,7 +1809,7 @@ implementation constructor Tai_Marker.ppuload(t:taitype;ppufile:tcompilerppufile); begin inherited ppuload(t,ppufile); - kind:=TMarker(ppufile.getbyte); + kind:=TAsmMarker(ppufile.getbyte); end; @@ -2453,26 +2464,26 @@ implementation {***************************************************************************** - TAAsmOutput + TAsmList *****************************************************************************} - constructor taasmoutput.create; + constructor TAsmList.create; begin inherited create; { make sure the optimizer won't remove the first tai of this list} - insert(tai_marker.create(marker_blockstart)); + insert(tai_marker.create(mark_BlockStart)); end; - function taasmoutput.empty : boolean; + function TAsmList.empty : boolean; begin - { there is always a marker_blockstart available, - see taasmoutput.create } + { there is always a mark_BlockStart available, + see TAsmList.create } result:=(count<=1); end; - function taasmoutput.getlasttaifilepos : pfileposinfo; + function TAsmList.getlasttaifilepos : pfileposinfo; var hp : tlinkedlistitem; begin @@ -2497,16 +2508,165 @@ implementation end; end; - procedure Taasmoutput.InsertAfter(Item,Loc : TLinkedListItem); +{**************************************************************************** + TAsmData +****************************************************************************} + + constructor TAsmData.create(const n:string); + var + alt : TAsmLabelType; + hal : TAsmListType; + begin + inherited create; + realname:=n; + name:=upper(n); + { symbols } + FAsmSymbolDict:=TDictionary.create; + FAsmSymbolDict.usehash; + FAltSymbolList:=TFPObjectList.Create(false); + { labels } + FNextAltNr:=1; + for alt:=low(TAsmLabelType) to high(TAsmLabelType) do + FNextLabelNr[alt]:=1; + { AsmLists } + CurrAsmList:=TAsmList.create; + for hal:=low(TAsmListType) to high(TAsmListType) do + AsmLists[hal]:=TAsmList.create; + { PIC data } + if (target_info.system in [system_powerpc_darwin,system_i386_darwin]) then + AsmLists[al_picdata].concat(tai_directive.create(asd_non_lazy_symbol_pointer,'')); + end; + + + destructor TAsmData.destroy; + var +{$ifdef MEMDEBUG} + d : tmemdebug; +{$endif} + hal : TAsmListType; begin - { This is not possible because it is not sure that the - tai at Loc has taifileinfo as parent } - {if assigned(Loc) then - tailineinfo(Item).fileinfo:=tailineinfo(Loc).fileinfo;} - inherited InsertAfter(Item,Loc); +{$ifdef MEMDEBUG} + d:=tmemdebug.create('AsmSymbols - '+name); +{$endif} + FAltSymbolList.free; + FAsmSymbolDict.free; +{$ifdef MEMDEBUG} + d.free; +{$endif} +{$ifdef MEMDEBUG} + d:=tmemdebug.create('AsmLists - '+name); +{$endif} + for hal:=low(TAsmListType) to high(TAsmListType) do + AsmLists[hal].free; +{$ifdef MEMDEBUG} + d.free; +{$endif} end; + + function TAsmData.newasmsymbol(const s : string;_bind:TAsmSymBind;_typ:Tasmsymtype) : tasmsymbol; + var + hp : tasmsymbol; + begin + hp:=tasmsymbol(FAsmSymbolDict.search(s)); + if assigned(hp) then + begin + {$IFDEF EXTDEBUG} + if (_typ <> AT_NONE) and + (hp.typ <> _typ) and + not(cs_compilesystem in aktmoduleswitches) and + (target_info.system <> system_powerpc_darwin) then + begin + //Writeln('Error symbol '+hp.name+' type is ',Ord(_typ),', should be ',Ord(hp.typ)); + InternalError(2004031501); + end; + {$ENDIF} + if (_bind<>AB_EXTERNAL) then + hp.bind:=_bind + end + else + begin + { Not found, insert it. } + hp:=tasmsymbol.create(s,_bind,_typ); + FAsmSymbolDict.insert(hp); + end; + newasmsymbol:=hp; + end; + + + function TAsmData.getasmsymbol(const s : string) : tasmsymbol; + begin + getasmsymbol:=tasmsymbol(FAsmSymbolDict.search(s)); + end; + + + procedure TAsmData.GenerateAltSymbol(p:tasmsymbol); + begin + if not assigned(p.altsymbol) then + begin + p.altsymbol:=tasmsymbol.create(p.name+'_'+tostr(FNextAltNr),p.bind,p.typ); + FAsmSymbolDict.insert(p.altsymbol); + FAltSymbolList.Add(p); + end; + end; + + + procedure TAsmData.ResetAltSymbols; + var + i : longint; + begin + for i:=0 to FAltSymbolList.Count-1 do + tasmsymbol(FAltSymbolList[i]).altsymbol:=nil; + FAltSymbolList.Clear; + end; + + + function TAsmData.newasmlabel(nr:longint;alt:tasmlabeltype;is_global:boolean) : tasmlabel; + var + hp : tasmlabel; + begin + if is_global then + hp:=tasmlabel.createglobal(name,nr,alt) + else + hp:=tasmlabel.createlocal(nr,alt); + FAsmSymbolDict.insert(hp); + result:=hp; + end; + + + procedure TAsmData.getlabel(var l : tasmlabel;alt:tasmlabeltype); + begin + l:=tasmlabel.createlocal(FNextLabelNr[alt],alt); + inc(FNextLabelNr[alt]); + FAsmSymbolDict.insert(l); + end; + + + procedure TAsmData.getjumplabel(var l : tasmlabel); + begin + l:=tasmlabel.createlocal(FNextLabelNr[alt_jump],alt_jump); + inc(FNextLabelNr[alt_jump]); + FAsmSymbolDict.insert(l); + end; + + + procedure TAsmData.getdatalabel(var l : tasmlabel); + begin + l:=tasmlabel.createglobal(name,FNextLabelNr[alt_data],alt_data); + inc(FNextLabelNr[alt_data]); + FAsmSymbolDict.insert(l); + end; + + + procedure TAsmData.getaddrlabel(var l : tasmlabel); + begin + l:=tasmlabel.createlocal(FNextLabelNr[alt_addr],alt_addr); + inc(FNextLabelNr[alt_addr]); + FAsmSymbolDict.insert(l); + end; + + begin cai_cpu:=tai_cpu_abstract; cai_align:=tai_align_abstract; diff --git a/compiler/aggas.pas b/compiler/aggas.pas index 33408beb5e..e67e7435b6 100644 --- a/compiler/aggas.pas +++ b/compiler/aggas.pas @@ -52,7 +52,7 @@ interface procedure WriteExtraHeader;virtual; procedure WriteInstruction(hp: tai); public - procedure WriteTree(p:TAAsmoutput);override; + procedure WriteTree(p:TAsmList);override; procedure WriteAsmList;override; destructor destroy; override; private @@ -377,7 +377,7 @@ implementation end; - procedure TGNUAssembler.WriteTree(p:TAAsmoutput); + procedure TGNUAssembler.WriteTree(p:TAsmList); function needsObject(hp : tai_symbol) : boolean; begin @@ -421,7 +421,7 @@ implementation { lineinfo is only needed for al_procedures (PFV) } do_line:=(cs_asm_source in aktglobalswitches) or ((cs_lineinfo in aktmoduleswitches) - and (p=asmlist[al_procedures])); + and (p=current_asmdata.asmlists[al_procedures])); hp:=tai(p.first); while assigned(hp) do begin @@ -978,9 +978,9 @@ implementation end; ait_marker : - if tai_marker(hp).kind=InlineStart then + if tai_marker(hp).kind=mark_InlineStart then inc(InlineLevel) - else if tai_marker(hp).kind=InlineEnd then + else if tai_marker(hp).kind=mark_InlineEnd then dec(InlineLevel); ait_directive : @@ -1015,7 +1015,7 @@ implementation p:dirstr; n:namestr; e:extstr; - hal : tasmlist; + hal : tasmlisttype; begin {$ifdef EXTDEBUG} if assigned(current_module.mainsource) then @@ -1048,11 +1048,11 @@ implementation AsmStartSize:=AsmSize; symendcount:=0; - for hal:=low(Tasmlist) to high(Tasmlist) do + for hal:=low(TasmlistType) to high(TasmlistType) do begin - AsmWriteLn(target_asm.comment+'Begin asmlist '+TasmlistStr[hal]); - writetree(asmlist[hal]); - AsmWriteLn(target_asm.comment+'End asmlist '+TasmlistStr[hal]); + AsmWriteLn(target_asm.comment+'Begin asmlist '+AsmlistTypeStr[hal]); + writetree(current_asmdata.asmlists[hal]); + AsmWriteLn(target_asm.comment+'End asmlist '+AsmlistTypeStr[hal]); end; AsmLn; diff --git a/compiler/alpha/cgcpu.pas b/compiler/alpha/cgcpu.pas index 07f3a9d92f..cc0b3168df 100644 --- a/compiler/alpha/cgcpu.pas +++ b/compiler/alpha/cgcpu.pas @@ -34,21 +34,21 @@ uses type pcgalpha = ^tcgalpha; tcgalpha = class(tcg) - procedure a_call_name(list : taasmoutput;const s : string);override; - procedure a_load_const_reg(list : taasmoutput;size : tcgsize;a : aword;register : tregister);override; - procedure a_load_reg_ref(list : taasmoutput;size : tcgsize;register : tregister;const ref : treference);override; - procedure a_load_ref_reg(list : taasmoutput;size : tcgsize;const ref : treference;register : tregister);override; - procedure a_load_reg_reg(list : taasmoutput;fromsize, tosize : tcgsize;reg1,reg2 : tregister);override; - procedure a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aword; + procedure a_call_name(list : TAsmList;const s : string);override; + procedure a_load_const_reg(list : TAsmList;size : tcgsize;a : aword;register : tregister);override; + procedure a_load_reg_ref(list : TAsmList;size : tcgsize;register : tregister;const ref : treference);override; + procedure a_load_ref_reg(list : TAsmList;size : tcgsize;const ref : treference;register : tregister);override; + procedure a_load_reg_reg(list : TAsmList;fromsize, tosize : tcgsize;reg1,reg2 : tregister);override; + procedure a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aword; reg : tregister; l : tasmlabel);override; - procedure a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); - procedure a_cmp_reg_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg : tregister;l : tasmlabel); - procedure a_cmp_ref_const_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aword; + procedure a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); + procedure a_cmp_reg_ref_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg : tregister;l : tasmlabel); + procedure a_cmp_ref_const_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aword; reg : tregister; l : tasmlabel); - procedure a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister);override; - procedure g_stackframe_entry(list : taasmoutput;localsize : longint);override; - procedure g_maybe_loadself(list : taasmoutput);override; - procedure g_restore_frame_pointer(list : taasmoutput);override; + procedure a_loadaddr_ref_reg(list : TAsmList;const ref : treference;r : tregister);override; + procedure g_stackframe_entry(list : TAsmList;localsize : longint);override; + procedure g_maybe_loadself(list : TAsmList);override; + procedure g_restore_frame_pointer(list : TAsmList);override; end; implementation @@ -56,7 +56,7 @@ implementation uses globtype,globals; -procedure tcgalpha.g_stackframe_entry(list : taasmoutput;localsize : longint); +procedure tcgalpha.g_stackframe_entry(list : TAsmList;localsize : longint); begin list.concat(taicpu.op_reg_ref(A_LDGP,Global_pointer,new_reference(R_27,0))); @@ -67,7 +67,7 @@ begin list.concat(taicpu.op_reg_reg_reg(A_BIS,stack_pointer_reg,stack_pointer_reg,frame_pointer_reg)); end; -procedure g_exitcode(list : taasmoutput;parasize : longint; nostackframe,inlined : boolean); +procedure g_exitcode(list : TAsmList;parasize : longint; nostackframe,inlined : boolean); begin { Restore stack pointer from frame pointer } @@ -81,7 +81,7 @@ begin } end; -procedure tcgalpha.a_call_name(list : taasmoutput;const s : string); +procedure tcgalpha.a_call_name(list : TAsmList;const s : string); begin { list^.concat(taicpu,op_sym(A_CALL,S_NO,newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)))); } @@ -89,69 +89,69 @@ procedure tcgalpha.a_call_name(list : taasmoutput;const s : string); abstract; end; -procedure tcgalpha.a_load_const_reg(list : taasmoutput;size : tcgsize;a : aword;register : tregister); +procedure tcgalpha.a_load_const_reg(list : TAsmList;size : tcgsize;a : aword;register : tregister); begin end; -procedure tcgalpha.a_load_reg_ref(list : taasmoutput;size : tcgsize;register : tregister;const ref : treference); +procedure tcgalpha.a_load_reg_ref(list : TAsmList;size : tcgsize;register : tregister;const ref : treference); begin end; -procedure tcgalpha.a_load_ref_reg(list : taasmoutput;size : tcgsize;const ref : treference;register : tregister); +procedure tcgalpha.a_load_ref_reg(list : TAsmList;size : tcgsize;const ref : treference;register : tregister); begin end; -procedure tcgalpha.a_load_reg_reg(list : taasmoutput;fromsize, tosize : tcgsize;reg1,reg2 : tregister); +procedure tcgalpha.a_load_reg_reg(list : TAsmList;fromsize, tosize : tcgsize;reg1,reg2 : tregister); begin end; -procedure tcgalpha.a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aword;reg : tregister; +procedure tcgalpha.a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aword;reg : tregister; l : tasmlabel); begin end; -procedure tcgalpha.a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); +procedure tcgalpha.a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); begin end; -procedure tcgalpha.a_cmp_reg_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg : tregister;l : tasmlabel); +procedure tcgalpha.a_cmp_reg_ref_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg : tregister;l : tasmlabel); begin end; -procedure tcgalpha.a_cmp_ref_const_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aword; +procedure tcgalpha.a_cmp_ref_const_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aword; reg : tregister; l : tasmlabel); begin end; -procedure tcgalpha.a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister); +procedure tcgalpha.a_loadaddr_ref_reg(list : TAsmList;const ref : treference;r : tregister); begin end; -procedure tcgalpha.g_maybe_loadself(list : taasmoutput); +procedure tcgalpha.g_maybe_loadself(list : TAsmList); begin end; -procedure tcgalpha.g_restore_frame_pointer(list : taasmoutput); +procedure tcgalpha.g_restore_frame_pointer(list : TAsmList); begin end; diff --git a/compiler/alpha/radirect.pas b/compiler/alpha/radirect.pas index a10f287570..472cae47df 100644 --- a/compiler/alpha/radirect.pas +++ b/compiler/alpha/radirect.pas @@ -64,7 +64,7 @@ interface ende : boolean; srsym,sym : tsym; srsymtable : tsymtable; - code : TAAsmoutput; + code : TAsmList; i,l : longint; procedure writeasmline; @@ -98,7 +98,7 @@ interface retstr:=''; c:=current_scanner.asmgetchar; - code:=TAAsmoutput.Create; + code:=TAsmList.Create; while not(ende) do begin { wrong placement diff --git a/compiler/alpha/rgcpu.pas b/compiler/alpha/rgcpu.pas index 23a1ca06e5..04b59f2d6a 100644 --- a/compiler/alpha/rgcpu.pas +++ b/compiler/alpha/rgcpu.pas @@ -34,8 +34,8 @@ unit rgcpu; type trgcpu = class(trgobj) - function getcpuregisterint(list: taasmoutput; reg: tregister): tregister; override; - procedure ungetregisterint(list: taasmoutput; reg: tregister); override; + function getcpuregisterint(list: TAsmList; reg: tregister): tregister; override; + procedure ungetregisterint(list: TAsmList; reg: tregister); override; end; implementation @@ -43,7 +43,7 @@ unit rgcpu; uses cgobj; - function trgcpu.getcpuregisterint(list: taasmoutput; reg: tregister): tregister; + function trgcpu.getcpuregisterint(list: TAsmList; reg: tregister): tregister; begin if reg = R_0 then @@ -55,7 +55,7 @@ unit rgcpu; end; - procedure trgcpu.ungetregisterint(list: taasmoutput; reg: tregister); + procedure trgcpu.ungetregisterint(list: TAsmList; reg: tregister); begin if reg = R_0 then diff --git a/compiler/aopt.pas b/compiler/aopt.pas index f71f2c52aa..d6e031ec19 100644 --- a/compiler/aopt.pas +++ b/compiler/aopt.pas @@ -35,7 +35,7 @@ Unit aopt; TAsmOptimizer = class(TAoptObj) { _AsmL is the PAasmOutpout list that has to be optimized } - Constructor create(_AsmL: taasmoutput); virtual; + Constructor create(_AsmL: TAsmList); virtual; { call the necessary optimizer procedures } Procedure Optimize; @@ -51,7 +51,7 @@ Unit aopt; var casmoptimizer : class of tasmoptimizer; - procedure Optimize(AsmL:taasmoutput); + procedure Optimize(AsmL:TAsmList); Implementation @@ -59,7 +59,7 @@ Unit aopt; globtype, globals, aoptda,aoptcpu,aoptcpud; - Constructor TAsmOptimizer.create(_AsmL: taasmoutput); + Constructor TAsmOptimizer.create(_AsmL: TAsmList); Begin inherited create(_asml,nil,nil,nil); {setup labeltable, always necessary} @@ -83,7 +83,7 @@ Unit aopt; Begin While Assigned(P) And ((P.typ <> Ait_Marker) Or - (tai_Marker(P).Kind <> AsmBlockStart)) Do + (tai_Marker(P).Kind <> mark_AsmBlockStart)) Do Begin If (p.typ = ait_label) Then If (tai_Label(p).labsym.is_used) Then @@ -98,7 +98,7 @@ Unit aopt; GetNextInstruction(p, p) End; if (prev.typ = ait_marker) and - (tai_marker(prev).kind = asmblockstart) then + (tai_marker(prev).kind = mark_AsmBlockStart) then blockend := prev else blockend := nil; If LabelFound @@ -108,7 +108,7 @@ Unit aopt; End; Procedure TAsmOptimizer.BuildLabelTableAndFixRegAlloc; - { Builds a table with the locations of the labels in the taasmoutput. } + { Builds a table with the locations of the labels in the TAsmList. } { Also fixes some RegDeallocs like "# %eax released; push (%eax)" } Var p, hp1, hp2: tai; UsedRegs: TRegSet; @@ -228,16 +228,16 @@ Unit aopt; BlockStart := BlockEnd; While Assigned(BlockStart) And (BlockStart.typ = ait_Marker) And - (tai_Marker(BlockStart).Kind = AsmBlockStart) Do + (tai_Marker(BlockStart).Kind = mark_AsmBlockStart) Do Begin { we stopped at an assembler block, so skip it } While GetNextInstruction(BlockStart, BlockStart) And ((BlockStart.Typ <> Ait_Marker) Or - (tai_Marker(Blockstart).Kind <> AsmBlockEnd)) Do; - { blockstart now contains a tai_marker(asmblockend) } + (tai_Marker(Blockstart).Kind <> mark_AsmBlockEnd)) Do; + { blockstart now contains a tai_marker(mark_AsmBlockEnd) } If GetNextInstruction(BlockStart, HP) And ((HP.typ <> ait_Marker) Or - (Tai_Marker(HP).Kind <> AsmBlockStart)) Then + (Tai_Marker(HP).Kind <> mark_AsmBlockStart)) Then { There is no assembler block anymore after the current one, so } { optimize the next block of "normal" instructions } pass_1 @@ -254,7 +254,7 @@ Unit aopt; End; - procedure Optimize(AsmL:taasmoutput); + procedure Optimize(AsmL:TAsmList); var p : TAsmOptimizer; begin diff --git a/compiler/aoptbase.pas b/compiler/aoptbase.pas index dfc832fdea..fb9fd3e97f 100644 --- a/compiler/aoptbase.pas +++ b/compiler/aoptbase.pas @@ -157,16 +157,16 @@ unit aoptbase; Current := tai(Current.Next); If Assigned(Current) And (Current.typ = ait_Marker) And - (Tai_Marker(Current).Kind = NoPropInfoStart) Then + (Tai_Marker(Current).Kind = mark_NoPropInfoStart) Then Begin While Assigned(Current) And ((Current.typ <> ait_Marker) Or - (Tai_Marker(Current).Kind <> NoPropInfoEnd)) Do + (Tai_Marker(Current).Kind <> mark_NoPropInfoEnd)) Do Current := Tai(Current.Next); End; Until Not(Assigned(Current)) Or (Current.typ <> ait_Marker) Or - (Tai_Marker(Current).Kind <> NoPropInfoEnd); + (Tai_Marker(Current).Kind <> mark_NoPropInfoEnd); Next := Current; If Assigned(Current) And Not((Current.typ In SkipInstr) or @@ -186,29 +186,29 @@ unit aoptbase; Current := Tai(Current.previous); While Assigned(Current) And (((Current.typ = ait_Marker) And - Not(Tai_Marker(Current).Kind in [AsmBlockEnd,NoPropInfoEnd])) or + Not(Tai_Marker(Current).Kind in [mark_AsmBlockEnd,mark_NoPropInfoEnd])) or (Current.typ In SkipInstr) or ((Current.typ = ait_label) And Not(Tai_Label(Current).labsym.is_used))) Do Current := Tai(Current.previous); If Assigned(Current) And (Current.typ = ait_Marker) And - (Tai_Marker(Current).Kind = NoPropInfoEnd) Then + (Tai_Marker(Current).Kind = mark_NoPropInfoEnd) Then Begin While Assigned(Current) And ((Current.typ <> ait_Marker) Or - (Tai_Marker(Current).Kind <> NoPropInfoStart)) Do + (Tai_Marker(Current).Kind <> mark_NoPropInfoStart)) Do Current := Tai(Current.previous); End; Until Not(Assigned(Current)) Or (Current.typ <> ait_Marker) Or - (Tai_Marker(Current).Kind <> NoPropInfoStart); + (Tai_Marker(Current).Kind <> mark_NoPropInfoStart); If Not(Assigned(Current)) or (Current.typ In SkipInstr) or ((Current.typ = ait_label) And Not(Tai_Label(Current).labsym.is_used)) or ((Current.typ = ait_Marker) And - (Tai_Marker(Current).Kind = AsmBlockEnd)) + (Tai_Marker(Current).Kind = mark_AsmBlockEnd)) Then Begin Last := Nil; diff --git a/compiler/aoptcs.pas b/compiler/aoptcs.pas index 460abd3c27..d50a57aaba 100644 --- a/compiler/aoptcs.pas +++ b/compiler/aoptcs.pas @@ -678,7 +678,7 @@ Begin { insert a marker noting that for the following instructions no PPaiProp's } { (containing optimizer info) have been generated, so GetNext/ } { LastInstruction will ignore them (it will use the original instructions) } - hp3 := New(Pai_Marker,Init(NoPropInfoStart)); + hp3 := New(Pai_Marker,Init(mark_NoPropInfoStart)); InsertLLItem(Pai(Current^.Previous), Current, hp3); { Prev is used to get the contents of the registers before the sequence } GetLastInstruction(Current, Prev); @@ -743,7 +743,7 @@ Begin End; { the end of the area where instructions without optimizer info can occur } - hp3 := New(Pai_Marker,Init(NoPropInfoEnd)); + hp3 := New(Pai_Marker,Init(mark_NoPropInfoEnd)); InsertLLItem(AsmL, Pai(Current^.Previous), Current, hp3); { if we found an instruction sequence that needs complete re-evaluation, } { process it } diff --git a/compiler/aoptobj.pas b/compiler/aoptobj.pas index 1a48964205..e7f1a8606f 100644 --- a/compiler/aoptobj.pas +++ b/compiler/aoptobj.pas @@ -233,7 +233,7 @@ Unit AoptObj; TAOptObj = class(TAoptBaseCpu) { the PAasmOutput list this optimizer instance works on } - AsmL: TAasmOutput; + AsmL: TAsmList; { The labelinfo record contains the addresses of the Tai objects } { that are labels, how many labels there are and the min and max } @@ -248,7 +248,7 @@ Unit AoptObj; { _BlockStart and _BlockEnd the start and the end of the block } { that has to be optimized and _LabelInfo a pointer to a } { TLabelInfo record } - Constructor create(_AsmL: TAasmOutput; _BlockStart, _BlockEnd: Tai; + Constructor create(_AsmL: TAsmList; _BlockStart, _BlockEnd: Tai; _LabelInfo: PLabelInfo); virtual; { processor independent methods } @@ -726,7 +726,7 @@ Unit AoptObj; { ***************************** TAoptObj ********************************** } { ************************************************************************* } - Constructor TAoptObj.create(_AsmL: TAasmOutput; _BlockStart, _BlockEnd: Tai; + Constructor TAoptObj.create(_AsmL: TAsmList; _BlockStart, _BlockEnd: Tai; _LabelInfo: PLabelInfo); Begin AsmL := _AsmL; @@ -782,19 +782,19 @@ Unit AoptObj; OldP := P; If (P.typ in SkipInstr) Or ((P.typ = ait_marker) And - (Tai_Marker(P).Kind = AsmBlockEnd)) Then + (Tai_Marker(P).Kind = mark_AsmBlockEnd)) Then GetNextInstruction(P, P) Else If ((P.Typ = Ait_Marker) And - (Tai_Marker(P).Kind = NoPropInfoStart)) Then - { a marker of the type NoPropInfoStart can't be the first instruction of a } + (Tai_Marker(P).Kind = mark_NoPropInfoStart)) Then + { a marker of the type mark_NoPropInfoStart can't be the first instruction of a } { paasmoutput list } GetNextInstruction(Tai(P.Previous),P); If (P.Typ = Ait_Marker) And - (Tai_Marker(P).Kind = AsmBlockStart) Then + (Tai_Marker(P).Kind = mark_AsmBlockStart) Then Begin P := Tai(P.Next); While (P.typ <> Ait_Marker) Or - (Tai_Marker(P).Kind <> AsmBlockEnd) Do + (Tai_Marker(P).Kind <> mark_AsmBlockEnd) Do P := Tai(P.Next) End; Until P = OldP; @@ -960,7 +960,7 @@ Unit AoptObj; insertllitem(asml,p1,p1.next,tai_comment.Create( strpnew('previous label inserted')))); {$endif finaldestdebug} - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); insertllitem(p1,p1.next,tai_label.Create(l)); tasmlabel(taicpu(hp).oper[0]^.ref^.symbol).decrefs; hp.oper[0]^.ref^.symbol := l; diff --git a/compiler/arm/aasmcpu.pas b/compiler/arm/aasmcpu.pas index a0d435a898..dfccad5ff9 100644 --- a/compiler/arm/aasmcpu.pas +++ b/compiler/arm/aasmcpu.pas @@ -234,7 +234,7 @@ uses function setcondition(i : taicpu;c : tasmcond) : taicpu; { inserts pc relative symbols at places where they are reachable } - procedure insertpcrelativedata(list,listtoinsert : taasmoutput); + procedure insertpcrelativedata(list,listtoinsert : TAsmList); procedure InitAsm; procedure DoneAsm; @@ -609,17 +609,17 @@ implementation end; - procedure insertpcrelativedata(list,listtoinsert : taasmoutput); + procedure insertpcrelativedata(list,listtoinsert : TAsmList); var curpos : longint; lastpos : longint; curop : longint; curtai : tai; curdatatai,hp : tai; - curdata : taasmoutput; + curdata : TAsmList; l : tasmlabel; begin - curdata:=taasmoutput.create; + curdata:=TAsmList.create; lastpos:=-1; curpos:=0; curtai:=tai(list.first); @@ -668,7 +668,7 @@ implementation begin lastpos:=curpos; hp:=tai(curtai.next); - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); curdata.insert(taicpu.op_sym(A_B,l)); curdata.concat(tai_label.create(l)); list.insertlistafter(curtai,curdata); diff --git a/compiler/arm/cgcpu.pas b/compiler/arm/cgcpu.pas index e95450285c..bad4941088 100644 --- a/compiler/arm/cgcpu.pas +++ b/compiler/arm/cgcpu.pas @@ -42,76 +42,76 @@ unit cgcpu; procedure init_register_allocators;override; procedure done_register_allocators;override; - procedure a_param_const(list : taasmoutput;size : tcgsize;a : aint;const paraloc : TCGPara);override; - procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const paraloc : TCGPara);override; - procedure a_paramaddr_ref(list : taasmoutput;const r : treference;const paraloc : TCGPara);override; + procedure a_param_const(list : TAsmList;size : tcgsize;a : aint;const paraloc : TCGPara);override; + procedure a_param_ref(list : TAsmList;size : tcgsize;const r : treference;const paraloc : TCGPara);override; + procedure a_paramaddr_ref(list : TAsmList;const r : treference;const paraloc : TCGPara);override; - procedure a_call_name(list : taasmoutput;const s : string);override; - procedure a_call_reg(list : taasmoutput;reg: tregister); override; + procedure a_call_name(list : TAsmList;const s : string);override; + procedure a_call_reg(list : TAsmList;reg: tregister); override; - procedure a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); override; - procedure a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; src, dst: TRegister); override; + procedure a_op_const_reg(list : TAsmList; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); override; + procedure a_op_reg_reg(list : TAsmList; Op: TOpCG; size: TCGSize; src, dst: TRegister); override; - procedure a_op_const_reg_reg(list: taasmoutput; op: TOpCg; + procedure a_op_const_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister); override; - procedure a_op_reg_reg_reg(list: taasmoutput; op: TOpCg; + procedure a_op_reg_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister); override; - procedure a_op_const_reg_reg_checkoverflow(list: taasmoutput; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation);override; - procedure a_op_reg_reg_reg_checkoverflow(list: taasmoutput; op: TOpCg; size: tcgsize; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation);override; + procedure a_op_const_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation);override; + procedure a_op_reg_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation);override; { move instructions } - procedure a_load_const_reg(list : taasmoutput; size: tcgsize; a : aint;reg : tregister);override; - procedure a_load_reg_ref(list : taasmoutput; fromsize, tosize: tcgsize; reg : tregister;const ref : treference);override; - procedure a_load_ref_reg(list : taasmoutput; fromsize, tosize : tcgsize;const Ref : treference;reg : tregister);override; - procedure a_load_reg_reg(list : taasmoutput; fromsize, tosize : tcgsize;reg1,reg2 : tregister);override; + procedure a_load_const_reg(list : TAsmList; size: tcgsize; a : aint;reg : tregister);override; + procedure a_load_reg_ref(list : TAsmList; fromsize, tosize: tcgsize; reg : tregister;const ref : treference);override; + procedure a_load_ref_reg(list : TAsmList; fromsize, tosize : tcgsize;const Ref : treference;reg : tregister);override; + procedure a_load_reg_reg(list : TAsmList; fromsize, tosize : tcgsize;reg1,reg2 : tregister);override; { fpu move instructions } - procedure a_loadfpu_reg_reg(list: taasmoutput; size: tcgsize; reg1, reg2: tregister); override; - procedure a_loadfpu_ref_reg(list: taasmoutput; size: tcgsize; const ref: treference; reg: tregister); override; - procedure a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: tregister; const ref: treference); override; + procedure a_loadfpu_reg_reg(list: TAsmList; size: tcgsize; reg1, reg2: tregister); override; + procedure a_loadfpu_ref_reg(list: TAsmList; size: tcgsize; const ref: treference; reg: tregister); override; + procedure a_loadfpu_reg_ref(list: TAsmList; size: tcgsize; reg: tregister; const ref: treference); override; - procedure a_paramfpu_ref(list : taasmoutput;size : tcgsize;const ref : treference;const paraloc : TCGPara);override; + procedure a_paramfpu_ref(list : TAsmList;size : tcgsize;const ref : treference;const paraloc : TCGPara);override; { comparison operations } - procedure a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; + procedure a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; l : tasmlabel);override; - procedure a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override; + procedure a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override; - procedure a_jmp_name(list : taasmoutput;const s : string); override; - procedure a_jmp_always(list : taasmoutput;l: tasmlabel); override; - procedure a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); override; + procedure a_jmp_name(list : TAsmList;const s : string); override; + procedure a_jmp_always(list : TAsmList;l: tasmlabel); override; + procedure a_jmp_flags(list : TAsmList;const f : TResFlags;l: tasmlabel); override; - procedure g_flags2reg(list: taasmoutput; size: TCgSize; const f: TResFlags; reg: TRegister); override; + procedure g_flags2reg(list: TAsmList; size: TCgSize; const f: TResFlags; reg: TRegister); override; - procedure g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean);override; - procedure g_proc_exit(list : taasmoutput;parasize : longint;nostackframe:boolean); override; + procedure g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean);override; + procedure g_proc_exit(list : TAsmList;parasize : longint;nostackframe:boolean); override; - procedure a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister);override; + procedure a_loadaddr_ref_reg(list : TAsmList;const ref : treference;r : tregister);override; - procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint);override; - procedure g_concatcopy_unaligned(list : taasmoutput;const source,dest : treference;len : aint);override; - procedure g_concatcopy_move(list : taasmoutput;const source,dest : treference;len : aint); - procedure g_concatcopy_internal(list : taasmoutput;const source,dest : treference;len : aint;aligned : boolean); + procedure g_concatcopy(list : TAsmList;const source,dest : treference;len : aint);override; + procedure g_concatcopy_unaligned(list : TAsmList;const source,dest : treference;len : aint);override; + procedure g_concatcopy_move(list : TAsmList;const source,dest : treference;len : aint); + procedure g_concatcopy_internal(list : TAsmList;const source,dest : treference;len : aint;aligned : boolean); - procedure g_overflowcheck(list: taasmoutput; const l: tlocation; def: tdef); override; - procedure g_overflowCheck_loc(List:TAasmOutput;const Loc:TLocation;def:TDef;ovloc : tlocation);override; + procedure g_overflowcheck(list: TAsmList; const l: tlocation; def: tdef); override; + procedure g_overflowCheck_loc(List:TAsmList;const Loc:TLocation;def:TDef;ovloc : tlocation);override; - procedure g_save_standard_registers(list : taasmoutput);override; - procedure g_restore_standard_registers(list : taasmoutput);override; + procedure g_save_standard_registers(list : TAsmList);override; + procedure g_restore_standard_registers(list : TAsmList);override; - procedure a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel); - procedure fixref(list : taasmoutput;var ref : treference); - procedure handle_load_store(list:taasmoutput;op: tasmop;oppostfix : toppostfix;reg:tregister;ref: treference); + procedure a_jmp_cond(list : TAsmList;cond : TOpCmp;l: tasmlabel); + procedure fixref(list : TAsmList;var ref : treference); + procedure handle_load_store(list:TAsmList;op: tasmop;oppostfix : toppostfix;reg:tregister;ref: treference); - procedure g_intf_wrapper(list: taasmoutput; procdef: tprocdef; const labelname: string; ioffset: longint);override; + procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);override; end; tcg64farm = class(tcg64f32) - procedure a_op64_reg_reg(list : taasmoutput;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64);override; - procedure a_op64_const_reg(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;reg : tregister64);override; - procedure a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64);override; - procedure a_op64_reg_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64);override; - procedure a_op64_const_reg_reg_checkoverflow(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation);override; - procedure a_op64_reg_reg_reg_checkoverflow(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation);override; + procedure a_op64_reg_reg(list : TAsmList;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64);override; + procedure a_op64_const_reg(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;reg : tregister64);override; + procedure a_op64_const_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64);override; + procedure a_op64_reg_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64);override; + procedure a_op64_const_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation);override; + procedure a_op64_reg_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation);override; end; const @@ -175,7 +175,7 @@ unit cgcpu; end; - procedure tcgarm.a_param_const(list : taasmoutput;size : tcgsize;a : aint;const paraloc : TCGPara); + procedure tcgarm.a_param_const(list : TAsmList;size : tcgsize;a : aint;const paraloc : TCGPara); var ref: treference; begin @@ -196,7 +196,7 @@ unit cgcpu; end; - procedure tcgarm.a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const paraloc : TCGPara); + procedure tcgarm.a_param_ref(list : TAsmList;size : tcgsize;const r : treference;const paraloc : TCGPara); var tmpref, ref: treference; location: pcgparalocation; @@ -244,7 +244,7 @@ unit cgcpu; end; - procedure tcgarm.a_paramaddr_ref(list : taasmoutput;const r : treference;const paraloc : TCGPara); + procedure tcgarm.a_paramaddr_ref(list : TAsmList;const r : treference;const paraloc : TCGPara); var ref: treference; tmpreg: tregister; @@ -268,9 +268,9 @@ unit cgcpu; end; - procedure tcgarm.a_call_name(list : taasmoutput;const s : string); + procedure tcgarm.a_call_name(list : TAsmList;const s : string); begin - list.concat(taicpu.op_sym(A_BL,objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); + list.concat(taicpu.op_sym(A_BL,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); { the compiler does not properly set this flag anymore in pass 1, and for now we only need it after pass 2 (I hope) (JM) @@ -281,7 +281,7 @@ unit cgcpu; end; - procedure tcgarm.a_call_reg(list : taasmoutput;reg: tregister); + procedure tcgarm.a_call_reg(list : TAsmList;reg: tregister); var r : tregister; begin @@ -297,13 +297,13 @@ unit cgcpu; end; - procedure tcgarm.a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); + procedure tcgarm.a_op_const_reg(list : TAsmList; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); begin a_op_const_reg_reg(list,op,size,a,reg,reg); end; - procedure tcgarm.a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; src, dst: TRegister); + procedure tcgarm.a_op_reg_reg(list : TAsmList; Op: TOpCG; size: TCGSize; src, dst: TRegister); begin case op of OP_NEG: @@ -330,7 +330,7 @@ unit cgcpu; A_NONE,A_NONE,A_NONE,A_SUB,A_EOR); - procedure tcgarm.a_op_const_reg_reg(list: taasmoutput; op: TOpCg; + procedure tcgarm.a_op_const_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister); var ovloc : tlocation; @@ -339,7 +339,7 @@ unit cgcpu; end; - procedure tcgarm.a_op_reg_reg_reg(list: taasmoutput; op: TOpCg; + procedure tcgarm.a_op_reg_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister); var ovloc : tlocation; @@ -348,7 +348,7 @@ unit cgcpu; end; - procedure tcgarm.a_op_const_reg_reg_checkoverflow(list: taasmoutput; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation); + procedure tcgarm.a_op_const_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation); var shift : byte; tmpreg : tregister; @@ -455,7 +455,7 @@ unit cgcpu; end; - procedure tcgarm.a_op_reg_reg_reg_checkoverflow(list: taasmoutput; op: TOpCg; size: tcgsize; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation); + procedure tcgarm.a_op_reg_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation); var so : tshifterop; tmpreg,overflowreg : tregister; @@ -550,7 +550,7 @@ unit cgcpu; end; - procedure tcgarm.a_load_const_reg(list : taasmoutput; size: tcgsize; a : aint;reg : tregister); + procedure tcgarm.a_load_const_reg(list : TAsmList; size: tcgsize; a : aint;reg : tregister); var imm_shift : byte; l : tasmlabel; @@ -566,7 +566,7 @@ unit cgcpu; begin reference_reset(hr); - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); cg.a_label(current_procinfo.aktlocaldata,l); hr.symboldata:=current_procinfo.aktlocaldata.last; current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(longint(a))); @@ -577,7 +577,7 @@ unit cgcpu; end; - procedure tcgarm.handle_load_store(list:taasmoutput;op: tasmop;oppostfix : toppostfix;reg:tregister;ref: treference); + procedure tcgarm.handle_load_store(list:TAsmList;op: tasmop;oppostfix : toppostfix;reg:tregister;ref: treference); var tmpreg : tregister; tmpref : treference; @@ -632,7 +632,7 @@ unit cgcpu; tmpreg:=getintregister(list,OS_INT); if assigned(ref.symbol) then begin - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); cg.a_label(current_procinfo.aktlocaldata,l); tmpref.symboldata:=current_procinfo.aktlocaldata.last; @@ -720,7 +720,7 @@ unit cgcpu; end; - procedure tcgarm.a_load_reg_ref(list : taasmoutput; fromsize, tosize: tcgsize; reg : tregister;const ref : treference); + procedure tcgarm.a_load_reg_ref(list : TAsmList; fromsize, tosize: tcgsize; reg : tregister;const ref : treference); var oppostfix:toppostfix; begin @@ -742,7 +742,7 @@ unit cgcpu; end; - procedure tcgarm.a_load_ref_reg(list : taasmoutput; fromsize, tosize : tcgsize;const Ref : treference;reg : tregister); + procedure tcgarm.a_load_ref_reg(list : TAsmList; fromsize, tosize : tcgsize;const Ref : treference;reg : tregister); var oppostfix:toppostfix; begin @@ -766,7 +766,7 @@ unit cgcpu; end; - procedure tcgarm.a_load_reg_reg(list : taasmoutput; fromsize, tosize : tcgsize;reg1,reg2 : tregister); + procedure tcgarm.a_load_reg_reg(list : TAsmList; fromsize, tosize : tcgsize;reg1,reg2 : tregister); var instr: taicpu; so : tshifterop; @@ -834,7 +834,7 @@ unit cgcpu; end; - procedure tcgarm.a_paramfpu_ref(list : taasmoutput;size : tcgsize;const ref : treference;const paraloc : TCGPara); + procedure tcgarm.a_paramfpu_ref(list : TAsmList;size : tcgsize;const ref : treference;const paraloc : TCGPara); var href,href2 : treference; hloc : pcgparalocation; @@ -862,13 +862,13 @@ unit cgcpu; end; - procedure tcgarm.a_loadfpu_reg_reg(list: taasmoutput; size: tcgsize; reg1, reg2: tregister); + procedure tcgarm.a_loadfpu_reg_reg(list: TAsmList; size: tcgsize; reg1, reg2: tregister); begin list.concat(setoppostfix(taicpu.op_reg_reg(A_MVF,reg2,reg1),cgsize2fpuoppostfix[size])); end; - procedure tcgarm.a_loadfpu_ref_reg(list: taasmoutput; size: tcgsize; const ref: treference; reg: tregister); + procedure tcgarm.a_loadfpu_ref_reg(list: TAsmList; size: tcgsize; const ref: treference; reg: tregister); var oppostfix:toppostfix; begin @@ -886,7 +886,7 @@ unit cgcpu; end; - procedure tcgarm.a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: tregister; const ref: treference); + procedure tcgarm.a_loadfpu_reg_ref(list: TAsmList; size: tcgsize; reg: tregister; const ref: treference); var oppostfix:toppostfix; begin @@ -905,7 +905,7 @@ unit cgcpu; { comparison operations } - procedure tcgarm.a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; + procedure tcgarm.a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; l : tasmlabel); var tmpreg : tregister; @@ -927,26 +927,26 @@ unit cgcpu; end; - procedure tcgarm.a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); + procedure tcgarm.a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); begin list.concat(taicpu.op_reg_reg(A_CMP,reg2,reg1)); a_jmp_cond(list,cmp_op,l); end; - procedure tcgarm.a_jmp_name(list : taasmoutput;const s : string); + procedure tcgarm.a_jmp_name(list : TAsmList;const s : string); begin - list.concat(taicpu.op_sym(A_B,objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); + list.concat(taicpu.op_sym(A_B,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); end; - procedure tcgarm.a_jmp_always(list : taasmoutput;l: tasmlabel); + procedure tcgarm.a_jmp_always(list : TAsmList;l: tasmlabel); begin list.concat(taicpu.op_sym(A_B,l)); end; - procedure tcgarm.a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); + procedure tcgarm.a_jmp_flags(list : TAsmList;const f : TResFlags;l: tasmlabel); var ai : taicpu; begin @@ -956,7 +956,7 @@ unit cgcpu; end; - procedure tcgarm.g_flags2reg(list: taasmoutput; size: TCgSize; const f: TResFlags; reg: TRegister); + procedure tcgarm.g_flags2reg(list: TAsmList; size: TCgSize; const f: TResFlags; reg: TRegister); var ai : taicpu; begin @@ -965,7 +965,7 @@ unit cgcpu; end; - procedure tcgarm.g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean); + procedure tcgarm.g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean); var ref : treference; shift : byte; @@ -1034,7 +1034,7 @@ unit cgcpu; end; - procedure tcgarm.g_proc_exit(list : taasmoutput;parasize : longint;nostackframe:boolean); + procedure tcgarm.g_proc_exit(list : TAsmList;parasize : longint;nostackframe:boolean); var ref : treference; firstfloatreg,lastfloatreg, @@ -1087,7 +1087,7 @@ unit cgcpu; end; - procedure tcgarm.a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister); + procedure tcgarm.a_loadaddr_ref_reg(list : TAsmList;const ref : treference;r : tregister); var b : byte; tmpref : treference; @@ -1147,7 +1147,7 @@ unit cgcpu; end; - procedure tcgarm.fixref(list : taasmoutput;var ref : treference); + procedure tcgarm.fixref(list : TAsmList;var ref : treference); var tmpreg : tregister; tmpref : treference; @@ -1165,7 +1165,7 @@ unit cgcpu; } { create consts entry } reference_reset(tmpref); - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); cg.a_label(current_procinfo.aktlocaldata,l); tmpref.symboldata:=current_procinfo.aktlocaldata.last; @@ -1203,7 +1203,7 @@ unit cgcpu; end; - procedure tcgarm.g_concatcopy_move(list : taasmoutput;const source,dest : treference;len : aint); + procedure tcgarm.g_concatcopy_move(list : TAsmList;const source,dest : treference;len : aint); var paraloc1,paraloc2,paraloc3 : TCGPara; begin @@ -1233,7 +1233,7 @@ unit cgcpu; end; - procedure tcgarm.g_concatcopy_internal(list : taasmoutput;const source,dest : treference;len : aint;aligned : boolean); + procedure tcgarm.g_concatcopy_internal(list : TAsmList;const source,dest : treference;len : aint;aligned : boolean); var srcref,dstref:treference; srcreg,destreg,countreg,r:tregister; @@ -1247,7 +1247,7 @@ unit cgcpu; var l : tasmlabel; begin - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); a_load_const_reg(list,OS_INT,count,countreg); cg.a_label(list,l); srcref.addressmode:=AM_POSTINDEXED; @@ -1336,19 +1336,19 @@ unit cgcpu; end; - procedure tcgarm.g_concatcopy_unaligned(list : taasmoutput;const source,dest : treference;len : aint); + procedure tcgarm.g_concatcopy_unaligned(list : TAsmList;const source,dest : treference;len : aint); begin g_concatcopy_internal(list,source,dest,len,false); end; - procedure tcgarm.g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint); + procedure tcgarm.g_concatcopy(list : TAsmList;const source,dest : treference;len : aint); begin g_concatcopy_internal(list,source,dest,len,true); end; - procedure tcgarm.g_overflowCheck(list : taasmoutput;const l : tlocation;def : tdef); + procedure tcgarm.g_overflowCheck(list : TAsmList;const l : tlocation;def : tdef); var ovloc : tlocation; begin @@ -1357,7 +1357,7 @@ unit cgcpu; end; - procedure tcgarm.g_overflowCheck_loc(List:TAasmOutput;const Loc:TLocation;def:TDef;ovloc : tlocation); + procedure tcgarm.g_overflowCheck_loc(List:TAsmList;const Loc:TLocation;def:TDef;ovloc : tlocation); var hl : tasmlabel; ai:TAiCpu; @@ -1365,7 +1365,7 @@ unit cgcpu; begin if not(cs_check_overflow in aktlocalswitches) then exit; - objectlibrary.getjumplabel(hl); + current_asmdata.getjumplabel(hl); case ovloc.loc of LOC_VOID: begin @@ -1396,19 +1396,19 @@ unit cgcpu; end; - procedure tcgarm.g_save_standard_registers(list : taasmoutput); + procedure tcgarm.g_save_standard_registers(list : TAsmList); begin { this work is done in g_proc_entry } end; - procedure tcgarm.g_restore_standard_registers(list : taasmoutput); + procedure tcgarm.g_restore_standard_registers(list : TAsmList); begin { this work is done in g_proc_exit } end; - procedure tcgarm.a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel); + procedure tcgarm.a_jmp_cond(list : TAsmList;cond : TOpCmp;l: tasmlabel); var ai : taicpu; begin @@ -1419,7 +1419,7 @@ unit cgcpu; end; - procedure tcgarm.g_intf_wrapper(list: taasmoutput; procdef: tprocdef; const labelname: string; ioffset: longint); + procedure tcgarm.g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint); procedure loadvmttor12; var @@ -1478,13 +1478,13 @@ unit cgcpu; end { case 0 } else - list.concat(taicpu.op_sym(A_B,objectlibrary.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); + list.concat(taicpu.op_sym(A_B,current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); list.concat(Tai_symbol_end.Createname(labelname)); end; - procedure tcg64farm.a_op64_reg_reg(list : taasmoutput;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64); + procedure tcg64farm.a_op64_reg_reg(list : TAsmList;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64); var tmpreg : tregister; begin @@ -1505,13 +1505,13 @@ unit cgcpu; end; - procedure tcg64farm.a_op64_const_reg(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;reg : tregister64); + procedure tcg64farm.a_op64_const_reg(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;reg : tregister64); begin a_op64_const_reg_reg(list,op,size,value,reg,reg); end; - procedure tcg64farm.a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64); + procedure tcg64farm.a_op64_const_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64); var ovloc : tlocation; begin @@ -1519,7 +1519,7 @@ unit cgcpu; end; - procedure tcg64farm.a_op64_reg_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64); + procedure tcg64farm.a_op64_reg_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64); var ovloc : tlocation; begin @@ -1527,7 +1527,7 @@ unit cgcpu; end; - procedure tcg64farm.a_op64_const_reg_reg_checkoverflow(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation); + procedure tcg64farm.a_op64_const_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation); var tmpreg : tregister; b : byte; @@ -1651,7 +1651,7 @@ unit cgcpu; end; - procedure tcg64farm.a_op64_reg_reg_reg_checkoverflow(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation); + procedure tcg64farm.a_op64_reg_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation); var op1,op2:TAsmOp; begin diff --git a/compiler/arm/narmadd.pas b/compiler/arm/narmadd.pas index 5b53c9fd29..c7def478b1 100644 --- a/compiler/arm/narmadd.pas +++ b/compiler/arm/narmadd.pas @@ -48,7 +48,7 @@ interface symconst,symdef,paramgr, aasmbase,aasmtai,aasmcpu,defutil,htypechk, cgbase,cgutils,cgcpu, - cpuinfo,pass_1,pass_2,regvars, + cpuinfo,pass_1,pass_2,regvars,procinfo, cpupara, ncon,nset,nadd, ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32; @@ -147,8 +147,8 @@ interface { force fpureg as location, left right doesn't matter as both will be in a fpureg } - location_force_fpureg(exprasmlist,left.location,true); - location_force_fpureg(exprasmlist,right.location,(left.location.loc<>LOC_CFPUREGISTER)); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,right.location,(left.location.loc<>LOC_CFPUREGISTER)); location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def)); if left.location.loc<>LOC_CFPUREGISTER then @@ -156,7 +156,7 @@ interface else location.register:=right.location.register; - exprasmlist.concat(setoppostfix(taicpu.op_reg_reg_reg(op, + current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(op, location.register,left.location.register,right.location.register), cgsize2fpuoppostfix[def_cgsize(resulttype.def)])); @@ -179,18 +179,18 @@ interface { force fpureg as location, left right doesn't matter as both will be in a fpureg } - location_force_fpureg(exprasmlist,left.location,true); - location_force_fpureg(exprasmlist,right.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,right.location,true); location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=getresflags(true); if nodetype in [equaln,unequaln] then - exprasmlist.concat(setoppostfix(taicpu.op_reg_reg(A_CMF, + current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMF, left.location.register,right.location.register), cgsize2fpuoppostfix[def_cgsize(resulttype.def)])) else - exprasmlist.concat(setoppostfix(taicpu.op_reg_reg(A_CMFE, + current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMFE, left.location.register,right.location.register), cgsize2fpuoppostfix[def_cgsize(resulttype.def)])); @@ -212,12 +212,12 @@ interface case nodetype of equaln: begin - exprasmlist.concat(taicpu.op_reg_reg(A_CMP,left.location.register,right.location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register,right.location.register)); location.resflags:=F_EQ; end; unequaln: begin - exprasmlist.concat(taicpu.op_reg_reg(A_CMP,left.location.register,right.location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register,right.location.register)); location.resflags:=F_NE; end; lten, @@ -228,9 +228,9 @@ interface ((nf_swaped in flags) and (nodetype = gten)) then swapleftright; - tmpreg:=cg.getintregister(exprasmlist,location.size); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_AND,tmpreg,left.location.register,right.location.register)); - exprasmlist.concat(taicpu.op_reg_reg(A_CMP,tmpreg,right.location.register)); + tmpreg:=cg.getintregister(current_asmdata.CurrAsmList,location.size); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_AND,tmpreg,left.location.register,right.location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,tmpreg,right.location.register)); location.resflags:=F_EQ; end; else @@ -256,22 +256,22 @@ interface begin location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=getresflags(unsigned); - exprasmlist.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reghi,right.location.register64.reghi)); - exprasmlist.concat(setcondition(taicpu.op_reg_reg(A_CMP,left.location.register64.reglo,right.location.register64.reglo),C_EQ)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reghi,right.location.register64.reghi)); + current_asmdata.CurrAsmList.concat(setcondition(taicpu.op_reg_reg(A_CMP,left.location.register64.reglo,right.location.register64.reglo),C_EQ)); end else { operation requiring proper N, Z and V flags ? } begin location_reset(location,LOC_JUMP,OS_NO); - exprasmlist.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reghi,right.location.register64.reghi)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reghi,right.location.register64.reghi)); { the jump the sequence is a little bit hairy } case nodetype of ltn,gtn: begin - cg.a_jmp_flags(exprasmlist,getresflags(false),truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(false),current_procinfo.CurrTrueLabel); { cheat a little bit for the negative test } toggleflag(nf_swaped); - cg.a_jmp_flags(exprasmlist,getresflags(false),falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(false),current_procinfo.CurrFalseLabel); toggleflag(nf_swaped); end; lten,gten: @@ -281,21 +281,21 @@ interface nodetype:=ltn else nodetype:=gtn; - cg.a_jmp_flags(exprasmlist,getresflags(unsigned),truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrTrueLabel); { cheat for the negative test } if nodetype=ltn then nodetype:=gtn else nodetype:=ltn; - cg.a_jmp_flags(exprasmlist,getresflags(unsigned),falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrFalseLabel); nodetype:=oldnodetype; end; end; - exprasmlist.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reglo,right.location.register64.reglo)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reglo,right.location.register64.reglo)); { the comparisaion of the low dword have to be always unsigned! } - cg.a_jmp_flags(exprasmlist,getresflags(true),truelabel); - cg.a_jmp_always(exprasmlist,falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(true),current_procinfo.CurrTrueLabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); end; end; @@ -315,17 +315,17 @@ interface if right.location.loc = LOC_CONSTANT then begin if is_shifter_const(right.location.value,b) then - exprasmlist.concat(taicpu.op_reg_const(A_CMP,left.location.register,right.location.value)) + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMP,left.location.register,right.location.value)) else begin - tmpreg:=cg.getintregister(exprasmlist,location.size); - cg.a_load_const_reg(exprasmlist,OS_INT, + tmpreg:=cg.getintregister(current_asmdata.CurrAsmList,location.size); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT, right.location.value,tmpreg); - exprasmlist.concat(taicpu.op_reg_reg(A_CMP,left.location.register,tmpreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register,tmpreg)); end; end else - exprasmlist.concat(taicpu.op_reg_reg(A_CMP,left.location.register,right.location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register,right.location.register)); location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=getresflags(unsigned); diff --git a/compiler/arm/narmcnv.pas b/compiler/arm/narmcnv.pas index 6fb0fdc62e..462f43d697 100644 --- a/compiler/arm/narmcnv.pas +++ b/compiler/arm/narmcnv.pas @@ -61,7 +61,7 @@ implementation symconst,symdef,aasmbase,aasmtai, defutil, cgbase,cgutils, - pass_1,pass_2, + pass_1,pass_2,procinfo, ncon,ncal, ncgutil, cpubase,aasmcpu, @@ -155,11 +155,11 @@ implementation instr : taicpu; begin location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def)); - location_force_reg(exprasmlist,left.location,OS_32,true); - location.register:=cg.getfpuregister(exprasmlist,location.size); + location_force_reg(current_asmdata.CurrAsmList,left.location,OS_32,true); + location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); instr:=taicpu.op_reg_reg(A_FLT,location.register,left.location.register); instr.oppostfix:=cgsize2fpuoppostfix[def_cgsize(resulttype.def)]; - exprasmlist.concat(instr); + current_asmdata.CurrAsmList.concat(instr); end; @@ -168,12 +168,12 @@ implementation hregister : tregister; href : treference; resflags : tresflags; - hlabel,oldtruelabel,oldfalselabel : tasmlabel; + hlabel,oldTrueLabel,oldFalseLabel : tasmlabel; begin - oldtruelabel:=truelabel; - oldfalselabel:=falselabel; - objectlibrary.getjumplabel(truelabel); - objectlibrary.getjumplabel(falselabel); + oldTrueLabel:=current_procinfo.CurrTrueLabel; + oldFalseLabel:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); secondpass(left); if codegenerror then exit; @@ -184,8 +184,8 @@ implementation (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then begin location_copy(location,left.location); - truelabel:=oldtruelabel; - falselabel:=oldfalselabel; + current_procinfo.CurrTrueLabel:=oldTrueLabel; + current_procinfo.CurrFalseLabel:=oldFalseLabel; exit; end; @@ -197,19 +197,19 @@ implementation begin if left.location.size in [OS_64,OS_S64] then begin - hregister:=cg.getintregister(exprasmlist,OS_INT); - cg.a_load_ref_reg(exprasmlist,OS_32,OS_32,left.location.reference,hregister); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_32,OS_32,left.location.reference,hregister); href:=left.location.reference; inc(href.offset,4); tcgarm(cg).cgsetflags:=true; - cg.a_op_ref_reg(exprasmlist,OP_OR,OS_32,href,hregister); + cg.a_op_ref_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,href,hregister); tcgarm(cg).cgsetflags:=false; end else begin - location_force_reg(exprasmlist,left.location,left.location.size,true); + location_force_reg(current_asmdata.CurrAsmList,left.location,left.location.size,true); tcgarm(cg).cgsetflags:=true; - cg.a_op_reg_reg(exprasmlist,OP_OR,left.location.size,left.location.register,left.location.register); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_OR,left.location.size,left.location.register,left.location.register); tcgarm(cg).cgsetflags:=false; end; end; @@ -221,31 +221,31 @@ implementation begin if left.location.size in [OS_64,OS_S64] then begin - hregister:=cg.getintregister(exprasmlist,OS_32); - cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,left.location.register64.reglo,hregister); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_32,OS_32,left.location.register64.reglo,hregister); tcgarm(cg).cgsetflags:=true; - cg.a_op_reg_reg(exprasmlist,OP_OR,OS_32,left.location.register64.reghi,hregister); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,left.location.register64.reghi,hregister); tcgarm(cg).cgsetflags:=false; end else begin tcgarm(cg).cgsetflags:=true; - cg.a_op_reg_reg(exprasmlist,OP_OR,left.location.size,left.location.register,left.location.register); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_OR,left.location.size,left.location.register,left.location.register); tcgarm(cg).cgsetflags:=false; end; end; LOC_JUMP : begin - hregister:=cg.getintregister(exprasmlist,OS_INT); - objectlibrary.getjumplabel(hlabel); - cg.a_label(exprasmlist,truelabel); - cg.a_load_const_reg(exprasmlist,OS_INT,1,hregister); - cg.a_jmp_always(exprasmlist,hlabel); - cg.a_label(exprasmlist,falselabel); - cg.a_load_const_reg(exprasmlist,OS_INT,0,hregister); - cg.a_label(exprasmlist,hlabel); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + current_asmdata.getjumplabel(hlabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT,1,hregister); + cg.a_jmp_always(current_asmdata.CurrAsmList,hlabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT,0,hregister); + cg.a_label(current_asmdata.CurrAsmList,hlabel); tcgarm(cg).cgsetflags:=true; - cg.a_op_reg_reg(exprasmlist,OP_OR,OS_INT,hregister,hregister); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_INT,hregister,hregister); tcgarm(cg).cgsetflags:=false; end; else @@ -253,10 +253,10 @@ implementation end; { load flags to register } location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def)); - location.register:=cg.getintregister(exprasmlist,location.size); - cg.g_flags2reg(exprasmlist,location.size,resflags,location.register); - truelabel:=oldtruelabel; - falselabel:=oldfalselabel; + location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size); + cg.g_flags2reg(current_asmdata.CurrAsmList,location.size,resflags,location.register); + current_procinfo.CurrTrueLabel:=oldTrueLabel; + current_procinfo.CurrFalseLabel:=oldFalseLabel; end; diff --git a/compiler/arm/narmcon.pas b/compiler/arm/narmcon.pas index b37b240b4b..049268cc90 100644 --- a/compiler/arm/narmcon.pas +++ b/compiler/arm/narmcon.pas @@ -70,7 +70,7 @@ interface { const already used ? } if not assigned(lab_real) then begin - objectlibrary.getjumplabel(lastlabel); + current_asmdata.getjumplabel(lastlabel); lab_real:=lastlabel; current_procinfo.aktlocaldata.concat(Tai_label.Create(lastlabel)); location.reference.symboldata:=current_procinfo.aktlocaldata.last; @@ -81,7 +81,7 @@ interface { range checking? } if ((cs_check_range in aktlocalswitches) or (cs_check_overflow in aktlocalswitches)) and - (tai_real_32bit(asmlist[al_typedconsts].last).value=double(MathInf)) then + (tai_real_32bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then Message(parser_e_range_check_error); end; @@ -95,7 +95,7 @@ interface { range checking? } if ((cs_check_range in aktlocalswitches) or (cs_check_overflow in aktlocalswitches)) and - (tai_real_64bit(asmlist[al_typedconsts].last).value=double(MathInf)) then + (tai_real_64bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then Message(parser_e_range_check_error); end; @@ -106,7 +106,7 @@ interface { range checking? } if ((cs_check_range in aktlocalswitches) or (cs_check_overflow in aktlocalswitches)) and - (tai_real_80bit(asmlist[al_typedconsts].last).value=double(MathInf)) then + (tai_real_80bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then Message(parser_e_range_check_error); end; {$ifdef cpufloat128} @@ -117,7 +117,7 @@ interface { range checking? } if ((cs_check_range in aktlocalswitches) or (cs_check_overflow in aktlocalswitches)) and - (tai_real_128bit(asmlist[al_typedconsts].last).value=double(MathInf)) then + (tai_real_128bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then Message(parser_e_range_check_error); end; {$endif cpufloat128} diff --git a/compiler/arm/narminl.pas b/compiler/arm/narminl.pas index ab9453c24c..51324229f9 100644 --- a/compiler/arm/narminl.pas +++ b/compiler/arm/narminl.pas @@ -73,11 +73,11 @@ implementation procedure tarminlinenode.load_fpu_location; begin secondpass(left); - location_force_fpureg(exprasmlist,left.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); location_copy(location,left.location); if left.location.loc=LOC_CFPUREGISTER then begin - location.register:=cg.getfpuregister(exprasmlist,location.size); + location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); location.loc := LOC_FPUREGISTER; end; end; @@ -165,21 +165,21 @@ implementation procedure tarminlinenode.second_abs_real; begin load_fpu_location; - exprasmlist.concat(setoppostfix(taicpu.op_reg_reg(A_ABS,location.register,location.register),get_fpu_postfix(resulttype.def))); + current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_ABS,location.register,location.register),get_fpu_postfix(resulttype.def))); end; procedure tarminlinenode.second_sqr_real; begin load_fpu_location; - exprasmlist.concat(setoppostfix(taicpu.op_reg_reg_reg(A_MUF,location.register,left.location.register,left.location.register),get_fpu_postfix(resulttype.def))); + current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(A_MUF,location.register,left.location.register,left.location.register),get_fpu_postfix(resulttype.def))); end; procedure tarminlinenode.second_sqrt_real; begin load_fpu_location; - exprasmlist.concat(setoppostfix(taicpu.op_reg_reg(A_SQT,location.register,location.register),get_fpu_postfix(resulttype.def))); + current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_SQT,location.register,location.register),get_fpu_postfix(resulttype.def))); end; @@ -187,27 +187,27 @@ implementation procedure tarminlinenode.second_arctan_real; begin load_fpu_location; - exprasmlist.concat(setoppostfix(taicpu.op_reg_reg(A_ATN,location.register,location.register),get_fpu_postfix(resulttype.def))); + current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_ATN,location.register,location.register),get_fpu_postfix(resulttype.def))); end; procedure tarminlinenode.second_ln_real; begin load_fpu_location; - exprasmlist.concat(setoppostfix(taicpu.op_reg_reg(A_LGN,location.register,location.register),get_fpu_postfix(resulttype.def))); + current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_LGN,location.register,location.register),get_fpu_postfix(resulttype.def))); end; procedure tarminlinenode.second_cos_real; begin load_fpu_location; - exprasmlist.concat(setoppostfix(taicpu.op_reg_reg(A_COS,location.register,location.register),get_fpu_postfix(resulttype.def))); + current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_COS,location.register,location.register),get_fpu_postfix(resulttype.def))); end; procedure tarminlinenode.second_sin_real; begin load_fpu_location; - exprasmlist.concat(setoppostfix(taicpu.op_reg_reg(A_SIN,location.register,location.register),get_fpu_postfix(resulttype.def))); + current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_SIN,location.register,location.register),get_fpu_postfix(resulttype.def))); end; } diff --git a/compiler/arm/narmmat.pas b/compiler/arm/narmmat.pas index 884ff77a28..3ddaa177ee 100644 --- a/compiler/arm/narmmat.pas +++ b/compiler/arm/narmmat.pas @@ -48,7 +48,7 @@ implementation aasmbase,aasmcpu,aasmtai, defutil, cgbase,cgobj,cgutils, - pass_1,pass_2, + pass_1,pass_2,procinfo, ncon, cpubase,cpuinfo, ncgutil,cgcpu,cg64f32,rgobj; @@ -67,14 +67,14 @@ implementation } if left.expectloc=LOC_JUMP then begin - hl:=truelabel; - truelabel:=falselabel; - falselabel:=hl; + hl:=current_procinfo.CurrTrueLabel; + current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel; + current_procinfo.CurrFalseLabel:=hl; secondpass(left); - maketojumpbool(exprasmlist,left,lr_load_regvars); - hl:=truelabel; - truelabel:=falselabel; - falselabel:=hl; + maketojumpbool(current_asmdata.CurrAsmList,left,lr_load_regvars); + hl:=current_procinfo.CurrTrueLabel; + current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel; + current_procinfo.CurrFalseLabel:=hl; location.loc:=LOC_JUMP; end else @@ -88,8 +88,8 @@ implementation end; LOC_REGISTER,LOC_CREGISTER,LOC_REFERENCE,LOC_CREFERENCE : begin - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),true); - exprasmlist.concat(taicpu.op_reg_const(A_CMP,left.location.register,0)); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMP,left.location.register,0)); location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=F_EQ; end; @@ -107,9 +107,9 @@ implementation begin secondpass(left); location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def)); - location_force_fpureg(exprasmlist,left.location,false); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,false); location:=left.location; - exprasmlist.concat(setoppostfix(taicpu.op_reg_reg_const(A_RSF, + current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_const(A_RSF, location.register,left.location.register,0), cgsize2fpuoppostfix[def_cgsize(resulttype.def)])); end; diff --git a/compiler/arm/raarm.pas b/compiler/arm/raarm.pas index 0b22d8a41e..dbf9d9d5c0 100644 --- a/compiler/arm/raarm.pas +++ b/compiler/arm/raarm.pas @@ -36,7 +36,7 @@ unit raarm; TARMInstruction=class(TInstruction) oppostfix : toppostfix; - function ConcatInstruction(p:TAAsmoutput) : tai;override; + function ConcatInstruction(p:TAsmList) : tai;override; end; implementation @@ -44,7 +44,7 @@ unit raarm; uses aasmcpu; - function TARMInstruction.ConcatInstruction(p:TAAsmoutput) : tai; + function TARMInstruction.ConcatInstruction(p:TAsmList) : tai; begin result:=inherited ConcatInstruction(p); (result as taicpu).oppostfix:=oppostfix; diff --git a/compiler/arm/rgcpu.pas b/compiler/arm/rgcpu.pas index a522a4f38c..df47b33694 100644 --- a/compiler/arm/rgcpu.pas +++ b/compiler/arm/rgcpu.pas @@ -35,8 +35,8 @@ unit rgcpu; type trgcpu = class(trgobj) - procedure do_spill_read(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister);override; - procedure do_spill_written(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister);override; + procedure do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);override; + procedure do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);override; end; trgintcpu = class(trgcpu) @@ -51,20 +51,20 @@ unit rgcpu; procinfo; - procedure trgcpu.do_spill_read(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister); + procedure trgcpu.do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister); var helpins: tai; tmpref : treference; - helplist : taasmoutput; + helplist : TAsmList; l : tasmlabel; hreg : tregister; begin if abs(spilltemp.offset)>4095 then begin - helplist:=taasmoutput.create; + helplist:=TAsmList.create; reference_reset(tmpref); { create consts entry } - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); cg.a_label(current_procinfo.aktlocaldata,l); tmpref.symboldata:=current_procinfo.aktlocaldata.last; @@ -99,20 +99,20 @@ unit rgcpu; end; - procedure trgcpu.do_spill_written(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister); + procedure trgcpu.do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister); var helpins: tai; tmpref : treference; - helplist : taasmoutput; + helplist : TAsmList; l : tasmlabel; hreg : tregister; begin if abs(spilltemp.offset)>4095 then begin - helplist:=taasmoutput.create; + helplist:=TAsmList.create; reference_reset(tmpref); { create consts entry } - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); cg.a_label(current_procinfo.aktlocaldata,l); tmpref.symboldata:=current_procinfo.aktlocaldata.last; diff --git a/compiler/assemble.pas b/compiler/assemble.pas index 868a34d7e6..98fdc6d578 100644 --- a/compiler/assemble.pas +++ b/compiler/assemble.pas @@ -116,7 +116,7 @@ interface {# This routine should be overriden for each assembler, it is used to actually write the abstract assembler stream to file.} - procedure WriteTree(p:TAAsmoutput);virtual; + procedure WriteTree(p:TAsmList);virtual; {# This routine should be overriden for each assembler, it is used to actually write all the different abstract assembler streams @@ -135,10 +135,10 @@ interface FCObjOutput : TObjOutputclass; { the aasmoutput lists that need to be processed } lists : byte; - list : array[1..maxoutputlists] of TAAsmoutput; + list : array[1..maxoutputlists] of TAsmList; { current processing } currlistidx : byte; - currlist : TAAsmoutput; + currlist : TAsmList; procedure convertstab(p:pchar); function MaybeNextList(var hp:Tai):boolean; function TreePass0(hp:Tai):Tai; @@ -641,7 +641,7 @@ Implementation end; - procedure TExternalAssembler.WriteTree(p:TAAsmoutput); + procedure TExternalAssembler.WriteTree(p:TAsmList); begin end; @@ -1030,9 +1030,9 @@ Implementation if SmartAsm then break; ait_marker : - if tai_marker(hp).kind=InlineStart then + if tai_marker(hp).kind=mark_InlineStart then inc(InlineLevel) - else if tai_marker(hp).kind=InlineEnd then + else if tai_marker(hp).kind=mark_InlineEnd then dec(InlineLevel); end; hp:=Tai(hp.next); @@ -1139,9 +1139,9 @@ Implementation if SmartAsm then break; ait_marker : - if tai_marker(hp).kind=InlineStart then + if tai_marker(hp).kind=mark_InlineStart then inc(InlineLevel) - else if tai_marker(hp).kind=InlineEnd then + else if tai_marker(hp).kind=mark_InlineEnd then dec(InlineLevel); end; hp:=Tai(hp.next); @@ -1336,29 +1336,29 @@ Implementation procedure TInternalAssembler.MakeObject; - var to_do:set of Tasmlist; - i:Tasmlist; + var to_do:set of TasmlistType; + i:TasmlistType; {$ifdef MEMDEBUG} d : tmemdebug; {$endif} - procedure addlist(p:TAAsmoutput); + procedure addlist(p:TAsmList); begin inc(lists); list[lists]:=p; end; begin - to_do:=[low(Tasmlist)..high(Tasmlist)]; + to_do:=[low(Tasmlisttype)..high(Tasmlisttype)]; if usedeffileforexports then exclude(to_do,al_exports); {$warning TODO internal writer support for dwarf} exclude(to_do,al_dwarf); if not(tf_section_threadvars in target_info.flags) then exclude(to_do,al_threadvars); - for i:=low(Tasmlist) to high(Tasmlist) do - if (i in to_do) and (asmlist[i]<>nil) then - addlist(asmlist[i]); + for i:=low(TasmlistType) to high(TasmlistType) do + if (i in to_do) and (current_asmdata.asmlists[i]<>nil) then + addlist(current_asmdata.asmlists[i]); if SmartAsm then writetreesmart @@ -1373,7 +1373,7 @@ Implementation {$ifdef MEMDEBUG} d:=tmemdebug.create(modulename^+' - librarydata'); {$endif} - objectlibrary.free; + current_asmdata.free; objectlibrary:=nil; current_module.librarydata:=nil; {$ifdef MEMDEBUG} diff --git a/compiler/cg64f32.pas b/compiler/cg64f32.pas index 0aca4d4e40..e31804896e 100644 --- a/compiler/cg64f32.pas +++ b/compiler/cg64f32.pas @@ -42,43 +42,43 @@ unit cg64f32; to handle 64-bit integers. } tcg64f32 = class(tcg64) - procedure a_load64_const_ref(list : taasmoutput;value : int64;const ref : treference);override; - procedure a_load64_reg_ref(list : taasmoutput;reg : tregister64;const ref : treference);override; - procedure a_load64_ref_reg(list : taasmoutput;const ref : treference;reg : tregister64);override; - procedure a_load64_reg_reg(list : taasmoutput;regsrc,regdst : tregister64);override; - procedure a_load64_const_reg(list : taasmoutput;value: int64;reg : tregister64);override; - procedure a_load64_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister64);override; - procedure a_load64_loc_ref(list : taasmoutput;const l : tlocation;const ref : treference);override; - procedure a_load64_const_loc(list : taasmoutput;value : int64;const l : tlocation);override; - procedure a_load64_reg_loc(list : taasmoutput;reg : tregister64;const l : tlocation);override; - - procedure a_load64high_reg_ref(list : taasmoutput;reg : tregister;const ref : treference);override; - procedure a_load64low_reg_ref(list : taasmoutput;reg : tregister;const ref : treference);override; - procedure a_load64high_ref_reg(list : taasmoutput;const ref : treference;reg : tregister);override; - procedure a_load64low_ref_reg(list : taasmoutput;const ref : treference;reg : tregister);override; - procedure a_load64high_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister);override; - procedure a_load64low_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister);override; - - procedure a_op64_ref_reg(list : taasmoutput;op:TOpCG;size : tcgsize;const ref : treference;reg : tregister64);override; - procedure a_op64_reg_ref(list : taasmoutput;op:TOpCG;size : tcgsize;reg : tregister64; const ref: treference);override; - procedure a_op64_const_loc(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;const l: tlocation);override; - procedure a_op64_reg_loc(list : taasmoutput;op:TOpCG;size : tcgsize;reg : tregister64;const l : tlocation);override; - procedure a_op64_loc_reg(list : taasmoutput;op:TOpCG;size : tcgsize;const l : tlocation;reg : tregister64);override; - procedure a_op64_const_ref(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;const ref : treference);override; - - procedure a_param64_reg(list : taasmoutput;reg : tregister64;const paraloc : tcgpara);override; - procedure a_param64_const(list : taasmoutput;value : int64;const paraloc : tcgpara);override; - procedure a_param64_ref(list : taasmoutput;const r : treference;const paraloc : tcgpara);override; - procedure a_param64_loc(list : taasmoutput;const l : tlocation;const paraloc : tcgpara);override; + procedure a_load64_const_ref(list : TAsmList;value : int64;const ref : treference);override; + procedure a_load64_reg_ref(list : TAsmList;reg : tregister64;const ref : treference);override; + procedure a_load64_ref_reg(list : TAsmList;const ref : treference;reg : tregister64);override; + procedure a_load64_reg_reg(list : TAsmList;regsrc,regdst : tregister64);override; + procedure a_load64_const_reg(list : TAsmList;value: int64;reg : tregister64);override; + procedure a_load64_loc_reg(list : TAsmList;const l : tlocation;reg : tregister64);override; + procedure a_load64_loc_ref(list : TAsmList;const l : tlocation;const ref : treference);override; + procedure a_load64_const_loc(list : TAsmList;value : int64;const l : tlocation);override; + procedure a_load64_reg_loc(list : TAsmList;reg : tregister64;const l : tlocation);override; + + procedure a_load64high_reg_ref(list : TAsmList;reg : tregister;const ref : treference);override; + procedure a_load64low_reg_ref(list : TAsmList;reg : tregister;const ref : treference);override; + procedure a_load64high_ref_reg(list : TAsmList;const ref : treference;reg : tregister);override; + procedure a_load64low_ref_reg(list : TAsmList;const ref : treference;reg : tregister);override; + procedure a_load64high_loc_reg(list : TAsmList;const l : tlocation;reg : tregister);override; + procedure a_load64low_loc_reg(list : TAsmList;const l : tlocation;reg : tregister);override; + + procedure a_op64_ref_reg(list : TAsmList;op:TOpCG;size : tcgsize;const ref : treference;reg : tregister64);override; + procedure a_op64_reg_ref(list : TAsmList;op:TOpCG;size : tcgsize;reg : tregister64; const ref: treference);override; + procedure a_op64_const_loc(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;const l: tlocation);override; + procedure a_op64_reg_loc(list : TAsmList;op:TOpCG;size : tcgsize;reg : tregister64;const l : tlocation);override; + procedure a_op64_loc_reg(list : TAsmList;op:TOpCG;size : tcgsize;const l : tlocation;reg : tregister64);override; + procedure a_op64_const_ref(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;const ref : treference);override; + + procedure a_param64_reg(list : TAsmList;reg : tregister64;const paraloc : tcgpara);override; + procedure a_param64_const(list : TAsmList;value : int64;const paraloc : tcgpara);override; + procedure a_param64_ref(list : TAsmList;const r : treference;const paraloc : tcgpara);override; + procedure a_param64_loc(list : TAsmList;const l : tlocation;const paraloc : tcgpara);override; {# This routine tries to optimize the a_op64_const_reg operation, by removing superfluous opcodes. Returns TRUE if normal processing must continue in op64_const_reg, otherwise, everything is processed entirely in this routine, by emitting the appropriate 32-bit opcodes. } - function optimize64_op_const_reg(list: taasmoutput; var op: topcg; var a : int64; var reg: tregister64): boolean;override; + function optimize64_op_const_reg(list: TAsmList; var op: topcg; var a : int64; var reg: tregister64): boolean;override; - procedure g_rangecheck64(list: taasmoutput; const l:tlocation;fromdef,todef: tdef); override; + procedure g_rangecheck64(list: TAsmList; const l:tlocation;fromdef,todef: tdef); override; end; {# Creates a tregister64 record from 2 32 Bit registers. } @@ -177,7 +177,7 @@ unit cg64f32; TCG64F32 ****************************************************************************} - procedure tcg64f32.a_load64_reg_ref(list : taasmoutput;reg : tregister64;const ref : treference); + procedure tcg64f32.a_load64_reg_ref(list : TAsmList;reg : tregister64;const ref : treference); var tmpreg: tregister; tmpref: treference; @@ -195,7 +195,7 @@ unit cg64f32; end; - procedure tcg64f32.a_load64_const_ref(list : taasmoutput;value : int64;const ref : treference); + procedure tcg64f32.a_load64_const_ref(list : TAsmList;value : int64;const ref : treference); var tmpref: treference; begin @@ -208,7 +208,7 @@ unit cg64f32; end; - procedure tcg64f32.a_load64_ref_reg(list : taasmoutput;const ref : treference;reg : tregister64); + procedure tcg64f32.a_load64_ref_reg(list : TAsmList;const ref : treference;reg : tregister64); var tmpreg: tregister; tmpref: treference; @@ -242,7 +242,7 @@ unit cg64f32; end; - procedure tcg64f32.a_load64_reg_reg(list : taasmoutput;regsrc,regdst : tregister64); + procedure tcg64f32.a_load64_reg_reg(list : TAsmList;regsrc,regdst : tregister64); begin cg.a_load_reg_reg(list,OS_32,OS_32,regsrc.reglo,regdst.reglo); @@ -250,7 +250,7 @@ unit cg64f32; end; - procedure tcg64f32.a_load64_const_reg(list : taasmoutput;value : int64;reg : tregister64); + procedure tcg64f32.a_load64_const_reg(list : TAsmList;value : int64;reg : tregister64); begin cg.a_load_const_reg(list,OS_32,aint(lo(value)),reg.reglo); @@ -258,7 +258,7 @@ unit cg64f32; end; - procedure tcg64f32.a_load64_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister64); + procedure tcg64f32.a_load64_loc_reg(list : TAsmList;const l : tlocation;reg : tregister64); begin case l.loc of @@ -274,7 +274,7 @@ unit cg64f32; end; - procedure tcg64f32.a_load64_loc_ref(list : taasmoutput;const l : tlocation;const ref : treference); + procedure tcg64f32.a_load64_loc_ref(list : TAsmList;const l : tlocation;const ref : treference); begin case l.loc of LOC_REGISTER,LOC_CREGISTER: @@ -287,7 +287,7 @@ unit cg64f32; end; - procedure tcg64f32.a_load64_const_loc(list : taasmoutput;value : int64;const l : tlocation); + procedure tcg64f32.a_load64_const_loc(list : TAsmList;value : int64;const l : tlocation); begin case l.loc of @@ -301,7 +301,7 @@ unit cg64f32; end; - procedure tcg64f32.a_load64_reg_loc(list : taasmoutput;reg : tregister64;const l : tlocation); + procedure tcg64f32.a_load64_reg_loc(list : TAsmList;reg : tregister64;const l : tlocation); begin case l.loc of @@ -315,7 +315,7 @@ unit cg64f32; end; - procedure tcg64f32.a_load64high_reg_ref(list : taasmoutput;reg : tregister;const ref : treference); + procedure tcg64f32.a_load64high_reg_ref(list : TAsmList;reg : tregister;const ref : treference); var tmpref: treference; begin @@ -329,7 +329,7 @@ unit cg64f32; end; end; - procedure tcg64f32.a_load64low_reg_ref(list : taasmoutput;reg : tregister;const ref : treference); + procedure tcg64f32.a_load64low_reg_ref(list : TAsmList;reg : tregister;const ref : treference); var tmpref: treference; begin @@ -344,7 +344,7 @@ unit cg64f32; end; - procedure tcg64f32.a_load64high_ref_reg(list : taasmoutput;const ref : treference;reg : tregister); + procedure tcg64f32.a_load64high_ref_reg(list : TAsmList;const ref : treference;reg : tregister); var tmpref: treference; begin @@ -359,7 +359,7 @@ unit cg64f32; end; - procedure tcg64f32.a_load64low_ref_reg(list : taasmoutput;const ref : treference;reg : tregister); + procedure tcg64f32.a_load64low_ref_reg(list : TAsmList;const ref : treference;reg : tregister); var tmpref: treference; begin @@ -374,7 +374,7 @@ unit cg64f32; end; - procedure tcg64f32.a_load64low_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister); + procedure tcg64f32.a_load64low_loc_reg(list : TAsmList;const l : tlocation;reg : tregister); begin case l.loc of LOC_REFERENCE, @@ -391,7 +391,7 @@ unit cg64f32; end; - procedure tcg64f32.a_load64high_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister); + procedure tcg64f32.a_load64high_loc_reg(list : TAsmList;const l : tlocation;reg : tregister); begin case l.loc of LOC_REFERENCE, @@ -408,7 +408,7 @@ unit cg64f32; end; - procedure tcg64f32.a_op64_const_loc(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;const l: tlocation); + procedure tcg64f32.a_op64_const_loc(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;const l: tlocation); begin case l.loc of LOC_REFERENCE, LOC_CREFERENCE: @@ -421,7 +421,7 @@ unit cg64f32; end; - procedure tcg64f32.a_op64_reg_loc(list : taasmoutput;op:TOpCG;size : tcgsize;reg : tregister64;const l : tlocation); + procedure tcg64f32.a_op64_reg_loc(list : TAsmList;op:TOpCG;size : tcgsize;reg : tregister64;const l : tlocation); begin case l.loc of LOC_REFERENCE, LOC_CREFERENCE: @@ -435,7 +435,7 @@ unit cg64f32; - procedure tcg64f32.a_op64_loc_reg(list : taasmoutput;op:TOpCG;size : tcgsize;const l : tlocation;reg : tregister64); + procedure tcg64f32.a_op64_loc_reg(list : TAsmList;op:TOpCG;size : tcgsize;const l : tlocation;reg : tregister64); begin case l.loc of LOC_REFERENCE, LOC_CREFERENCE: @@ -450,7 +450,7 @@ unit cg64f32; end; - procedure tcg64f32.a_op64_ref_reg(list : taasmoutput;op:TOpCG;size : tcgsize;const ref : treference;reg : tregister64); + procedure tcg64f32.a_op64_ref_reg(list : TAsmList;op:TOpCG;size : tcgsize;const ref : treference;reg : tregister64); var tempreg: tregister64; begin @@ -461,7 +461,7 @@ unit cg64f32; end; - procedure tcg64f32.a_op64_reg_ref(list : taasmoutput;op:TOpCG;size : tcgsize;reg : tregister64; const ref: treference); + procedure tcg64f32.a_op64_reg_ref(list : TAsmList;op:TOpCG;size : tcgsize;reg : tregister64; const ref: treference); var tempreg: tregister64; begin @@ -473,7 +473,7 @@ unit cg64f32; end; - procedure tcg64f32.a_op64_const_ref(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;const ref : treference); + procedure tcg64f32.a_op64_const_ref(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;const ref : treference); var tempreg: tregister64; begin @@ -485,7 +485,7 @@ unit cg64f32; end; - procedure tcg64f32.a_param64_reg(list : taasmoutput;reg : tregister64;const paraloc : tcgpara); + procedure tcg64f32.a_param64_reg(list : TAsmList;reg : tregister64;const paraloc : tcgpara); var tmplochi,tmploclo: tcgpara; begin @@ -501,7 +501,7 @@ unit cg64f32; end; - procedure tcg64f32.a_param64_const(list : taasmoutput;value : int64;const paraloc : tcgpara); + procedure tcg64f32.a_param64_const(list : TAsmList;value : int64;const paraloc : tcgpara); var tmplochi,tmploclo: tcgpara; begin @@ -517,7 +517,7 @@ unit cg64f32; end; - procedure tcg64f32.a_param64_ref(list : taasmoutput;const r : treference;const paraloc : tcgpara); + procedure tcg64f32.a_param64_ref(list : TAsmList;const r : treference;const paraloc : tcgpara); var tmprefhi,tmpreflo : treference; tmploclo,tmplochi : tcgpara; @@ -540,7 +540,7 @@ unit cg64f32; end; - procedure tcg64f32.a_param64_loc(list : taasmoutput;const l:tlocation;const paraloc : tcgpara); + procedure tcg64f32.a_param64_loc(list : TAsmList;const l:tlocation;const paraloc : tcgpara); begin case l.loc of LOC_REGISTER, @@ -557,7 +557,7 @@ unit cg64f32; end; - procedure tcg64f32.g_rangecheck64(list : taasmoutput;const l:tlocation;fromdef,todef:tdef); + procedure tcg64f32.g_rangecheck64(list : TAsmList;const l:tlocation;fromdef,todef:tdef); var neglabel, @@ -585,7 +585,7 @@ unit cg64f32; hreg:=cg.getintregister(list,OS_32); a_load64high_ref_reg(list,l.reference,hreg); end; - objectlibrary.getjumplabel(poslabel); + current_asmdata.getjumplabel(poslabel); { check high dword, must be 0 (for positive numbers) } cg.a_cmp_const_reg_label(list,OS_32,OC_EQ,0,hreg,poslabel); @@ -593,7 +593,7 @@ unit cg64f32; { It can also be $ffffffff, but only for negative numbers } if from_signed and to_signed then begin - objectlibrary.getjumplabel(neglabel); + current_asmdata.getjumplabel(neglabel); cg.a_cmp_const_reg_label(list,OS_32,OC_EQ,-1,hreg,neglabel); end; { For all other values we have a range check error } @@ -616,7 +616,7 @@ unit cg64f32; if from_signed and to_signed then begin - objectlibrary.getjumplabel(endlabel); + current_asmdata.getjumplabel(endlabel); cg.a_jmp_always(list,endlabel); { if the high dword = $ffffffff, then the low dword (when } { considered as a longint) must be < 0 } @@ -631,7 +631,7 @@ unit cg64f32; a_load64low_ref_reg(list,l.reference,hreg); end; { get a new neglabel (JM) } - objectlibrary.getjumplabel(neglabel); + current_asmdata.getjumplabel(neglabel); cg.a_cmp_const_reg_label(list,OS_32,OC_LT,0,hreg,neglabel); cg.a_call_name(list,'FPC_RANGEERROR'); @@ -682,7 +682,7 @@ unit cg64f32; else cg.a_load_ref_reg(list,l.size,OS_32,l.reference,hreg); end; - objectlibrary.getjumplabel(poslabel); + current_asmdata.getjumplabel(poslabel); cg.a_cmp_const_reg_label(list,opsize,OC_GTE,0,hreg,poslabel); cg.a_call_name(list,'FPC_RANGEERROR'); @@ -691,7 +691,7 @@ unit cg64f32; end; - function tcg64f32.optimize64_op_const_reg(list: taasmoutput; var op: topcg; var a : int64; var reg: tregister64): boolean; + function tcg64f32.optimize64_op_const_reg(list: TAsmList; var op: topcg; var a : int64; var reg: tregister64): boolean; var lowvalue, highvalue : longint; hreg: tregister; diff --git a/compiler/cgobj.pas b/compiler/cgobj.pas index c0da9640c1..e97c5aa9c7 100644 --- a/compiler/cgobj.pas +++ b/compiler/cgobj.pas @@ -76,12 +76,12 @@ unit cgobj; procedure done_flowgraph; {$endif} {# Gets a register suitable to do integer operations on.} - function getintregister(list:Taasmoutput;size:Tcgsize):Tregister;virtual; + function getintregister(list:TAsmList;size:Tcgsize):Tregister;virtual; {# Gets a register suitable to do integer operations on.} - function getaddressregister(list:Taasmoutput):Tregister;virtual; - function getfpuregister(list:Taasmoutput;size:Tcgsize):Tregister;virtual; - function getmmregister(list:Taasmoutput;size:Tcgsize):Tregister;virtual; - function getflagregister(list:Taasmoutput;size:Tcgsize):Tregister;virtual;abstract; + function getaddressregister(list:TAsmList):Tregister;virtual; + function getfpuregister(list:TAsmList;size:Tcgsize):Tregister;virtual; + function getmmregister(list:TAsmList;size:Tcgsize):Tregister;virtual; + function getflagregister(list:TAsmList;size:Tcgsize):Tregister;virtual;abstract; {Does the generic cg need SIMD registers, like getmmxregister? Or should the cpu specific child cg object have such a method?} @@ -90,29 +90,29 @@ unit cgobj; function uses_registers(rt:Tregistertype):boolean;virtual; {# Get a specific register.} - procedure getcpuregister(list:Taasmoutput;r:Tregister);virtual; - procedure ungetcpuregister(list:Taasmoutput;r:Tregister);virtual; + procedure getcpuregister(list:TAsmList;r:Tregister);virtual; + procedure ungetcpuregister(list:TAsmList;r:Tregister);virtual; {# Get multiple registers specified.} - procedure alloccpuregisters(list:Taasmoutput;rt:Tregistertype;const r:Tcpuregisterset);virtual; + procedure alloccpuregisters(list:TAsmList;rt:Tregistertype;const r:Tcpuregisterset);virtual; {# Free multiple registers specified.} - procedure dealloccpuregisters(list:Taasmoutput;rt:Tregistertype;const r:Tcpuregisterset);virtual; + procedure dealloccpuregisters(list:TAsmList;rt:Tregistertype;const r:Tcpuregisterset);virtual; - procedure allocallcpuregisters(list:Taasmoutput);virtual; - procedure deallocallcpuregisters(list:Taasmoutput);virtual; - procedure do_register_allocation(list:Taasmoutput;headertai:tai);virtual; + procedure allocallcpuregisters(list:TAsmList);virtual; + procedure deallocallcpuregisters(list:TAsmList);virtual; + procedure do_register_allocation(list:TAsmList;headertai:tai);virtual; procedure translate_register(var reg : tregister); - function makeregsize(list:Taasmoutput;reg:Tregister;size:Tcgsize):Tregister; + function makeregsize(list:TAsmList;reg:Tregister;size:Tcgsize):Tregister; {# Emit a label to the instruction stream. } - procedure a_label(list : taasmoutput;l : tasmlabel);virtual; + procedure a_label(list : TAsmList;l : tasmlabel);virtual; {# Allocates register r by inserting a pai_realloc record } - procedure a_reg_alloc(list : taasmoutput;r : tregister); + procedure a_reg_alloc(list : TAsmList;r : tregister); {# Deallocates register r by inserting a pa_regdealloc record} - procedure a_reg_dealloc(list : taasmoutput;r : tregister); + procedure a_reg_dealloc(list : TAsmList;r : tregister); { Synchronize register, make sure it is still valid } - procedure a_reg_sync(list : taasmoutput;r : tregister); + procedure a_reg_sync(list : TAsmList;r : tregister); {# Pass a parameter, which is located in a register, to a routine. @@ -124,7 +124,7 @@ unit cgobj; @param(r register source of the operand) @param(cgpara where the parameter will be stored) } - procedure a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;const cgpara : TCGPara);virtual; + procedure a_param_reg(list : TAsmList;size : tcgsize;r : tregister;const cgpara : TCGPara);virtual; {# Pass a parameter, which is a constant, to a routine. A generic version is provided. This routine should @@ -135,7 +135,7 @@ unit cgobj; @param(a value of constant to send) @param(cgpara where the parameter will be stored) } - procedure a_param_const(list : taasmoutput;size : tcgsize;a : aint;const cgpara : TCGPara);virtual; + procedure a_param_const(list : TAsmList;size : tcgsize;a : aint;const cgpara : TCGPara);virtual; {# Pass the value of a parameter, which is located in memory, to a routine. A generic version is provided. This routine should @@ -146,7 +146,7 @@ unit cgobj; @param(r Memory reference of value to send) @param(cgpara where the parameter will be stored) } - procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const cgpara : TCGPara);virtual; + procedure a_param_ref(list : TAsmList;size : tcgsize;const r : treference;const cgpara : TCGPara);virtual; {# Pass the value of a parameter, which can be located either in a register or memory location, to a routine. @@ -156,7 +156,7 @@ unit cgobj; @param(nr parameter number (starting from one) of routine (from left to right)) @param(cgpara where the parameter will be stored) } - procedure a_param_loc(list : taasmoutput;const l : tlocation;const cgpara : TCGPara); + procedure a_param_loc(list : TAsmList;const l : tlocation;const cgpara : TCGPara); {# Pass the address of a reference to a routine. This routine will calculate the address of the reference, and pass this calculated address as a parameter. @@ -168,7 +168,7 @@ unit cgobj; @param(r reference to get address from) @param(nr parameter number (starting from one) of routine (from left to right)) } - procedure a_paramaddr_ref(list : taasmoutput;const r : treference;const cgpara : TCGPara);virtual; + procedure a_paramaddr_ref(list : TAsmList;const r : treference;const cgpara : TCGPara);virtual; { Remarks: * If a method specifies a size you have only to take care @@ -194,95 +194,95 @@ unit cgobj; a temp register on most cpu's resulting in conflicts with the registers used for the parameters (PFV) } - procedure a_call_name(list : taasmoutput;const s : string);virtual; abstract; - procedure a_call_reg(list : taasmoutput;reg : tregister);virtual; abstract; - procedure a_call_ref(list : taasmoutput;ref : treference);virtual; abstract; + procedure a_call_name(list : TAsmList;const s : string);virtual; abstract; + procedure a_call_reg(list : TAsmList;reg : tregister);virtual; abstract; + procedure a_call_ref(list : TAsmList;ref : treference);virtual; abstract; { same as a_call_name, might be overriden on certain architectures to emit static calls without usage of a got trampoline } - procedure a_call_name_static(list : taasmoutput;const s : string);virtual; + procedure a_call_name_static(list : TAsmList;const s : string);virtual; { move instructions } - procedure a_load_const_reg(list : taasmoutput;size : tcgsize;a : aint;register : tregister);virtual; abstract; - procedure a_load_const_ref(list : taasmoutput;size : tcgsize;a : aint;const ref : treference);virtual; - procedure a_load_const_loc(list : taasmoutput;a : aint;const loc : tlocation); - procedure a_load_reg_ref(list : taasmoutput;fromsize,tosize : tcgsize;register : tregister;const ref : treference);virtual; abstract; - procedure a_load_reg_reg(list : taasmoutput;fromsize,tosize : tcgsize;reg1,reg2 : tregister);virtual; abstract; - procedure a_load_reg_loc(list : taasmoutput;fromsize : tcgsize;reg : tregister;const loc: tlocation); - procedure a_load_ref_reg(list : taasmoutput;fromsize,tosize : tcgsize;const ref : treference;register : tregister);virtual; abstract; - procedure a_load_ref_ref(list : taasmoutput;fromsize,tosize : tcgsize;const sref : treference;const dref : treference);virtual; - procedure a_load_loc_reg(list : taasmoutput;tosize: tcgsize; const loc: tlocation; reg : tregister); - procedure a_load_loc_ref(list : taasmoutput;tosize: tcgsize; const loc: tlocation; const ref : treference); - procedure a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister);virtual; abstract; + procedure a_load_const_reg(list : TAsmList;size : tcgsize;a : aint;register : tregister);virtual; abstract; + procedure a_load_const_ref(list : TAsmList;size : tcgsize;a : aint;const ref : treference);virtual; + procedure a_load_const_loc(list : TAsmList;a : aint;const loc : tlocation); + procedure a_load_reg_ref(list : TAsmList;fromsize,tosize : tcgsize;register : tregister;const ref : treference);virtual; abstract; + procedure a_load_reg_reg(list : TAsmList;fromsize,tosize : tcgsize;reg1,reg2 : tregister);virtual; abstract; + procedure a_load_reg_loc(list : TAsmList;fromsize : tcgsize;reg : tregister;const loc: tlocation); + procedure a_load_ref_reg(list : TAsmList;fromsize,tosize : tcgsize;const ref : treference;register : tregister);virtual; abstract; + procedure a_load_ref_ref(list : TAsmList;fromsize,tosize : tcgsize;const sref : treference;const dref : treference);virtual; + procedure a_load_loc_reg(list : TAsmList;tosize: tcgsize; const loc: tlocation; reg : tregister); + procedure a_load_loc_ref(list : TAsmList;tosize: tcgsize; const loc: tlocation; const ref : treference); + procedure a_loadaddr_ref_reg(list : TAsmList;const ref : treference;r : tregister);virtual; abstract; { fpu move instructions } - procedure a_loadfpu_reg_reg(list: taasmoutput; size:tcgsize; reg1, reg2: tregister); virtual; abstract; - procedure a_loadfpu_ref_reg(list: taasmoutput; size: tcgsize; const ref: treference; reg: tregister); virtual; abstract; - procedure a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: tregister; const ref: treference); virtual; abstract; - procedure a_loadfpu_loc_reg(list: taasmoutput; const loc: tlocation; const reg: tregister); - procedure a_loadfpu_reg_loc(list: taasmoutput; size: tcgsize; const reg: tregister; const loc: tlocation); - procedure a_paramfpu_reg(list : taasmoutput;size : tcgsize;const r : tregister;const cgpara : TCGPara);virtual; - procedure a_paramfpu_ref(list : taasmoutput;size : tcgsize;const ref : treference;const cgpara : TCGPara);virtual; + procedure a_loadfpu_reg_reg(list: TAsmList; size:tcgsize; reg1, reg2: tregister); virtual; abstract; + procedure a_loadfpu_ref_reg(list: TAsmList; size: tcgsize; const ref: treference; reg: tregister); virtual; abstract; + procedure a_loadfpu_reg_ref(list: TAsmList; size: tcgsize; reg: tregister; const ref: treference); virtual; abstract; + procedure a_loadfpu_loc_reg(list: TAsmList; const loc: tlocation; const reg: tregister); + procedure a_loadfpu_reg_loc(list: TAsmList; size: tcgsize; const reg: tregister; const loc: tlocation); + procedure a_paramfpu_reg(list : TAsmList;size : tcgsize;const r : tregister;const cgpara : TCGPara);virtual; + procedure a_paramfpu_ref(list : TAsmList;size : tcgsize;const ref : treference;const cgpara : TCGPara);virtual; { vector register move instructions } - procedure a_loadmm_reg_reg(list: taasmoutput; fromsize, tosize : tcgsize;reg1, reg2: tregister;shuffle : pmmshuffle); virtual; abstract; - procedure a_loadmm_ref_reg(list: taasmoutput; fromsize, tosize : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); virtual; abstract; - procedure a_loadmm_reg_ref(list: taasmoutput; fromsize, tosize : tcgsize;reg: tregister; const ref: treference;shuffle : pmmshuffle); virtual; abstract; - procedure a_loadmm_loc_reg(list: taasmoutput; size: tcgsize; const loc: tlocation; const reg: tregister;shuffle : pmmshuffle); - procedure a_loadmm_reg_loc(list: taasmoutput; size: tcgsize; const reg: tregister; const loc: tlocation;shuffle : pmmshuffle); - procedure a_parammm_reg(list: taasmoutput; size: tcgsize; reg: tregister;const cgpara : TCGPara;shuffle : pmmshuffle); virtual; - procedure a_parammm_ref(list: taasmoutput; size: tcgsize; const ref: treference;const cgpara : TCGPara;shuffle : pmmshuffle); virtual; - procedure a_parammm_loc(list: taasmoutput; const loc: tlocation; const cgpara : TCGPara;shuffle : pmmshuffle); virtual; - procedure a_opmm_reg_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;src,dst: tregister;shuffle : pmmshuffle); virtual;abstract; - procedure a_opmm_ref_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); virtual; - procedure a_opmm_loc_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;const loc: tlocation; reg: tregister;shuffle : pmmshuffle); virtual; - procedure a_opmm_reg_ref(list: taasmoutput; Op: TOpCG; size : tcgsize;reg: tregister;const ref: treference; shuffle : pmmshuffle); virtual; + procedure a_loadmm_reg_reg(list: TAsmList; fromsize, tosize : tcgsize;reg1, reg2: tregister;shuffle : pmmshuffle); virtual; abstract; + procedure a_loadmm_ref_reg(list: TAsmList; fromsize, tosize : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); virtual; abstract; + procedure a_loadmm_reg_ref(list: TAsmList; fromsize, tosize : tcgsize;reg: tregister; const ref: treference;shuffle : pmmshuffle); virtual; abstract; + procedure a_loadmm_loc_reg(list: TAsmList; size: tcgsize; const loc: tlocation; const reg: tregister;shuffle : pmmshuffle); + procedure a_loadmm_reg_loc(list: TAsmList; size: tcgsize; const reg: tregister; const loc: tlocation;shuffle : pmmshuffle); + procedure a_parammm_reg(list: TAsmList; size: tcgsize; reg: tregister;const cgpara : TCGPara;shuffle : pmmshuffle); virtual; + procedure a_parammm_ref(list: TAsmList; size: tcgsize; const ref: treference;const cgpara : TCGPara;shuffle : pmmshuffle); virtual; + procedure a_parammm_loc(list: TAsmList; const loc: tlocation; const cgpara : TCGPara;shuffle : pmmshuffle); virtual; + procedure a_opmm_reg_reg(list: TAsmList; Op: TOpCG; size : tcgsize;src,dst: tregister;shuffle : pmmshuffle); virtual;abstract; + procedure a_opmm_ref_reg(list: TAsmList; Op: TOpCG; size : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); virtual; + procedure a_opmm_loc_reg(list: TAsmList; Op: TOpCG; size : tcgsize;const loc: tlocation; reg: tregister;shuffle : pmmshuffle); virtual; + procedure a_opmm_reg_ref(list: TAsmList; Op: TOpCG; size : tcgsize;reg: tregister;const ref: treference; shuffle : pmmshuffle); virtual; { basic arithmetic operations } { note: for operators which require only one argument (not, neg), use } { the op_reg_reg, op_reg_ref or op_reg_loc methods and keep in mind } { that in this case the *second* operand is used as both source and } { destination (JM) } - procedure a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: Aint; reg: TRegister); virtual; abstract; - procedure a_op_const_ref(list : taasmoutput; Op: TOpCG; size: TCGSize; a: Aint; const ref: TReference); virtual; - procedure a_op_const_loc(list : taasmoutput; Op: TOpCG; a: Aint; const loc: tlocation); - procedure a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; reg1, reg2: TRegister); virtual; abstract; - procedure a_op_reg_ref(list : taasmoutput; Op: TOpCG; size: TCGSize; reg: TRegister; const ref: TReference); virtual; - procedure a_op_ref_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; const ref: TReference; reg: TRegister); virtual; - procedure a_op_reg_loc(list : taasmoutput; Op: TOpCG; reg: tregister; const loc: tlocation); - procedure a_op_ref_loc(list : taasmoutput; Op: TOpCG; const ref: TReference; const loc: tlocation); + procedure a_op_const_reg(list : TAsmList; Op: TOpCG; size: TCGSize; a: Aint; reg: TRegister); virtual; abstract; + procedure a_op_const_ref(list : TAsmList; Op: TOpCG; size: TCGSize; a: Aint; const ref: TReference); virtual; + procedure a_op_const_loc(list : TAsmList; Op: TOpCG; a: Aint; const loc: tlocation); + procedure a_op_reg_reg(list : TAsmList; Op: TOpCG; size: TCGSize; reg1, reg2: TRegister); virtual; abstract; + procedure a_op_reg_ref(list : TAsmList; Op: TOpCG; size: TCGSize; reg: TRegister; const ref: TReference); virtual; + procedure a_op_ref_reg(list : TAsmList; Op: TOpCG; size: TCGSize; const ref: TReference; reg: TRegister); virtual; + procedure a_op_reg_loc(list : TAsmList; Op: TOpCG; reg: tregister; const loc: tlocation); + procedure a_op_ref_loc(list : TAsmList; Op: TOpCG; const ref: TReference; const loc: tlocation); { trinary operations for processors that support them, 'emulated' } { on others. None with "ref" arguments since I don't think there } { are any processors that support it (JM) } - procedure a_op_const_reg_reg(list: taasmoutput; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister); virtual; - procedure a_op_reg_reg_reg(list: taasmoutput; op: TOpCg; size: tcgsize; src1, src2, dst: tregister); virtual; - procedure a_op_const_reg_reg_checkoverflow(list: taasmoutput; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation); virtual; - procedure a_op_reg_reg_reg_checkoverflow(list: taasmoutput; op: TOpCg; size: tcgsize; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation); virtual; + procedure a_op_const_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister); virtual; + procedure a_op_reg_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister); virtual; + procedure a_op_const_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation); virtual; + procedure a_op_reg_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation); virtual; { comparison operations } - procedure a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; + procedure a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; l : tasmlabel);virtual; abstract; - procedure a_cmp_const_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;const ref : treference; + procedure a_cmp_const_ref_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;const ref : treference; l : tasmlabel); virtual; - procedure a_cmp_const_loc_label(list: taasmoutput; size: tcgsize;cmp_op: topcmp; a: aint; const loc: tlocation; + procedure a_cmp_const_loc_label(list: TAsmList; size: tcgsize;cmp_op: topcmp; a: aint; const loc: tlocation; l : tasmlabel); - procedure a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); virtual; abstract; - procedure a_cmp_ref_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp; const ref: treference; reg : tregister; l : tasmlabel); virtual; - procedure a_cmp_reg_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg : tregister; const ref: treference; l : tasmlabel); virtual; - procedure a_cmp_loc_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp; const loc: tlocation; reg : tregister; l : tasmlabel); - procedure a_cmp_reg_loc_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp; reg: tregister; const loc: tlocation; l : tasmlabel); - procedure a_cmp_ref_loc_label(list: taasmoutput; size: tcgsize;cmp_op: topcmp; const ref: treference; const loc: tlocation; + procedure a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); virtual; abstract; + procedure a_cmp_ref_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp; const ref: treference; reg : tregister; l : tasmlabel); virtual; + procedure a_cmp_reg_ref_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg : tregister; const ref: treference; l : tasmlabel); virtual; + procedure a_cmp_loc_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp; const loc: tlocation; reg : tregister; l : tasmlabel); + procedure a_cmp_reg_loc_label(list : TAsmList;size : tcgsize;cmp_op : topcmp; reg: tregister; const loc: tlocation; l : tasmlabel); + procedure a_cmp_ref_loc_label(list: TAsmList; size: tcgsize;cmp_op: topcmp; const ref: treference; const loc: tlocation; l : tasmlabel); - procedure a_jmp_name(list : taasmoutput;const s : string); virtual; abstract; - procedure a_jmp_always(list : taasmoutput;l: tasmlabel); virtual; abstract; - procedure a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); virtual; abstract; + procedure a_jmp_name(list : TAsmList;const s : string); virtual; abstract; + procedure a_jmp_always(list : TAsmList;l: tasmlabel); virtual; abstract; + procedure a_jmp_flags(list : TAsmList;const f : TResFlags;l: tasmlabel); virtual; abstract; {# Depending on the value to check in the flags, either sets the register reg to one (if the flag is set) or zero (if the flag is cleared). The size parameter indicates the destination size register. } - procedure g_flags2reg(list: taasmoutput; size: TCgSize; const f: tresflags; reg: TRegister); virtual; abstract; - procedure g_flags2ref(list: taasmoutput; size: TCgSize; const f: tresflags; const ref:TReference); virtual; + procedure g_flags2reg(list: TAsmList; size: TCgSize; const f: tresflags; reg: TRegister); virtual; abstract; + procedure g_flags2ref(list: TAsmList; size: TCgSize; const f: tresflags; const ref:TReference); virtual; { This routine tries to optimize the const_reg opcode, and should be @@ -296,7 +296,7 @@ unit cgobj; @param(reg The register to emit the opcode with, returns the register with which the opcode will be emitted) } - function optimize_op_const_reg(list: taasmoutput; var op: topcg; var a : aint; var reg: tregister): boolean;virtual; + function optimize_op_const_reg(list: TAsmList; var op: topcg; var a : aint; var reg: tregister): boolean;virtual; {# This routine is used in exception management nodes. It should @@ -307,7 +307,7 @@ unit cgobj; The size of the value to save is OS_S32. The default version saves the exception reason to a temp. memory area. } - procedure g_exception_reason_save(list : taasmoutput; const href : treference);virtual; + procedure g_exception_reason_save(list : TAsmList; const href : treference);virtual; {# This routine is used in exception management nodes. It should save the exception reason constant. The @@ -317,7 +317,7 @@ unit cgobj; The size of the value to save is OS_S32. The default version saves the exception reason to a temp. memory area. } - procedure g_exception_reason_save_const(list : taasmoutput; const href : treference; a: aint);virtual; + procedure g_exception_reason_save_const(list : TAsmList; const href : treference; a: aint);virtual; {# This routine is used in exception management nodes. It should load the exception reason to the FUNCTION_RETURN_REG. The saved value @@ -327,10 +327,10 @@ unit cgobj; The size of the value to save is OS_S32. The default version saves the exception reason to a temp. memory area. } - procedure g_exception_reason_load(list : taasmoutput; const href : treference);virtual; + procedure g_exception_reason_load(list : TAsmList; const href : treference);virtual; - procedure g_maybe_testself(list : taasmoutput;reg:tregister); - procedure g_maybe_testvmt(list : taasmoutput;reg:tregister;objdef:tobjectdef); + procedure g_maybe_testself(list : TAsmList;reg:tregister); + procedure g_maybe_testvmt(list : TAsmList;reg:tregister;objdef:tobjectdef); {# This should emit the opcode to copy len bytes from the source to destination. @@ -340,7 +340,7 @@ unit cgobj; @param(dest Destination reference of copy) } - procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint);virtual; abstract; + procedure g_concatcopy(list : TAsmList;const source,dest : treference;len : aint);virtual; abstract; {# This should emit the opcode to copy len bytes from the an unaligned source to destination. @@ -350,7 +350,7 @@ unit cgobj; @param(dest Destination reference of copy) } - procedure g_concatcopy_unaligned(list : taasmoutput;const source,dest : treference;len : aint);virtual; + procedure g_concatcopy_unaligned(list : TAsmList;const source,dest : treference;len : aint);virtual; {# This should emit the opcode to a shortrstring from the source to destination. @@ -358,12 +358,12 @@ unit cgobj; @param(dest Destination reference of copy) } - procedure g_copyshortstring(list : taasmoutput;const source,dest : treference;len:byte); + procedure g_copyshortstring(list : TAsmList;const source,dest : treference;len:byte); - procedure g_incrrefcount(list : taasmoutput;t: tdef; const ref: treference); - procedure g_decrrefcount(list : taasmoutput;t: tdef; const ref: treference); - procedure g_initialize(list : taasmoutput;t : tdef;const ref : treference); - procedure g_finalize(list : taasmoutput;t : tdef;const ref : treference); + procedure g_incrrefcount(list : TAsmList;t: tdef; const ref: treference); + procedure g_decrrefcount(list : TAsmList;t: tdef; const ref: treference); + procedure g_initialize(list : TAsmList;t : tdef;const ref : treference); + procedure g_finalize(list : TAsmList;t : tdef;const ref : treference); {# Generates range checking code. It is to note that this routine does not need to be overriden, @@ -372,38 +372,38 @@ unit cgobj; @param(p Node which contains the value to check) @param(todef Type definition of node to range check) } - procedure g_rangecheck(list: taasmoutput; const l:tlocation; fromdef,todef: tdef); virtual; + procedure g_rangecheck(list: TAsmList; const l:tlocation; fromdef,todef: tdef); virtual; {# Generates overflow checking code for a node } - procedure g_overflowcheck(list: taasmoutput; const Loc:tlocation; def:tdef); virtual;abstract; - procedure g_overflowCheck_loc(List:TAasmOutput;const Loc:TLocation;def:TDef;ovloc : tlocation);virtual; + procedure g_overflowcheck(list: TAsmList; const Loc:tlocation; def:tdef); virtual;abstract; + procedure g_overflowCheck_loc(List:TAsmList;const Loc:TLocation;def:TDef;ovloc : tlocation);virtual; - procedure g_copyvaluepara_openarray(list : taasmoutput;const ref:treference;const lenloc:tlocation;elesize:aint;destreg:tregister);virtual; - procedure g_releasevaluepara_openarray(list : taasmoutput;const l:tlocation);virtual; + procedure g_copyvaluepara_openarray(list : TAsmList;const ref:treference;const lenloc:tlocation;elesize:aint;destreg:tregister);virtual; + procedure g_releasevaluepara_openarray(list : TAsmList;const l:tlocation);virtual; {# Emits instructions when compilation is done in profile mode (this is set as a command line option). The default behavior does nothing, should be overriden as required. } - procedure g_profilecode(list : taasmoutput);virtual; + procedure g_profilecode(list : TAsmList);virtual; {# Emits instruction for allocating @var(size) bytes at the stackpointer @param(size Number of bytes to allocate) } - procedure g_stackpointer_alloc(list : taasmoutput;size : longint);virtual; abstract; + procedure g_stackpointer_alloc(list : TAsmList;size : longint);virtual; abstract; {# Emits instruction for allocating the locals in entry code of a routine. This is one of the first routine called in @var(genentrycode). @param(localsize Number of bytes to allocate as locals) } - procedure g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean);virtual; abstract; + procedure g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean);virtual; abstract; {# Emits instructions for returning from a subroutine. Should also restore the framepointer and stack. @param(parasize Number of bytes of parameters to deallocate from stack) } - procedure g_proc_exit(list : taasmoutput;parasize:longint;nostackframe:boolean);virtual;abstract; + procedure g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean);virtual;abstract; {# This routine is called when generating the code for the entry point of a routine. It should save all registers which are not used in this routine, and which should be declared as saved in the std_saved_registers @@ -415,18 +415,18 @@ unit cgobj; @param(usedinproc Registers which are used in the code of this routine) } - procedure g_save_standard_registers(list:Taasmoutput);virtual; + procedure g_save_standard_registers(list:TAsmList);virtual; {# This routine is called when generating the code for the exit point of a routine. It should restore all registers which were previously saved in @var(g_save_standard_registers). @param(usedinproc Registers which are used in the code of this routine) } - procedure g_restore_standard_registers(list:Taasmoutput);virtual; - procedure g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint);virtual;abstract; - procedure g_adjust_self_value(list:taasmoutput;procdef: tprocdef;ioffset: aint);virtual; + procedure g_restore_standard_registers(list:TAsmList);virtual; + procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);virtual;abstract; + procedure g_adjust_self_value(list:TAsmList;procdef: tprocdef;ioffset: aint);virtual; - function g_indirect_sym_load(list:taasmoutput;const symname: string): tregister;virtual; + function g_indirect_sym_load(list:TAsmList;const symname: string): tregister;virtual; end; {$ifndef cpu64bit} @@ -435,40 +435,40 @@ unit cgobj; for 64 Bit operations. } tcg64 = class - procedure a_load64_const_ref(list : taasmoutput;value : int64;const ref : treference);virtual;abstract; - procedure a_load64_reg_ref(list : taasmoutput;reg : tregister64;const ref : treference);virtual;abstract; - procedure a_load64_ref_reg(list : taasmoutput;const ref : treference;reg : tregister64);virtual;abstract; - procedure a_load64_reg_reg(list : taasmoutput;regsrc,regdst : tregister64);virtual;abstract; - procedure a_load64_const_reg(list : taasmoutput;value : int64;reg : tregister64);virtual;abstract; - procedure a_load64_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister64);virtual;abstract; - procedure a_load64_loc_ref(list : taasmoutput;const l : tlocation;const ref : treference);virtual;abstract; - procedure a_load64_const_loc(list : taasmoutput;value : int64;const l : tlocation);virtual;abstract; - procedure a_load64_reg_loc(list : taasmoutput;reg : tregister64;const l : tlocation);virtual;abstract; - - procedure a_load64high_reg_ref(list : taasmoutput;reg : tregister;const ref : treference);virtual;abstract; - procedure a_load64low_reg_ref(list : taasmoutput;reg : tregister;const ref : treference);virtual;abstract; - procedure a_load64high_ref_reg(list : taasmoutput;const ref : treference;reg : tregister);virtual;abstract; - procedure a_load64low_ref_reg(list : taasmoutput;const ref : treference;reg : tregister);virtual;abstract; - procedure a_load64high_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister);virtual;abstract; - procedure a_load64low_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister);virtual;abstract; - - procedure a_op64_ref_reg(list : taasmoutput;op:TOpCG;size : tcgsize;const ref : treference;reg : tregister64);virtual;abstract; - procedure a_op64_reg_reg(list : taasmoutput;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64);virtual;abstract; - procedure a_op64_reg_ref(list : taasmoutput;op:TOpCG;size : tcgsize;regsrc : tregister64;const ref : treference);virtual;abstract; - procedure a_op64_const_reg(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;regdst : tregister64);virtual;abstract; - procedure a_op64_const_ref(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;const ref : treference);virtual;abstract; - procedure a_op64_const_loc(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;const l: tlocation);virtual;abstract; - procedure a_op64_reg_loc(list : taasmoutput;op:TOpCG;size : tcgsize;reg : tregister64;const l : tlocation);virtual;abstract; - procedure a_op64_loc_reg(list : taasmoutput;op:TOpCG;size : tcgsize;const l : tlocation;reg64 : tregister64);virtual;abstract; - procedure a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64);virtual; - procedure a_op64_reg_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64);virtual; - procedure a_op64_const_reg_reg_checkoverflow(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation);virtual; - procedure a_op64_reg_reg_reg_checkoverflow(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation);virtual; - - procedure a_param64_reg(list : taasmoutput;reg64 : tregister64;const loc : TCGPara);virtual;abstract; - procedure a_param64_const(list : taasmoutput;value : int64;const loc : TCGPara);virtual;abstract; - procedure a_param64_ref(list : taasmoutput;const r : treference;const loc : TCGPara);virtual;abstract; - procedure a_param64_loc(list : taasmoutput;const l : tlocation;const loc : TCGPara);virtual;abstract; + procedure a_load64_const_ref(list : TAsmList;value : int64;const ref : treference);virtual;abstract; + procedure a_load64_reg_ref(list : TAsmList;reg : tregister64;const ref : treference);virtual;abstract; + procedure a_load64_ref_reg(list : TAsmList;const ref : treference;reg : tregister64);virtual;abstract; + procedure a_load64_reg_reg(list : TAsmList;regsrc,regdst : tregister64);virtual;abstract; + procedure a_load64_const_reg(list : TAsmList;value : int64;reg : tregister64);virtual;abstract; + procedure a_load64_loc_reg(list : TAsmList;const l : tlocation;reg : tregister64);virtual;abstract; + procedure a_load64_loc_ref(list : TAsmList;const l : tlocation;const ref : treference);virtual;abstract; + procedure a_load64_const_loc(list : TAsmList;value : int64;const l : tlocation);virtual;abstract; + procedure a_load64_reg_loc(list : TAsmList;reg : tregister64;const l : tlocation);virtual;abstract; + + procedure a_load64high_reg_ref(list : TAsmList;reg : tregister;const ref : treference);virtual;abstract; + procedure a_load64low_reg_ref(list : TAsmList;reg : tregister;const ref : treference);virtual;abstract; + procedure a_load64high_ref_reg(list : TAsmList;const ref : treference;reg : tregister);virtual;abstract; + procedure a_load64low_ref_reg(list : TAsmList;const ref : treference;reg : tregister);virtual;abstract; + procedure a_load64high_loc_reg(list : TAsmList;const l : tlocation;reg : tregister);virtual;abstract; + procedure a_load64low_loc_reg(list : TAsmList;const l : tlocation;reg : tregister);virtual;abstract; + + procedure a_op64_ref_reg(list : TAsmList;op:TOpCG;size : tcgsize;const ref : treference;reg : tregister64);virtual;abstract; + procedure a_op64_reg_reg(list : TAsmList;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64);virtual;abstract; + procedure a_op64_reg_ref(list : TAsmList;op:TOpCG;size : tcgsize;regsrc : tregister64;const ref : treference);virtual;abstract; + procedure a_op64_const_reg(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;regdst : tregister64);virtual;abstract; + procedure a_op64_const_ref(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;const ref : treference);virtual;abstract; + procedure a_op64_const_loc(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;const l: tlocation);virtual;abstract; + procedure a_op64_reg_loc(list : TAsmList;op:TOpCG;size : tcgsize;reg : tregister64;const l : tlocation);virtual;abstract; + procedure a_op64_loc_reg(list : TAsmList;op:TOpCG;size : tcgsize;const l : tlocation;reg64 : tregister64);virtual;abstract; + procedure a_op64_const_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64);virtual; + procedure a_op64_reg_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64);virtual; + procedure a_op64_const_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation);virtual; + procedure a_op64_reg_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation);virtual; + + procedure a_param64_reg(list : TAsmList;reg64 : tregister64;const loc : TCGPara);virtual;abstract; + procedure a_param64_const(list : TAsmList;value : int64;const loc : TCGPara);virtual;abstract; + procedure a_param64_ref(list : TAsmList;const r : treference;const loc : TCGPara);virtual;abstract; + procedure a_param64_loc(list : TAsmList;const l : tlocation;const loc : TCGPara);virtual;abstract; { This routine tries to optimize the const_reg opcode, and should be @@ -482,11 +482,11 @@ unit cgobj; @param(reg The register to emit the opcode with, returns the register with which the opcode will be emitted) } - function optimize64_op_const_reg(list: taasmoutput; var op: topcg; var a : int64; var reg: tregister64): boolean;virtual;abstract; + function optimize64_op_const_reg(list: TAsmList; var op: topcg; var a : int64; var reg: tregister64): boolean;virtual;abstract; { override to catch 64bit rangechecks } - procedure g_rangecheck64(list: taasmoutput; const l:tlocation; fromdef,todef: tdef);virtual;abstract; + procedure g_rangecheck64(list: TAsmList; const l:tlocation; fromdef,todef: tdef);virtual;abstract; end; {$endif cpu64bit} @@ -506,12 +506,6 @@ implementation verbose,defutil,paramgr,symsym, tgobj,cutils,procinfo; - const - { Please leave this here, this module should NOT use - exprasmlist, the lists are always passed as arguments. - Declaring it as string here results in an error when compiling (PFV) } - exprasmlist = 'error'; - {***************************************************************************** basic functionallity @@ -554,7 +548,7 @@ implementation end; {$endif} - function tcg.getintregister(list:Taasmoutput;size:Tcgsize):Tregister; + function tcg.getintregister(list:TAsmList;size:Tcgsize):Tregister; begin if not assigned(rg[R_INTREGISTER]) then internalerror(200312122); @@ -562,7 +556,7 @@ implementation end; - function tcg.getfpuregister(list:Taasmoutput;size:Tcgsize):Tregister; + function tcg.getfpuregister(list:TAsmList;size:Tcgsize):Tregister; begin if not assigned(rg[R_FPUREGISTER]) then internalerror(200312123); @@ -570,7 +564,7 @@ implementation end; - function tcg.getmmregister(list:Taasmoutput;size:Tcgsize):Tregister; + function tcg.getmmregister(list:TAsmList;size:Tcgsize):Tregister; begin if not assigned(rg[R_MMREGISTER]) then internalerror(2003121214); @@ -578,7 +572,7 @@ implementation end; - function tcg.getaddressregister(list:Taasmoutput):Tregister; + function tcg.getaddressregister(list:TAsmList):Tregister; begin if assigned(rg[R_ADDRESSREGISTER]) then result:=rg[R_ADDRESSREGISTER].getregister(list,R_SUBWHOLE) @@ -591,7 +585,7 @@ implementation end; - function Tcg.makeregsize(list:Taasmoutput;reg:Tregister;size:Tcgsize):Tregister; + function Tcg.makeregsize(list:TAsmList;reg:Tregister;size:Tcgsize):Tregister; var subreg:Tsubregister; begin @@ -604,7 +598,7 @@ implementation end; - procedure tcg.getcpuregister(list:Taasmoutput;r:Tregister); + procedure tcg.getcpuregister(list:TAsmList;r:Tregister); begin if not assigned(rg[getregtype(r)]) then internalerror(200312125); @@ -612,7 +606,7 @@ implementation end; - procedure tcg.ungetcpuregister(list:Taasmoutput;r:Tregister); + procedure tcg.ungetcpuregister(list:TAsmList;r:Tregister); begin if not assigned(rg[getregtype(r)]) then internalerror(200312126); @@ -620,7 +614,7 @@ implementation end; - procedure tcg.alloccpuregisters(list:Taasmoutput;rt:Tregistertype;const r:Tcpuregisterset); + procedure tcg.alloccpuregisters(list:TAsmList;rt:Tregistertype;const r:Tcpuregisterset); begin if assigned(rg[rt]) then rg[rt].alloccpuregisters(list,r) @@ -629,7 +623,7 @@ implementation end; - procedure tcg.allocallcpuregisters(list:Taasmoutput); + procedure tcg.allocallcpuregisters(list:TAsmList); begin alloccpuregisters(list,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default)); {$ifndef i386} @@ -641,7 +635,7 @@ implementation end; - procedure tcg.dealloccpuregisters(list:Taasmoutput;rt:Tregistertype;const r:Tcpuregisterset); + procedure tcg.dealloccpuregisters(list:TAsmList;rt:Tregistertype;const r:Tcpuregisterset); begin if assigned(rg[rt]) then rg[rt].dealloccpuregisters(list,r) @@ -650,7 +644,7 @@ implementation end; - procedure tcg.deallocallcpuregisters(list:Taasmoutput); + procedure tcg.deallocallcpuregisters(list:TAsmList); begin dealloccpuregisters(list,R_INTREGISTER,paramanager.get_volatile_registers_int(pocall_default)); {$ifndef i386} @@ -708,7 +702,7 @@ implementation end; - procedure tcg.do_register_allocation(list:Taasmoutput;headertai:tai); + procedure tcg.do_register_allocation(list:TAsmList;headertai:tai); var rt : tregistertype; begin @@ -732,19 +726,19 @@ implementation end; - procedure tcg.a_reg_alloc(list : taasmoutput;r : tregister); + procedure tcg.a_reg_alloc(list : TAsmList;r : tregister); begin list.concat(tai_regalloc.alloc(r,nil)); end; - procedure tcg.a_reg_dealloc(list : taasmoutput;r : tregister); + procedure tcg.a_reg_dealloc(list : TAsmList;r : tregister); begin list.concat(tai_regalloc.dealloc(r,nil)); end; - procedure tcg.a_reg_sync(list : taasmoutput;r : tregister); + procedure tcg.a_reg_sync(list : TAsmList;r : tregister); var instr : tai; begin @@ -754,7 +748,7 @@ implementation end; - procedure tcg.a_label(list : taasmoutput;l : tasmlabel); + procedure tcg.a_label(list : TAsmList;l : tasmlabel); begin list.concat(tai_label.create(l)); end; @@ -764,7 +758,7 @@ implementation for better code generation these methods should be overridden ******************************************************************************} - procedure tcg.a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;const cgpara : TCGPara); + procedure tcg.a_param_reg(list : TAsmList;size : tcgsize;r : tregister;const cgpara : TCGPara); var ref : treference; begin @@ -783,7 +777,7 @@ implementation end; - procedure tcg.a_param_const(list : taasmoutput;size : tcgsize;a : aint;const cgpara : TCGPara); + procedure tcg.a_param_const(list : TAsmList;size : tcgsize;a : aint;const cgpara : TCGPara); var ref : treference; begin @@ -802,7 +796,7 @@ implementation end; - procedure tcg.a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const cgpara : TCGPara); + procedure tcg.a_param_ref(list : TAsmList;size : tcgsize;const r : treference;const cgpara : TCGPara); var ref : treference; begin @@ -825,7 +819,7 @@ implementation end; - procedure tcg.a_param_loc(list : taasmoutput;const l:tlocation;const cgpara : TCGPara); + procedure tcg.a_param_loc(list : TAsmList;const l:tlocation;const cgpara : TCGPara); begin case l.loc of LOC_REGISTER, @@ -842,7 +836,7 @@ implementation end; - procedure tcg.a_paramaddr_ref(list : taasmoutput;const r : treference;const cgpara : TCGPara); + procedure tcg.a_paramaddr_ref(list : TAsmList;const r : treference;const cgpara : TCGPara); var hr : tregister; begin @@ -857,7 +851,7 @@ implementation some generic implementations ****************************************************************************} - procedure tcg.a_load_ref_ref(list : taasmoutput;fromsize,tosize : tcgsize;const sref : treference;const dref : treference); + procedure tcg.a_load_ref_ref(list : TAsmList;fromsize,tosize : tcgsize;const sref : treference;const dref : treference); var tmpreg: tregister; begin @@ -870,7 +864,7 @@ implementation end; - procedure tcg.a_load_const_ref(list : taasmoutput;size : tcgsize;a : aint;const ref : treference); + procedure tcg.a_load_const_ref(list : TAsmList;size : tcgsize;a : aint;const ref : treference); var tmpreg: tregister; begin @@ -880,7 +874,7 @@ implementation end; - procedure tcg.a_load_const_loc(list : taasmoutput;a : aint;const loc: tlocation); + procedure tcg.a_load_const_loc(list : TAsmList;a : aint;const loc: tlocation); begin case loc.loc of LOC_REFERENCE,LOC_CREFERENCE: @@ -893,7 +887,7 @@ implementation end; - procedure tcg.a_load_reg_loc(list : taasmoutput;fromsize : tcgsize;reg : tregister;const loc: tlocation); + procedure tcg.a_load_reg_loc(list : TAsmList;fromsize : tcgsize;reg : tregister;const loc: tlocation); begin case loc.loc of LOC_REFERENCE,LOC_CREFERENCE: @@ -906,7 +900,7 @@ implementation end; - procedure tcg.a_load_loc_reg(list : taasmoutput; tosize: tcgsize; const loc: tlocation; reg : tregister); + procedure tcg.a_load_loc_reg(list : TAsmList; tosize: tcgsize; const loc: tlocation; reg : tregister); begin case loc.loc of LOC_REFERENCE,LOC_CREFERENCE: @@ -921,7 +915,7 @@ implementation end; - procedure tcg.a_load_loc_ref(list : taasmoutput;tosize: tcgsize; const loc: tlocation; const ref : treference); + procedure tcg.a_load_loc_ref(list : TAsmList;tosize: tcgsize; const loc: tlocation; const ref : treference); begin case loc.loc of LOC_REFERENCE,LOC_CREFERENCE: @@ -936,7 +930,7 @@ implementation end; - function tcg.optimize_op_const_reg(list: taasmoutput; var op: topcg; var a : aint; var reg:tregister): boolean; + function tcg.optimize_op_const_reg(list: TAsmList; var op: topcg; var a : aint; var reg:tregister): boolean; var powerval : longint; begin @@ -990,7 +984,7 @@ implementation end; - procedure tcg.a_loadfpu_loc_reg(list: taasmoutput; const loc: tlocation; const reg: tregister); + procedure tcg.a_loadfpu_loc_reg(list: TAsmList; const loc: tlocation; const reg: tregister); begin case loc.loc of LOC_REFERENCE, LOC_CREFERENCE: @@ -1003,7 +997,7 @@ implementation end; - procedure tcg.a_loadfpu_reg_loc(list: taasmoutput; size: tcgsize; const reg: tregister; const loc: tlocation); + procedure tcg.a_loadfpu_reg_loc(list: TAsmList; size: tcgsize; const reg: tregister; const loc: tlocation); begin case loc.loc of LOC_REFERENCE, LOC_CREFERENCE: @@ -1016,7 +1010,7 @@ implementation end; - procedure tcg.a_paramfpu_reg(list : taasmoutput;size : tcgsize;const r : tregister;const cgpara : TCGPara); + procedure tcg.a_paramfpu_reg(list : TAsmList;size : tcgsize;const r : tregister;const cgpara : TCGPara); var ref : treference; begin @@ -1046,7 +1040,7 @@ implementation end; - procedure tcg.a_paramfpu_ref(list : taasmoutput;size : tcgsize;const ref : treference;const cgpara : TCGPara); + procedure tcg.a_paramfpu_ref(list : TAsmList;size : tcgsize;const ref : treference;const cgpara : TCGPara); var href : treference; begin @@ -1066,7 +1060,7 @@ implementation end; - procedure tcg.a_op_const_ref(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; const ref: TReference); + procedure tcg.a_op_const_ref(list : TAsmList; Op: TOpCG; size: TCGSize; a: aint; const ref: TReference); var tmpreg : tregister; begin @@ -1077,7 +1071,7 @@ implementation end; - procedure tcg.a_op_const_loc(list : taasmoutput; Op: TOpCG; a: aint; const loc: tlocation); + procedure tcg.a_op_const_loc(list : TAsmList; Op: TOpCG; a: aint; const loc: tlocation); begin case loc.loc of LOC_REGISTER, LOC_CREGISTER: @@ -1090,7 +1084,7 @@ implementation end; - procedure tcg.a_op_reg_ref(list : taasmoutput; Op: TOpCG; size: TCGSize;reg: TRegister; const ref: TReference); + procedure tcg.a_op_reg_ref(list : TAsmList; Op: TOpCG; size: TCGSize;reg: TRegister; const ref: TReference); var tmpreg : tregister; begin @@ -1101,7 +1095,7 @@ implementation end; - procedure tcg.a_op_ref_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; const ref: TReference; reg: TRegister); + procedure tcg.a_op_ref_reg(list : TAsmList; Op: TOpCG; size: TCGSize; const ref: TReference; reg: TRegister); var tmpreg: tregister; @@ -1124,7 +1118,7 @@ implementation end; - procedure tcg.a_op_reg_loc(list : taasmoutput; Op: TOpCG; reg: tregister; const loc: tlocation); + procedure tcg.a_op_reg_loc(list : TAsmList; Op: TOpCG; reg: tregister; const loc: tlocation); begin case loc.loc of @@ -1138,7 +1132,7 @@ implementation end; - procedure tcg.a_op_ref_loc(list : taasmoutput; Op: TOpCG; const ref: TReference; const loc: tlocation); + procedure tcg.a_op_ref_loc(list : TAsmList; Op: TOpCG; const ref: TReference; const loc: tlocation); var tmpreg: tregister; @@ -1158,7 +1152,7 @@ implementation end; end; - procedure Tcg.a_op_const_reg_reg(list:Taasmoutput;op:Topcg;size:Tcgsize; + procedure Tcg.a_op_const_reg_reg(list:TAsmList;op:Topcg;size:Tcgsize; a:aint;src,dst:Tregister); begin @@ -1166,7 +1160,7 @@ implementation a_op_const_reg(list,op,size,a,dst); end; - procedure tcg.a_op_reg_reg_reg(list: taasmoutput; op: TOpCg; + procedure tcg.a_op_reg_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister); var tmpreg: tregister; @@ -1186,21 +1180,21 @@ implementation end; - procedure tcg.a_op_const_reg_reg_checkoverflow(list: taasmoutput; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation); + procedure tcg.a_op_const_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation); begin a_op_const_reg_reg(list,op,size,a,src,dst); ovloc.loc:=LOC_VOID; end; - procedure tcg.a_op_reg_reg_reg_checkoverflow(list: taasmoutput; op: TOpCg; size: tcgsize; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation); + procedure tcg.a_op_reg_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation); begin a_op_reg_reg_reg(list,op,size,src1,src2,dst); ovloc.loc:=LOC_VOID; end; - procedure tcg.a_cmp_const_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;const ref : treference; + procedure tcg.a_cmp_const_ref_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;const ref : treference; l : tasmlabel); var @@ -1212,7 +1206,7 @@ implementation end; - procedure tcg.a_cmp_const_loc_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;const loc : tlocation; + procedure tcg.a_cmp_const_loc_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;const loc : tlocation; l : tasmlabel); begin @@ -1227,7 +1221,7 @@ implementation end; - procedure tcg.a_cmp_ref_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp; const ref: treference; reg : tregister; l : tasmlabel); + procedure tcg.a_cmp_ref_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp; const ref: treference; reg : tregister; l : tasmlabel); var tmpreg: tregister; begin @@ -1237,7 +1231,7 @@ implementation end; - procedure tcg.a_cmp_reg_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp; reg : tregister; const ref: treference; l : tasmlabel); + procedure tcg.a_cmp_reg_ref_label(list : TAsmList;size : tcgsize;cmp_op : topcmp; reg : tregister; const ref: treference; l : tasmlabel); var tmpreg: tregister; begin @@ -1247,13 +1241,13 @@ implementation end; - procedure tcg.a_cmp_reg_loc_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp; reg: tregister; const loc: tlocation; l : tasmlabel); + procedure tcg.a_cmp_reg_loc_label(list : TAsmList;size : tcgsize;cmp_op : topcmp; reg: tregister; const loc: tlocation; l : tasmlabel); begin a_cmp_loc_reg_label(list,size,swap_opcmp(cmp_op),loc,reg,l); end; - procedure tcg.a_cmp_loc_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp; const loc: tlocation; reg : tregister; l : tasmlabel); + procedure tcg.a_cmp_loc_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp; const loc: tlocation; reg : tregister; l : tasmlabel); begin case loc.loc of LOC_REGISTER, @@ -1270,7 +1264,7 @@ implementation end; - procedure tcg.a_cmp_ref_loc_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;const ref: treference;const loc : tlocation; + procedure tcg.a_cmp_ref_loc_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;const ref: treference;const loc : tlocation; l : tasmlabel); var tmpreg: tregister; @@ -1290,7 +1284,7 @@ implementation end; - procedure tcg.a_loadmm_loc_reg(list: taasmoutput; size: tcgsize; const loc: tlocation; const reg: tregister;shuffle : pmmshuffle); + procedure tcg.a_loadmm_loc_reg(list: TAsmList; size: tcgsize; const loc: tlocation; const reg: tregister;shuffle : pmmshuffle); begin case loc.loc of LOC_MMREGISTER,LOC_CMMREGISTER: @@ -1303,7 +1297,7 @@ implementation end; - procedure tcg.a_loadmm_reg_loc(list: taasmoutput; size: tcgsize; const reg: tregister; const loc: tlocation;shuffle : pmmshuffle); + procedure tcg.a_loadmm_reg_loc(list: TAsmList; size: tcgsize; const reg: tregister; const loc: tlocation;shuffle : pmmshuffle); begin case loc.loc of LOC_MMREGISTER,LOC_CMMREGISTER: @@ -1316,7 +1310,7 @@ implementation end; - procedure tcg.a_parammm_reg(list: taasmoutput; size: tcgsize; reg: tregister;const cgpara : TCGPara;shuffle : pmmshuffle); + procedure tcg.a_parammm_reg(list: TAsmList; size: tcgsize; reg: tregister;const cgpara : TCGPara;shuffle : pmmshuffle); var href : treference; begin @@ -1335,7 +1329,7 @@ implementation end; - procedure tcg.a_parammm_ref(list: taasmoutput; size: tcgsize;const ref: treference;const cgpara : TCGPara;shuffle : pmmshuffle); + procedure tcg.a_parammm_ref(list: TAsmList; size: tcgsize;const ref: treference;const cgpara : TCGPara;shuffle : pmmshuffle); var hr : tregister; hs : tmmshuffle; @@ -1354,7 +1348,7 @@ implementation end; - procedure tcg.a_parammm_loc(list: taasmoutput;const loc: tlocation; const cgpara : TCGPara;shuffle : pmmshuffle); + procedure tcg.a_parammm_loc(list: TAsmList;const loc: tlocation; const cgpara : TCGPara;shuffle : pmmshuffle); begin case loc.loc of LOC_MMREGISTER,LOC_CMMREGISTER: @@ -1367,7 +1361,7 @@ implementation end; - procedure tcg.a_opmm_ref_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); + procedure tcg.a_opmm_ref_reg(list: TAsmList; Op: TOpCG; size : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); var hr : tregister; hs : tmmshuffle; @@ -1385,7 +1379,7 @@ implementation end; - procedure tcg.a_opmm_reg_ref(list: taasmoutput; Op: TOpCG; size : tcgsize;reg: tregister; const ref: treference; shuffle : pmmshuffle); + procedure tcg.a_opmm_reg_ref(list: TAsmList; Op: TOpCG; size : tcgsize;reg: tregister; const ref: treference; shuffle : pmmshuffle); var hr : tregister; hs : tmmshuffle; @@ -1407,7 +1401,7 @@ implementation end; - procedure tcg.a_opmm_loc_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;const loc: tlocation; reg: tregister;shuffle : pmmshuffle); + procedure tcg.a_opmm_loc_reg(list: TAsmList; Op: TOpCG; size : tcgsize;const loc: tlocation; reg: tregister;shuffle : pmmshuffle); begin case loc.loc of LOC_CMMREGISTER,LOC_MMREGISTER: @@ -1420,13 +1414,13 @@ implementation end; - procedure tcg.g_concatcopy_unaligned(list : taasmoutput;const source,dest : treference;len : aint); + procedure tcg.g_concatcopy_unaligned(list : TAsmList;const source,dest : treference;len : aint); begin g_concatcopy(list,source,dest,len); end; - procedure tcg.g_copyshortstring(list : taasmoutput;const source,dest : treference;len:byte); + procedure tcg.g_copyshortstring(list : TAsmList;const source,dest : treference;len:byte); var cgpara1,cgpara2,cgpara3 : TCGPara; begin @@ -1454,7 +1448,7 @@ implementation end; - procedure tcg.g_incrrefcount(list : taasmoutput;t: tdef; const ref: treference); + procedure tcg.g_incrrefcount(list : TAsmList;t: tdef; const ref: treference); var href : treference; incrfunc : string; @@ -1503,7 +1497,7 @@ implementation end; - procedure tcg.g_decrrefcount(list : taasmoutput;t: tdef; const ref: treference); + procedure tcg.g_decrrefcount(list : TAsmList;t: tdef; const ref: treference); var href : treference; decrfunc : string; @@ -1571,7 +1565,7 @@ implementation end; - procedure tcg.g_initialize(list : taasmoutput;t : tdef;const ref : treference); + procedure tcg.g_initialize(list : TAsmList;t : tdef;const ref : treference); var href : treference; cgpara1,cgpara2 : TCGPara; @@ -1603,7 +1597,7 @@ implementation end; - procedure tcg.g_finalize(list : taasmoutput;t : tdef;const ref : treference); + procedure tcg.g_finalize(list : TAsmList;t : tdef;const ref : treference); var href : treference; cgpara1,cgpara2 : TCGPara; @@ -1637,7 +1631,7 @@ implementation end; - procedure tcg.g_rangecheck(list: taasmoutput; const l:tlocation;fromdef,todef: tdef); + procedure tcg.g_rangecheck(list: TAsmList; const l:tlocation;fromdef,todef: tdef); { generate range checking code for the value at location p. The type } { type used is checked against todefs ranges. fromdef (p.resulttype.def) } { is the original type used at that location. When both defs are equal } @@ -1729,7 +1723,7 @@ implementation {$endif} if to_signed then begin - { calculation of the low/high ranges must not overflow 64 bit + { calculation of the low/high ranges must not overflow 64 bit otherwise we end up comparing with zero for 64 bit data types on 64 bit processors } if (lto = (int64(-1) << (tosize * 8 - 1))) and @@ -1738,7 +1732,7 @@ implementation end else begin - { calculation of the low/high ranges must not overflow 64 bit + { calculation of the low/high ranges must not overflow 64 bit otherwise we end up having all zeros for 64 bit data types on 64 bit processors } if (lto = 0) and @@ -1800,7 +1794,7 @@ implementation hreg:=getintregister(list,OS_INT); a_load_loc_reg(list,OS_INT,l,hreg); a_op_const_reg(list,OP_SUB,OS_INT,aint(lto),hreg); - objectlibrary.getjumplabel(neglabel); + current_asmdata.getjumplabel(neglabel); { if from_signed then a_cmp_const_reg_label(list,OS_INT,OC_GTE,aint(hto-lto),hreg,neglabel) @@ -1817,13 +1811,13 @@ implementation end; - procedure tcg.g_overflowCheck_loc(List:TAasmOutput;const Loc:TLocation;def:TDef;ovloc : tlocation); + procedure tcg.g_overflowCheck_loc(List:TAsmList;const Loc:TLocation;def:TDef;ovloc : tlocation); begin g_overflowCheck(list,loc,def); end; - procedure tcg.g_flags2ref(list: taasmoutput; size: TCgSize; const f: tresflags; const ref:TReference); + procedure tcg.g_flags2ref(list: TAsmList; size: TCgSize; const f: tresflags; const ref:TReference); var tmpreg : tregister; @@ -1834,7 +1828,7 @@ implementation end; - procedure tcg.g_maybe_testself(list : taasmoutput;reg:tregister); + procedure tcg.g_maybe_testself(list : TAsmList;reg:tregister); var OKLabel : tasmlabel; cgpara1 : TCGPara; @@ -1842,7 +1836,7 @@ implementation if (cs_check_object in aktlocalswitches) or (cs_check_range in aktlocalswitches) then begin - objectlibrary.getjumplabel(oklabel); + current_asmdata.getjumplabel(oklabel); a_cmp_const_reg_label(list,OS_ADDR,OC_NE,0,reg,oklabel); cgpara1.init; paramanager.getintparaloc(pocall_default,1,cgpara1); @@ -1856,7 +1850,7 @@ implementation end; - procedure tcg.g_maybe_testvmt(list : taasmoutput;reg:tregister;objdef:tobjectdef); + procedure tcg.g_maybe_testvmt(list : TAsmList;reg:tregister;objdef:tobjectdef); var hrefvmt : treference; cgpara1,cgpara2 : TCGPara; @@ -1867,7 +1861,7 @@ implementation paramanager.getintparaloc(pocall_default,2,cgpara2); if (cs_check_object in aktlocalswitches) then begin - reference_reset_symbol(hrefvmt,objectlibrary.newasmsymbol(objdef.vmt_mangledname,AB_EXTERNAL,AT_DATA),0); + reference_reset_symbol(hrefvmt,current_asmdata.newasmsymbol(objdef.vmt_mangledname,AB_EXTERNAL,AT_DATA),0); paramanager.allocparaloc(list,cgpara2); a_paramaddr_ref(list,hrefvmt,cgpara2); paramanager.allocparaloc(list,cgpara1); @@ -1897,7 +1891,7 @@ implementation Entry/Exit Code Functions *****************************************************************************} - procedure tcg.g_copyvaluepara_openarray(list : taasmoutput;const ref:treference;const lenloc:tlocation;elesize:aint;destreg:tregister); + procedure tcg.g_copyvaluepara_openarray(list : TAsmList;const ref:treference;const lenloc:tlocation;elesize:aint;destreg:tregister); var sizereg,sourcereg,lenreg : tregister; cgpara1,cgpara2,cgpara3 : TCGPara; @@ -1965,7 +1959,7 @@ implementation end; - procedure tcg.g_releasevaluepara_openarray(list : taasmoutput;const l:tlocation); + procedure tcg.g_releasevaluepara_openarray(list : TAsmList;const l:tlocation); var cgpara1 : TCGPara; begin @@ -1983,7 +1977,7 @@ implementation end; - procedure tcg.g_save_standard_registers(list:Taasmoutput); + procedure tcg.g_save_standard_registers(list:TAsmList); var href : treference; size : longint; @@ -2013,7 +2007,7 @@ implementation end; - procedure tcg.g_restore_standard_registers(list:Taasmoutput); + procedure tcg.g_restore_standard_registers(list:TAsmList); var href : treference; r : integer; @@ -2034,30 +2028,30 @@ implementation end; - procedure tcg.g_profilecode(list : taasmoutput); + procedure tcg.g_profilecode(list : TAsmList); begin end; - procedure tcg.g_exception_reason_save(list : taasmoutput; const href : treference); + procedure tcg.g_exception_reason_save(list : TAsmList; const href : treference); begin a_load_reg_ref(list, OS_INT, OS_INT, NR_FUNCTION_RESULT_REG, href); end; - procedure tcg.g_exception_reason_save_const(list : taasmoutput; const href : treference; a: aint); + procedure tcg.g_exception_reason_save_const(list : TAsmList; const href : treference; a: aint); begin a_load_const_ref(list, OS_INT, a, href); end; - procedure tcg.g_exception_reason_load(list : taasmoutput; const href : treference); + procedure tcg.g_exception_reason_load(list : TAsmList; const href : treference); begin a_load_ref_reg(list, OS_INT, OS_INT, href, NR_FUNCTION_RESULT_REG); end; - procedure tcg.g_adjust_self_value(list:taasmoutput;procdef: tprocdef;ioffset: aint); + procedure tcg.g_adjust_self_value(list:TAsmList;procdef: tprocdef;ioffset: aint); var hsym : tsym; href : treference; @@ -2090,13 +2084,13 @@ implementation end; - procedure tcg.a_call_name_static(list : taasmoutput;const s : string); + procedure tcg.a_call_name_static(list : TAsmList;const s : string); begin a_call_name(list,s); end; - function tcg.g_indirect_sym_load(list:taasmoutput;const symname: string): tregister; + function tcg.g_indirect_sym_load(list:TAsmList;const symname: string): tregister; var l: tasmsymbol; ref: treference; @@ -2106,18 +2100,18 @@ implementation system_powerpc_darwin, system_i386_darwin: begin - l:=objectlibrary.getasmsymbol('L'+symname+'$non_lazy_ptr'); + l:=current_asmdata.getasmsymbol('L'+symname+'$non_lazy_ptr'); if not(assigned(l)) then begin - l:=objectlibrary.newasmsymbol('L'+symname+'$non_lazy_ptr',AB_COMMON,AT_DATA); - asmlist[al_picdata].concat(tai_symbol.create(l,0)); - asmlist[al_picdata].concat(tai_const.create_indirect_sym(objectlibrary.newasmsymbol(symname,AB_EXTERNAL,AT_DATA))); - asmlist[al_picdata].concat(tai_const.create_32bit(0)); + l:=current_asmdata.newasmsymbol('L'+symname+'$non_lazy_ptr',AB_COMMON,AT_DATA); + current_asmdata.asmlists[al_picdata].concat(tai_symbol.create(l,0)); + current_asmdata.asmlists[al_picdata].concat(tai_const.create_indirect_sym(current_asmdata.newasmsymbol(symname,AB_EXTERNAL,AT_DATA))); + current_asmdata.asmlists[al_picdata].concat(tai_const.create_32bit(0)); end; result := cg.getaddressregister(list); reference_reset_symbol(ref,l,0); { ref.base:=current_procinfo.got; - ref.relsymbol:=current_procinfo.gotlabel;} + ref.relsymbol:=current_procinfo.CurrGOTLabel;} cg.a_load_ref_reg(list,OS_ADDR,OS_ADDR,ref,result); end; end; @@ -2129,14 +2123,14 @@ implementation *****************************************************************************} {$ifndef cpu64bit} - procedure tcg64.a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64; regsrc,regdst : tregister64); + procedure tcg64.a_op64_const_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;value : int64; regsrc,regdst : tregister64); begin a_load64_reg_reg(list,regsrc,regdst); a_op64_const_reg(list,op,size,value,regdst); end; - procedure tcg64.a_op64_reg_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64); + procedure tcg64.a_op64_reg_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64); var tmpreg64 : tregister64; begin @@ -2161,14 +2155,14 @@ implementation end; - procedure tcg64.a_op64_const_reg_reg_checkoverflow(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation); + procedure tcg64.a_op64_const_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation); begin a_op64_const_reg_reg(list,op,size,value,regsrc,regdst); ovloc.loc:=LOC_VOID; end; - procedure tcg64.a_op64_reg_reg_reg_checkoverflow(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation); + procedure tcg64.a_op64_reg_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation); begin a_op64_reg_reg_reg(list,op,size,regsrc1,regsrc2,regdst); ovloc.loc:=LOC_VOID; diff --git a/compiler/cresstr.pas b/compiler/cresstr.pas index 266e9ed2bf..e9d9dec86b 100644 --- a/compiler/cresstr.pas +++ b/compiler/cresstr.pas @@ -137,37 +137,37 @@ uses R:=TResourceStringItem(List.First); while assigned(R) do begin - maybe_new_object_file(asmlist[al_const]); - new_section(asmlist[al_const],sec_fpc_resstr_data,R.name,sizeof(aint)); + maybe_new_object_file(current_asmdata.asmlists[al_const]); + new_section(current_asmdata.asmlists[al_const],sec_fpc_resstr_data,R.name,sizeof(aint)); { Write default value } if assigned(R.value) and (R.len<>0) then begin - objectlibrary.getdatalabel(valuelab); - asmlist[al_const].concat(tai_align.Create(const_align(sizeof(aint)))); - asmlist[al_const].concat(tai_const.create_aint(-1)); - asmlist[al_const].concat(tai_const.create_aint(R.len)); - asmlist[al_const].concat(tai_label.create(valuelab)); + current_asmdata.getdatalabel(valuelab); + current_asmdata.asmlists[al_const].concat(tai_align.Create(const_align(sizeof(aint)))); + current_asmdata.asmlists[al_const].concat(tai_const.create_aint(-1)); + current_asmdata.asmlists[al_const].concat(tai_const.create_aint(R.len)); + current_asmdata.asmlists[al_const].concat(tai_label.create(valuelab)); getmem(s,R.len+1); move(R.value^,s^,R.len); s[R.len]:=#0; - asmlist[al_const].concat(tai_string.create_pchar(s,R.len)); - asmlist[al_const].concat(tai_const.create_8bit(0)); + current_asmdata.asmlists[al_const].concat(tai_string.create_pchar(s,R.len)); + current_asmdata.asmlists[al_const].concat(tai_const.create_8bit(0)); end else valuelab:=nil; { Append the name as a ansistring. } - objectlibrary.getdatalabel(namelab); + current_asmdata.getdatalabel(namelab); l:=length(R.name); - maybe_new_object_file(asmlist[al_const]); - asmlist[al_const].concat(tai_align.create(const_align(sizeof(aint)))); - asmlist[al_const].concat(tai_const.create_aint(-1)); - asmlist[al_const].concat(tai_const.create_aint(l)); - asmlist[al_const].concat(tai_label.create(namelab)); + maybe_new_object_file(current_asmdata.asmlists[al_const]); + current_asmdata.asmlists[al_const].concat(tai_align.create(const_align(sizeof(aint)))); + current_asmdata.asmlists[al_const].concat(tai_const.create_aint(-1)); + current_asmdata.asmlists[al_const].concat(tai_const.create_aint(l)); + current_asmdata.asmlists[al_const].concat(tai_label.create(namelab)); getmem(s,l+1); move(R.Name[1],s^,l); s[l]:=#0; - asmlist[al_const].concat(tai_string.create_pchar(s,l)); - asmlist[al_const].concat(tai_const.create_8bit(0)); + current_asmdata.asmlists[al_const].concat(tai_string.create_pchar(s,l)); + current_asmdata.asmlists[al_const].concat(tai_const.create_8bit(0)); { Resourcestring index: @@ -179,14 +179,14 @@ uses HashValue : LongWord; end; } - new_section(asmlist[al_resourcestrings],sec_fpc_resstr_index,r.name,sizeof(aint)); - resstrlab:=objectlibrary.newasmsymbol(make_mangledname('RESSTR',R.Sym.owner,R.Sym.name),AB_GLOBAL,AT_DATA); - asmlist[al_resourcestrings].concat(tai_symbol.Create_global(resstrlab,0)); - asmlist[al_resourcestrings].concat(tai_const.create_sym(namelab)); - asmlist[al_resourcestrings].concat(tai_const.create_sym(nil)); - asmlist[al_resourcestrings].concat(tai_const.create_sym(valuelab)); - asmlist[al_resourcestrings].concat(tai_const.create_32bit(longint(R.Hash))); - asmlist[al_resourcestrings].concat(tai_symbol_end.create(resstrlab)); + new_section(current_asmdata.asmlists[al_resourcestrings],sec_fpc_resstr_index,r.name,sizeof(aint)); + resstrlab:=current_asmdata.newasmsymbol(make_mangledname('RESSTR',R.Sym.owner,R.Sym.name),AB_GLOBAL,AT_DATA); + current_asmdata.asmlists[al_resourcestrings].concat(tai_symbol.Create_global(resstrlab,0)); + current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(namelab)); + current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(nil)); + current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_sym(valuelab)); + current_asmdata.asmlists[al_resourcestrings].concat(tai_const.create_32bit(longint(R.Hash))); + current_asmdata.asmlists[al_resourcestrings].concat(tai_symbol_end.create(resstrlab)); R:=TResourceStringItem(R.Next); end; end; diff --git a/compiler/dbgbase.pas b/compiler/dbgbase.pas index 74cf240d5d..9711a8769e 100644 --- a/compiler/dbgbase.pas +++ b/compiler/dbgbase.pas @@ -40,12 +40,12 @@ interface procedure inserttypeinfo;virtual; procedure insertmoduleinfo;virtual; - procedure insertlineinfo(list:taasmoutput);virtual; - procedure referencesections(list:taasmoutput);virtual; - procedure insertdef(list:taasmoutput;def:tdef);virtual;abstract; - procedure write_symtable_defs(list:taasmoutput;st:tsymtable);virtual;abstract; + procedure insertlineinfo(list:TAsmList);virtual; + procedure referencesections(list:TAsmList);virtual; + procedure insertdef(list:TAsmList;def:tdef);virtual;abstract; + procedure write_symtable_defs(list:TAsmList;st:tsymtable);virtual;abstract; - procedure write_used_unit_type_info(list:taasmoutput;hp:tmodule); + procedure write_used_unit_type_info(list:TAsmList;hp:tmodule); procedure field_write_defs(p:Tnamedindexitem;arg:pointer); procedure method_write_defs(p :tnamedindexitem;arg:pointer); end; @@ -81,12 +81,12 @@ implementation end; - procedure tdebuginfo.insertlineinfo(list:taasmoutput); + procedure tdebuginfo.insertlineinfo(list:TAsmList); begin end; - procedure tdebuginfo.referencesections(list:taasmoutput); + procedure tdebuginfo.referencesections(list:TAsmList); begin end; @@ -108,7 +108,7 @@ implementation begin if (Tsym(p).typ=fieldvarsym) and not(sp_static in Tsym(p).symoptions) then - insertdef(taasmoutput(arg),tfieldvarsym(p).vartype.def); + insertdef(TAsmList(arg),tfieldvarsym(p).vartype.def); end; @@ -119,12 +119,12 @@ implementation if tsym(p).typ=procsym then begin pd:=tprocsym(p).first_procdef; - insertdef(taasmoutput(arg),pd.rettype.def); + insertdef(TAsmList(arg),pd.rettype.def); end; end; - procedure TDebugInfo.write_used_unit_type_info(list:taasmoutput;hp:tmodule); + procedure TDebugInfo.write_used_unit_type_info(list:TAsmList;hp:tmodule); var pu : tused_unit; begin diff --git a/compiler/dbgdwarf.pas b/compiler/dbgdwarf.pas index 671e5e025c..cd1432d66b 100644 --- a/compiler/dbgdwarf.pas +++ b/compiler/dbgdwarf.pas @@ -212,19 +212,19 @@ interface procedure field_add_dwarftag(p:Tnamedindexitem;arg:pointer); procedure method_add_dwarftag(p:Tnamedindexitem;arg:pointer); - procedure append_procdef(list:taasmoutput;pd:tprocdef); - procedure append_dwarftag(list:taasmoutput;def:tdef); - procedure insertsym(list:taasmoutput;sym:tsym); - procedure write_symtable_syms(list:taasmoutput;st:tsymtable); + procedure append_procdef(list:TAsmList;pd:tprocdef); + procedure append_dwarftag(list:TAsmList;def:tdef); + procedure insertsym(list:TAsmList;sym:tsym); + procedure write_symtable_syms(list:TAsmList;st:tsymtable); function def_dwarf_lab(def:tdef) : tasmsymbol; public - procedure insertdef(list:taasmoutput;def:tdef);override; + procedure insertdef(list:TAsmList;def:tdef);override; procedure insertmoduleinfo;override; procedure inserttypeinfo;override; - procedure referencesections(list:taasmoutput);override; - procedure insertlineinfo(list:taasmoutput);override; - procedure write_symtable_defs(list:taasmoutput;st:tsymtable);override; + procedure referencesections(list:TAsmList);override; + procedure insertlineinfo(list:TAsmList);override; + procedure write_symtable_defs(list:TAsmList;st:tsymtable);override; end; implementation @@ -441,7 +441,7 @@ implementation { Need a new label? } if def.dwarf_lab=nil then begin - objectlibrary.getdatalabel(def.dwarf_lab); + current_asmdata.getdatalabel(def.dwarf_lab); if nextdefnumber>=defnumberlist.count then defnumberlist.count:=nextdefnumber+250; defnumberlist[nextdefnumber]:=def; @@ -459,16 +459,16 @@ implementation begin inc(currabbrevnumber); - asmlist[al_dwarf_abbrev].concat(tai_comment.Create(strpnew('Abbrev '+tostr(currabbrevnumber)))); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_comment.Create(strpnew('Abbrev '+tostr(currabbrevnumber)))); { abbrev number } - asmlist[al_dwarf_info].concat(tai_const.create_uleb128bit(currabbrevnumber)); - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(currabbrevnumber)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(currabbrevnumber)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(currabbrevnumber)); { tag } - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(tag))); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(tag))); { children? } - asmlist[al_dwarf_abbrev].concat(tai_const.create_8bit(ord(has_children))); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_8bit(ord(has_children))); i:=0; while i<=high(data) do @@ -476,7 +476,7 @@ implementation { attribute } if data[i].VType=vtInteger then begin - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(data[i].VInteger)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(data[i].VInteger)); end else internalerror(200601261); @@ -485,7 +485,7 @@ implementation { form } if data[i].VType=vtInteger then begin - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(data[i].VInteger)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(data[i].VInteger)); end else internalerror(200601262); @@ -496,27 +496,27 @@ implementation DW_FORM_string: case data[i].VType of vtChar: - asmlist[al_dwarf_info].concat(tai_string.create(data[i].VChar)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_string.create(data[i].VChar)); vtString: - asmlist[al_dwarf_info].concat(tai_string.create(data[i].VString^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_string.create(data[i].VString^)); vtAnsistring: - asmlist[al_dwarf_info].concat(tai_string.create(Ansistring(data[i].VAnsiString))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_string.create(Ansistring(data[i].VAnsiString))); else internalerror(200601264); end; DW_FORM_flag: - asmlist[al_dwarf_info].concat(tai_const.create_8bit(byte(data[i].VBoolean))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(byte(data[i].VBoolean))); DW_FORM_data1: case data[i].VType of vtInteger: - asmlist[al_dwarf_info].concat(tai_const.create_8bit(data[i].VInteger)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(data[i].VInteger)); vtInt64: - asmlist[al_dwarf_info].concat(tai_const.create_8bit(data[i].VInt64^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(data[i].VInt64^)); vtQWord: - asmlist[al_dwarf_info].concat(tai_const.create_8bit(data[i].VQWord^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(data[i].VQWord^)); else internalerror(200602143); end; @@ -524,11 +524,11 @@ implementation DW_FORM_data2: case data[i].VType of vtInteger: - asmlist[al_dwarf_info].concat(tai_const.create_16bit(data[i].VInteger)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(data[i].VInteger)); vtInt64: - asmlist[al_dwarf_info].concat(tai_const.create_16bit(data[i].VInt64^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(data[i].VInt64^)); vtQWord: - asmlist[al_dwarf_info].concat(tai_const.create_16bit(data[i].VQWord^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(data[i].VQWord^)); else internalerror(200602144); end; @@ -536,11 +536,11 @@ implementation DW_FORM_data4: case data[i].VType of vtInteger: - asmlist[al_dwarf_info].concat(tai_const.create_32bit(data[i].VInteger)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit(data[i].VInteger)); vtInt64: - asmlist[al_dwarf_info].concat(tai_const.create_32bit(data[i].VInt64^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit(data[i].VInt64^)); vtQWord: - asmlist[al_dwarf_info].concat(tai_const.create_32bit(data[i].VQWord^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit(data[i].VQWord^)); else internalerror(200602145); end; @@ -548,11 +548,11 @@ implementation DW_FORM_data8: case data[i].VType of vtInteger: - asmlist[al_dwarf_info].concat(tai_const.create_64bit(data[i].VInteger)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit(data[i].VInteger)); vtInt64: - asmlist[al_dwarf_info].concat(tai_const.create_64bit(data[i].VInt64^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit(data[i].VInt64^)); vtQWord: - asmlist[al_dwarf_info].concat(tai_const.create_64bit(data[i].VQWord^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit(data[i].VQWord^)); else internalerror(200602146); end; @@ -560,11 +560,11 @@ implementation DW_FORM_sdata: case data[i].VType of vtInteger: - asmlist[al_dwarf_info].concat(tai_const.create_sleb128bit(data[i].VInteger)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_sleb128bit(data[i].VInteger)); vtInt64: - asmlist[al_dwarf_info].concat(tai_const.create_sleb128bit(data[i].VInt64^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_sleb128bit(data[i].VInt64^)); vtQWord: - asmlist[al_dwarf_info].concat(tai_const.create_sleb128bit(data[i].VQWord^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_sleb128bit(data[i].VQWord^)); else internalerror(200601285); end; @@ -572,11 +572,11 @@ implementation DW_FORM_udata: case data[i].VType of vtInteger: - asmlist[al_dwarf_info].concat(tai_const.create_uleb128bit(data[i].VInteger)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(data[i].VInteger)); vtInt64: - asmlist[al_dwarf_info].concat(tai_const.create_uleb128bit(data[i].VInt64^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(data[i].VInt64^)); vtQWord: - asmlist[al_dwarf_info].concat(tai_const.create_uleb128bit(data[i].VQWord^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(data[i].VQWord^)); else internalerror(200601284); end; @@ -585,11 +585,11 @@ implementation DW_FORM_block1: case data[i].VType of vtInteger: - asmlist[al_dwarf_info].concat(tai_const.create_8bit(data[i].VInteger)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(data[i].VInteger)); vtInt64: - asmlist[al_dwarf_info].concat(tai_const.create_8bit(data[i].VInt64^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(data[i].VInt64^)); vtQWord: - asmlist[al_dwarf_info].concat(tai_const.create_8bit(data[i].VQWord^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(data[i].VQWord^)); else internalerror(200602141); end; @@ -603,42 +603,42 @@ implementation procedure TDebugInfoDwarf.append_labelentry(attr : tdwarf_attribute;sym : tasmsymbol); begin - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(attr))); - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_addr))); - asmlist[al_dwarf_info].concat(tai_const.create_sym(sym)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(attr))); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_addr))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_sym(sym)); end; procedure TDebugInfoDwarf.append_labelentry_ref(attr : tdwarf_attribute;sym : tasmsymbol); begin - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(attr))); - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_ref_addr))); - asmlist[al_dwarf_info].concat(tai_const.create_sym(sym)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(attr))); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_ref_addr))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_sym(sym)); end; procedure TDebugInfoDwarf.append_labelentry_data(attr : tdwarf_attribute;sym : tasmsymbol); begin - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(attr))); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(attr))); {$ifdef cpu64bit} - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_data8))); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_data8))); {$else cpu64bit} - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_data4))); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_data4))); {$endif cpu64bit} - asmlist[al_dwarf_info].concat(tai_const.create_sym(sym)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_sym(sym)); end; procedure TDebugInfoDwarf.finish_entry; begin - asmlist[al_dwarf_abbrev].concat(tai_const.create_8bit(0)); - asmlist[al_dwarf_abbrev].concat(tai_const.create_8bit(0)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_8bit(0)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_8bit(0)); end; procedure TDebugInfoDwarf.finish_children; begin - asmlist[al_dwarf_info].concat(tai_const.create_8bit(0)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(0)); end; @@ -652,8 +652,8 @@ implementation DW_AT_name,DW_FORM_string,tsym(p).name+#0, DW_AT_data_member_location,DW_FORM_block1,1+lengthuleb128(tfieldvarsym(p).fieldoffset) ]); - asmlist[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); - asmlist[al_dwarf_info].concat(tai_const.create_uleb128bit(tfieldvarsym(p).fieldoffset)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(tfieldvarsym(p).fieldoffset)); append_labelentry_ref(DW_AT_type,def_dwarf_lab(tfieldvarsym(p).vartype.def)); finish_entry; @@ -666,7 +666,7 @@ implementation end; - procedure TDebugInfoDwarf.append_dwarftag(list:taasmoutput;def:tdef); + procedure TDebugInfoDwarf.append_dwarftag(list:TAsmList;def:tdef); procedure append_dwarftag_orddef(def:torddef); begin @@ -904,11 +904,11 @@ implementation { !!! FIXME !!! } { gdb's dwarf implementation sucks, so we can't use DW_OP_push_object here (FK) { insert location attribute manually } - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(DW_AT_data_location)); - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(DW_FORM_block1)); - asmlist[al_dwarf_info].concat(tai_const.create_8bit(1)); - asmlist[al_dwarf_info].concat(tai_const.create_8bit(DW_OP_push_object)); - asmlist[al_dwarf_info].concat(tai_const.create_8bit(DW_OP_deref)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(DW_AT_data_location)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(DW_FORM_block1)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(1)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(DW_OP_push_object)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(DW_OP_deref)); } finish_entry; @@ -972,8 +972,8 @@ implementation DW_AT_accessibility,DW_FORM_data1,DW_ACCESS_public, DW_AT_data_member_location,DW_FORM_block1,1+lengthuleb128(0) ]); - asmlist[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); - asmlist[al_dwarf_info].concat(tai_const.create_uleb128bit(0)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(0)); append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.childof)); finish_entry; end; @@ -997,13 +997,13 @@ implementation odt_dispinterface, odt_class: begin - objectlibrary.getdatalabel(obj); + current_asmdata.getdatalabel(obj); { implicit pointer } append_entry(DW_TAG_pointer_type,false,[]); append_labelentry_ref(DW_AT_type,obj); finish_entry; - asmlist[al_dwarf_info].concat(tai_symbol.create(obj,0)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(obj,0)); doappend; end; else @@ -1035,7 +1035,7 @@ implementation slen:=255; { create a structure with two elements } - objectlibrary.getdatalabel(arr); + current_asmdata.getdatalabel(arr); append_entry(DW_TAG_structure_type,true,[ DW_AT_name,DW_FORM_string,'ShortString'#0, DW_AT_byte_size,DW_FORM_data1,2*sizeof(aint) @@ -1047,8 +1047,8 @@ implementation DW_AT_name,DW_FORM_string,'Length'#0, DW_AT_data_member_location,DW_FORM_block1,1+lengthuleb128(0) ]); - asmlist[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); - asmlist[al_dwarf_info].concat(tai_const.create_uleb128bit(0)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(0)); append_labelentry_ref(DW_AT_type,def_dwarf_lab(u8inttype.def)); finish_entry; @@ -1057,15 +1057,15 @@ implementation DW_AT_name,DW_FORM_string,'Data'#0, DW_AT_data_member_location,DW_FORM_block1,1+lengthuleb128(1) ]); - asmlist[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); - asmlist[al_dwarf_info].concat(tai_const.create_uleb128bit(1)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(1)); append_labelentry_ref(DW_AT_type,arr); finish_entry; finish_children; { now the data array } - asmlist[al_dwarf_info].concat(tai_symbol.create(arr,0)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(arr,0)); append_entry(DW_TAG_array_type,true,[ DW_AT_byte_size,DW_FORM_udata,def.size, DW_AT_stride_size,DW_FORM_udata,1*8 @@ -1146,7 +1146,7 @@ implementation if def.is_methodpointer then begin { create a structure with two elements } - objectlibrary.getdatalabel(proc); + current_asmdata.getdatalabel(proc); append_entry(DW_TAG_structure_type,true,[ DW_AT_byte_size,DW_FORM_data1,2*sizeof(aint) ]); @@ -1157,8 +1157,8 @@ implementation DW_AT_name,DW_FORM_string,'Proc'#0, DW_AT_data_member_location,DW_FORM_block1,1+lengthuleb128(0) ]); - asmlist[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); - asmlist[al_dwarf_info].concat(tai_const.create_uleb128bit(0)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(0)); append_labelentry_ref(DW_AT_type,proc); finish_entry; @@ -1167,14 +1167,14 @@ implementation DW_AT_name,DW_FORM_string,'Self'#0, DW_AT_data_member_location,DW_FORM_block1,1+lengthuleb128(sizeof(aint)) ]); - asmlist[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); - asmlist[al_dwarf_info].concat(tai_const.create_uleb128bit(sizeof(aint))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(ord(DW_OP_plus_uconst))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_uleb128bit(sizeof(aint))); append_labelentry_ref(DW_AT_type,def_dwarf_lab(class_tobject)); finish_entry; finish_children; - asmlist[al_dwarf_info].concat(tai_symbol.create(proc,0)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(proc,0)); doappend; end else @@ -1296,7 +1296,7 @@ implementation end; - procedure TDebugInfoDwarf.insertdef(list:taasmoutput;def:tdef); + procedure TDebugInfoDwarf.insertdef(list:TAsmList;def:tdef); var anc : tobjectdef; oldtypesym : tsym; @@ -1382,9 +1382,9 @@ implementation end; - procedure TDebugInfoDwarf.write_symtable_defs(list:taasmoutput;st:tsymtable); + procedure TDebugInfoDwarf.write_symtable_defs(list:TAsmList;st:tsymtable); - procedure dowritedwarf(list:taasmoutput;st:tsymtable); + procedure dowritedwarf(list:TAsmList;st:tsymtable); var p : tdef; begin @@ -1419,7 +1419,7 @@ implementation end; - procedure TDebugInfoDwarf.append_procdef(list:taasmoutput;pd:tprocdef); + procedure TDebugInfoDwarf.append_procdef(list:TAsmList;pd:tprocdef); var procendlabel : tasmlabel; mangled_length : longint; @@ -1436,16 +1436,16 @@ implementation } ]); { append block data } - { asmlist[al_dwarf_info].concat(tai_const.create_8bit(dwarf_reg(pd.))); } + { current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(dwarf_reg(pd.))); } if not(is_void(tprocdef(pd).rettype.def)) then append_labelentry_ref(DW_AT_type,def_dwarf_lab(tprocdef(pd).rettype.def)); { mark end of procedure } - objectlibrary.getlabel(procendlabel,alt_dbgtype); - asmlist[al_procedures].insertbefore(tai_label.create(procendlabel),pd.procendtai); + current_asmdata.getlabel(procendlabel,alt_dbgtype); + current_asmdata.asmlists[al_procedures].insertbefore(tai_label.create(procendlabel),pd.procendtai); - append_labelentry(DW_AT_low_pc,objectlibrary.newasmsymbol(pd.mangledname,AB_LOCAL,AT_DATA)); + append_labelentry(DW_AT_low_pc,current_asmdata.newasmsymbol(pd.mangledname,AB_LOCAL,AT_DATA)); append_labelentry(DW_AT_high_pc,procendlabel); { @@ -1486,10 +1486,10 @@ implementation { last write the types from this procdef } if assigned(pd.parast) then - write_symtable_defs(asmlist[al_dwarf_info],pd.parast); + write_symtable_defs(current_asmdata.asmlists[al_dwarf_info],pd.parast); if assigned(pd.localst) and (pd.localst.symtabletype=localsymtable) then - write_symtable_defs(asmlist[al_dwarf_info],pd.localst); + write_symtable_defs(current_asmdata.asmlists[al_dwarf_info],pd.localst); finish_children; end; @@ -1497,11 +1497,11 @@ implementation end; - procedure TDebugInfoDwarf.insertsym(list:taasmoutput;sym:tsym); + procedure TDebugInfoDwarf.insertsym(list:TAsmList;sym:tsym); procedure append_varsym(sym:tabstractnormalvarsym); var - templist : taasmoutput; + templist : TAsmList; blocksize : longint; regidx : longint; tag : tdwarf_tag; @@ -1518,7 +1518,7 @@ implementation if (sym.owner.symtabletype=localsymtable) and (sym.refs=0) then exit; - templist:=taasmoutput.create; + templist:=TAsmList.create; case sym.localloc.loc of LOC_REGISTER, @@ -1580,7 +1580,7 @@ implementation DW_AT_location,DW_FORM_block1,blocksize ]); { append block data } - asmlist[al_dwarf_info].concatlist(templist); + current_asmdata.asmlists[al_dwarf_info].concatlist(templist); append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.vartype.def)); templist.free; @@ -1597,13 +1597,13 @@ implementation { for string constants, consttype isn't set because they have no real type } if not(sym.consttyp in [conststring,constresourcestring]) then append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.consttype.def)); - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_AT_const_value))); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_AT_const_value))); case sym.consttyp of conststring: begin - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_string))); - asmlist[al_dwarf_info].concat(tai_string.create(strpas(pchar(sym.value.valueptr)))); - asmlist[al_dwarf_info].concat(tai_const.create_8bit(0)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_string))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_string.create(strpas(pchar(sym.value.valueptr)))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(0)); end; constset, constwstring, @@ -1611,55 +1611,55 @@ implementation constresourcestring: begin { write dummy for now } - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_string))); - asmlist[al_dwarf_info].concat(tai_string.create('')); - asmlist[al_dwarf_info].concat(tai_const.create_8bit(0)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_string))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_string.create('')); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(0)); end; constord: begin - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_sdata))); - asmlist[al_dwarf_info].concat(tai_const.create_sleb128bit(sym.value.valueord)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_sdata))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_sleb128bit(sym.value.valueord)); end; constnil: begin {$ifdef cpu64bit} - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_data8))); - asmlist[al_dwarf_info].concat(tai_const.create_64bit(0)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_data8))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit(0)); {$else cpu64bit} - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_data4))); - asmlist[al_dwarf_info].concat(tai_const.create_32bit(0)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_data4))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit(0)); {$endif cpu64bit} end; constpointer: begin {$ifdef cpu64bit} - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_data8))); - asmlist[al_dwarf_info].concat(tai_const.create_64bit(sym.value.valueordptr)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_data8))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_64bit(sym.value.valueordptr)); {$else cpu64bit} - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_data4))); - asmlist[al_dwarf_info].concat(tai_const.create_32bit(sym.value.valueordptr)); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_data4))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_32bit(sym.value.valueordptr)); {$endif cpu64bit} end; constreal: begin - asmlist[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_block1))); + current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_uleb128bit(ord(DW_FORM_block1))); case tfloatdef(sym.consttype.def).typ of s32real: begin - asmlist[al_dwarf_info].concat(tai_const.create_8bit(4)); - asmlist[al_dwarf_info].concat(tai_real_32bit.create(psingle(sym.value.valueptr)^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(4)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_real_32bit.create(psingle(sym.value.valueptr)^)); end; s64comp, s64currency, s64real: begin - asmlist[al_dwarf_info].concat(tai_const.create_8bit(8)); - asmlist[al_dwarf_info].concat(tai_real_64bit.create(pdouble(sym.value.valueptr)^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(8)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_real_64bit.create(pdouble(sym.value.valueptr)^)); end; s80real: begin - asmlist[al_dwarf_info].concat(tai_const.create_8bit(10)); - asmlist[al_dwarf_info].concat(tai_real_80bit.create(pextended(sym.value.valueptr)^)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(10)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_real_80bit.create(pextended(sym.value.valueptr)^)); end; else internalerror(200601291); @@ -1683,11 +1683,11 @@ implementation procedure append_absolutesym(sym:tabsolutevarsym); var - templist : taasmoutput; + templist : TAsmList; blocksize : longint; symlist : psymlistitem; begin - templist:=taasmoutput.create; + templist:=TAsmList.create; case tabsolutevarsym(sym).abstyp of toaddr : begin @@ -1729,7 +1729,7 @@ implementation DW_AT_location,DW_FORM_block1,blocksize ]); { append block data } - asmlist[al_dwarf_info].concatlist(templist); + current_asmdata.asmlists[al_dwarf_info].concatlist(templist); append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.vartype.def)); templist.free; @@ -1768,8 +1768,8 @@ implementation DW_AT_location,DW_FORM_block1,1+sizeof(aword) ]); { append block data } - asmlist[al_dwarf_info].concat(tai_const.create_8bit(3)); - asmlist[al_dwarf_info].concat(tai_const.createname(sym.mangledname,AT_DATA,0)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(3)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.createname(sym.mangledname,AT_DATA,0)); append_labelentry_ref(DW_AT_type,def_dwarf_lab(ttypedconstsym(sym).typedconsttype.def)); finish_entry; @@ -1813,7 +1813,7 @@ implementation end; - procedure TDebugInfoDwarf.write_symtable_syms(list:taasmoutput;st:tsymtable); + procedure TDebugInfoDwarf.write_symtable_syms(list:TAsmList;st:tsymtable); var p : tsym; begin @@ -1841,34 +1841,34 @@ implementation procedure TDebugInfoDwarf.insertmoduleinfo; var - templist : taasmoutput; + templist : TAsmList; begin { insert .Ltext0 label } - templist:=taasmoutput.create; + templist:=TAsmList.create; new_section(templist,sec_code,'',0); templist.concat(tai_symbol.createname('.Ltext0',AT_DATA,0)); - asmlist[al_start].insertlist(templist); + current_asmdata.asmlists[al_start].insertlist(templist); templist.free; { insert .Letext0 label } - templist:=taasmoutput.create; + templist:=TAsmList.create; new_section(templist,sec_code,'',0); templist.concat(tai_symbol.createname('.Letext0',AT_DATA,0)); - asmlist[al_end].insertlist(templist); + current_asmdata.asmlists[al_end].insertlist(templist); templist.free; { insert .Ldebug_abbrev0 label } - templist:=taasmoutput.create; + templist:=TAsmList.create; new_section(templist,sec_debug_abbrev,'',0); templist.concat(tai_symbol.createname('.Ldebug_abbrev0',AT_DATA,0)); - asmlist[al_start].insertlist(templist); + current_asmdata.asmlists[al_start].insertlist(templist); templist.free; { insert .Ldebug_line0 label } - templist:=taasmoutput.create; + templist:=TAsmList.create; new_section(templist,sec_debug_line,'',0); templist.concat(tai_symbol.createname('.Ldebug_line0',AT_DATA,0)); - asmlist[al_start].insertlist(templist); + current_asmdata.asmlists[al_start].insertlist(templist); templist.free; end; @@ -1896,31 +1896,31 @@ implementation } { write start labels } - asmlist[al_dwarf_info].concat(tai_section.create(sec_debug_info,'',0)); - asmlist[al_dwarf_info].concat(tai_symbol.createname('.Ldebug_info0',AT_DATA,0)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_section.create(sec_debug_info,'',0)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.createname('.Ldebug_info0',AT_DATA,0)); { start abbrev section } - new_section(asmlist[al_dwarf_abbrev],sec_debug_abbrev,'',0); + new_section(current_asmdata.asmlists[al_dwarf_abbrev],sec_debug_abbrev,'',0); { debug info header } - objectlibrary.getlabel(lenstartlabel,alt_dbgfile); + current_asmdata.getlabel(lenstartlabel,alt_dbgfile); { size } { currently we create only 32 bit dwarf } - asmlist[al_dwarf_info].concat(tai_const.create_rel_sym(aitconst_32bit, + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_rel_sym(aitconst_32bit, lenstartlabel,tasmsymbol.create('.Ledebug_info0',AB_COMMON,AT_DATA))); - asmlist[al_dwarf_info].concat(tai_label.create(lenstartlabel)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_label.create(lenstartlabel)); { version } - asmlist[al_dwarf_info].concat(tai_const.create_16bit(2)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_16bit(2)); { abbrev table } if isdwarf64 then - asmlist[al_dwarf_info].concat(tai_const.create_type_sym(aitconst_64bit, - objectlibrary.newasmsymbol('.Ldebug_abbrev0',AB_EXTERNAL,AT_DATA))) + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(aitconst_64bit, + current_asmdata.newasmsymbol('.Ldebug_abbrev0',AB_EXTERNAL,AT_DATA))) else - asmlist[al_dwarf_info].concat(tai_const.create_type_sym(aitconst_32bit, - objectlibrary.newasmsymbol('.Ldebug_abbrev0',AB_EXTERNAL,AT_DATA))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_type_sym(aitconst_32bit, + current_asmdata.newasmsymbol('.Ldebug_abbrev0',AB_EXTERNAL,AT_DATA))); { address size } - asmlist[al_dwarf_info].concat(tai_const.create_8bit(sizeof(aint))); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(sizeof(aint))); append_entry(DW_TAG_compile_unit,true,[ DW_AT_name,DW_FORM_string,FixFileName(current_module.sourcefiles.get_file(1).name^)+#0, @@ -1930,36 +1930,36 @@ implementation DW_AT_identifier_case,DW_FORM_data1,DW_ID_case_insensitive]); { reference to line info section } - append_labelentry_data(DW_AT_stmt_list,objectlibrary.newasmsymbol('.Ldebug_line0',AB_LOCAL,AT_DATA)); - append_labelentry(DW_AT_low_pc,objectlibrary.newasmsymbol('.Ltext0',AB_LOCAL,AT_DATA)); - append_labelentry(DW_AT_high_pc,objectlibrary.newasmsymbol('.Letext0',AB_LOCAL,AT_DATA)); + append_labelentry_data(DW_AT_stmt_list,current_asmdata.newasmsymbol('.Ldebug_line0',AB_LOCAL,AT_DATA)); + append_labelentry(DW_AT_low_pc,current_asmdata.newasmsymbol('.Ltext0',AB_LOCAL,AT_DATA)); + append_labelentry(DW_AT_high_pc,current_asmdata.newasmsymbol('.Letext0',AB_LOCAL,AT_DATA)); finish_entry; { first write all global/local symbols. This will flag all required tdefs } if assigned(current_module.globalsymtable) then - write_symtable_syms(asmlist[al_dwarf_info],current_module.globalsymtable); + write_symtable_syms(current_asmdata.asmlists[al_dwarf_info],current_module.globalsymtable); if assigned(current_module.localsymtable) then - write_symtable_syms(asmlist[al_dwarf_info],current_module.localsymtable); + write_symtable_syms(current_asmdata.asmlists[al_dwarf_info],current_module.localsymtable); { reset unit type info flag } reset_unit_type_info; { write used types from the used units } - write_used_unit_type_info(asmlist[al_dwarf_info],current_module); + write_used_unit_type_info(current_asmdata.asmlists[al_dwarf_info],current_module); { last write the types from this unit } if assigned(current_module.globalsymtable) then - write_symtable_defs(asmlist[al_dwarf_info],current_module.globalsymtable); + write_symtable_defs(current_asmdata.asmlists[al_dwarf_info],current_module.globalsymtable); if assigned(current_module.localsymtable) then - write_symtable_defs(asmlist[al_dwarf_info],current_module.localsymtable); + write_symtable_defs(current_asmdata.asmlists[al_dwarf_info],current_module.localsymtable); { close compilation unit entry } finish_children; { end of debug info table } - asmlist[al_dwarf_info].concat(tai_const.create_8bit(0)); - asmlist[al_dwarf_info].concat(tai_symbol.createname('.Ledebug_info0',AT_DATA,0)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(0)); + current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.createname('.Ledebug_info0',AT_DATA,0)); { reset all def labels } for i:=0 to defnumberlist.count-1 do begin @@ -1977,12 +1977,12 @@ implementation end; - procedure TDebugInfoDwarf.referencesections(list:taasmoutput); + procedure TDebugInfoDwarf.referencesections(list:TAsmList); begin end; - procedure TDebugInfoDwarf.insertlineinfo(list:taasmoutput); + procedure TDebugInfoDwarf.insertlineinfo(list:TAsmList); var currfileinfo, lastfileinfo : tfileposinfo; diff --git a/compiler/dbgstabs.pas b/compiler/dbgstabs.pas index 9592076b8f..ac0fe2ffa0 100644 --- a/compiler/dbgstabs.pas +++ b/compiler/dbgstabs.pas @@ -40,7 +40,7 @@ interface { tsym writing } function sym_var_value(const s:string;arg:pointer):string; function sym_stabstr_evaluate(sym:tsym;const s:string;const vars:array of string):Pchar; - procedure write_symtable_syms(list:taasmoutput;st:tsymtable); + procedure write_symtable_syms(list:TAsmList;st:tsymtable); { tdef writing } function def_stab_number(def:tdef):string; function def_stab_classnumber(def:tobjectdef):string; @@ -49,16 +49,16 @@ interface procedure field_add_stabstr(p:Tnamedindexitem;arg:pointer); procedure method_add_stabstr(p:Tnamedindexitem;arg:pointer); function def_stabstr(def:tdef):pchar; - procedure write_def_stabstr(list:taasmoutput;def:tdef); - procedure write_procdef(list:taasmoutput;pd:tprocdef); - procedure insertsym(list:taasmoutput;sym:tsym); + procedure write_def_stabstr(list:TAsmList;def:tdef); + procedure write_procdef(list:TAsmList;pd:tprocdef); + procedure insertsym(list:TAsmList;sym:tsym); public procedure inserttypeinfo;override; procedure insertmoduleinfo;override; - procedure insertlineinfo(list:taasmoutput);override; - procedure referencesections(list:taasmoutput);override; - procedure insertdef(list:taasmoutput;def:tdef);override; - procedure write_symtable_defs(list:taasmoutput;st:tsymtable);override; + procedure insertlineinfo(list:TAsmList);override; + procedure referencesections(list:TAsmList);override; + procedure insertdef(list:TAsmList;def:tdef);override; + procedure write_symtable_defs(list:TAsmList;st:tsymtable);override; end; @@ -736,7 +736,7 @@ implementation end; - procedure TDebugInfoStabs.write_def_stabstr(list:taasmoutput;def:tdef); + procedure TDebugInfoStabs.write_def_stabstr(list:TAsmList;def:tdef); var stabchar : string[2]; ss,st,su : pchar; @@ -776,7 +776,7 @@ implementation end; - procedure TDebugInfoStabs.insertdef(list:taasmoutput;def:tdef); + procedure TDebugInfoStabs.insertdef(list:TAsmList;def:tdef); var anc : tobjectdef; oldtypesym : tsym; @@ -882,9 +882,9 @@ implementation end; - procedure TDebugInfoStabs.write_symtable_defs(list:taasmoutput;st:tsymtable); + procedure TDebugInfoStabs.write_symtable_defs(list:TAsmList;st:tsymtable); - procedure dowritestabs(list:taasmoutput;st:tsymtable); + procedure dowritestabs(list:TAsmList;st:tsymtable); var p : tdef; begin @@ -919,9 +919,9 @@ implementation end; - procedure TDebugInfoStabs.write_procdef(list:taasmoutput;pd:tprocdef); + procedure TDebugInfoStabs.write_procdef(list:TAsmList;pd:tprocdef); var - templist : taasmoutput; + templist : TAsmList; stabsendlabel : tasmlabel; mangled_length : longint; p : pchar; @@ -929,7 +929,7 @@ implementation begin if assigned(pd.procstarttai) then begin - templist:=taasmoutput.create; + templist:=TAsmList.create; { para types } write_def_stabstr(templist,pd); if assigned(pd.parast) then @@ -939,9 +939,9 @@ implementation if assigned(pd.localst) and (pd.localst.symtabletype=localsymtable) then write_symtable_syms(templist,pd.localst); - asmlist[al_procedures].insertlistbefore(pd.procstarttai,templist); + current_asmdata.asmlists[al_procedures].insertlistbefore(pd.procstarttai,templist); { end of procedure } - objectlibrary.getlabel(stabsendlabel,alt_dbgtype); + current_asmdata.getlabel(stabsendlabel,alt_dbgtype); templist.concat(tai_label.create(stabsendlabel)); if assigned(pd.funcretsym) and (tabstractnormalvarsym(pd.funcretsym).refs>0) then @@ -983,7 +983,7 @@ implementation end; templist.concat(Tai_stab.Create(stab_stabn,strnew(p))); freemem(p,2*mangled_length+50); - asmlist[al_procedures].insertlistbefore(pd.procendtai,templist); + current_asmdata.asmlists[al_procedures].insertlistbefore(pd.procendtai,templist); templist.free; end; end; @@ -1030,7 +1030,7 @@ implementation end; - procedure TDebugInfoStabs.insertsym(list:taasmoutput;sym:tsym); + procedure TDebugInfoStabs.insertsym(list:TAsmList;sym:tsym); function fieldvarsym_stabstr(sym:tfieldvarsym):Pchar; begin @@ -1285,7 +1285,7 @@ implementation end; - procedure TDebugInfoStabs.write_symtable_syms(list:taasmoutput;st:tsymtable); + procedure TDebugInfoStabs.write_symtable_syms(list:TAsmList;st:tsymtable); var p : tsym; begin @@ -1317,7 +1317,7 @@ implementation procedure tdebuginfostabs.inserttypeinfo; var stabsvarlist, - stabstypelist : taasmoutput; + stabstypelist : TAsmList; storefilepos : tfileposinfo; st : tsymtable; i : longint; @@ -1327,8 +1327,8 @@ implementation global_stab_number:=0; defnumberlist:=TFPObjectlist.create(false); - stabsvarlist:=taasmoutput.create; - stabstypelist:=taasmoutput.create; + stabsvarlist:=TAsmList.create; + stabstypelist:=TAsmList.create; { include symbol that will be referenced from the main to be sure to include this debuginfo .o file } @@ -1339,8 +1339,8 @@ implementation end else st:=current_module.localsymtable; - new_section(asmlist[al_stabs],sec_data,st.name^,0); - asmlist[al_stabs].concat(tai_symbol.Createname_global(make_mangledname('DEBUGINFO',st,''),AT_DATA,0)); + new_section(current_asmdata.asmlists[al_stabs],sec_data,st.name^,0); + current_asmdata.asmlists[al_stabs].concat(tai_symbol.Createname_global(make_mangledname('DEBUGINFO',st,''),AT_DATA,0)); { first write all global/local symbols. This will flag all required tdefs } if assigned(current_module.globalsymtable) then @@ -1359,8 +1359,8 @@ implementation if assigned(current_module.localsymtable) then write_symtable_defs(stabstypelist,current_module.localsymtable); - asmlist[al_stabs].concatlist(stabstypelist); - asmlist[al_stabs].concatlist(stabsvarlist); + current_asmdata.asmlists[al_stabs].concatlist(stabstypelist); + current_asmdata.asmlists[al_stabs].concatlist(stabsvarlist); { reset stab numbers } for i:=0 to defnumberlist.count-1 do @@ -1381,7 +1381,7 @@ implementation end; - procedure tdebuginfostabs.insertlineinfo(list:taasmoutput); + procedure tdebuginfostabs.insertlineinfo(list:TAsmList); var currfileinfo, lastfileinfo : tfileposinfo; @@ -1417,7 +1417,7 @@ implementation infile:=current_module.sourcefiles.get_file(currfileinfo.fileindex); if assigned(infile) then begin - objectlibrary.getlabel(hlabel,alt_dbgfile); + current_asmdata.getlabel(hlabel,alt_dbgfile); { emit stabs } if (infile.path^<>'') then list.insertbefore(Tai_stab.Create_str(stab_stabs,'"'+BsToSlash(FixPath(infile.path^,false))+'",'+tostr(n_includefile)+ @@ -1436,7 +1436,7 @@ implementation if assigned(currfuncname) and (tf_use_function_relative_addresses in target_info.flags) then begin - objectlibrary.getlabel(hlabel,alt_dbgline); + current_asmdata.getlabel(hlabel,alt_dbgline); list.insertbefore(Tai_stab.Create_str(stab_stabn,tostr(n_textline)+',0,'+tostr(currfileinfo.line)+','+ hlabel.name+' - '+{$IFDEF POWERPC64}'.'+{$ENDIF POWERPC64}currfuncname^),hp); list.insertbefore(tai_label.create(hlabel),hp); @@ -1456,12 +1456,12 @@ implementation var hlabel : tasmlabel; infile : tinputfile; - templist : taasmoutput; + templist : TAsmList; begin { emit main source n_sourcefile for start of module } - objectlibrary.getlabel(hlabel,alt_dbgfile); + current_asmdata.getlabel(hlabel,alt_dbgfile); infile:=current_module.sourcefiles.get_file(1); - templist:=taasmoutput.create; + templist:=TAsmList.create; new_section(templist,sec_code,'',0); if (infile.path^<>'') then templist.concat(Tai_stab.Create_str(stab_stabs,'"'+BsToSlash(FixPath(infile.path^,false))+'",'+tostr(n_sourcefile)+ @@ -1469,20 +1469,20 @@ implementation templist.concat(Tai_stab.Create_str(stab_stabs,'"'+FixFileName(infile.name^)+'",'+tostr(n_sourcefile)+ ',0,0,'+hlabel.name)); templist.concat(tai_label.create(hlabel)); - asmlist[al_start].insertlist(templist); + current_asmdata.asmlists[al_start].insertlist(templist); templist.free; { emit empty n_sourcefile for end of module } - objectlibrary.getlabel(hlabel,alt_dbgfile); - templist:=taasmoutput.create; + current_asmdata.getlabel(hlabel,alt_dbgfile); + templist:=TAsmList.create; new_section(templist,sec_code,'',0); templist.concat(Tai_stab.Create_str(stab_stabs,'"",'+tostr(n_sourcefile)+',0,0,'+hlabel.name)); templist.concat(tai_label.create(hlabel)); - asmlist[al_end].insertlist(templist); + current_asmdata.asmlists[al_end].insertlist(templist); templist.free; end; - procedure tdebuginfostabs.referencesections(list:taasmoutput); + procedure tdebuginfostabs.referencesections(list:TAsmList); var hp : tused_unit; begin diff --git a/compiler/dwarf.pas b/compiler/dwarf.pas index 613103f49c..fbc963da51 100644 --- a/compiler/dwarf.pas +++ b/compiler/dwarf.pas @@ -56,7 +56,7 @@ interface constructor create_const(aop:longint;enc1:tdwarfoperenc;val:int64); constructor create_reloffset(aop:longint;enc1:tdwarfoperenc;beginlab,endlab:tasmsymbol); constructor create_reg_const(aop:longint;enc1:tdwarfoperenc;reg:tregister;enc2:tdwarfoperenc;val:longint); - procedure generate_code(list:taasmoutput); + procedure generate_code(list:TAsmList); end; tdwarf=class @@ -73,24 +73,23 @@ interface FFrameStartLabel, FFrameEndLabel, FLastloclabel : tasmlabel; - procedure cfa_advance_loc(list:taasmoutput); + procedure cfa_advance_loc(list:TAsmList); protected code_alignment_factor, data_alignment_factor : shortint; public constructor create; - procedure generate_code(list:taasmoutput); - procedure generate_initial_instructions(list:taasmoutput);virtual; + procedure generate_code(list:TAsmList); + procedure generate_initial_instructions(list:TAsmList);virtual; { operations } - procedure start_frame(list:taasmoutput); - procedure end_frame(list:taasmoutput); - procedure cfa_offset(list:taasmoutput;reg:tregister;ofs:longint); - procedure cfa_restore(list:taasmoutput;reg:tregister); - procedure cfa_def_cfa_register(list:taasmoutput;reg:tregister); - procedure cfa_def_cfa_offset(list:taasmoutput;ofs:longint); + procedure start_frame(list:TAsmList); + procedure end_frame(list:TAsmList); + procedure cfa_offset(list:TAsmList;reg:tregister;ofs:longint); + procedure cfa_restore(list:TAsmList;reg:tregister); + procedure cfa_def_cfa_register(list:TAsmList;reg:tregister); + procedure cfa_def_cfa_offset(list:TAsmList;ofs:longint); end; - var dwarfcfi : tdwarfcfi; @@ -225,7 +224,7 @@ implementation end; - procedure tdwarfitem.generate_code(list:taasmoutput); + procedure tdwarfitem.generate_code(list:TAsmList); const enc2ait_const : array[tdwarfoperenc] of taiconst_type = ( aitconst_uleb128bit,aitconst_sleb128bit,aitconst_ptr, @@ -273,7 +272,7 @@ implementation {$ifdef i386} { if more cpu dependend stuff is implemented, this needs more refactoring } - procedure tdwarfcfi.generate_initial_instructions(list:taasmoutput); + procedure tdwarfcfi.generate_initial_instructions(list:TAsmList); begin list.concat(tai_const.create_8bit(DW_CFA_def_cfa)); list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_STACK_POINTER_REG))); @@ -284,7 +283,7 @@ implementation end; {$else i386} { if more cpu dependend stuff is implemented, this needs more refactoring } - procedure tdwarfcfi.generate_initial_instructions(list:taasmoutput); + procedure tdwarfcfi.generate_initial_instructions(list:TAsmList); begin list.concat(tai_const.create_8bit(DW_CFA_def_cfa)); list.concat(tai_const.create_uleb128bit(dwarf_reg(NR_STACK_POINTER_REG))); @@ -295,7 +294,7 @@ implementation end; {$endif i386} - procedure tdwarfcfi.generate_code(list:taasmoutput); + procedure tdwarfcfi.generate_code(list:TAsmList); var hp : tdwarfitem; cielabel, @@ -314,10 +313,10 @@ implementation BYTE return address register <...> start sequence } - objectlibrary.getlabel(cielabel,alt_dbgframe); + current_asmdata.getlabel(cielabel,alt_dbgframe); list.concat(tai_label.create(cielabel)); - objectlibrary.getlabel(lenstartlabel,alt_dbgframe); - objectlibrary.getlabel(lenendlabel,alt_dbgframe); + current_asmdata.getlabel(lenstartlabel,alt_dbgframe); + current_asmdata.getlabel(lenendlabel,alt_dbgframe); list.concat(tai_const.create_rel_sym(aitconst_32bit,lenstartlabel,lenendlabel)); list.concat(tai_label.create(lenstartlabel)); list.concat(tai_const.create_32bit(longint($ffffffff))); @@ -348,8 +347,8 @@ implementation if (hp.ops<>1) or (hp.oper[0].typ<>dop_reloffset) then internalerror(200404126); - objectlibrary.getlabel(lenstartlabel,alt_dbgframe); - objectlibrary.getlabel(lenendlabel,alt_dbgframe); + current_asmdata.getlabel(lenstartlabel,alt_dbgframe); + current_asmdata.getlabel(lenendlabel,alt_dbgframe); { FDE DWORD length DWORD CIE-pointer = cielabel @@ -385,19 +384,19 @@ implementation end; - procedure tdwarfcfi.start_frame(list:taasmoutput); + procedure tdwarfcfi.start_frame(list:TAsmList); begin if assigned(FFrameStartLabel) then internalerror(200404129); - objectlibrary.getlabel(FFrameStartLabel,alt_dbgframe); - objectlibrary.getlabel(FFrameEndLabel,alt_dbgframe); + current_asmdata.getlabel(FFrameStartLabel,alt_dbgframe); + current_asmdata.getlabel(FFrameEndLabel,alt_dbgframe); FLastloclabel:=FFrameStartLabel; list.concat(tai_label.create(FFrameStartLabel)); al_dwarf.concat(tdwarfitem.create_reloffset(DW_CFA_start_frame,doe_32bit,FFrameStartLabel,FFrameEndLabel)); end; - procedure tdwarfcfi.end_frame(list:taasmoutput); + procedure tdwarfcfi.end_frame(list:TAsmList); begin if not assigned(FFrameStartLabel) then internalerror(2004041213); @@ -409,20 +408,20 @@ implementation end; - procedure tdwarfcfi.cfa_advance_loc(list:taasmoutput); + procedure tdwarfcfi.cfa_advance_loc(list:TAsmList); var currloclabel : tasmlabel; begin if FLastloclabel=nil then internalerror(200404082); - objectlibrary.getlabel(currloclabel,alt_dbgframe); + current_asmdata.getlabel(currloclabel,alt_dbgframe); list.concat(tai_label.create(currloclabel)); al_dwarf.concat(tdwarfitem.create_reloffset(DW_CFA_advance_loc4,doe_32bit,FLastloclabel,currloclabel)); FLastloclabel:=currloclabel; end; - procedure tdwarfcfi.cfa_offset(list:taasmoutput;reg:tregister;ofs:longint); + procedure tdwarfcfi.cfa_offset(list:TAsmList;reg:tregister;ofs:longint); begin cfa_advance_loc(list); {$warning TODO check if ref is a temp} @@ -431,21 +430,21 @@ implementation end; - procedure tdwarfcfi.cfa_restore(list:taasmoutput;reg:tregister); + procedure tdwarfcfi.cfa_restore(list:TAsmList;reg:tregister); begin cfa_advance_loc(list); al_dwarf.concat(tdwarfitem.create_reg(DW_CFA_restore_extended,doe_uleb,reg)); end; - procedure tdwarfcfi.cfa_def_cfa_register(list:taasmoutput;reg:tregister); + procedure tdwarfcfi.cfa_def_cfa_register(list:TAsmList;reg:tregister); begin cfa_advance_loc(list); al_dwarf.concat(tdwarfitem.create_reg(DW_CFA_def_cfa_register,doe_uleb,reg)); end; - procedure tdwarfcfi.cfa_def_cfa_offset(list:taasmoutput;ofs:longint); + procedure tdwarfcfi.cfa_def_cfa_offset(list:TAsmList;ofs:longint); begin cfa_advance_loc(list); al_dwarf.concat(tdwarfitem.create_const(DW_CFA_def_cfa_offset,doe_uleb,ofs)); diff --git a/compiler/fmodule.pas b/compiler/fmodule.pas index 20721e6633..a9d289aab1 100644 --- a/compiler/fmodule.pas +++ b/compiler/fmodule.pas @@ -44,7 +44,7 @@ interface uses cutils,cclasses, globals,finput, - symbase,symsym,aasmbase; + symbase,symsym,aasmbase,aasmtai; type @@ -129,8 +129,10 @@ interface localsymtable : tsymtable;{ pointer to the local symtable of this unit } globalmacrosymtable, { pointer to the global macro symtable of this unit } localmacrosymtable : tsymtable;{ pointer to the local macro symtable of this unit } - scanner : pointer; { scanner object used } - procinfo : pointer; { current procedure being compiled } + scanner : TObject; { scanner object used } + procinfo : TObject; { current procedure being compiled } + asmdata : TObject; { Assembler data } + asmprefix : pstring; { prefix for the smartlink asmfiles } loaded_from : tmodule; uses_imports : boolean; { Set if the module imports from DLL's.} imports : tlinkedlist; @@ -153,8 +155,6 @@ interface localincludesearchpath, locallibrarysearchpath : TSearchPathList; - asmprefix : pstring; { prefix for the smartlink asmfiles } - librarydata : TObjLibraryData; { librarydata for this module } {create creates a new module which name is stored in 's'. LoadedFrom points to the module calling it. It is nil for the first compiled module. This allow inheritence of all path lists. MUST pay attention @@ -454,7 +454,7 @@ implementation imports:=TLinkedList.Create; _exports:=TLinkedList.Create; externals:=TLinkedList.Create; - librarydata:=TObjLibraryData.create(realmodulename^); + asmdata:=TAsmData.create(realmodulename^); end; @@ -488,6 +488,12 @@ implementation current_scanner:=nil; tscannerfile(scanner).free; end; + if assigned(asmdata) then + begin + if current_asmdata=asmdata then + current_asmdata:=nil; + asmdata.free; + end; if assigned(procinfo) then begin if current_procinfo=tprocinfo(procinfo) then @@ -540,16 +546,6 @@ implementation {$ifdef MEMDEBUG} d.free; {$endif} - if assigned(librarydata) then - begin -{$ifdef MEMDEBUG} - d:=tmemdebug.create(modulename^+' - librarydata'); -{$endif} - librarydata.free; -{$ifdef MEMDEBUG} - d.free; -{$endif} - end; stringdispose(modulename); inherited Destroy; end; @@ -581,6 +577,13 @@ implementation procinfo:=hpi; end; end; + if assigned(asmdata) then + begin + if current_asmdata=TAsmData(asmdata) then + current_asmdata:=nil; + asmdata.free; + asmdata:=nil; + end; if assigned(globalsymtable) then begin globalsymtable.free; @@ -621,8 +624,7 @@ implementation derefdataintflen:=0; sourcefiles.free; sourcefiles:=tinputfilemanager.create; - librarydata.free; - librarydata:=TObjLibraryData.create(realmodulename^); + asmdata:=TAsmData.create(realmodulename^); imports.free; imports:=tlinkedlist.create; _exports.free; @@ -838,8 +840,8 @@ implementation modulename:=stringdup(upper(s)); realmodulename:=stringdup(s); { also update asmlibrary names } - librarydata.name:=modulename^; - librarydata.realname:=realmodulename^; + current_asmdata.name:=modulename^; + current_asmdata.realname:=realmodulename^; end; end. diff --git a/compiler/i386/ag386nsm.pas b/compiler/i386/ag386nsm.pas index b6a20e9972..12423db3a9 100644 --- a/compiler/i386/ag386nsm.pas +++ b/compiler/i386/ag386nsm.pas @@ -38,7 +38,7 @@ interface procedure WriteOper_jmp(const o:toper; op : tasmop); procedure WriteSection(atype:TAsmSectiontype;const aname:string); public - procedure WriteTree(p:taasmoutput);override; + procedure WriteTree(p:TAsmList);override; procedure WriteAsmList;override; procedure WriteExternals; end; @@ -386,7 +386,7 @@ interface LasTSecType:=atype; end; - procedure T386NasmAssembler.WriteTree(p:taasmoutput); + procedure T386NasmAssembler.WriteTree(p:TAsmList); var s : string; hp : tai; @@ -405,7 +405,7 @@ interface { lineinfo is only needed for al_procedures (PFV) } do_line:=(cs_asm_source in aktglobalswitches) or ((cs_lineinfo in aktmoduleswitches) - and (p=asmlist[al_procedures])); + and (p=current_asmdata.asmlists[al_procedures])); hp:=tai(p.first); while assigned(hp) do begin @@ -750,9 +750,9 @@ interface end; ait_marker : - if tai_marker(hp).kind=InlineStart then + if tai_marker(hp).kind=mark_InlineStart then inc(InlineLevel) - else if tai_marker(hp).kind=InlineEnd then + else if tai_marker(hp).kind=mark_InlineEnd then dec(InlineLevel); ait_directive : @@ -790,13 +790,13 @@ interface procedure T386NasmAssembler.WriteExternals; begin currentasmlist:=self; - objectlibrary.symbolsearch.foreach_static(@writeexternal,nil); + current_asmdata.AsmSymbolDict.foreach_static(@writeexternal,nil); end; procedure T386NasmAssembler.WriteAsmList; var - hal : tasmlist; + hal : tasmlisttype; begin {$ifdef EXTDEBUG} if assigned(current_module.mainsource) then @@ -812,11 +812,11 @@ interface WriteExternals; - for hal:=low(Tasmlist) to high(Tasmlist) do + for hal:=low(TasmlistType) to high(TasmlistType) do begin - AsmWriteLn(target_asm.comment+'Begin asmlist '+TasmlistStr[hal]); - writetree(asmlist[hal]); - AsmWriteLn(target_asm.comment+'End asmlist '+TasmlistStr[hal]); + AsmWriteLn(target_asm.comment+'Begin asmlist '+AsmListTypeStr[hal]); + writetree(current_asmdata.asmlists[hal]); + AsmWriteLn(target_asm.comment+'End asmlist '+AsmListTypeStr[hal]); end; AsmLn; diff --git a/compiler/i386/aopt386.pas b/compiler/i386/aopt386.pas index 47b49241c6..66690b51eb 100644 --- a/compiler/i386/aopt386.pas +++ b/compiler/i386/aopt386.pas @@ -29,7 +29,7 @@ Interface Uses aasmbase,aasmtai,aasmcpu; -Procedure Optimize(AsmL: TAasmOutput); +Procedure Optimize(AsmL: TAsmList); Implementation @@ -40,7 +40,7 @@ Uses DAOpt386,POpt386,CSOpt386; -Procedure Optimize(AsmL: TAAsmOutput); +Procedure Optimize(AsmL: TAsmList); Var BlockStart, BlockEnd, HP: Tai; pass: longint; @@ -60,7 +60,7 @@ Begin { Setup labeltable, always necessary } blockstart := tai(asml.first); blockend := dfa.pass_1(blockstart); - { Blockend now either contains an ait_marker with Kind = AsmBlockStart, } + { Blockend now either contains an ait_marker with Kind = mark_AsmBlockStart, } { or nil } While Assigned(BlockStart) Do Begin @@ -91,17 +91,17 @@ Begin BlockStart := BlockEnd; While Assigned(BlockStart) And (BlockStart.typ = ait_Marker) And - (Tai_Marker(BlockStart).Kind = AsmBlockStart) Do + (Tai_Marker(BlockStart).Kind = mark_AsmBlockStart) Do Begin { We stopped at an assembler block, so skip it } Repeat BlockStart := Tai(BlockStart.Next); Until (BlockStart.Typ = Ait_Marker) And - (Tai_Marker(Blockstart).Kind = AsmBlockEnd); - { Blockstart now contains a Tai_marker(asmblockend) } + (Tai_Marker(Blockstart).Kind = mark_AsmBlockEnd); + { Blockstart now contains a Tai_marker(mark_AsmBlockEnd) } If GetNextInstruction(BlockStart, HP) And ((HP.typ <> ait_Marker) Or - (Tai_Marker(HP).Kind <> AsmBlockStart)) Then + (Tai_Marker(HP).Kind <> mark_AsmBlockStart)) Then { There is no assembler block anymore after the current one, so } { optimize the next block of "normal" instructions } BlockEnd := dfa.pass_1(blockstart) diff --git a/compiler/i386/cgcpu.pas b/compiler/i386/cgcpu.pas index 2a6da5cf7d..7430ccdddb 100644 --- a/compiler/i386/cgcpu.pas +++ b/compiler/i386/cgcpu.pas @@ -36,28 +36,28 @@ unit cgcpu; type tcg386 = class(tcgx86) procedure init_register_allocators;override; - procedure do_register_allocation(list:Taasmoutput;headertai:tai);override; + procedure do_register_allocation(list:TAsmList;headertai:tai);override; { passing parameter using push instead of mov } - procedure a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;const cgpara : tcgpara);override; - procedure a_param_const(list : taasmoutput;size : tcgsize;a : aint;const cgpara : tcgpara);override; - procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const cgpara : tcgpara);override; - procedure a_paramaddr_ref(list : taasmoutput;const r : treference;const cgpara : tcgpara);override; - - procedure g_proc_exit(list : taasmoutput;parasize:longint;nostackframe:boolean);override; - procedure g_copyvaluepara_openarray(list : taasmoutput;const ref:treference;const lenloc:tlocation;elesize:aint;destreg:tregister);override; - - procedure g_exception_reason_save(list : taasmoutput; const href : treference);override; - procedure g_exception_reason_save_const(list : taasmoutput; const href : treference; a: aint);override; - procedure g_exception_reason_load(list : taasmoutput; const href : treference);override; - procedure g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint);override; + procedure a_param_reg(list : TAsmList;size : tcgsize;r : tregister;const cgpara : tcgpara);override; + procedure a_param_const(list : TAsmList;size : tcgsize;a : aint;const cgpara : tcgpara);override; + procedure a_param_ref(list : TAsmList;size : tcgsize;const r : treference;const cgpara : tcgpara);override; + procedure a_paramaddr_ref(list : TAsmList;const r : treference;const cgpara : tcgpara);override; + + procedure g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean);override; + procedure g_copyvaluepara_openarray(list : TAsmList;const ref:treference;const lenloc:tlocation;elesize:aint;destreg:tregister);override; + + procedure g_exception_reason_save(list : TAsmList; const href : treference);override; + procedure g_exception_reason_save_const(list : TAsmList; const href : treference; a: aint);override; + procedure g_exception_reason_load(list : TAsmList; const href : treference);override; + procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);override; end; tcg64f386 = class(tcg64f32) - procedure a_op64_ref_reg(list : taasmoutput;op:TOpCG;size : tcgsize;const ref : treference;reg : tregister64);override; - procedure a_op64_reg_reg(list : taasmoutput;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64);override; - procedure a_op64_const_reg(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;reg : tregister64);override; - procedure a_op64_const_ref(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;const ref : treference);override; + procedure a_op64_ref_reg(list : TAsmList;op:TOpCG;size : tcgsize;const ref : treference;reg : tregister64);override; + procedure a_op64_reg_reg(list : TAsmList;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64);override; + procedure a_op64_const_reg(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;reg : tregister64);override; + procedure a_op64_const_ref(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;const ref : treference);override; private procedure get_64bit_ops(op:TOpCG;var op1,op2:TAsmOp); end; @@ -90,7 +90,7 @@ unit cgcpu; rgfpu:=Trgx86fpu.create; end; - procedure tcg386.do_register_allocation(list:Taasmoutput;headertai:tai); + procedure tcg386.do_register_allocation(list:TAsmList;headertai:tai); begin if pi_needs_got in current_procinfo.flags then include(rg[R_INTREGISTER].used_in_proc,getsupreg(current_procinfo.got)); @@ -98,7 +98,7 @@ unit cgcpu; end; - procedure tcg386.a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;const cgpara : tcgpara); + procedure tcg386.a_param_reg(list : TAsmList;size : tcgsize;r : tregister;const cgpara : tcgpara); var pushsize : tcgsize; begin @@ -117,7 +117,7 @@ unit cgcpu; end; - procedure tcg386.a_param_const(list : taasmoutput;size : tcgsize;a : aint;const cgpara : tcgpara); + procedure tcg386.a_param_const(list : TAsmList;size : tcgsize;a : aint;const cgpara : tcgpara); var pushsize : tcgsize; begin @@ -135,7 +135,7 @@ unit cgcpu; end; - procedure tcg386.a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const cgpara : tcgpara); + procedure tcg386.a_param_ref(list : TAsmList;size : tcgsize;const r : treference;const cgpara : tcgpara); procedure pushdata(paraloc:pcgparalocation;ofs:aint); var @@ -202,7 +202,7 @@ unit cgcpu; end; - procedure tcg386.a_paramaddr_ref(list : taasmoutput;const r : treference;const cgpara : tcgpara); + procedure tcg386.a_paramaddr_ref(list : TAsmList;const r : treference;const cgpara : tcgpara); var tmpreg : tregister; opsize : topsize; @@ -241,7 +241,7 @@ unit cgcpu; end; - procedure tcg386.g_proc_exit(list : taasmoutput;parasize:longint;nostackframe:boolean); + procedure tcg386.g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean); var stacksize : longint; begin @@ -328,7 +328,7 @@ unit cgcpu; end; - procedure tcg386.g_copyvaluepara_openarray(list : taasmoutput;const ref:treference;const lenloc:tlocation;elesize:aint;destreg:tregister); + procedure tcg386.g_copyvaluepara_openarray(list : TAsmList;const ref:treference;const lenloc:tlocation;elesize:aint;destreg:tregister); var power,len : longint; opsize : topsize; @@ -358,8 +358,8 @@ unit cgcpu; { so we have to access every page first } if target_info.system=system_i386_win32 then begin - objectlibrary.getjumplabel(again); - objectlibrary.getjumplabel(ok); + current_asmdata.getjumplabel(again); + current_asmdata.getjumplabel(ok); a_label(list,again); list.concat(Taicpu.op_const_reg(A_CMP,S_L,winstackpagesize,NR_EDI)); a_jmp_cond(list,OC_B,ok); @@ -444,7 +444,7 @@ unit cgcpu; end; - procedure tcg386.g_exception_reason_save(list : taasmoutput; const href : treference); + procedure tcg386.g_exception_reason_save(list : TAsmList; const href : treference); begin if not use_fixed_stack then list.concat(Taicpu.op_reg(A_PUSH,tcgsize2opsize[OS_INT],NR_FUNCTION_RESULT_REG)) @@ -453,7 +453,7 @@ unit cgcpu; end; - procedure tcg386.g_exception_reason_save_const(list : taasmoutput;const href : treference; a: aint); + procedure tcg386.g_exception_reason_save_const(list : TAsmList;const href : treference; a: aint); begin if not use_fixed_stack then list.concat(Taicpu.op_const(A_PUSH,tcgsize2opsize[OS_INT],a)) @@ -462,7 +462,7 @@ unit cgcpu; end; - procedure tcg386.g_exception_reason_load(list : taasmoutput; const href : treference); + procedure tcg386.g_exception_reason_load(list : TAsmList; const href : treference); begin if not use_fixed_stack then list.concat(Taicpu.op_reg(A_POP,tcgsize2opsize[OS_INT],NR_FUNCTION_RESULT_REG)) @@ -472,7 +472,7 @@ unit cgcpu; - procedure tcg386.g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint); + procedure tcg386.g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint); { possible calling conventions: default stdcall cdecl pascal register @@ -641,7 +641,7 @@ unit cgcpu; { case 0 } else begin - lab:=objectlibrary.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION); + lab:=current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION); list.concat(taicpu.op_sym(A_JMP,S_NO,lab)); end; @@ -685,7 +685,7 @@ unit cgcpu; end; - procedure tcg64f386.a_op64_ref_reg(list : taasmoutput;op:TOpCG;size : tcgsize;const ref : treference;reg : tregister64); + procedure tcg64f386.a_op64_ref_reg(list : TAsmList;op:TOpCG;size : tcgsize;const ref : treference;reg : tregister64); var op1,op2 : TAsmOp; tempref : treference; @@ -698,7 +698,7 @@ unit cgcpu; end; - procedure tcg64f386.a_op64_reg_reg(list : taasmoutput;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64); + procedure tcg64f386.a_op64_reg_reg(list : TAsmList;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64); var op1,op2 : TAsmOp; begin @@ -727,7 +727,7 @@ unit cgcpu; end; - procedure tcg64f386.a_op64_const_reg(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;reg : tregister64); + procedure tcg64f386.a_op64_const_reg(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;reg : tregister64); var op1,op2 : TAsmOp; begin @@ -750,7 +750,7 @@ unit cgcpu; end; - procedure tcg64f386.a_op64_const_ref(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;const ref : treference); + procedure tcg64f386.a_op64_const_ref(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;const ref : treference); var op1,op2 : TAsmOp; tempref : treference; diff --git a/compiler/i386/cpupara.pas b/compiler/i386/cpupara.pas index 39b7116481..593e004a55 100644 --- a/compiler/i386/cpupara.pas +++ b/compiler/i386/cpupara.pas @@ -48,7 +48,7 @@ unit cpupara; procedure getintparaloc(calloption : tproccalloption; nr : longint;var cgpara:TCGPara);override; function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override; function create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargsparalist):longint;override; - procedure createtempparaloc(list: taasmoutput;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara);override; + procedure createtempparaloc(list: TAsmList;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara);override; private procedure create_funcretloc_info(p : tabstractprocdef; side: tcallercallee); procedure create_stdcall_paraloc_info(p : tabstractprocdef; side: tcallercallee;paras:tparalist;var parasize:longint); @@ -612,7 +612,7 @@ unit cpupara; end; - procedure ti386paramanager.createtempparaloc(list: taasmoutput;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); + procedure ti386paramanager.createtempparaloc(list: TAsmList;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); var paraloc : pcgparalocation; begin diff --git a/compiler/i386/csopt386.pas b/compiler/i386/csopt386.pas index f4de881edb..b541ac911b 100644 --- a/compiler/i386/csopt386.pas +++ b/compiler/i386/csopt386.pas @@ -28,7 +28,7 @@ interface uses aasmbase,aasmtai,aasmcpu, cpuinfo, cpubase, optbase, cgbase; -function CSE(asml: TAAsmoutput; first, last: tai; pass: longint): boolean; +function CSE(asml: TAsmList; first, last: tai; pass: longint): boolean; function doReplaceReg(hp: taicpu; newReg, orgReg: tsuperregister): boolean; function changeOp(var o: toper; newReg, orgReg: tsuperregister): boolean; @@ -832,7 +832,7 @@ begin end; -procedure ClearRegContentsFrom(asml: taasmoutput; supreg: tsuperregister; p, endP: tai); +procedure ClearRegContentsFrom(asml: TAsmList; supreg: tsuperregister; p, endP: tai); { first clears the contents of reg from p till endP. then the contents are } { cleared until the first instruction that changes reg } var @@ -883,7 +883,7 @@ begin {$endif replaceregdebug} end; -procedure RestoreRegContentsTo(asml: taasmoutput; supreg: tsuperregister; const c: TContent; p, endP: tai); +procedure RestoreRegContentsTo(asml: TAsmList; supreg: tsuperregister; const c: TContent; p, endP: tai); var {$ifdef replaceregdebug} l: longint; @@ -1351,7 +1351,7 @@ end; -function ReplaceReg(asml: TAAsmOutput; orgsupreg, newsupreg: tsuperregister; p, +function ReplaceReg(asml: TAsmList; orgsupreg, newsupreg: tsuperregister; p, seqstart: tai; const c: TContent; orgRegCanBeModified: Boolean; var returnEndP: tai): Boolean; { Tries to replace orgsupreg with newsupreg in all instructions coming after p } @@ -1482,7 +1482,7 @@ begin end; -procedure removePrevNotUsedLoad(asml: taasmoutput; p: tai; supreg: tsuperregister; check: boolean); +procedure removePrevNotUsedLoad(asml: TAsmList; p: tai; supreg: tsuperregister; check: boolean); { if check = true, it means the procedure has to check whether it isn't } { possible that the contents are still used after p (used when removing } { instructions because of a "call"), otherwise this is not necessary } @@ -1619,7 +1619,7 @@ begin end; -procedure loadcseregs(asml: taasmoutput; const reginfo: toptreginfo; curseqend, prevseqstart, curseqstart, curprev: tai; cnt: longint); +procedure loadcseregs(asml: TAsmList; const reginfo: toptreginfo; curseqend, prevseqstart, curseqstart, curprev: tai; cnt: longint); var regsloaded: tregset; regloads, reguses: array[RS_EAX..RS_EDI] of tai; @@ -1680,7 +1680,7 @@ begin else if assigned(regloads[reginfo.new2oldreg[regcounter]]) then insertpos := regloads[reginfo.new2oldreg[regcounter]]; - hp := Tai_Marker.Create(NoPropInfoStart); + hp := Tai_Marker.Create(mark_NoPropInfoStart); InsertLLItem(asml, insertpos.previous,insertpos, hp); hp2 := taicpu.Op_Reg_Reg(opc, S_L, {old reg new reg} @@ -1691,7 +1691,7 @@ begin ptaiprop(hp2.optinfo)^ := ptaiprop(insertpos.optinfo)^; ptaiprop(hp2.optinfo)^.canBeRemoved := false; InsertLLItem(asml, insertpos.previous, insertpos, hp2); - hp := Tai_Marker.Create(NoPropInfoEnd); + hp := Tai_Marker.Create(mark_NoPropInfoEnd); InsertLLItem(asml, insertpos.previous, insertpos, hp); { adjusts states in previous instruction so that it will } { definitely be different from the previous or next state } @@ -1751,12 +1751,12 @@ begin end; -procedure replaceoperandwithreg(asml: taasmoutput; p: tai; opnr: byte; reg: tregister); +procedure replaceoperandwithreg(asml: TAsmList; p: tai; opnr: byte; reg: tregister); var hp: tai; begin { new instruction -> it's info block is not in the big one allocated at the start } - hp := Tai_Marker.Create(NoPropInfoStart); + hp := Tai_Marker.Create(mark_NoPropInfoStart); InsertLLItem(asml, p.previous,p, hp); { duplicate the original instruction and replace it's designated operant with the register } hp := tai(p.getcopy); @@ -1770,12 +1770,12 @@ begin ptaiprop(p.optinfo)^.canBeRemoved := true; { insert end marker } InsertLLItem(asml, p.previous, p, hp); - hp := Tai_Marker.Create(NoPropInfoEnd); + hp := Tai_Marker.Create(mark_NoPropInfoEnd); InsertLLItem(asml, p.previous, p, hp); end; -procedure doCSE(asml: TAAsmOutput; First, Last: tai; findPrevSeqs, doSubOpts: boolean); +procedure doCSE(asml: TAsmList; First, Last: tai; findPrevSeqs, doSubOpts: boolean); {marks the instructions that can be removed by RemoveInstructs. They're not removed immediately because sometimes an instruction needs to be checked in two different sequences} @@ -2028,7 +2028,7 @@ begin (RegLoadedWithNewValue(getsupreg(memreg),false,hp1) or FindRegDealloc(getsupreg(memreg),hp1))) then begin - hp1 := Tai_Marker.Create(NoPropInfoEnd); + hp1 := Tai_Marker.Create(mark_NoPropInfoEnd); insertllitem(asml,p,p.next,hp1); hp1 := taicpu.op_reg_ref(A_MOV,reg2opsize(memreg), memreg,taicpu(p).oper[0]^.ref^); @@ -2038,7 +2038,7 @@ begin regcounter := getsupreg(memreg); incstate(pTaiProp(hp1.optinfo)^.regs[regcounter].rstate,1); updatestate(regcounter,hp1); - hp1 := Tai_Marker.Create(NoPropInfoStart); + hp1 := Tai_Marker.Create(mark_NoPropInfoStart); insertllitem(asml,p,p.next,hp1); replaceoperandwithreg(asml,p,0,memreg); allocregbetween(asml,memreg,hp5, @@ -2081,7 +2081,7 @@ begin (RegLoadedWithNewValue(getsupreg(memreg),false,hp1) or FindRegDealloc(getsupreg(memreg),hp1))) then begin - hp1 := Tai_Marker.Create(NoPropInfoEnd); + hp1 := Tai_Marker.Create(mark_NoPropInfoEnd); insertllitem(asml,p,p.next,hp1); hp1 := taicpu.op_reg_ref(A_MOV,reg2opsize(memreg), memreg,taicpu(p).oper[1]^.ref^); @@ -2091,7 +2091,7 @@ begin regcounter := getsupreg(memreg); incstate(pTaiProp(hp1.optinfo)^.regs[regcounter].rstate,1); updatestate(regcounter,hp1); - hp1 := Tai_Marker.Create(NoPropInfoStart); + hp1 := Tai_Marker.Create(mark_NoPropInfoStart); insertllitem(asml,p,p.next,hp1); replaceoperandwithreg(asml,p,1,memreg); allocregbetween(asml,memreg,hp5, @@ -2109,7 +2109,7 @@ begin end; end; -function removeInstructs(asml: TAAsmoutput; first, last: tai): boolean; +function removeInstructs(asml: TAsmList; first, last: tai): boolean; { Removes the marked instructions and disposes the PTaiProps of the other } { instructions } var @@ -2122,7 +2122,7 @@ begin while (p <> Last) do begin if (p.typ = ait_marker) and - (Tai_marker(p).kind = noPropInfoStart) then + (Tai_marker(p).kind = mark_NoPropInfoStart) then begin hp1 := tai(p.next); asml.remove(p); @@ -2138,8 +2138,8 @@ begin begin case Tai_marker(hp1).kind of { they can be nested! } - noPropInfoStart: inc(nopropinfolevel); - noPropInfoEnd: dec(nopropinfolevel); + mark_NoPropInfoStart: inc(nopropinfolevel); + mark_NoPropInfoEnd: dec(nopropinfolevel); else begin hp1 := p; @@ -2186,7 +2186,7 @@ begin end; end; -function CSE(asml: TAAsmOutput; First, Last: tai; pass: longint): boolean; +function CSE(asml: TAsmList; First, Last: tai; pass: longint): boolean; begin doCSE(asml, First, Last, not(cs_opt_asmcse in aktoptimizerswitches) or (pass >= 2), not(cs_opt_asmcse in aktoptimizerswitches) or (pass >= 1)); diff --git a/compiler/i386/daopt386.pas b/compiler/i386/daopt386.pas index b5d55ddf3a..6f5d76f865 100644 --- a/compiler/i386/daopt386.pas +++ b/compiler/i386/daopt386.pas @@ -167,7 +167,7 @@ type {*********************** procedures and functions ************************} -procedure InsertLLItem(AsmL: TAAsmOutput; prev, foll, new_one: TLinkedListItem); +procedure InsertLLItem(AsmL: TAsmList; prev, foll, new_one: TLinkedListItem); function RefsEqual(const R1, R2: TReference): Boolean; @@ -193,11 +193,11 @@ function GetLastInstruction(Current: tai; var Last: tai): Boolean; procedure SkipHead(var p: tai); function labelCanBeSkipped(p: tai_label): boolean; -procedure RemoveLastDeallocForFuncRes(asmL: TAAsmOutput; p: tai); +procedure RemoveLastDeallocForFuncRes(asmL: TAsmList; p: tai); function regLoadedWithNewValue(supreg: tsuperregister; canDependOnPrevValue: boolean; hp: tai): boolean; procedure UpdateUsedRegs(var UsedRegs: TRegSet; p: tai); -procedure AllocRegBetween(asml: taasmoutput; reg: tregister; p1, p2: tai; const initialusedregs: tregset); +procedure AllocRegBetween(asml: TAsmList; reg: tregister; p1, p2: tai; const initialusedregs: tregset); function FindRegDealloc(supreg: tsuperregister; p: tai): boolean; function InstructionsEquivalent(p1, p2: tai; var RegInfo: toptreginfo): Boolean; @@ -207,7 +207,7 @@ function OpsEqual(const o1,o2:toper): Boolean; type tdfaobj = class - constructor create(_list: taasmoutput); virtual; + constructor create(_list: TAsmList); virtual; function pass_1(_blockstart: tai): tai; function pass_2: boolean; @@ -224,7 +224,7 @@ type procedure dodfapass2; { asm list we're working on } - list: taasmoutput; + list: TAsmList; { current part of the asm list } blockstart, blockend: tai; @@ -379,9 +379,9 @@ begin until false; end; -procedure RemoveLastDeallocForFuncRes(asml: taasmoutput; p: tai); +procedure RemoveLastDeallocForFuncRes(asml: TAsmList; p: tai); - procedure DoRemoveLastDeallocForFuncRes(asml: taasmoutput; supreg: tsuperregister); + procedure DoRemoveLastDeallocForFuncRes(asml: TAsmList; supreg: tsuperregister); var hp2: tai; begin @@ -445,7 +445,7 @@ begin end; -procedure AddRegDeallocFor(asml: taasmoutput; reg: tregister; p: tai); +procedure AddRegDeallocFor(asml: TAsmList; reg: tregister; p: tai); var hp1: tai; funcResRegs: tregset; @@ -540,7 +540,7 @@ end; { inserts new_one between prev and foll } -procedure InsertLLItem(AsmL: TAAsmOutput; prev, foll, new_one: TLinkedListItem); +procedure InsertLLItem(AsmL: TAsmList; prev, foll, new_one: TLinkedListItem); begin if assigned(prev) then if assigned(foll) then @@ -984,7 +984,7 @@ function GetNextInstruction(Current: tai; var Next: tai): Boolean; begin repeat if (Current.typ = ait_marker) and - (tai_Marker(current).Kind = AsmBlockStart) then + (tai_Marker(current).Kind = mark_AsmBlockStart) then begin GetNextInstruction := False; Next := Nil; @@ -998,16 +998,16 @@ begin Current := tai(current.Next); { if assigned(Current) and (current.typ = ait_Marker) and - (tai_Marker(current).Kind = NoPropInfoStart) then + (tai_Marker(current).Kind = mark_NoPropInfoStart) then begin while assigned(Current) and ((current.typ <> ait_Marker) or - (tai_Marker(current).Kind <> NoPropInfoend)) Do + (tai_Marker(current).Kind <> mark_NoPropInfoEnd)) Do Current := tai(current.Next); end;} until not(assigned(Current)) or (current.typ <> ait_Marker) or - not(tai_Marker(current).Kind in [NoPropInfoStart,NoPropInfoend]); + not(tai_Marker(current).Kind in [mark_NoPropInfoStart,mark_NoPropInfoEnd]); Next := Current; if assigned(Current) and not((current.typ in SkipInstr) or @@ -1016,7 +1016,7 @@ begin then GetNextInstruction := not((current.typ = ait_marker) and - (tai_marker(current).kind = asmBlockStart)) + (tai_marker(current).kind = mark_AsmBlockStart)) else begin GetNextInstruction := False; @@ -1033,29 +1033,29 @@ begin Current := tai(current.previous); while assigned(Current) and (((current.typ = ait_Marker) and - not(tai_Marker(current).Kind in [AsmBlockend{,NoPropInfoend}])) or + not(tai_Marker(current).Kind in [mark_AsmBlockEnd{,mark_NoPropInfoEnd}])) or (current.typ in SkipInstr) or ((current.typ = ait_label) and labelCanBeSkipped(tai_label(current)))) Do Current := tai(current.previous); { if assigned(Current) and (current.typ = ait_Marker) and - (tai_Marker(current).Kind = NoPropInfoend) then + (tai_Marker(current).Kind = mark_NoPropInfoEnd) then begin while assigned(Current) and ((current.typ <> ait_Marker) or - (tai_Marker(current).Kind <> NoPropInfoStart)) Do + (tai_Marker(current).Kind <> mark_NoPropInfoStart)) Do Current := tai(current.previous); end;} until not(assigned(Current)) or (current.typ <> ait_Marker) or - not(tai_Marker(current).Kind in [NoPropInfoStart,NoPropInfoend]); + not(tai_Marker(current).Kind in [mark_NoPropInfoStart,mark_NoPropInfoEnd]); if not(assigned(Current)) or (current.typ in SkipInstr) or ((current.typ = ait_label) and labelCanBeSkipped(tai_label(current))) or ((current.typ = ait_Marker) and - (tai_Marker(current).Kind = AsmBlockend)) + (tai_Marker(current).Kind = mark_AsmBlockEnd)) then begin Last := nil; @@ -1077,12 +1077,12 @@ begin oldp := p; if (p.typ in SkipInstr) or ((p.typ = ait_marker) and - (tai_Marker(p).Kind in [AsmBlockend,inlinestart,inlineend])) then + (tai_Marker(p).Kind in [mark_AsmBlockEnd,mark_InlineStart,mark_InlineEnd])) then GetNextInstruction(p,p) else if ((p.Typ = Ait_Marker) and - (tai_Marker(p).Kind = nopropinfostart)) then - {a marker of the NoPropInfoStart can't be the first instruction of a - TAAsmoutput list} + (tai_Marker(p).Kind = mark_NoPropInfoStart)) then + {a marker of the mark_NoPropInfoStart can't be the first instruction of a + TAsmList list} GetNextInstruction(tai(p.previous),p); until p = oldp end; @@ -1131,7 +1131,7 @@ begin ((p.typ = ait_label) and labelCanBeSkipped(tai_label(p))) or ((p.typ = ait_marker) and - (tai_Marker(p).Kind in [AsmBlockend,inlinestart,inlineend]))) do + (tai_Marker(p).Kind in [mark_AsmBlockEnd,mark_InlineStart,mark_InlineEnd]))) do p := tai(p.next); while assigned(p) and (p.typ=ait_RegAlloc) Do @@ -1154,7 +1154,7 @@ begin end; -procedure AllocRegBetween(asml: taasmoutput; reg: tregister; p1, p2: tai; const initialusedregs: tregset); +procedure AllocRegBetween(asml: TAsmList; reg: tregister; p1, p2: tai; const initialusedregs: tregset); { allocates register reg between (and including) instructions p1 and p2 } { the type of p1 and p2 must not be in SkipInstr } { note that this routine is both called from the peephole optimizer } @@ -1964,7 +1964,7 @@ begin end; -procedure AddInstr2RegContents({$ifdef statedebug} asml: taasmoutput; {$endif} +procedure AddInstr2RegContents({$ifdef statedebug} asml: TAsmList; {$endif} p: taicpu; supreg: tsuperregister); {$ifdef statedebug} var @@ -2004,7 +2004,7 @@ begin end; -procedure AddInstr2OpContents({$ifdef statedebug} asml: TAAsmoutput; {$endif} +procedure AddInstr2OpContents({$ifdef statedebug} asml: TAsmList; {$endif} p: taicpu; const oper: TOper); begin if oper.typ = top_reg then @@ -2021,7 +2021,7 @@ end; {************************************** TDFAOBJ **************************************} {*************************************************************************************} -constructor tdfaobj.create(_list: taasmoutput); +constructor tdfaobj.create(_list: TAsmList); begin list := _list; blockstart := nil; @@ -2066,7 +2066,7 @@ begin getnextinstruction(p, p); end; if (prev.typ = ait_marker) and - (tai_marker(prev).kind = asmblockstart) then + (tai_marker(prev).kind = mark_AsmBlockStart) then blockend := prev else blockend := nil; if labelfound then diff --git a/compiler/i386/n386add.pas b/compiler/i386/n386add.pas index 92e9ef29ea..c39563ee3f 100644 --- a/compiler/i386/n386add.pas +++ b/compiler/i386/n386add.pas @@ -42,7 +42,7 @@ interface cutils,verbose,globals, symconst,symdef,paramgr, aasmbase,aasmtai,aasmcpu, - cgbase, + cgbase,procinfo, ncon,nset,cgutils,tgobj, cga,ncgutil,cgobj,cg64f32; @@ -105,9 +105,9 @@ interface begin if (right.location.loc<>LOC_REGISTER) then begin - hregister:=cg.getintregister(exprasmlist,OS_INT); - hregister2:=cg.getintregister(exprasmlist,OS_INT); - cg64.a_load64_loc_reg(exprasmlist,left.location,joinreg64(hregister,hregister2)); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + hregister2:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg64.a_load64_loc_reg(current_asmdata.CurrAsmList,left.location,joinreg64(hregister,hregister2)); location_reset(left.location,LOC_REGISTER,OS_64); left.location.register64.reglo:=hregister; left.location.register64.reghi:=hregister2; @@ -125,7 +125,7 @@ interface { when swapped another result register } if (nodetype=subn) and (nf_swaped in flags) then begin - cg64.a_op64_reg_reg(exprasmlist,op,location.size, + cg64.a_op64_reg_reg(current_asmdata.CurrAsmList,op,location.size, left.location.register64, right.location.register64); location_swap(left.location,right.location); @@ -133,7 +133,7 @@ interface end else begin - cg64.a_op64_reg_reg(exprasmlist,op,location.size, + cg64.a_op64_reg_reg(current_asmdata.CurrAsmList,op,location.size, right.location.register64, left.location.register64); end; @@ -143,21 +143,21 @@ interface { right.location<>LOC_REGISTER } if (nodetype=subn) and (nf_swaped in flags) then begin - r:=cg.getintregister(exprasmlist,OS_INT); - cg64.a_load64low_loc_reg(exprasmlist,right.location,r); + r:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg64.a_load64low_loc_reg(current_asmdata.CurrAsmList,right.location,r); emit_reg_reg(op1,opsize,left.location.register64.reglo,r); emit_reg_reg(A_MOV,opsize,r,left.location.register64.reglo); - cg64.a_load64high_loc_reg(exprasmlist,right.location,r); + cg64.a_load64high_loc_reg(current_asmdata.CurrAsmList,right.location,r); { the carry flag is still ok } emit_reg_reg(op2,opsize,left.location.register64.reghi,r); emit_reg_reg(A_MOV,opsize,r,left.location.register64.reghi); end else begin - cg64.a_op64_loc_reg(exprasmlist,op,location.size,right.location, + cg64.a_op64_loc_reg(current_asmdata.CurrAsmList,op,location.size,right.location, left.location.register64); end; - location_freetemp(exprasmlist,right.location); + location_freetemp(current_asmdata.CurrAsmList,right.location); end; { only in case of overflow operations } @@ -168,13 +168,13 @@ interface begin if cs_check_overflow in aktlocalswitches then begin - objectlibrary.getjumplabel(hl4); + current_asmdata.getjumplabel(hl4); if unsigned then - cg.a_jmp_flags(exprasmlist,F_AE,hl4) + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_AE,hl4) else - cg.a_jmp_flags(exprasmlist,F_NO,hl4); - cg.a_call_name(exprasmlist,'FPC_OVERFLOW'); - cg.a_label(exprasmlist,hl4); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NO,hl4); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_OVERFLOW'); + cg.a_label(current_asmdata.CurrAsmList,hl4); end; end; @@ -196,16 +196,16 @@ interface begin {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} { the jump the sequence is a little bit hairy } case nodetype of ltn,gtn: begin - cg.a_jmp_flags(exprasmlist,getresflags(unsigned),truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrTrueLabel); { cheat a little bit for the negative test } toggleflag(nf_swaped); - cg.a_jmp_flags(exprasmlist,getresflags(unsigned),falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrFalseLabel); toggleflag(nf_swaped); end; lten,gten: @@ -215,19 +215,19 @@ interface nodetype:=ltn else nodetype:=gtn; - cg.a_jmp_flags(exprasmlist,getresflags(unsigned),truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrTrueLabel); { cheat for the negative test } if nodetype=ltn then nodetype:=gtn else nodetype:=ltn; - cg.a_jmp_flags(exprasmlist,getresflags(unsigned),falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrFalseLabel); nodetype:=oldnodetype; end; equaln: - cg.a_jmp_flags(exprasmlist,F_NE,falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NE,current_procinfo.CurrFalseLabel); unequaln: - cg.a_jmp_flags(exprasmlist,F_NE,truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NE,current_procinfo.CurrTrueLabel); end; end; @@ -240,18 +240,18 @@ interface begin { the comparisaion of the low dword have to be } { always unsigned! } - cg.a_jmp_flags(exprasmlist,getresflags(true),truelabel); - cg.a_jmp_always(exprasmlist,falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(true),current_procinfo.CurrTrueLabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); end; equaln: begin - cg.a_jmp_flags(exprasmlist,F_NE,falselabel); - cg.a_jmp_always(exprasmlist,truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NE,current_procinfo.CurrFalseLabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); end; unequaln: begin - cg.a_jmp_flags(exprasmlist,F_NE,truelabel); - cg.a_jmp_always(exprasmlist,falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NE,current_procinfo.CurrTrueLabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); end; end; end; @@ -275,9 +275,9 @@ interface { we can reuse a CREGISTER for comparison } if (left.location.loc<>LOC_CREGISTER) then begin - hregister:=cg.getintregister(exprasmlist,OS_INT); - hregister2:=cg.getintregister(exprasmlist,OS_INT); - cg64.a_load64_loc_reg(exprasmlist,left.location,joinreg64(hregister,hregister2)); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + hregister2:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg64.a_load64_loc_reg(current_asmdata.CurrAsmList,left.location,joinreg64(hregister,hregister2)); location_reset(left.location,LOC_REGISTER,OS_64); left.location.register64.reglo:=hregister; left.location.register64.reghi:=hregister2; @@ -317,14 +317,14 @@ interface firstjmp64bitcmp; emit_ref_reg(A_CMP,S_L,right.location.reference,left.location.register64.reglo); secondjmp64bitcmp; - cg.a_jmp_always(exprasmlist,falselabel); - location_freetemp(exprasmlist,right.location); + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); + location_freetemp(current_asmdata.CurrAsmList,right.location); end; LOC_CONSTANT : begin - exprasmlist.concat(taicpu.op_const_reg(A_CMP,S_L,aint(hi(right.location.value64)),left.location.register64.reghi)); + current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_CMP,S_L,aint(hi(right.location.value64)),left.location.register64.reghi)); firstjmp64bitcmp; - exprasmlist.concat(taicpu.op_const_reg(A_CMP,S_L,aint(lo(right.location.value64)),left.location.register64.reglo)); + current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_CMP,S_L,aint(lo(right.location.value64)),left.location.register64.reglo)); secondjmp64bitcmp; end; else @@ -332,7 +332,7 @@ interface end; end; - location_freetemp(exprasmlist,left.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); { we have LOC_JUMP as result } location_reset(location,LOC_JUMP,OS_NO) @@ -353,30 +353,30 @@ interface location_reset(location,LOC_REGISTER,OS_INT); {Get a temp register and load the left value into it and free the location.} - r:=cg.getintregister(exprasmlist,OS_INT); - cg.a_load_loc_reg(exprasmlist,OS_INT,left.location,r); + r:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_INT,left.location,r); {Allocate EAX.} - cg.getcpuregister(exprasmlist,NR_EAX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_EAX); {Load the right value.} - cg.a_load_loc_reg(exprasmlist,OS_INT,right.location,NR_EAX); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_INT,right.location,NR_EAX); {Also allocate EDX, since it is also modified by a mul (JM).} - cg.getcpuregister(exprasmlist,NR_EDX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_EDX); emit_reg(A_MUL,S_L,r); if cs_check_overflow in aktlocalswitches then begin - objectlibrary.getjumplabel(hl4); - cg.a_jmp_flags(exprasmlist,F_AE,hl4); - cg.a_call_name(exprasmlist,'FPC_OVERFLOW'); - cg.a_label(exprasmlist,hl4); + current_asmdata.getjumplabel(hl4); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_AE,hl4); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_OVERFLOW'); + cg.a_label(current_asmdata.CurrAsmList,hl4); end; {Free EAX,EDX} - cg.ungetcpuregister(exprasmlist,NR_EDX); - cg.ungetcpuregister(exprasmlist,NR_EAX); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EDX); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EAX); {Allocate a new register and store the result in EAX in it.} - location.register:=cg.getintregister(exprasmlist,OS_INT); - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,NR_EAX,location.register); - location_freetemp(exprasmlist,left.location); - location_freetemp(exprasmlist,right.location); + location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_EAX,location.register); + location_freetemp(current_asmdata.CurrAsmList,left.location); + location_freetemp(current_asmdata.CurrAsmList,right.location); end; diff --git a/compiler/i386/n386cal.pas b/compiler/i386/n386cal.pas index 9d14aa1b99..6c9439406f 100644 --- a/compiler/i386/n386cal.pas +++ b/compiler/i386/n386cal.pas @@ -77,15 +77,15 @@ implementation { old-style code (JM) } dec(pop_size,pushedparasize); if (pop_size < 0) then - exprasmlist.concat(taicpu.op_const_reg(A_SUB,S_L,-pop_size,NR_ESP)); + current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_SUB,S_L,-pop_size,NR_ESP)); exit; end; { better than an add on all processors } if pop_size=4 then begin - hreg:=cg.getintregister(exprasmlist,OS_INT); - exprasmlist.concat(taicpu.op_reg(A_POP,S_L,hreg)); + hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_POP,S_L,hreg)); end { the pentium has two pipes and pop reg is pairable } { but the registers must be different! } @@ -94,14 +94,14 @@ implementation not(cs_opt_size in aktoptimizerswitches) and (aktoptimizecputype=cpu_Pentium) then begin - hreg:=cg.getintregister(exprasmlist,OS_INT); - exprasmlist.concat(taicpu.op_reg(A_POP,S_L,hreg)); - hreg:=cg.getintregister(exprasmlist,OS_INT); - exprasmlist.concat(taicpu.op_reg(A_POP,S_L,hreg)); + hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_POP,S_L,hreg)); + hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_POP,S_L,hreg)); end else if pop_size<>0 then - exprasmlist.concat(taicpu.op_const_reg(A_ADD,S_L,pop_size,NR_ESP)); + current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_ADD,S_L,pop_size,NR_ESP)); end; diff --git a/compiler/i386/n386mat.pas b/compiler/i386/n386mat.pas index cba99c7e93..05cad1b7f4 100644 --- a/compiler/i386/n386mat.pas +++ b/compiler/i386/n386mat.pas @@ -95,7 +95,7 @@ implementation internalerror(200109052); { put numerator in register } location_reset(location,LOC_REGISTER,OS_INT); - location_force_reg(exprasmlist,left.location,OS_INT,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,OS_INT,false); hreg1:=left.location.register; if (nodetype=divn) and (right.nodetype=ordconstn) then @@ -113,7 +113,7 @@ implementation comp.compilers (JM) } begin { no jumps, but more operations } - hreg2:=cg.getintregister(exprasmlist,OS_INT); + hreg2:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); emit_reg_reg(A_MOV,S_L,hreg1,hreg2); {If the left value is signed, hreg2=$ffffffff, otherwise 0.} emit_const_reg(A_SAR,S_L,31,hreg2); @@ -128,13 +128,13 @@ implementation begin { a jump, but less operations } emit_reg_reg(A_TEST,S_L,hreg1,hreg1); - objectlibrary.getjumplabel(hl); - cg.a_jmp_flags(exprasmlist,F_NS,hl); + current_asmdata.getjumplabel(hl); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NS,hl); if power=1 then emit_reg(A_INC,S_L,hreg1) else emit_const_reg(A_ADD,S_L,tordconstnode(right).value-1,hreg1); - cg.a_label(exprasmlist,hl); + cg.a_label(current_asmdata.CurrAsmList,hl); emit_const_reg(A_SAR,S_L,power,hreg1); end end @@ -171,9 +171,9 @@ implementation a:=1 else a:=0; - cg.getcpuregister(exprasmlist,NR_EAX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_EAX); emit_const_reg(A_MOV,S_L,aint(m),NR_EAX); - cg.getcpuregister(exprasmlist,NR_EDX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_EDX); emit_reg(A_IMUL,S_L,hreg1); emit_reg_reg(A_MOV,S_L,hreg1,NR_EAX); if a<>0 then @@ -213,10 +213,10 @@ implementation emit_reg_reg(A_ADD,S_L,NR_EAX,NR_EDX); if e<0 then emit_reg(A_NEG,S_L,NR_EDX); - cg.ungetcpuregister(exprasmlist,NR_EDX); - cg.ungetcpuregister(exprasmlist,NR_EAX); - location.register:=cg.getintregister(exprasmlist,OS_INT); - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,NR_EDX,location.register) + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EDX); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EAX); + location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_EDX,location.register) end else begin @@ -224,7 +224,7 @@ implementation if d>=$80000000 then begin emit_const_reg(A_CMP,S_L,d,hreg1); - location.register:=cg.getintregister(exprasmlist,OS_INT); + location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); emit_const_reg(A_MOV,S_L,0,location.register); emit_const_reg(A_SBB,S_L,-1,location.register); end @@ -283,9 +283,9 @@ implementation end; { Adjust multiplier for reduction of even divisors } inc(s,n); - cg.getcpuregister(exprasmlist,NR_EAX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_EAX); emit_const_reg(A_MOV,S_L,aint(m),NR_EAX); - cg.getcpuregister(exprasmlist,NR_EDX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_EDX); emit_reg(A_MUL,S_L,hreg1); if a<>0 then begin @@ -305,19 +305,19 @@ implementation end; if s<>0 then emit_const_reg(A_SHR,S_L,aint(s),NR_EDX); - cg.ungetcpuregister(exprasmlist,NR_EDX); - cg.ungetcpuregister(exprasmlist,NR_EAX); - location.register:=cg.getintregister(exprasmlist,OS_INT); - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,NR_EDX,location.register) + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EDX); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EAX); + location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_EDX,location.register) end; end end end else begin - cg.getcpuregister(exprasmlist,NR_EAX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_EAX); emit_reg_reg(A_MOV,S_L,hreg1,NR_EAX); - cg.getcpuregister(exprasmlist,NR_EDX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_EDX); {Sign extension depends on the left type.} if torddef(left.resulttype.def).typ=u32bit then emit_reg_reg(A_XOR,S_L,NR_EDX,NR_EDX) @@ -336,19 +336,19 @@ implementation emit_reg(op,S_L,right.location.register) else begin - hreg1:=cg.getintregister(exprasmlist,right.location.size); - cg.a_load_loc_reg(exprasmlist,OS_32,right.location,hreg1); + hreg1:=cg.getintregister(current_asmdata.CurrAsmList,right.location.size); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_32,right.location,hreg1); emit_reg(op,S_L,hreg1); end; {Copy the result into a new register. Release EAX & EDX.} - cg.ungetcpuregister(exprasmlist,NR_EDX); - cg.ungetcpuregister(exprasmlist,NR_EAX); - location.register:=cg.getintregister(exprasmlist,OS_INT); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EDX); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_EAX); + location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); if nodetype=divn then - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,NR_EAX,location.register) + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_EAX,location.register) else - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,NR_EDX,location.register); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_EDX,location.register); end; end; @@ -386,7 +386,7 @@ implementation location_reset(location,LOC_REGISTER,OS_64); { load left operator in a register } - location_force_reg(exprasmlist,left.location,OS_64,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,OS_64,false); hreg64hi:=left.location.register64.reghi; hreg64lo:=left.location.register64.reglo; @@ -430,8 +430,8 @@ implementation else begin { load right operators in a register } - cg.getcpuregister(exprasmlist,NR_ECX); - cg.a_load_loc_reg(exprasmlist,OS_32,right.location,NR_ECX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_ECX); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_32,right.location,NR_ECX); { left operator is already in a register } { hence are both in a register } @@ -439,25 +439,25 @@ implementation { the damned shift instructions work only til a count of 32 } { so we've to do some tricks here } - objectlibrary.getjumplabel(l1); - objectlibrary.getjumplabel(l2); - objectlibrary.getjumplabel(l3); + current_asmdata.getjumplabel(l1); + current_asmdata.getjumplabel(l2); + current_asmdata.getjumplabel(l3); emit_const_reg(A_CMP,S_L,64,NR_ECX); - cg.a_jmp_flags(exprasmlist,F_L,l1); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_L,l1); emit_reg_reg(A_XOR,S_L,hreg64lo,hreg64lo); emit_reg_reg(A_XOR,S_L,hreg64hi,hreg64hi); - cg.a_jmp_always(exprasmlist,l3); - cg.a_label(exprasmlist,l1); + cg.a_jmp_always(current_asmdata.CurrAsmList,l3); + cg.a_label(current_asmdata.CurrAsmList,l1); emit_const_reg(A_CMP,S_L,32,NR_ECX); - cg.a_jmp_flags(exprasmlist,F_L,l2); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_L,l2); emit_const_reg(A_SUB,S_L,32,NR_ECX); if nodetype=shln then begin emit_reg_reg(A_SHL,S_L,NR_CL,hreg64lo); emit_reg_reg(A_MOV,S_L,hreg64lo,hreg64hi); emit_reg_reg(A_XOR,S_L,hreg64lo,hreg64lo); - cg.a_jmp_always(exprasmlist,l3); - cg.a_label(exprasmlist,l2); + cg.a_jmp_always(current_asmdata.CurrAsmList,l3); + cg.a_label(current_asmdata.CurrAsmList,l2); emit_reg_reg_reg(A_SHLD,S_L,NR_CL,hreg64lo,hreg64hi); emit_reg_reg(A_SHL,S_L,NR_CL,hreg64lo); end @@ -466,14 +466,14 @@ implementation emit_reg_reg(A_SHR,S_L,NR_CL,hreg64hi); emit_reg_reg(A_MOV,S_L,hreg64hi,hreg64lo); emit_reg_reg(A_XOR,S_L,hreg64hi,hreg64hi); - cg.a_jmp_always(exprasmlist,l3); - cg.a_label(exprasmlist,l2); + cg.a_jmp_always(current_asmdata.CurrAsmList,l3); + cg.a_label(current_asmdata.CurrAsmList,l2); emit_reg_reg_reg(A_SHRD,S_L,NR_CL,hreg64hi,hreg64lo); emit_reg_reg(A_SHR,S_L,NR_CL,hreg64hi); end; - cg.a_label(exprasmlist,l3); + cg.a_label(current_asmdata.CurrAsmList,l3); - cg.ungetcpuregister(exprasmlist,NR_ECX); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_ECX); location.register64.reglo:=hreg64lo; location.register64.reghi:=hreg64hi; end; @@ -482,7 +482,7 @@ implementation begin { load left operators in a register } location_copy(location,left.location); - location_force_reg(exprasmlist,location,OS_INT,false); + location_force_reg(current_asmdata.CurrAsmList,location,OS_INT,false); { shifting by a constant directly coded: } if (right.nodetype=ordconstn) then @@ -491,11 +491,11 @@ implementation else begin { load right operators in a ECX } - cg.getcpuregister(exprasmlist,NR_ECX); - cg.a_load_loc_reg(exprasmlist,OS_32,right.location,NR_ECX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_ECX); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_32,right.location,NR_ECX); { right operand is in ECX } - cg.ungetcpuregister(exprasmlist,NR_ECX); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_ECX); emit_reg_reg(op,S_L,NR_CL,location.register); end; end; diff --git a/compiler/i386/n386mem.pas b/compiler/i386/n386mem.pas index f3939c9ed3..34e4d363a9 100644 --- a/compiler/i386/n386mem.pas +++ b/compiler/i386/n386mem.pas @@ -97,16 +97,16 @@ implementation else if location.reference.base=NR_NO then begin case location.reference.scalefactor of - 2 : cg.a_op_const_reg(exprasmlist,OP_SHL,OS_ADDR,1,location.reference.index); - 4 : cg.a_op_const_reg(exprasmlist,OP_SHL,OS_ADDR,2,location.reference.index); - 8 : cg.a_op_const_reg(exprasmlist,OP_SHL,OS_ADDR,3,location.reference.index); + 2 : cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SHL,OS_ADDR,1,location.reference.index); + 4 : cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SHL,OS_ADDR,2,location.reference.index); + 8 : cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SHL,OS_ADDR,3,location.reference.index); end; location.reference.base:=location.reference.index; end else begin - hreg := cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,location.reference,hreg); + hreg := cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,location.reference,hreg); reference_reset_base(location.reference,hreg,0); end; { insert the new index register and scalefactor or @@ -116,9 +116,9 @@ implementation else begin if ispowerof2(l,l2) then - cg.a_op_const_reg(exprasmlist,OP_SHL,OS_ADDR,l2,reg) + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SHL,OS_ADDR,l2,reg) else - cg.a_op_const_reg(exprasmlist,OP_IMUL,OS_ADDR,l,reg); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_IMUL,OS_ADDR,l,reg); end; end; location.reference.index:=reg; diff --git a/compiler/i386/n386set.pas b/compiler/i386/n386set.pas index a6d9265759..27ec8c1812 100644 --- a/compiler/i386/n386set.pas +++ b/compiler/i386/n386set.pas @@ -83,7 +83,7 @@ implementation indexreg : tregister; href : treference; - procedure genitem(list:taasmoutput;t : pcaselabel); + procedure genitem(list:TAsmList;t : pcaselabel); var i : aint; begin @@ -103,14 +103,14 @@ implementation if not(jumptable_no_range) then begin { case expr less than min_ => goto elselabel } - cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,aint(min_),hregister,elselabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_lt,aint(min_),hregister,elselabel); { case expr greater than max_ => goto elselabel } - cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_gt,aint(max_),hregister,elselabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_gt,aint(max_),hregister,elselabel); end; - objectlibrary.getjumplabel(table); + current_asmdata.getjumplabel(table); { make it a 32bit register } - indexreg:=cg.makeregsize(exprasmlist,hregister,OS_INT); - cg.a_load_reg_reg(exprasmlist,opsize,OS_INT,hregister,indexreg); + indexreg:=cg.makeregsize(current_asmdata.CurrAsmList,hregister,OS_INT); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,opsize,OS_INT,hregister,indexreg); { create reference } reference_reset_symbol(href,table,0); href.offset:=(-aint(min_))*4; @@ -139,16 +139,16 @@ implementation { need we to test the first value } if first and (t^._low>get_min_value(left.resulttype.def)) then begin - cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,aint(t^._low),hregister,elselabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_lt,aint(t^._low),hregister,elselabel); end; if t^._low=t^._high then begin if t^._low-last=0 then - cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ,0,hregister,blocklabel(t^.blockid)) + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize, OC_EQ,0,hregister,blocklabel(t^.blockid)) else begin - cg.a_op_const_reg(exprasmlist, OP_SUB, opsize, aint(t^._low-last), hregister); - cg.a_jmp_flags(exprasmlist,F_E,blocklabel(t^.blockid)); + cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opsize, aint(t^._low-last), hregister); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_E,blocklabel(t^.blockid)); end; last:=t^._low; lastrange:=false; @@ -162,7 +162,7 @@ implementation begin { have we to ajust the first value ? } if (t^._low>get_min_value(left.resulttype.def)) then - cg.a_op_const_reg(exprasmlist, OP_SUB, opsize, aint(t^._low), hregister); + cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opsize, aint(t^._low), hregister); end else begin @@ -170,17 +170,17 @@ implementation { present label then the lower limit can be checked } { immediately. else check the range in between: } - cg.a_op_const_reg(exprasmlist, OP_SUB, opsize, aint(t^._low-last), hregister); + cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opsize, aint(t^._low-last), hregister); { no jump necessary here if the new range starts at } { at the value following the previous one } if ((t^._low-last) <> 1) or (not lastrange) then - cg.a_jmp_flags(exprasmlist,cond_lt,elselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,cond_lt,elselabel); end; {we need to use A_SUB, because A_DEC does not set the correct flags, therefor using a_op_const_reg(OP_SUB) is not possible } emit_const_reg(A_SUB,TCGSize2OpSize[opsize],aint(t^._high-t^._low),hregister); - cg.a_jmp_flags(exprasmlist,cond_le,blocklabel(t^.blockid)); + cg.a_jmp_flags(current_asmdata.CurrAsmList,cond_le,blocklabel(t^.blockid)); last:=t^._high; lastrange:=true; end; @@ -209,7 +209,7 @@ implementation lastrange:=false; first:=true; genitem(hp); - cg.a_jmp_always(exprasmlist,elselabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,elselabel); end; end; diff --git a/compiler/i386/popt386.pas b/compiler/i386/popt386.pas index ebd16cabd9..8c27a1a8d5 100644 --- a/compiler/i386/popt386.pas +++ b/compiler/i386/popt386.pas @@ -27,10 +27,10 @@ interface uses Aasmbase,aasmtai,aasmcpu,verbose; -procedure PrePeepHoleOpts(asml: taasmoutput; BlockStart, BlockEnd: tai); -procedure PeepHoleOptPass1(asml: taasmoutput; BlockStart, BlockEnd: tai); -procedure PeepHoleOptPass2(asml: taasmoutput; BlockStart, BlockEnd: tai); -procedure PostPeepHoleOpts(asml: taasmoutput; BlockStart, BlockEnd: tai); +procedure PrePeepHoleOpts(asml: TAsmList; BlockStart, BlockEnd: tai); +procedure PeepHoleOptPass1(asml: TAsmList; BlockStart, BlockEnd: tai); +procedure PeepHoleOptPass2(asml: TAsmList; BlockStart, BlockEnd: tai); +procedure PostPeepHoleOpts(asml: TAsmList; BlockStart, BlockEnd: tai); implementation @@ -56,7 +56,7 @@ begin end; -function doFpuLoadStoreOpt(asmL: TAAsmoutput; var p: tai): boolean; +function doFpuLoadStoreOpt(asmL: TAsmList; var p: tai): boolean; { returns true if a "continue" should be done after this optimization } var hp1, hp2: tai; begin @@ -108,7 +108,7 @@ begin end; -procedure PrePeepHoleOpts(asml: taasmoutput; BlockStart, BlockEnd: tai); +procedure PrePeepHoleOpts(asml: TAsmList; BlockStart, BlockEnd: tai); var p,hp1: tai; l: aint; @@ -402,7 +402,7 @@ end; -procedure PeepHoleOptPass1(Asml: taasmoutput; BlockStart, BlockEnd: tai); +procedure PeepHoleOptPass1(Asml: TAsmList; BlockStart, BlockEnd: tai); {First pass of peepholeoptimizations} var @@ -435,7 +435,7 @@ var end; end; - function GetFinalDestination(asml: taasmoutput; hp: taicpu; level: longint): boolean; + function GetFinalDestination(asml: TAsmList; hp: taicpu; level: longint): boolean; {traces sucessive jumps to their final destination and sets it, e.g. je l1 je l3 <code> <code> @@ -508,7 +508,7 @@ var insertllitem(asml,p1,p1.next,tai_comment.Create( strpnew('previous label inserted')))); {$endif finaldestdebug} - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); insertllitem(asml,p1,p1.next,tai_label.Create(l)); tasmlabel(taicpu(hp).oper[0]^.ref^.symbol).decrefs; hp.oper[0]^.ref^.symbol := l; @@ -1657,7 +1657,7 @@ begin end; -procedure PeepHoleOptPass2(asml: taasmoutput; BlockStart, BlockEnd: tai); +procedure PeepHoleOptPass2(asml: TAsmList; BlockStart, BlockEnd: tai); {$ifdef USECMOV} function CanBeCMOV(p : tai) : boolean; @@ -1918,7 +1918,7 @@ begin end; -procedure PostPeepHoleOpts(asml: taasmoutput; BlockStart, BlockEnd: tai); +procedure PostPeepHoleOpts(asml: TAsmList; BlockStart, BlockEnd: tai); var p,hp1,hp2: tai; begin diff --git a/compiler/i386/ra386int.pas b/compiler/i386/ra386int.pas index 0ba64e5e2a..bf5cccebc6 100644 --- a/compiler/i386/ra386int.pas +++ b/compiler/i386/ra386int.pas @@ -1395,7 +1395,7 @@ Unit Ra386int; if GotStar then Message(asmr_e_only_add_relocatable_symbol); if not assigned(oper.opr.ref.symbol) then - oper.opr.ref.symbol:=objectlibrary.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp) + oper.opr.ref.symbol:=current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp) else Message(asmr_e_cant_have_multiple_relocatable_symbols); end; @@ -1478,7 +1478,7 @@ Unit Ra386int; begin oper.opr.typ:=OPR_SYMBOL; oper.opr.symofs:=l; - oper.opr.symbol:=objectlibrary.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp); + oper.opr.symbol:=current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp); end else if oper.opr.typ=OPR_NONE then @@ -2021,7 +2021,7 @@ Unit Ra386int; _asmsorted:=TRUE; end; } - curlist:=TAAsmoutput.Create; + curlist:=TAsmList.Create; { setup label linked list } LocalLabelList:=TLocalLabelList.Create; { start tokenizer } diff --git a/compiler/i386/rropt386.pas b/compiler/i386/rropt386.pas index e862ab58de..cdba08162a 100644 --- a/compiler/i386/rropt386.pas +++ b/compiler/i386/rropt386.pas @@ -28,7 +28,7 @@ interface uses aasmbase,aasmtai,aasmcpu; -procedure doRenaming(asml: taasmoutput; first, last: tai); +procedure doRenaming(asml: TAsmList; first, last: tai); implementation @@ -189,7 +189,7 @@ begin end; -function switchRegs(asml: taasmoutput; reg1, reg2: tsuperregister; start: tai): Boolean; +function switchRegs(asml: TAsmList; reg1, reg2: tsuperregister; start: tai): Boolean; { change movl %reg1,%reg2 ... bla ... to ... bla with reg1 and reg2 switched } var endP, hp, lastreg1,lastreg2: tai; @@ -329,7 +329,7 @@ begin end; -procedure doRenaming(asml: taasmoutput; first, last: tai); +procedure doRenaming(asml: TAsmList; first, last: tai); var p: tai; begin diff --git a/compiler/link.pas b/compiler/link.pas index 0eeeb33d5b..33f49c6c43 100644 --- a/compiler/link.pas +++ b/compiler/link.pas @@ -684,8 +684,16 @@ end; Destructor TInternalLinker.Destroy; begin linkscript.free; - exeoutput.free; - exeoutput:=nil; + if assigned(exeoutput) then + begin + exeoutput.free; + exeoutput:=nil; + end; + if assigned(exemap) then + begin + exemap.free; + exemap:=nil; + end; inherited destroy; end; @@ -779,6 +787,7 @@ end; ExeOutput.Order_Stabs; hp:=tstringlistitem(hp.next); end; + exeoutput.Order_End; end; @@ -893,6 +902,10 @@ end; exemap:=nil; end; + { close exe } + exeoutput.free; + exeoutput:=nil; + MakeExecutable:=true; end; diff --git a/compiler/m68k/cgcpu.pas b/compiler/m68k/cgcpu.pas index 69f0248960..b53692daa4 100644 --- a/compiler/m68k/cgcpu.pas +++ b/compiler/m68k/cgcpu.pas @@ -38,61 +38,61 @@ unit cgcpu; tcg68k = class(tcg) procedure init_register_allocators;override; procedure done_register_allocators;override; - procedure a_call_name(list : taasmoutput;const s : string);override; - procedure a_call_reg(list : taasmoutput;reg : tregister);override; - procedure a_load_const_reg(list : taasmoutput;size : tcgsize;a : aint;register : tregister);override; - procedure a_load_reg_ref(list : taasmoutput;fromsize,tosize : tcgsize;register : tregister;const ref : treference);override; - procedure a_load_reg_reg(list : taasmoutput;fromsize,tosize : tcgsize;reg1,reg2 : tregister);override; - procedure a_load_ref_reg(list : taasmoutput;fromsize,tosize : tcgsize;const ref : treference;register : tregister);override; - procedure a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister);override; - procedure a_loadfpu_reg_reg(list: taasmoutput; size: tcgsize; reg1, reg2: tregister); override; - procedure a_loadfpu_ref_reg(list: taasmoutput; size: tcgsize; const ref: treference; reg: tregister); override; - procedure a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: tregister; const ref: treference); override; - procedure a_loadmm_reg_reg(list: taasmoutput;fromsize,tosize : tcgsize; reg1, reg2: tregister;shuffle : pmmshuffle); override; - procedure a_loadmm_ref_reg(list: taasmoutput;fromsize,tosize : tcgsize; const ref: treference; reg: tregister;shuffle : pmmshuffle); override; - procedure a_loadmm_reg_ref(list: taasmoutput;fromsize,tosize : tcgsize; reg: tregister; const ref: treference;shuffle : pmmshuffle); override; - procedure a_parammm_reg(list: taasmoutput; size: tcgsize; reg: tregister;const locpara : TCGPara;shuffle : pmmshuffle); override; - procedure a_op_const_reg(list : taasmoutput; Op: TOpCG; size: tcgsize; a: aint; reg: TRegister); override; - procedure a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; reg1, reg2: TRegister); override; - procedure a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; + procedure a_call_name(list : TAsmList;const s : string);override; + procedure a_call_reg(list : TAsmList;reg : tregister);override; + procedure a_load_const_reg(list : TAsmList;size : tcgsize;a : aint;register : tregister);override; + procedure a_load_reg_ref(list : TAsmList;fromsize,tosize : tcgsize;register : tregister;const ref : treference);override; + procedure a_load_reg_reg(list : TAsmList;fromsize,tosize : tcgsize;reg1,reg2 : tregister);override; + procedure a_load_ref_reg(list : TAsmList;fromsize,tosize : tcgsize;const ref : treference;register : tregister);override; + procedure a_loadaddr_ref_reg(list : TAsmList;const ref : treference;r : tregister);override; + procedure a_loadfpu_reg_reg(list: TAsmList; size: tcgsize; reg1, reg2: tregister); override; + procedure a_loadfpu_ref_reg(list: TAsmList; size: tcgsize; const ref: treference; reg: tregister); override; + procedure a_loadfpu_reg_ref(list: TAsmList; size: tcgsize; reg: tregister; const ref: treference); override; + procedure a_loadmm_reg_reg(list: TAsmList;fromsize,tosize : tcgsize; reg1, reg2: tregister;shuffle : pmmshuffle); override; + procedure a_loadmm_ref_reg(list: TAsmList;fromsize,tosize : tcgsize; const ref: treference; reg: tregister;shuffle : pmmshuffle); override; + procedure a_loadmm_reg_ref(list: TAsmList;fromsize,tosize : tcgsize; reg: tregister; const ref: treference;shuffle : pmmshuffle); override; + procedure a_parammm_reg(list: TAsmList; size: tcgsize; reg: tregister;const locpara : TCGPara;shuffle : pmmshuffle); override; + procedure a_op_const_reg(list : TAsmList; Op: TOpCG; size: tcgsize; a: aint; reg: TRegister); override; + procedure a_op_reg_reg(list : TAsmList; Op: TOpCG; size: TCGSize; reg1, reg2: TRegister); override; + procedure a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; l : tasmlabel);override; - procedure a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override; - procedure a_jmp_always(list : taasmoutput;l: tasmlabel); override; - procedure a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); override; - procedure g_flags2reg(list: taasmoutput; size: TCgSize; const f: tresflags; reg: TRegister); override; + procedure a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override; + procedure a_jmp_always(list : TAsmList;l: tasmlabel); override; + procedure a_jmp_flags(list : TAsmList;const f : TResFlags;l: tasmlabel); override; + procedure g_flags2reg(list: TAsmList; size: TCgSize; const f: tresflags; reg: TRegister); override; - procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint);override; + procedure g_concatcopy(list : TAsmList;const source,dest : treference;len : aint);override; { generates overflow checking code for a node } - procedure g_overflowcheck(list: taasmoutput; const l:tlocation; def:tdef); override; - procedure g_copyvaluepara_openarray(list : taasmoutput;const ref:treference;const lenloc:tlocation;elesize:aint;destreg:tregister);override; + procedure g_overflowcheck(list: TAsmList; const l:tlocation; def:tdef); override; + procedure g_copyvaluepara_openarray(list : TAsmList;const ref:treference;const lenloc:tlocation;elesize:aint;destreg:tregister);override; - procedure g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean);override; - procedure g_proc_exit(list : taasmoutput;parasize:longint;nostackframe:boolean);override; + procedure g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean);override; + procedure g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean);override; -// procedure g_restore_frame_pointer(list : taasmoutput);override; -// procedure g_return_from_proc(list : taasmoutput;parasize : aint);override; - procedure g_restore_standard_registers(list:Taasmoutput);override; - procedure g_save_standard_registers(list:Taasmoutput);override; +// procedure g_restore_frame_pointer(list : TAsmList);override; +// procedure g_return_from_proc(list : TAsmList;parasize : aint);override; + procedure g_restore_standard_registers(list:TAsmList);override; + procedure g_save_standard_registers(list:TAsmList);override; -// procedure g_save_all_registers(list : taasmoutput);override; -// procedure g_restore_all_registers(list : taasmoutput;const funcretparaloc:TCGPara);override; +// procedure g_save_all_registers(list : TAsmList);override; +// procedure g_restore_all_registers(list : TAsmList;const funcretparaloc:TCGPara);override; - procedure g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint);override; + procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);override; protected - function fixref(list: taasmoutput; var ref: treference): boolean; + function fixref(list: TAsmList; var ref: treference): boolean; private { # Sign or zero extend the register to a full 32-bit value. The new value is left in the same register. } - procedure sign_extend(list: taasmoutput;_oldsize : tcgsize; reg: tregister); - procedure a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel); + procedure sign_extend(list: TAsmList;_oldsize : tcgsize; reg: tregister); + procedure a_jmp_cond(list : TAsmList;cond : TOpCmp;l: tasmlabel); end; tcg64f68k = class(tcg64f32) - procedure a_op64_reg_reg(list : taasmoutput;op:TOpCG; size: tcgsize; regsrc,regdst : tregister64);override; - procedure a_op64_const_reg(list : taasmoutput;op:TOpCG; size: tcgsize; value : int64;regdst : tregister64);override; + procedure a_op64_reg_reg(list : TAsmList;op:TOpCG; size: tcgsize; regsrc,regdst : tregister64);override; + procedure a_op64_const_reg(list : TAsmList;op:TOpCG; size: tcgsize; value : int64;regdst : tregister64);override; end; { This function returns true if the reference+offset is valid. @@ -203,7 +203,7 @@ unit cgcpu; end; - function tcg68k.fixref(list: taasmoutput; var ref: treference): boolean; + function tcg68k.fixref(list: TAsmList; var ref: treference): boolean; begin result:=false; @@ -243,14 +243,14 @@ unit cgcpu; - procedure tcg68k.a_call_name(list : taasmoutput;const s : string); + procedure tcg68k.a_call_name(list : TAsmList;const s : string); begin - list.concat(taicpu.op_sym(A_JSR,S_NO,objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); + list.concat(taicpu.op_sym(A_JSR,S_NO,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); end; - procedure tcg68k.a_call_reg(list : taasmoutput;reg : tregister); + procedure tcg68k.a_call_reg(list : TAsmList;reg : tregister); var href : treference; begin @@ -260,7 +260,7 @@ unit cgcpu; - procedure tcg68k.a_load_const_reg(list : taasmoutput;size : tcgsize;a : aint;register : tregister); + procedure tcg68k.a_load_const_reg(list : TAsmList;size : tcgsize;a : aint;register : tregister); begin if getregtype(register)=R_ADDRESSREGISTER then begin @@ -279,7 +279,7 @@ unit cgcpu; end; - procedure tcg68k.a_load_reg_ref(list : taasmoutput;fromsize,tosize : tcgsize;register : tregister;const ref : treference); + procedure tcg68k.a_load_reg_ref(list : TAsmList;fromsize,tosize : tcgsize;register : tregister;const ref : treference); var href : treference; begin @@ -290,7 +290,7 @@ unit cgcpu; end; - procedure tcg68k.a_load_reg_reg(list : taasmoutput;fromsize,tosize : tcgsize;reg1,reg2 : tregister); + procedure tcg68k.a_load_reg_reg(list : TAsmList;fromsize,tosize : tcgsize;reg1,reg2 : tregister); begin { move to destination register } list.concat(taicpu.op_reg_reg(A_MOVE,S_L,reg1,reg2)); @@ -299,7 +299,7 @@ unit cgcpu; end; - procedure tcg68k.a_load_ref_reg(list : taasmoutput;fromsize,tosize : tcgsize;const ref : treference;register : tregister); + procedure tcg68k.a_load_ref_reg(list : TAsmList;fromsize,tosize : tcgsize;const ref : treference;register : tregister); var href : treference; begin @@ -311,7 +311,7 @@ unit cgcpu; end; - procedure tcg68k.a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister); + procedure tcg68k.a_loadaddr_ref_reg(list : TAsmList;const ref : treference;r : tregister); var href : treference; // p: pointer; @@ -329,7 +329,7 @@ unit cgcpu; end; - procedure tcg68k.a_loadfpu_reg_reg(list: taasmoutput; size: tcgsize; reg1, reg2: tregister); + procedure tcg68k.a_loadfpu_reg_reg(list: TAsmList; size: tcgsize; reg1, reg2: tregister); begin { in emulation mode, only 32-bit single is supported } if cs_fp_emulation in aktmoduleswitches then @@ -339,7 +339,7 @@ unit cgcpu; end; - procedure tcg68k.a_loadfpu_ref_reg(list: taasmoutput; size: tcgsize; const ref: treference; reg: tregister); + procedure tcg68k.a_loadfpu_ref_reg(list: TAsmList; size: tcgsize; const ref: treference; reg: tregister); var opsize : topsize; href : treference; @@ -357,7 +357,7 @@ unit cgcpu; list.concat(taicpu.op_ref_reg(A_FMOVE,opsize,href,reg)); end; - procedure tcg68k.a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: tregister; const ref: treference); + procedure tcg68k.a_loadfpu_reg_ref(list: TAsmList; size: tcgsize; reg: tregister; const ref: treference); var opsize : topsize; begin @@ -373,31 +373,31 @@ unit cgcpu; end; - procedure tcg68k.a_loadmm_reg_reg(list: taasmoutput;fromsize,tosize : tcgsize; reg1, reg2: tregister;shuffle : pmmshuffle); + procedure tcg68k.a_loadmm_reg_reg(list: TAsmList;fromsize,tosize : tcgsize; reg1, reg2: tregister;shuffle : pmmshuffle); begin internalerror(20020729); end; - procedure tcg68k.a_loadmm_ref_reg(list: taasmoutput;fromsize,tosize : tcgsize; const ref: treference; reg: tregister;shuffle : pmmshuffle); + procedure tcg68k.a_loadmm_ref_reg(list: TAsmList;fromsize,tosize : tcgsize; const ref: treference; reg: tregister;shuffle : pmmshuffle); begin internalerror(20020729); end; - procedure tcg68k.a_loadmm_reg_ref(list: taasmoutput;fromsize,tosize : tcgsize; reg: tregister; const ref: treference;shuffle : pmmshuffle); + procedure tcg68k.a_loadmm_reg_ref(list: TAsmList;fromsize,tosize : tcgsize; reg: tregister; const ref: treference;shuffle : pmmshuffle); begin internalerror(20020729); end; - procedure tcg68k.a_parammm_reg(list: taasmoutput; size: tcgsize; reg: tregister;const locpara : TCGPara;shuffle : pmmshuffle); + procedure tcg68k.a_parammm_reg(list: TAsmList; size: tcgsize; reg: tregister;const locpara : TCGPara;shuffle : pmmshuffle); begin internalerror(20020729); end; - procedure tcg68k.a_op_const_reg(list : taasmoutput; Op: TOpCG; size: tcgsize; a: aint; reg: TRegister); + procedure tcg68k.a_op_const_reg(list : TAsmList; Op: TOpCG; size: tcgsize; a: aint; reg: TRegister); var scratch_reg : tregister; scratch_reg2: tregister; @@ -543,7 +543,7 @@ unit cgcpu; end; - procedure tcg68k.a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; reg1, reg2: TRegister); + procedure tcg68k.a_op_reg_reg(list : TAsmList; Op: TOpCG; size: TCGSize; reg1, reg2: TRegister); var hreg1,hreg2,r,r2: tregister; begin @@ -711,7 +711,7 @@ unit cgcpu; register. } if reg1 <> NR_NO then - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,reg1,reg2); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,reg1,reg2); if (isaddressregister(reg2)) then begin @@ -745,7 +745,7 @@ unit cgcpu; - procedure tcg68k.a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; + procedure tcg68k.a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; l : tasmlabel); var hregister : tregister; @@ -778,14 +778,14 @@ unit cgcpu; a_jmp_cond(list,cmp_op,l); end; - procedure tcg68k.a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); + procedure tcg68k.a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); begin list.concat(taicpu.op_reg_reg(A_CMP,tcgsize2opsize[size],reg1,reg2)); { emit the actual jump to the label } a_jmp_cond(list,cmp_op,l); end; - procedure tcg68k.a_jmp_always(list : taasmoutput;l: tasmlabel); + procedure tcg68k.a_jmp_always(list : TAsmList;l: tasmlabel); var ai: taicpu; begin @@ -794,7 +794,7 @@ unit cgcpu; list.concat(ai); end; - procedure tcg68k.a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); + procedure tcg68k.a_jmp_flags(list : TAsmList;const f : TResFlags;l: tasmlabel); var ai : taicpu; begin @@ -804,7 +804,7 @@ unit cgcpu; list.concat(ai); end; - procedure tcg68k.g_flags2reg(list: taasmoutput; size: TCgSize; const f: tresflags; reg: TRegister); + procedure tcg68k.g_flags2reg(list: TAsmList; size: TCgSize; const f: tresflags; reg: TRegister); var ai : taicpu; hreg : tregister; @@ -858,7 +858,7 @@ unit cgcpu; - procedure tcg68k.g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint); + procedure tcg68k.g_concatcopy(list : TAsmList;const source,dest : treference;len : aint); var helpsize : longint; @@ -948,9 +948,9 @@ unit cgcpu; helpsize := len - len mod 4; len := len mod 4; list.concat(taicpu.op_const_reg(A_MOVE,S_L,helpsize div 4,hregister)); - objectlibrary.getjumplabel(hl2); + current_asmdata.getjumplabel(hl2); a_jmp_always(list,hl2); - objectlibrary.getjumplabel(hl); + current_asmdata.getjumplabel(hl); a_label(list,hl); list.concat(taicpu.op_ref_ref(A_MOVE,S_L,hp1,hp2)); a_label(list,hl2); @@ -968,9 +968,9 @@ unit cgcpu; { Fast 68010 loop mode with no possible alignment problems } helpsize := len; list.concat(taicpu.op_const_reg(A_MOVE,S_L,helpsize,hregister)); - objectlibrary.getjumplabel(hl2); + current_asmdata.getjumplabel(hl2); a_jmp_always(list,hl2); - objectlibrary.getjumplabel(hl); + current_asmdata.getjumplabel(hl); a_label(list,hl); list.concat(taicpu.op_ref_ref(A_MOVE,S_B,hp1,hp2)); a_label(list,hl2); @@ -990,16 +990,16 @@ unit cgcpu; // tg.ungetiftemp(list,source); end; - procedure tcg68k.g_overflowcheck(list: taasmoutput; const l:tlocation; def:tdef); + procedure tcg68k.g_overflowcheck(list: TAsmList; const l:tlocation; def:tdef); begin end; - procedure tcg68k.g_copyvaluepara_openarray(list : taasmoutput;const ref:treference;const lenloc:tlocation;elesize:aint;destreg:tregister); + procedure tcg68k.g_copyvaluepara_openarray(list : TAsmList;const ref:treference;const lenloc:tlocation;elesize:aint;destreg:tregister); begin end; - procedure tcg68k.g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean); + procedure tcg68k.g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean); var r,rsp:Tregister; ref : treference; @@ -1025,7 +1025,7 @@ unit cgcpu; end; -{ procedure tcg68k.g_restore_frame_pointer(list : taasmoutput); +{ procedure tcg68k.g_restore_frame_pointer(list : TAsmList); var r:Tregister; begin @@ -1034,7 +1034,7 @@ unit cgcpu; end; } - procedure tcg68k.g_proc_exit(list : taasmoutput;parasize:longint;nostackframe:boolean); + procedure tcg68k.g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean); var r,hregister : tregister; ref : treference; @@ -1092,7 +1092,7 @@ unit cgcpu; end; - procedure Tcg68k.g_save_standard_registers(list:Taasmoutput); + procedure Tcg68k.g_save_standard_registers(list:TAsmList); var tosave : tcpuregisterset; ref : treference; @@ -1109,7 +1109,7 @@ unit cgcpu; end; - procedure Tcg68k.g_restore_standard_registers(list:Taasmoutput); + procedure Tcg68k.g_restore_standard_registers(list:TAsmList); var torestore : tcpuregisterset; r:Tregister; @@ -1127,15 +1127,15 @@ unit cgcpu; end; { - procedure tcg68k.g_save_all_registers(list : taasmoutput); + procedure tcg68k.g_save_all_registers(list : TAsmList); begin end; - procedure tcg68k.g_restore_all_registers(list : taasmoutput;const funcretparaloc:TCGPara); + procedure tcg68k.g_restore_all_registers(list : TAsmList;const funcretparaloc:TCGPara); begin end; } - procedure tcg68k.sign_extend(list: taasmoutput;_oldsize : tcgsize; reg: tregister); + procedure tcg68k.sign_extend(list: TAsmList;_oldsize : tcgsize; reg: tregister); begin case _oldsize of { sign extend } @@ -1171,7 +1171,7 @@ unit cgcpu; end; { otherwise the size is already correct } end; - procedure tcg68k.a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel); + procedure tcg68k.a_jmp_cond(list : TAsmList;cond : TOpCmp;l: tasmlabel); var ai : taicpu; @@ -1189,7 +1189,7 @@ unit cgcpu; end; - procedure tcg68k.g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint); + procedure tcg68k.g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint); { procedure loadvmttor11; var @@ -1253,7 +1253,7 @@ unit cgcpu; end { case 0 } else -// list.concat(taicpu.op_sym(A_B,objectlibrary.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); +// list.concat(taicpu.op_sym(A_B,current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); List.concat(Tai_symbol_end.Createname(labelname)); end; @@ -1262,7 +1262,7 @@ unit cgcpu; {****************************************************************************} { TCG64F68K } {****************************************************************************} - procedure tcg64f68k.a_op64_reg_reg(list : taasmoutput;op:TOpCG;size: tcgsize; regsrc,regdst : tregister64); + procedure tcg64f68k.a_op64_reg_reg(list : TAsmList;op:TOpCG;size: tcgsize; regsrc,regdst : tregister64); var hreg1, hreg2 : tregister; opcode : tasmop; @@ -1325,7 +1325,7 @@ unit cgcpu; end; - procedure tcg64f68k.a_op64_const_reg(list : taasmoutput;op:TOpCG;size: tcgsize; value : int64;regdst : tregister64); + procedure tcg64f68k.a_op64_const_reg(list : TAsmList;op:TOpCG;size: tcgsize; value : int64;regdst : tregister64); var lowvalue : cardinal; highvalue : cardinal; diff --git a/compiler/m68k/n68kadd.pas b/compiler/m68k/n68kadd.pas index 609bd98b0c..08d625a79c 100644 --- a/compiler/m68k/n68kadd.pas +++ b/compiler/m68k/n68kadd.pas @@ -39,7 +39,7 @@ interface procedure second_cmpordinal;override; procedure second_cmpsmallset;override; procedure second_cmp64bit;override; - procedure second_cmpboolean;override; + procedure second_cmpboolean;override; end; @@ -51,7 +51,7 @@ implementation symconst,symdef,paramgr, aasmbase,aasmtai,aasmcpu,defutil,htypechk, cgbase,cpuinfo,pass_1,pass_2,regvars, - cpupara,cgutils, + cpupara,cgutils,procinfo, ncon,nset, ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32; @@ -140,8 +140,8 @@ implementation swapleftright; // put both operands in a register - location_force_fpureg(exprasmlist,right.location,true); - location_force_fpureg(exprasmlist,left.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,right.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); // initialize de result if not cmpop then @@ -152,7 +152,7 @@ implementation else if right.location.loc = LOC_FPUREGISTER then location.register := right.location.register else - location.register := cg.getfpuregister(exprasmlist,location.size); + location.register := cg.getfpuregister(current_asmdata.CurrAsmList,location.size); end else begin @@ -165,14 +165,14 @@ implementation if not cmpop then begin { - exprasmlist.concat(taicpu.op_reg_reg_reg(op, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op, location.register,left.location.register, right.location.register)) - } + } end else begin -{ exprasmlist.concat(taicpu.op_reg_reg_reg(op, +{ current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op, newreg(R_SPECIALREGISTER,location.resflags.cr,R_SUBNONE),left.location.register,right.location.register))} end; end; @@ -188,18 +188,18 @@ implementation } { force fpureg as location, left right doesn't matter as both will be in a fpureg } - location_force_fpureg(exprasmlist,left.location,true); - location_force_fpureg(exprasmlist,right.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,right.location,true); location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=getresflags(true); { if nodetype in [equaln,unequaln] then - exprasmlist.concat(setoppostfix(taicpu.op_reg_reg(A_CMF, + current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMF, left.location.register,right.location.register), cgsize2fpuoppostfix[def_cgsize(resulttype.def)])) else - exprasmlist.concat(setoppostfix(taicpu.op_reg_reg(A_CMFE, + current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_CMFE, left.location.register,right.location.register), cgsize2fpuoppostfix[def_cgsize(resulttype.def)])); @@ -235,12 +235,12 @@ implementation (nodetype = gten)) then swapleftright; // now we have to check whether left >= right - tmpreg := cg.getintregister(exprasmlist,OS_INT); + tmpreg := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); if left.location.loc = LOC_CONSTANT then begin - cg.a_op_const_reg_reg(exprasmlist,OP_AND,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_AND,OS_INT, not(left.location.value),right.location.register,tmpreg); - exprasmlist.concat(taicpu.op_reg(A_TST,S_L,tmpreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,S_L,tmpreg)); // the two instructions above should be folded together by // the peepholeoptimizer end @@ -248,16 +248,16 @@ implementation begin if right.location.loc = LOC_CONSTANT then begin - cg.a_load_const_reg(exprasmlist,OS_INT, + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT, aword(right.location.value),tmpreg); - exprasmlist.concat(taicpu.op_reg_reg(A_AND,S_L, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_AND,S_L, tmpreg,left.location.register)); end else - exprasmlist.concat(taicpu.op_reg_reg(A_AND,S_L, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_AND,S_L, right.location.register,left.location.register)); end; -// cg.ungetcpuregister(exprasmlist,tmpreg); +// cg.ungetcpuregister(current_asmdata.CurrAsmList,tmpreg); location.resflags := getresflags(true); end; else @@ -321,8 +321,8 @@ implementation else begin useconst := false; - tmpreg := cg.getintregister(exprasmlist,OS_INT); - cg.a_load_const_reg(exprasmlist,OS_INT, + tmpreg := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT, aword(right.location.value),tmpreg); end end @@ -333,16 +333,16 @@ implementation op := A_CMP; if (right.location.loc = LOC_CONSTANT) then if useconst then - exprasmlist.concat(taicpu.op_reg_const(op,S_L, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(op,S_L, left.location.register,longint(right.location.value))) else begin - exprasmlist.concat(taicpu.op_reg_reg(op,S_L, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,S_L, left.location.register,tmpreg)); -// cg.ungetcpuregister(exprasmlist,tmpreg); +// cg.ungetcpuregister(current_asmdata.CurrAsmList,tmpreg); end else - exprasmlist.concat(taicpu.op_reg_reg(op,S_L, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,S_L, left.location.register,right.location.register)); end; @@ -377,38 +377,38 @@ implementation isjump:=(left.location.loc=LOC_JUMP); if isjump then begin - otl:=truelabel; - objectlibrary.getjumplabel(truelabel); - ofl:=falselabel; - objectlibrary.getjumplabel(falselabel); + otl:=current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + ofl:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); end; secondpass(left); if left.location.loc in [LOC_FLAGS,LOC_JUMP] then begin // writeln('ajjaj'); - location_force_reg(exprasmlist,left.location,cgsize,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,cgsize,false); // writeln('reccs?'); - end; + end; if isjump then begin - truelabel:=otl; - falselabel:=ofl; + current_procinfo.CurrTrueLabel:=otl; + current_procinfo.CurrFalseLabel:=ofl; end; isjump:=(right.location.loc=LOC_JUMP); if isjump then begin - otl:=truelabel; - objectlibrary.getjumplabel(truelabel); - ofl:=falselabel; - objectlibrary.getjumplabel(falselabel); + otl:=current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + ofl:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); end; secondpass(right); if right.location.loc in [LOC_FLAGS,LOC_JUMP] then - location_force_reg(exprasmlist,right.location,cgsize,false); + location_force_reg(current_asmdata.CurrAsmList,right.location,cgsize,false); if isjump then begin - truelabel:=otl; - falselabel:=ofl; + current_procinfo.CurrTrueLabel:=otl; + current_procinfo.CurrFalseLabel:=ofl; end; location_reset(location,LOC_FLAGS,OS_NO); @@ -419,10 +419,10 @@ implementation swapleftright; if (right.location.loc <> LOC_CONSTANT) then - exprasmlist.concat(taicpu.op_reg_reg(A_CMP,S_L, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,S_L, left.location.register,right.location.register)) else - exprasmlist.concat(taicpu.op_const_reg(A_CMP,S_L, + current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_CMP,S_L, longint(right.location.value),left.location.register)); location.resflags := getresflags(true); end; @@ -439,10 +439,10 @@ implementation begin writeln('second_cmp64bit'); pass_left_right; - - + + // load_left_right(true,false); -(* +(* case nodetype of ltn,lten, gtn,gten: @@ -470,11 +470,11 @@ implementation else begin if (aword(right.location.valueqword) <> 0) then - tempreg64.reglo := cg.getintregister(exprasmlist) + tempreg64.reglo := cg.getintregister(current_asmdata.CurrAsmList) else tempreg64.reglo := left.location.register64.reglo; if ((right.location.valueqword shr 32) <> 0) then - tempreg64.reghi := cg.getintregister(exprasmlist) + tempreg64.reghi := cg.getintregister(current_asmdata.CurrAsmList) else tempreg64.reghi := left.location.register64.reghi; end; @@ -484,42 +484,42 @@ implementation { positive values < 65535 using XOR. } if (longint(right.location.valueqword) >= -32767) and (longint(right.location.valueqword) < 0) then - cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT, aword(right.location.valueqword), left.location.register64.reglo,tempreg64.reglo) else - cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_XOR,OS_INT, aword(right.location.valueqword), left.location.register64.reglo,tempreg64.reglo); if ((right.location.valueqword shr 32) <> 0) then if (longint(right.location.valueqword shr 32) >= -32767) and (longint(right.location.valueqword shr 32) < 0) then - cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT, aword(right.location.valueqword shr 32), left.location.register64.reghi,tempreg64.reghi) else - cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_XOR,OS_INT, aword(right.location.valueqword shr 32), left.location.register64.reghi,tempreg64.reghi); end else begin - tempreg64.reglo := cg.getintregister(exprasmlist); - tempreg64.reghi := cg.getintregister(exprasmlist); - cg64.a_op64_reg_reg_reg(exprasmlist,OP_XOR, + tempreg64.reglo := cg.getintregister(current_asmdata.CurrAsmList); + tempreg64.reghi := cg.getintregister(current_asmdata.CurrAsmList); + cg64.a_op64_reg_reg_reg(current_asmdata.CurrAsmList,OP_XOR, left.location.register64,right.location.register64, tempreg64); end; - cg.a_reg_alloc(exprasmlist,R_0); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_OR_,R_0, + cg.a_reg_alloc(current_asmdata.CurrAsmList,R_0); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_OR_,R_0, tempreg64.reglo,tempreg64.reghi)); - cg.a_reg_dealloc(exprasmlist,R_0); + cg.a_reg_dealloc(current_asmdata.CurrAsmList,R_0); if (tempreg64.reglo <> left.location.register64.reglo) then - cg.ungetregister(exprasmlist,tempreg64.reglo); + cg.ungetregister(current_asmdata.CurrAsmList,tempreg64.reglo); if (tempreg64.reghi <> left.location.register64.reghi) then - cg.ungetregister(exprasmlist,tempreg64.reghi); + cg.ungetregister(current_asmdata.CurrAsmList,tempreg64.reghi); location_reset(location,LOC_FLAGS,OS_NO); location.resflags := getresflags; diff --git a/compiler/m68k/n68kcal.pas b/compiler/m68k/n68kcal.pas index db85019ff6..ac854d0d90 100644 --- a/compiler/m68k/n68kcal.pas +++ b/compiler/m68k/n68kcal.pas @@ -57,7 +57,7 @@ implementation if po_syscall_legacy in tprocdef(procdefinition).procoptions then begin reference_reset_base(tmpref,NR_A6,-tprocdef(procdefinition).extnumber); - exprasmlist.concat(taicpu.op_ref_reg(A_JSR,S_NO,tmpref,NR_NO)); + current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(A_JSR,S_NO,tmpref,NR_NO)); end else internalerror(2005010403); diff --git a/compiler/m68k/n68kcnv.pas b/compiler/m68k/n68kcnv.pas index fc0b0d02ae..4a2af212c4 100644 --- a/compiler/m68k/n68kcnv.pas +++ b/compiler/m68k/n68kcnv.pas @@ -134,17 +134,17 @@ implementation if not signed then internalerror(20020814); - location.register:=cg.getfpuregister(exprasmlist,opsize); + location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,opsize); case left.location.loc of LOC_REGISTER, LOC_CREGISTER: begin leftreg := left.location.register; - exprasmlist.concat(taicpu.op_reg_reg(A_FMOVE,TCGSize2OpSize[opsize],leftreg, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FMOVE,TCGSize2OpSize[opsize],leftreg, location.register)); end; LOC_REFERENCE,LOC_CREFERENCE: begin - exprasmlist.concat(taicpu.op_ref_reg(A_FMOVE,TCGSize2OpSize[opsize], + current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(A_FMOVE,TCGSize2OpSize[opsize], left.location.reference,location.register)); end else @@ -178,38 +178,38 @@ implementation { can we optimize it, or do we need to fix the ref. ? } if isvalidrefoffset(left.location.reference) then begin - exprasmlist.concat(taicpu.op_ref(A_TST,TCGSize2OpSize[opsize], + current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_TST,TCGSize2OpSize[opsize], left.location.reference)); end else begin - hreg2:=cg.getintregister(exprasmlist,opsize); - cg.a_load_ref_reg(exprasmlist,opsize,opsize, + hreg2:=cg.getintregister(current_asmdata.CurrAsmList,opsize); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,opsize,opsize, left.location.reference,hreg2); - exprasmlist.concat(taicpu.op_reg(A_TST,TCGSize2OpSize[opsize],hreg2)); -// cg.ungetcpuregister(exprasmlist,hreg2); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,TCGSize2OpSize[opsize],hreg2)); +// cg.ungetcpuregister(current_asmdata.CurrAsmList,hreg2); end; -// reference_release(exprasmlist,left.location.reference); +// reference_release(current_asmdata.CurrAsmList,left.location.reference); resflags:=F_NE; - hreg1:=cg.getintregister(exprasmlist,opsize); + hreg1:=cg.getintregister(current_asmdata.CurrAsmList,opsize); end; LOC_REGISTER,LOC_CREGISTER : begin hreg2:=left.location.register; - exprasmlist.concat(taicpu.op_reg(A_TST,TCGSize2OpSize[opsize],hreg2)); -// cg.ungetcpuregister(exprasmlist,hreg2); - hreg1:=cg.getintregister(exprasmlist,opsize); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,TCGSize2OpSize[opsize],hreg2)); +// cg.ungetcpuregister(current_asmdata.CurrAsmList,hreg2); + hreg1:=cg.getintregister(current_asmdata.CurrAsmList,opsize); resflags:=F_NE; end; LOC_FLAGS : begin - hreg1:=cg.getintregister(exprasmlist,opsize); + hreg1:=cg.getintregister(current_asmdata.CurrAsmList,opsize); resflags:=left.location.resflags; end; else internalerror(200512182); end; - cg.g_flags2reg(exprasmlist,location.size,resflags,hreg1); + cg.g_flags2reg(current_asmdata.CurrAsmList,location.size,resflags,hreg1); location.register := hreg1; end; diff --git a/compiler/m68k/n68kmat.pas b/compiler/m68k/n68kmat.pas index 957bf80d1f..fd7dad1bac 100644 --- a/compiler/m68k/n68kmat.pas +++ b/compiler/m68k/n68kmat.pas @@ -53,7 +53,7 @@ implementation globtype,systems, cutils,verbose,globals, symconst,symdef,aasmbase,aasmtai,aasmcpu, - pass_1,pass_2, + pass_1,pass_2,procinfo, ncon, cpuinfo,paramgr,defutil,parabase, tgobj,ncgutil,cgobj,cgutils,rgobj,rgcpu,cgcpu,cg64f32; @@ -83,19 +83,19 @@ implementation LOC_JUMP : begin location_reset(location,LOC_JUMP,OS_NO); - hl:=truelabel; - truelabel:=falselabel; - falselabel:=hl; + hl:=current_procinfo.CurrTrueLabel; + current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel; + current_procinfo.CurrFalseLabel:=hl; secondpass(left); - maketojumpbool(exprasmlist,left,lr_load_regvars); - hl:=truelabel; - truelabel:=falselabel; - falselabel:=hl; + maketojumpbool(current_asmdata.CurrAsmList,left,lr_load_regvars); + hl:=current_procinfo.CurrTrueLabel; + current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel; + current_procinfo.CurrFalseLabel:=hl; end; LOC_FLAGS : begin location_copy(location,left.location); -// location_release(exprasmlist,left.location); +// location_release(current_asmdata.CurrAsmList,left.location); inverse_flags(location.resflags); end; LOC_CONSTANT, @@ -104,9 +104,9 @@ implementation LOC_REFERENCE, LOC_CREFERENCE : begin - location_force_reg(exprasmlist,left.location,def_cgsize(resulttype.def),true); - exprasmlist.concat(taicpu.op_reg(A_TST,tcgsize2opsize[opsize],left.location.register)); -// location_release(exprasmlist,left.location); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(resulttype.def),true); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,tcgsize2opsize[opsize],left.location.register)); +// location_release(current_asmdata.CurrAsmList,left.location); location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=F_E; end; @@ -118,19 +118,19 @@ implementation begin secondpass(left); location_copy(location,left.location); - location_force_reg(exprasmlist,location,OS_64,false); - cg64.a_op64_loc_reg(exprasmlist,OP_NOT,OS_64,location, + location_force_reg(current_asmdata.CurrAsmList,location,OS_64,false); + cg64.a_op64_loc_reg(current_asmdata.CurrAsmList,OP_NOT,OS_64,location, joinreg64(location.register64.reglo,location.register64.reghi)); end else begin secondpass(left); - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),false); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),false); location_copy(location,left.location); if location.loc=LOC_CREGISTER then - location.register := cg.getintregister(exprasmlist,opsize); + location.register := cg.getintregister(current_asmdata.CurrAsmList,opsize); { perform the NOT operation } - cg.a_op_reg_reg(exprasmlist,OP_NOT,opsize,location.register,left.location.register); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,opsize,location.register,left.location.register); end; end; @@ -148,39 +148,39 @@ implementation if aktcputype <> cpu_MC68000 then begin { verify if denominator is zero } - objectlibrary.getjumplabel(continuelabel); + current_asmdata.getjumplabel(continuelabel); { compare against zero, if not zero continue } - cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_NE,0,denum,continuelabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_S32,OC_NE,0,denum,continuelabel); // paraloc1.init; -// cg.a_param_const(exprasmlist,OS_S32,200,paramanager.getintparaloc(pocall_default,1,paraloc1)); +// cg.a_param_const(current_asmdata.CurrAsmList,OS_S32,200,paramanager.getintparaloc(pocall_default,1,paraloc1)); - cg.a_call_name(exprasmlist,'FPC_HANDLEERROR'); - cg.a_label(exprasmlist, continuelabel); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_HANDLEERROR'); + cg.a_label(current_asmdata.CurrAsmList, continuelabel); if signed then - exprasmlist.concat(taicpu.op_reg_reg(A_DIVS,S_L,denum,num)) + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_DIVS,S_L,denum,num)) else - exprasmlist.concat(taicpu.op_reg_reg(A_DIVU,S_L,denum,num)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_DIVU,S_L,denum,num)); { result should be in denuminator } - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,num,denum); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,num,denum); end else begin { On MC68000/68010 mw must pass through RTL routines } reg_d0:=NR_D0; - cg.getcpuregister(exprasmlist,NR_D0); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_D0); reg_d1:=NR_D1; - cg.getcpuregister(exprasmlist,NR_D1); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_D1); { put numerator in d0 } - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,num,reg_d0); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,num,reg_d0); { put denum in D1 } - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,denum,reg_d1); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,denum,reg_d1); if signed then - cg.a_call_name(exprasmlist,'FPC_DIV_LONGINT') + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DIV_LONGINT') else - cg.a_call_name(exprasmlist,'FPC_DIV_CARDINAL'); - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,reg_d0,denum); - cg.ungetcpuregister(exprasmlist,reg_d0); - cg.ungetcpuregister(exprasmlist,reg_d1); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DIV_CARDINAL'); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,reg_d0,denum); + cg.ungetcpuregister(current_asmdata.CurrAsmList,reg_d0); + cg.ungetcpuregister(current_asmdata.CurrAsmList,reg_d1); end; end; @@ -196,54 +196,54 @@ implementation if aktcputype <> cpu_MC68000 then begin { verify if denominator is zero } - objectlibrary.getjumplabel(continuelabel); + current_asmdata.getjumplabel(continuelabel); { compare against zero, if not zero continue } - cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_NE,0,denum,continuelabel); -// cg.a_param_const(exprasmlist, OS_S32,200,paramanager.getintparaloc(pocall_default,1)); - cg.a_call_name(exprasmlist,'FPC_HANDLEERROR'); - cg.a_label(exprasmlist, continuelabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_S32,OC_NE,0,denum,continuelabel); +// cg.a_param_const(current_asmdata.CurrAsmList, OS_S32,200,paramanager.getintparaloc(pocall_default,1)); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_HANDLEERROR'); + cg.a_label(current_asmdata.CurrAsmList, continuelabel); - tmpreg:=cg.getintregister(exprasmlist,OS_INT); + tmpreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); { we have to prepare the high register with the } { correct sign. i.e we clear it, check if the low dword reg } { which will participate in the division is signed, if so we} { we extend the sign to the high doword register by inverting } { all the bits. } - exprasmlist.concat(taicpu.op_reg(A_CLR,S_L,tmpreg)); - objectlibrary.getjumplabel(signlabel); - exprasmlist.concat(taicpu.op_reg(A_TST,S_L,tmpreg)); - cg.a_cmp_const_reg_label(exprasmlist,OS_S32,OC_A,0,tmpreg,signlabel); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_CLR,S_L,tmpreg)); + current_asmdata.getjumplabel(signlabel); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_TST,S_L,tmpreg)); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_S32,OC_A,0,tmpreg,signlabel); { its a negative value, therefore change sign } - cg.a_label(exprasmlist,signlabel); + cg.a_label(current_asmdata.CurrAsmList,signlabel); { tmpreg:num / denum } if signed then - exprasmlist.concat(taicpu.op_reg_reg_reg(A_DIVSL,S_L,denum,tmpreg,num)) + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_DIVSL,S_L,denum,tmpreg,num)) else - exprasmlist.concat(taicpu.op_reg_reg_reg(A_DIVUL,S_L,denum,tmpreg,num)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_DIVUL,S_L,denum,tmpreg,num)); { remainder in tmpreg } - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,tmpreg,denum); -// cg.ungetcpuregister(exprasmlist,tmpreg); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,tmpreg,denum); +// cg.ungetcpuregister(current_asmdata.CurrAsmList,tmpreg); end else begin { On MC68000/68010 mw must pass through RTL routines } Reg_d0:=NR_D0; - cg.getcpuregister(exprasmlist,NR_D0); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_D0); Reg_d1:=NR_D1; - cg.getcpuregister(exprasmlist,NR_D1); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_D1); { put numerator in d0 } - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,num,Reg_D0); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,num,Reg_D0); { put denum in D1 } - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,denum,Reg_D1); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,denum,Reg_D1); if signed then - cg.a_call_name(exprasmlist,'FPC_MOD_LONGINT') + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_MOD_LONGINT') else - cg.a_call_name(exprasmlist,'FPC_MOD_CARDINAL'); - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,Reg_D0,denum); - cg.ungetcpuregister(exprasmlist,Reg_D0); - cg.ungetcpuregister(exprasmlist,Reg_D1); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_MOD_CARDINAL'); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,Reg_D0,denum); + cg.ungetcpuregister(current_asmdata.CurrAsmList,Reg_D0); + cg.ungetcpuregister(current_asmdata.CurrAsmList,Reg_D1); end; // writeln('exits'); end; @@ -275,7 +275,7 @@ implementation location_reset(location,LOC_REGISTER,OS_64); { load left operator in a register } - location_force_reg(exprasmlist,left.location,OS_64,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,OS_64,false); hreg64hi:=left.location.register64.reghi; hreg64lo:=left.location.register64.reglo; @@ -284,35 +284,35 @@ implementation begin if nodetype = shln then begin - cg.a_load_const_reg(exprasmlist,OS_32,0,hreg64hi); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_32,0,hreg64hi); if (shiftval and 31) <> 0 then - cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,shiftval and 31,hreg64lo,hreg64lo); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_32,shiftval and 31,hreg64lo,hreg64lo); end else begin - cg.a_load_const_reg(exprasmlist,OS_32,0,hreg64lo); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_32,0,hreg64lo); if (shiftval and 31) <> 0 then - cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,shiftval and 31,hreg64hi,hreg64hi); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHR,OS_32,shiftval and 31,hreg64hi,hreg64hi); end; location.register64.reglo:=hreg64hi; location.register64.reghi:=hreg64lo; end else begin - hregister:=cg.getintregister(exprasmlist,OS_32); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); if nodetype = shln then begin - cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,32-shiftval,hreg64lo,hregister); - cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,shiftval,hreg64hi,hreg64hi); - cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,hregister,hreg64hi,hreg64hi); - cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,shiftval,hreg64lo,hreg64lo); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHR,OS_32,32-shiftval,hreg64lo,hregister); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_32,shiftval,hreg64hi,hreg64hi); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,hregister,hreg64hi,hreg64hi); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_32,shiftval,hreg64lo,hreg64lo); end else begin - cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,32-shiftval,hreg64hi,hregister); - cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,shiftval,hreg64lo,hreg64lo); - cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,hregister,hreg64lo,hreg64lo); - cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,shiftval,hreg64hi,hreg64hi); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_32,32-shiftval,hreg64hi,hregister); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHR,OS_32,shiftval,hreg64lo,hreg64lo); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,hregister,hreg64lo,hreg64lo); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHR,OS_32,shiftval,hreg64hi,hreg64hi); end; location.register64.reghi:=hreg64hi; location.register64.reglo:=hreg64lo; @@ -321,14 +321,14 @@ implementation else begin { load left operators in a register } - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),true); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true); location_copy(location,left.location); resultreg := location.register; hregister1 := location.register; if (location.loc = LOC_CREGISTER) then begin location.loc := LOC_REGISTER; - resultreg := cg.GetIntRegister(exprasmlist,OS_INT); + resultreg := cg.GetIntRegister(current_asmdata.CurrAsmList,OS_INT); location.register := resultreg; end; { determine operator } @@ -340,13 +340,13 @@ implementation if (right.nodetype=ordconstn) then begin if tordconstnode(right).value and 31<>0 then - cg.a_op_const_reg_reg(exprasmlist,op,OS_32,tordconstnode(right).value and 31,hregister1,resultreg) + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,op,OS_32,tordconstnode(right).value and 31,hregister1,resultreg) end else begin { load shift count in a register if necessary } - location_force_reg(exprasmlist,right.location,def_cgsize(right.resulttype.def),true); - cg.a_op_reg_reg_reg(exprasmlist,op,OS_32,right.location.register,hregister1,resultreg); + location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(right.resulttype.def),true); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,op,OS_32,right.location.register,hregister1,resultreg); end; end; end; diff --git a/compiler/m68k/ra68k.pas b/compiler/m68k/ra68k.pas index 8f7779e93c..006489429d 100644 --- a/compiler/m68k/ra68k.pas +++ b/compiler/m68k/ra68k.pas @@ -35,8 +35,8 @@ unit ra68k; Tm68kInstruction=class(TInstruction) opsize : topsize; -// function ConcatInstruction(p : taasmoutput):tai;override; - function ConcatLabeledInstr(p : taasmoutput):tai; +// function ConcatInstruction(p : TAsmList):tai;override; + function ConcatLabeledInstr(p : TAsmList):tai; end; implementation @@ -49,7 +49,7 @@ unit ra68k; *****************************************************************************} { - function TM68kInstruction.ConcatInstruction(p : taasmoutput):tai; + function TM68kInstruction.ConcatInstruction(p : TAsmList):tai; var fits : boolean; begin @@ -321,7 +321,7 @@ unit ra68k; end; } - function TM68kInstruction.ConcatLabeledInstr(p : taasmoutput):tai; + function TM68kInstruction.ConcatLabeledInstr(p : TAsmList):tai; begin if ((opcode >= A_BCC) and (opcode <= A_BVS)) or (opcode = A_BRA) or (opcode = A_BSR) or diff --git a/compiler/m68k/ra68kmot.pas b/compiler/m68k/ra68kmot.pas index 652119fed3..1384c5ac5b 100644 --- a/compiler/m68k/ra68kmot.pas +++ b/compiler/m68k/ra68kmot.pas @@ -1311,7 +1311,7 @@ const l:=oper.opr.val; oper.opr.typ := OPR_SYMBOL; oper.opr.symofs := l; - oper.opr.symbol := objectlibrary.newasmsymbol(tempstr,AB_EXTERNAL,AT_FUNCTION); + oper.opr.symbol := current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,AT_FUNCTION); end; end; { // Constant memory offset . // } @@ -1713,7 +1713,7 @@ const SetupTables; _asmsorted := TRUE; end; - curlist:=TAAsmoutput.Create; + curlist:=TAsmList.Create; { setup label linked list } LocalLabelList:=TLocalLabelList.Create; c:=current_scanner.asmgetchar; diff --git a/compiler/nbas.pas b/compiler/nbas.pas index 9986db9839..2f45fd61d2 100644 --- a/compiler/nbas.pas +++ b/compiler/nbas.pas @@ -49,12 +49,12 @@ interface terrornodeclass = class of terrornode; tasmnode = class(tnode) - p_asm : taasmoutput; + p_asm : TAsmList; currenttai : tai; { Used registers in assembler block } used_regs_int, used_regs_fpu : tcpuregisterset; - constructor create(p : taasmoutput);virtual; + constructor create(p : TAsmList);virtual; constructor create_get_position; destructor destroy;override; constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override; @@ -475,7 +475,7 @@ implementation TASMNODE *****************************************************************************} - constructor tasmnode.create(p : taasmoutput); + constructor tasmnode.create(p : TAsmList); begin inherited create(asmn); p_asm:=p; @@ -509,7 +509,7 @@ implementation inherited ppuload(t,ppufile); if not(nf_get_asm_position in flags) then begin - p_asm:=taasmoutput.create; + p_asm:=TAsmList.create; repeat hp:=ppuloadai(ppufile); if hp=nil then @@ -584,7 +584,7 @@ implementation n := tasmnode(inherited _getcopy); if assigned(p_asm) then begin - n.p_asm:=taasmoutput.create; + n.p_asm:=TAsmList.create; n.p_asm.concatlistcopy(p_asm); end else n.p_asm := nil; diff --git a/compiler/ncgadd.pas b/compiler/ncgadd.pas index f85f03cbd2..131b7b213d 100644 --- a/compiler/ncgadd.pas +++ b/compiler/ncgadd.pas @@ -72,7 +72,7 @@ interface cutils,verbose,globals, symconst,symdef,paramgr, aasmbase,aasmtai,defutil, - cgbase,pass_2, + cgbase,procinfo,pass_2, ncon,nset,ncgutil,cgobj,cgutils ; @@ -98,45 +98,45 @@ interface isjump:=(left.expectloc=LOC_JUMP); if isjump then begin - otl:=truelabel; - objectlibrary.getjumplabel(truelabel); - ofl:=falselabel; - objectlibrary.getjumplabel(falselabel); + otl:=current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + ofl:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); end; secondpass(left); if left.location.loc in [LOC_FLAGS,LOC_JUMP] then - location_force_reg(exprasmlist,left.location,def_cgsize(resulttype.def),false); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(resulttype.def),false); if isjump then begin - truelabel:=otl; - falselabel:=ofl; + current_procinfo.CurrTrueLabel:=otl; + current_procinfo.CurrFalseLabel:=ofl; end; { are too few registers free? } if left.location.loc=LOC_FPUREGISTER then - pushedfpu:=maybe_pushfpu(exprasmlist,right.registersfpu,left.location) + pushedfpu:=maybe_pushfpu(current_asmdata.CurrAsmList,right.registersfpu,left.location) else pushedfpu:=false; isjump:=(right.expectloc=LOC_JUMP); if isjump then begin - otl:=truelabel; - objectlibrary.getjumplabel(truelabel); - ofl:=falselabel; - objectlibrary.getjumplabel(falselabel); + otl:=current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + ofl:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); end; secondpass(right); if right.location.loc in [LOC_FLAGS,LOC_JUMP] then - location_force_reg(exprasmlist,right.location,def_cgsize(resulttype.def),false); + location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(resulttype.def),false); if isjump then begin - truelabel:=otl; - falselabel:=ofl; + current_procinfo.CurrTrueLabel:=otl; + current_procinfo.CurrFalseLabel:=ofl; end; if pushedfpu then begin - tmpreg := cg.getfpuregister(exprasmlist,left.location.size); - cg.a_loadfpu_loc_reg(exprasmlist,left.location,tmpreg); + tmpreg := cg.getfpuregister(current_asmdata.CurrAsmList,left.location.size); + cg.a_loadfpu_loc_reg(current_asmdata.CurrAsmList,left.location,tmpreg); location_reset(left.location,LOC_FPUREGISTER,left.location.size); left.location.register := tmpreg; {$ifdef x86} @@ -186,12 +186,12 @@ interface {$ifndef cpu64bit} if location.size in [OS_64,OS_S64] then begin - location.register64.reglo := cg.getintregister(exprasmlist,OS_INT); - location.register64.reghi := cg.getintregister(exprasmlist,OS_INT); + location.register64.reglo := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + location.register64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); end else {$endif} - location.register := cg.getintregister(exprasmlist,location.size); + location.register := cg.getintregister(current_asmdata.CurrAsmList,location.size); end; end; @@ -203,14 +203,14 @@ interface allow_constant and (left.location.loc in [LOC_CONSTANT,LOC_CREGISTER]) ) then - location_force_reg(exprasmlist,left.location,left.location.size,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,left.location.size,false); if (right.location.loc<>LOC_REGISTER) and not( allow_constant and (right.location.loc in [LOC_CONSTANT,LOC_CREGISTER]) and (left.location.loc<>LOC_CONSTANT) ) then - location_force_reg(exprasmlist,right.location,right.location.size,false); + location_force_reg(current_asmdata.CurrAsmList,right.location,right.location.size,false); { Left is always a register, right can be register or constant } if left.location.loc=LOC_CONSTANT then @@ -264,7 +264,7 @@ interface swapleftright; if (right.nodetype=setelementn) and (left.location.loc<>LOC_REGISTER) then - location_force_reg(exprasmlist,left.location,left.location.size,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,left.location.size,false); set_result_location_reg; @@ -278,20 +278,20 @@ interface if assigned(tsetelementnode(right).right) then internalerror(43244); if (right.location.loc = LOC_CONSTANT) then - cg.a_op_const_reg_reg(exprasmlist,OP_OR,location.size, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_OR,location.size, aint(1 shl right.location.value), left.location.register,location.register) else begin - tmpreg := cg.getintregister(exprasmlist,location.size); - cg.a_load_const_reg(exprasmlist,location.size,1,tmpreg); - cg.a_op_reg_reg(exprasmlist,OP_SHL,location.size, + tmpreg := cg.getintregister(current_asmdata.CurrAsmList,location.size); + cg.a_load_const_reg(current_asmdata.CurrAsmList,location.size,1,tmpreg); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_SHL,location.size, right.location.register,tmpreg); if left.location.loc <> LOC_CONSTANT then - cg.a_op_reg_reg_reg(exprasmlist,OP_OR,location.size,tmpreg, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,location.size,tmpreg, left.location.register,location.register) else - cg.a_op_const_reg_reg(exprasmlist,OP_OR,location.size, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_OR,location.size, left.location.value,tmpreg,location.register); end; opdone := true; @@ -322,18 +322,18 @@ interface begin if left.location.loc = LOC_CONSTANT then begin - tmpreg := cg.getintregister(exprasmlist,location.size); - cg.a_load_const_reg(exprasmlist,location.size, + tmpreg := cg.getintregister(current_asmdata.CurrAsmList,location.size); + cg.a_load_const_reg(current_asmdata.CurrAsmList,location.size, left.location.value,tmpreg); - cg.a_op_reg_reg(exprasmlist,OP_NOT,location.size,right.location.register,right.location.register); - cg.a_op_reg_reg(exprasmlist,OP_AND,location.size,right.location.register,tmpreg); - cg.a_load_reg_reg(exprasmlist,OS_INT,location.size,tmpreg,location.register); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,location.size,right.location.register,right.location.register); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_AND,location.size,right.location.register,tmpreg); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,location.size,tmpreg,location.register); end else begin - cg.a_op_reg_reg(exprasmlist,OP_NOT,right.location.size,right.location.register,right.location.register); - cg.a_op_reg_reg(exprasmlist,OP_AND,left.location.size,right.location.register,left.location.register); - cg.a_load_reg_reg(exprasmlist,left.location.size,location.size,left.location.register,location.register); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,right.location.size,right.location.register,right.location.register); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_AND,left.location.size,right.location.register,left.location.register); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,left.location.size,location.size,left.location.register,location.register); end; end; end; @@ -347,11 +347,11 @@ interface if (left.location.loc = LOC_CONSTANT) then swapleftright; if (right.location.loc = LOC_CONSTANT) then - cg.a_op_const_reg_reg(exprasmlist,cgop,location.size, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,cgop,location.size, right.location.value,left.location.register, location.register) else - cg.a_op_reg_reg_reg(exprasmlist,cgop,location.size, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,cgop,location.size, right.location.register,left.location.register, location.register); end; @@ -385,27 +385,27 @@ interface case nodetype of andn : begin - otl:=truelabel; - objectlibrary.getjumplabel(truelabel); + otl:=current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); secondpass(left); - maketojumpbool(exprasmlist,left,lr_load_regvars); - cg.a_label(exprasmlist,truelabel); - truelabel:=otl; + maketojumpbool(current_asmdata.CurrAsmList,left,lr_load_regvars); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); + current_procinfo.CurrTrueLabel:=otl; end; orn : begin - ofl:=falselabel; - objectlibrary.getjumplabel(falselabel); + ofl:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); secondpass(left); - maketojumpbool(exprasmlist,left,lr_load_regvars); - cg.a_label(exprasmlist,falselabel); - falselabel:=ofl; + maketojumpbool(current_asmdata.CurrAsmList,left,lr_load_regvars); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); + current_procinfo.CurrFalseLabel:=ofl; end; else internalerror(200307044); end; secondpass(right); - maketojumpbool(exprasmlist,right,lr_load_regvars); + maketojumpbool(current_asmdata.CurrAsmList,right,lr_load_regvars); end else begin @@ -425,11 +425,11 @@ interface end; if right.location.loc <> LOC_CONSTANT then - cg.a_op_reg_reg_reg(exprasmlist,cgop,location.size, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,cgop,location.size, left.location.register,right.location.register, location.register) else - cg.a_op_const_reg_reg(exprasmlist,cgop,location.size, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,cgop,location.size, right.location.value,left.location.register, location.register); end; @@ -496,10 +496,10 @@ interface xorn,orn,andn,addn: begin if (right.location.loc = LOC_CONSTANT) then - cg.a_op_const_reg_reg(exprasmlist,op,location.size,right.location.value, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,op,location.size,right.location.value, left.location.register,location.register) else - cg.a_op_reg_reg_reg(exprasmlist,op,location.size,right.location.register, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,op,location.size,right.location.register, left.location.register,location.register); end; subn: @@ -511,20 +511,20 @@ interface begin if right.location.loc <> LOC_CONSTANT then // reg64 - reg64 - cg.a_op_reg_reg_reg_checkoverflow(exprasmlist,OP_SUB,location.size, + cg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.register,left.location.register,location.register, checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc) else // reg64 - const64 - cg.a_op_const_reg_reg_checkoverflow(exprasmlist,OP_SUB,location.size, + cg.a_op_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.value,left.location.register,location.register, checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); end else begin // const64 - reg64 - location_force_reg(exprasmlist,left.location,left.location.size,true); - cg.a_op_reg_reg_reg_checkoverflow(exprasmlist,OP_SUB,location.size, + location_force_reg(current_asmdata.CurrAsmList,left.location,left.location.size,true); + cg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.register,left.location.register,location.register, checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); end; @@ -537,11 +537,11 @@ interface xorn,orn,andn,addn: begin if (right.location.loc = LOC_CONSTANT) then - cg64.a_op64_const_reg_reg_checkoverflow(exprasmlist,op,location.size,right.location.value64, + cg64.a_op64_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,op,location.size,right.location.value64, left.location.register64,location.register64, checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc) else - cg64.a_op64_reg_reg_reg_checkoverflow(exprasmlist,op,location.size,right.location.register64, + cg64.a_op64_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,op,location.size,right.location.register64, left.location.register64,location.register64, checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); end; @@ -554,13 +554,13 @@ interface begin if right.location.loc <> LOC_CONSTANT then // reg64 - reg64 - cg64.a_op64_reg_reg_reg_checkoverflow(exprasmlist,OP_SUB,location.size, + cg64.a_op64_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.register64,left.location.register64, location.register64, checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc) else // reg64 - const64 - cg64.a_op64_const_reg_reg_checkoverflow(exprasmlist,OP_SUB,location.size, + cg64.a_op64_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.value64,left.location.register64, location.register64, checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc) @@ -568,8 +568,8 @@ interface else begin // const64 - reg64 - location_force_reg(exprasmlist,left.location,left.location.size,true); - cg64.a_op64_reg_reg_reg_checkoverflow(exprasmlist,OP_SUB,location.size, + location_force_reg(current_asmdata.CurrAsmList,left.location,left.location.size,true); + cg64.a_op64_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.register64,left.location.register64, location.register64, checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); @@ -582,7 +582,7 @@ interface { emit overflow check if enabled } if checkoverflow then - cg.g_overflowcheck_loc(exprasmlist,Location,ResultType.Def,ovloc); + cg.g_overflowcheck_loc(current_asmdata.CurrAsmList,Location,ResultType.Def,ovloc); end; @@ -681,11 +681,11 @@ interface if nodetype<>subn then begin if (right.location.loc >LOC_CONSTANT) then - cg.a_op_reg_reg_reg_checkoverflow(exprasmlist,cgop,location.size, + cg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,cgop,location.size, left.location.register,right.location.register, location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc) else - cg.a_op_const_reg_reg_checkoverflow(exprasmlist,cgop,location.size, + cg.a_op_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,cgop,location.size, right.location.value,left.location.register, location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); end @@ -696,27 +696,27 @@ interface if left.location.loc<>LOC_CONSTANT then begin if right.location.loc<>LOC_CONSTANT then - cg.a_op_reg_reg_reg_checkoverflow(exprasmlist,OP_SUB,location.size, + cg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.register,left.location.register, location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc) else - cg.a_op_const_reg_reg_checkoverflow(exprasmlist,OP_SUB,location.size, + cg.a_op_const_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, aword(right.location.value),left.location.register, location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); end else begin - tmpreg:=cg.getintregister(exprasmlist,location.size); - cg.a_load_const_reg(exprasmlist,location.size, + tmpreg:=cg.getintregister(current_asmdata.CurrAsmList,location.size); + cg.a_load_const_reg(current_asmdata.CurrAsmList,location.size, aword(left.location.value),tmpreg); - cg.a_op_reg_reg_reg_checkoverflow(exprasmlist,OP_SUB,location.size, + cg.a_op_reg_reg_reg_checkoverflow(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.register,tmpreg,location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc); end; end; { emit overflow check if required } if checkoverflow then - cg.g_overflowcheck_loc(exprasmlist,Location,ResultType.Def,ovloc); + cg.g_overflowcheck_loc(current_asmdata.CurrAsmList,Location,ResultType.Def,ovloc); end; diff --git a/compiler/ncgbas.pas b/compiler/ncgbas.pas index 2544aa3a7e..5252fa7136 100644 --- a/compiler/ncgbas.pas +++ b/compiler/ncgbas.pas @@ -125,7 +125,7 @@ interface (p is tasmlabel) then begin if not assigned(p.altsymbol) then - objectlibrary.GenerateAltSymbol(p); + current_asmdata.GenerateAltSymbol(p); p:=p.altsymbol; p.increfs; end; @@ -217,13 +217,13 @@ interface if (nf_get_asm_position in flags) then begin { Add a marker, to be sure the list is not empty } - exprasmlist.concat(tai_marker.create(marker_position)); - currenttai:=tai(exprasmlist.last); + current_asmdata.CurrAsmList.concat(tai_marker.create(mark_Position)); + currenttai:=tai(current_asmdata.CurrAsmList.last); exit; end; { Allocate registers used in the assembler block } - cg.alloccpuregisters(exprasmlist,R_INTREGISTER,used_regs_int); + cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,used_regs_int); if (po_inline in current_procinfo.procdef.procoptions) then begin @@ -272,18 +272,18 @@ interface ait_marker : begin { it's not an assembler block anymore } - if (tai_marker(hp2).kind in [AsmBlockStart, AsmBlockEnd]) then + if (tai_marker(hp2).kind in [mark_AsmBlockStart, mark_AsmBlockEnd]) then skipnode:=true; end; end; if not skipnode then - exprasmList.concat(hp2) + current_asmdata.CurrAsmList.concat(hp2) else hp2.free; hp:=tai(hp.next); end; { restore used symbols } - objectlibrary.ResetAltSymbols; + current_asmdata.ResetAltSymbols; end else begin @@ -308,11 +308,11 @@ interface hp:=tai(hp.next); end; { insert the list } - exprasmList.concatlist(p_asm); + current_asmdata.CurrAsmList.concatlist(p_asm); end; { Release register used in the assembler block } - cg.dealloccpuregisters(exprasmlist,R_INTREGISTER,used_regs_int); + cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,used_regs_int); end; @@ -330,8 +330,8 @@ interface { replace exitlabel? } if nf_block_with_exit in flags then begin - oldexitlabel:=current_procinfo.aktexitlabel; - objectlibrary.getjumplabel(current_procinfo.aktexitlabel); + oldexitlabel:=current_procinfo.CurrExitLabel; + current_asmdata.getjumplabel(current_procinfo.CurrExitLabel); end; { do second pass on left node } @@ -353,8 +353,8 @@ interface { write exitlabel } if nf_block_with_exit in flags then begin - cg.a_label(exprasmlist,current_procinfo.aktexitlabel); - current_procinfo.aktexitlabel:=oldexitlabel; + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrExitLabel); + current_procinfo.CurrExitLabel:=oldexitlabel; end; end; @@ -375,7 +375,7 @@ interface if tempinfo^.restype.def.needs_inittable then begin location_reset(tempinfo^.location,LOC_REFERENCE,def_cgsize(tempinfo^.restype.def)); - tg.GetTempTyped(exprasmlist,tempinfo^.restype.def,tempinfo^.temptype,tempinfo^.location.reference); + tg.GetTempTyped(current_asmdata.CurrAsmList,tempinfo^.restype.def,tempinfo^.temptype,tempinfo^.location.reference); end else if tempinfo^.may_be_in_reg then begin @@ -385,7 +385,7 @@ interface location_reset(tempinfo^.location,LOC_CFPUREGISTER,def_cgsize(tempinfo^.restype.def)) else location_reset(tempinfo^.location,LOC_FPUREGISTER,def_cgsize(tempinfo^.restype.def)); - tempinfo^.location.register:=cg.getfpuregister(exprasmlist,tempinfo^.location.size); + tempinfo^.location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,tempinfo^.location.size); end else begin @@ -396,18 +396,18 @@ interface {$ifndef cpu64bit} if tempinfo^.location.size in [OS_64,OS_S64] then begin - tempinfo^.location.register64.reglo:=cg.getintregister(exprasmlist,OS_32); - tempinfo^.location.register64.reghi:=cg.getintregister(exprasmlist,OS_32); + tempinfo^.location.register64.reglo:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + tempinfo^.location.register64.reghi:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); end else {$endif cpu64bit} - tempinfo^.location.register:=cg.getintregister(exprasmlist,tempinfo^.location.size); + tempinfo^.location.register:=cg.getintregister(current_asmdata.CurrAsmList,tempinfo^.location.size); end; end else begin location_reset(tempinfo^.location,LOC_REFERENCE,def_cgsize(tempinfo^.restype.def)); - tg.GetTemp(exprasmlist,size,tempinfo^.temptype,tempinfo^.location.reference); + tg.GetTemp(current_asmdata.CurrAsmList,size,tempinfo^.temptype,tempinfo^.location.reference); end; tempinfo^.valid := true; end; @@ -443,10 +443,10 @@ interface if (tempinfo^.location.loc<>LOC_REFERENCE) then internalerror(2004020203); if (tempinfo^.temptype = tt_persistent) then - tg.ChangeTempType(exprasmlist,tempinfo^.location.reference,tt_normal); - tg.ungettemp(exprasmlist,tempinfo^.location.reference); + tg.ChangeTempType(current_asmdata.CurrAsmList,tempinfo^.location.reference,tt_normal); + tg.ungettemp(current_asmdata.CurrAsmList,tempinfo^.location.reference); tempinfo^.location.reference := ref; - tg.ChangeTempType(exprasmlist,tempinfo^.location.reference,tempinfo^.temptype); + tg.ChangeTempType(current_asmdata.CurrAsmList,tempinfo^.location.reference,tempinfo^.temptype); { adapt location } location.reference := ref; inc(location.reference.offset,offset); @@ -465,10 +465,10 @@ interface LOC_REFERENCE: begin if release_to_normal then - tg.ChangeTempType(exprasmlist,tempinfo^.location.reference,tt_normal) + tg.ChangeTempType(current_asmdata.CurrAsmList,tempinfo^.location.reference,tt_normal) else begin - tg.UnGetTemp(exprasmlist,tempinfo^.location.reference); + tg.UnGetTemp(current_asmdata.CurrAsmList,tempinfo^.location.reference); tempinfo^.valid := false; end; end; @@ -483,12 +483,12 @@ interface {$ifndef cpu64bit} if tempinfo^.location.size in [OS_64,OS_S64] then begin - cg.a_reg_sync(exprasmlist,tempinfo^.location.register64.reghi); - cg.a_reg_sync(exprasmlist,tempinfo^.location.register64.reglo); + cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register64.reghi); + cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register64.reglo); end else {$endif cpu64bit} - cg.a_reg_sync(exprasmlist,tempinfo^.location.register); + cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register); end; if release_to_normal then tempinfo^.location.loc := LOC_REGISTER @@ -503,7 +503,7 @@ interface begin { make sure the register allocator doesn't reuse the } { register e.g. in the middle of a loop } - cg.a_reg_sync(exprasmlist,tempinfo^.location.register); + cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register); end; if release_to_normal then tempinfo^.location.loc := LOC_FPUREGISTER diff --git a/compiler/ncgcal.pas b/compiler/ncgcal.pas index ad96180ce8..193b2d680b 100644 --- a/compiler/ncgcal.pas +++ b/compiler/ncgcal.pas @@ -110,7 +110,7 @@ implementation begin if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then internalerror(200304235); - cg.a_paramaddr_ref(exprasmlist,left.location.reference,tempcgpara); + cg.a_paramaddr_ref(current_asmdata.CurrAsmList,left.location.reference,tempcgpara); end; @@ -127,7 +127,7 @@ implementation { Move flags and jump in register to make it less complex } if left.location.loc in [LOC_FLAGS,LOC_JUMP] then - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),false); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),false); { Handle Floating point types differently } if (left.resulttype.def.deftype=floatdef) and not(cs_fp_emulation in aktmoduleswitches) then @@ -142,12 +142,12 @@ implementation size:=align(TCGSize2Size[left.location.size],tempcgpara.alignment); if tempcgpara.location^.reference.index=NR_STACK_POINTER_REG then begin - cg.g_stackpointer_alloc(exprasmlist,size); + cg.g_stackpointer_alloc(current_asmdata.CurrAsmList,size); reference_reset_base(href,NR_STACK_POINTER_REG,0); end else reference_reset_base(href,tempcgpara.location^.reference.index,tempcgpara.location^.reference.offset); - cg.a_loadfpu_reg_ref(exprasmlist,left.location.size,left.location.register,href); + cg.a_loadfpu_reg_ref(current_asmdata.CurrAsmList,left.location.size,left.location.register,href); end; LOC_MMREGISTER, LOC_CMMREGISTER: @@ -155,12 +155,12 @@ implementation size:=align(tfloatdef(left.resulttype.def).size,tempcgpara.alignment); if tempcgpara.location^.reference.index=NR_STACK_POINTER_REG then begin - cg.g_stackpointer_alloc(exprasmlist,size); + cg.g_stackpointer_alloc(current_asmdata.CurrAsmList,size); reference_reset_base(href,NR_STACK_POINTER_REG,0); end else reference_reset_base(href,tempcgpara.location^.reference.index,tempcgpara.location^.reference.offset); - cg.a_loadmm_reg_ref(exprasmlist,left.location.size,left.location.size,left.location.register,href,mms_movescalar); + cg.a_loadmm_reg_ref(current_asmdata.CurrAsmList,left.location.size,left.location.size,left.location.register,href,mms_movescalar); end; LOC_REFERENCE, LOC_CREFERENCE : @@ -168,11 +168,11 @@ implementation size:=align(left.resulttype.def.size,tempcgpara.alignment); if (not use_fixed_stack) and (tempcgpara.location^.reference.index=NR_STACK_POINTER_REG) then - cg.a_param_ref(exprasmlist,left.location.size,left.location.reference,tempcgpara) + cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara) else begin reference_reset_base(href,tempcgpara.location^.reference.index,tempcgpara.location^.reference.offset); - cg.g_concatcopy(exprasmlist,left.location.reference,href,size); + cg.g_concatcopy(current_asmdata.CurrAsmList,left.location.reference,href,size); end; end; else @@ -187,12 +187,12 @@ implementation LOC_CREFERENCE, LOC_MMREGISTER, LOC_CMMREGISTER: - cg.a_parammm_reg(exprasmlist,left.location.size,left.location.register,tempcgpara,mms_movescalar); + cg.a_parammm_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,tempcgpara,mms_movescalar); LOC_FPUREGISTER, LOC_CFPUREGISTER: begin - location_force_fpureg(exprasmlist,left.location,false); - cg.a_paramfpu_reg(exprasmlist,left.location.size,left.location.register,tempcgpara); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,false); + cg.a_paramfpu_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,tempcgpara); end; else internalerror(200204249); @@ -203,18 +203,18 @@ implementation LOC_MMREGISTER, LOC_CMMREGISTER: begin - location_force_mmregscalar(exprasmlist,left.location,false); - cg.a_parammm_reg(exprasmlist,left.location.size,left.location.register,tempcgpara,mms_movescalar); + location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,false); + cg.a_parammm_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,tempcgpara,mms_movescalar); end; {$ifdef x86_64} { x86_64 pushes s64comp in normal register } LOC_REGISTER, LOC_CREGISTER : begin - location_force_mem(exprasmlist,left.location); + location_force_mem(current_asmdata.CurrAsmList,left.location); { force integer size } left.location.size:=int_cgsize(tcgsize2size[left.location.size]); - cg.a_param_ref(exprasmlist,left.location.size,left.location.reference,tempcgpara); + cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara); end; {$endif x86_64} {$ifdef powerpc} @@ -223,13 +223,13 @@ implementation begin { aix abi passes floats of varargs in both fpu and } { integer registers } - location_force_mem(exprasmlist,left.location); + location_force_mem(current_asmdata.CurrAsmList,left.location); { force integer size } left.location.size:=int_cgsize(tcgsize2size[left.location.size]); if (left.location.size in [OS_32,OS_S32]) then - cg.a_param_ref(exprasmlist,left.location.size,left.location.reference,tempcgpara) + cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara) else - cg64.a_param64_ref(exprasmlist,left.location.reference,tempcgpara); + cg64.a_param64_ref(current_asmdata.CurrAsmList,left.location.reference,tempcgpara); end; {$endif powerpc} {$ifdef powerpc64} @@ -237,10 +237,10 @@ implementation LOC_CREGISTER : begin { ppc64 abi passes floats of varargs in integer registers, so force a store } - location_force_mem(exprasmlist,left.location); + location_force_mem(current_asmdata.CurrAsmList,left.location); { force integer size } left.location.size:=int_cgsize(tcgsize2size[tempcgpara.location^.size]); - cg.a_param_ref(exprasmlist,left.location.size,left.location.reference,tempcgpara) + cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara) end; {$endif powerpc64} {$if defined(sparc) or defined(arm)} @@ -252,7 +252,7 @@ implementation LOC_CREFERENCE, LOC_FPUREGISTER, LOC_CFPUREGISTER: - cg.a_paramfpu_reg(exprasmlist,left.location.size,left.location.register,tempcgpara); + cg.a_paramfpu_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,tempcgpara); else internalerror(2002042433); end; @@ -261,7 +261,7 @@ implementation case tempcgpara.location^.loc of LOC_MMREGISTER, LOC_CMMREGISTER: - cg.a_parammm_ref(exprasmlist,left.location.size,left.location.reference,tempcgpara,mms_movescalar); + cg.a_parammm_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara,mms_movescalar); {$ifdef x86_64} { x86_64 pushes s64comp in normal register } LOC_REGISTER, @@ -269,7 +269,7 @@ implementation begin { force integer size } left.location.size:=int_cgsize(tcgsize2size[left.location.size]); - cg.a_param_ref(exprasmlist,left.location.size,left.location.reference,tempcgpara); + cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara); end; {$endif x86_64} {$ifdef powerpc} @@ -280,9 +280,9 @@ implementation { force integer size } left.location.size:=int_cgsize(tcgsize2size[left.location.size]); if (left.location.size in [OS_32,OS_S32]) then - cg.a_param_ref(exprasmlist,left.location.size,left.location.reference,tempcgpara) + cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara) else - cg64.a_param64_ref(exprasmlist,left.location.reference,tempcgpara); + cg64.a_param64_ref(current_asmdata.CurrAsmList,left.location.reference,tempcgpara); end; {$endif powerpc} {$ifdef powerpc64} @@ -291,7 +291,7 @@ implementation begin { force integer size } left.location.size:=int_cgsize(tcgsize2size[tempcgpara.location^.size]); - cg.a_param_ref(exprasmlist,left.location.size,left.location.reference,tempcgpara) + cg.a_param_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara) end; {$endif powerpc64} {$if defined(sparc) or defined(arm) } @@ -303,7 +303,7 @@ implementation LOC_CREFERENCE, LOC_FPUREGISTER, LOC_CFPUREGISTER: - cg.a_paramfpu_ref(exprasmlist,left.location.size,left.location.reference,tempcgpara); + cg.a_paramfpu_ref(current_asmdata.CurrAsmList,left.location.size,left.location.reference,tempcgpara); else internalerror(2002042431); end; @@ -324,7 +324,7 @@ implementation {$ifndef cpu64bit} { use cg64 only for int64, not for 8 byte records } if is_64bit(left.resulttype.def) then - cg64.a_param64_loc(exprasmlist,left.location,tempcgpara) + cg64.a_param64_loc(current_asmdata.CurrAsmList,left.location,tempcgpara) else {$endif cpu64bit} begin @@ -334,15 +334,15 @@ implementation to a reference first. This situation can be triggered by typecasting an int64 constant to a record of 8 bytes } if left.location.size in [OS_64,OS_S64] then - location_force_mem(exprasmlist,left.location); + location_force_mem(current_asmdata.CurrAsmList,left.location); {$endif cpu64bit} - cg.a_param_loc(exprasmlist,left.location,tempcgpara); + cg.a_param_loc(current_asmdata.CurrAsmList,left.location,tempcgpara); end; end; {$ifdef SUPPORT_MMX} LOC_MMXREGISTER, LOC_CMMXREGISTER: - cg.a_parammm_reg(exprasmlist,OS_M64,left.location.register,tempcgpara,nil); + cg.a_parammm_reg(current_asmdata.CurrAsmList,OS_M64,left.location.register,tempcgpara,nil); {$endif SUPPORT_MMX} else internalerror(200204241); @@ -364,21 +364,21 @@ implementation a parameter } if (left.nodetype<>nothingn) then begin - otlabel:=truelabel; - oflabel:=falselabel; - objectlibrary.getjumplabel(truelabel); - objectlibrary.getjumplabel(falselabel); + otlabel:=current_procinfo.CurrTrueLabel; + oflabel:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); secondpass(left); { release memory for refcnt out parameters } if (parasym.varspez=vs_out) and (left.resulttype.def.needs_inittable) then begin - location_get_data_ref(exprasmlist,left.location,href,false); - cg.g_decrrefcount(exprasmlist,left.resulttype.def,href); + location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false); + cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resulttype.def,href); end; - paramanager.createtempparaloc(exprasmlist,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara); + paramanager.createtempparaloc(current_asmdata.CurrAsmList,aktcallnode.procdefinition.proccalloption,parasym,tempcgpara); { handle varargs first, because parasym is not valid } if (cpf_varargs_para in callparaflags) then @@ -408,7 +408,7 @@ implementation { allow passing of a constant to a const formaldef } if (parasym.varspez=vs_const) and (left.location.loc in [LOC_CONSTANT,LOC_REGISTER]) then - location_force_mem(exprasmlist,left.location); + location_force_mem(current_asmdata.CurrAsmList,left.location); push_addr_para; end { Normal parameter } @@ -436,7 +436,7 @@ implementation if (left.location.reference.index<>NR_NO) or (left.location.reference.offset<>0) then internalerror(200410107); - cg.a_param_reg(exprasmlist,OS_ADDR,left.location.reference.base,tempcgpara) + cg.a_param_reg(current_asmdata.CurrAsmList,OS_ADDR,left.location.reference.base,tempcgpara) end else begin @@ -452,15 +452,15 @@ implementation end; { Force to be in memory } if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then - location_force_mem(exprasmlist,left.location); + location_force_mem(current_asmdata.CurrAsmList,left.location); push_addr_para; end; end else push_value_para; end; - truelabel:=otlabel; - falselabel:=oflabel; + current_procinfo.CurrTrueLabel:=otlabel; + current_procinfo.CurrFalseLabel:=oflabel; { update return location in callnode when this is the function result } @@ -526,22 +526,22 @@ implementation { the FUNCTION_RESULT_REG is already allocated } if getsupreg(procdefinition.funcretloc[callerside].register)<first_int_imreg then - cg.ungetcpuregister(exprasmlist,procdefinition.funcretloc[callerside].register); + cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register); if not assigned(funcretnode) then begin { reg_ref could generate two instrcutions and allocate a register so we've to save the result first before releasing it } - hregister:=cg.getaddressregister(exprasmlist); - cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,procdefinition.funcretloc[callerside].register,hregister); + hregister:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,procdefinition.funcretloc[callerside].register,hregister); location_reset(location,LOC_REFERENCE,OS_ADDR); location.reference:=refcountedtemp; - cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,location.reference); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hregister,location.reference); end else begin - hregister := cg.getaddressregister(exprasmlist); - cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,procdefinition.funcretloc[callerside].register,hregister); + hregister := cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,procdefinition.funcretloc[callerside].register,hregister); { in case of a regular funcretnode with ret_in_param, the } { original funcretnode isn't touched -> make sure it's } { the same here (not sure if it's necessary) } @@ -549,8 +549,8 @@ implementation tempnode.pass_2; location := tempnode.location; tempnode.free; - cg.g_decrrefcount(exprasmlist,resulttype.def,location.reference); - cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,location.reference); + cg.g_decrrefcount(current_asmdata.CurrAsmList,resulttype.def,location.reference); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hregister,location.reference); end; end else @@ -569,9 +569,9 @@ implementation tcgx86(cg).inc_fpu_stack; {$else x86} if getsupreg(procdefinition.funcretloc[callerside].register)<first_fpu_imreg then - cg.ungetcpuregister(exprasmlist,procdefinition.funcretloc[callerside].register); - hregister:=cg.getfpuregister(exprasmlist,location.size); - cg.a_loadfpu_reg_reg(exprasmlist,location.size,location.register,hregister); + cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register); + hregister:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); + cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,location.size,location.register,hregister); location.register:=hregister; {$endif x86} end; @@ -589,13 +589,13 @@ implementation internalerror(200409141); { the function result registers are already allocated } if getsupreg(retloc.register64.reglo)<first_int_imreg then - cg.ungetcpuregister(exprasmlist,retloc.register64.reglo); - location.register64.reglo:=cg.getintregister(exprasmlist,OS_32); - cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,retloc.register64.reglo,location.register64.reglo); + cg.ungetcpuregister(current_asmdata.CurrAsmList,retloc.register64.reglo); + location.register64.reglo:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_32,OS_32,retloc.register64.reglo,location.register64.reglo); if getsupreg(retloc.register64.reghi)<first_int_imreg then - cg.ungetcpuregister(exprasmlist,retloc.register64.reghi); - location.register64.reghi:=cg.getintregister(exprasmlist,OS_32); - cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,retloc.register64.reghi,location.register64.reghi); + cg.ungetcpuregister(current_asmdata.CurrAsmList,retloc.register64.reghi); + location.register64.reghi:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_32,OS_32,retloc.register64.reghi,location.register64.reghi); end else {$endif cpu64bit} @@ -605,9 +605,9 @@ implementation def_cgsize(resulttype.def) is used here because it could be a constructor call } if getsupreg(procdefinition.funcretloc[callerside].register)<first_int_imreg then - cg.ungetcpuregister(exprasmlist,procdefinition.funcretloc[callerside].register); - location.register:=cg.getintregister(exprasmlist,def_cgsize(resulttype.def)); - cg.a_load_reg_reg(exprasmlist,cgsize,def_cgsize(resulttype.def),procdefinition.funcretloc[callerside].register,location.register); + cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register); + location.register:=cg.getintregister(current_asmdata.CurrAsmList,def_cgsize(resulttype.def)); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,cgsize,def_cgsize(resulttype.def),procdefinition.funcretloc[callerside].register,location.register); end; end else @@ -621,9 +621,9 @@ implementation begin location_reset(location,LOC_MMREGISTER,cgsize); if getsupreg(procdefinition.funcretloc[callerside].register)<first_mm_imreg then - cg.ungetcpuregister(exprasmlist,procdefinition.funcretloc[callerside].register); - location.register:=cg.getmmregister(exprasmlist,cgsize); - cg.a_loadmm_reg_reg(exprasmlist,cgsize,cgsize,procdefinition.funcretloc[callerside].register,location.register,mms_movescalar); + cg.ungetcpuregister(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside].register); + location.register:=cg.getmmregister(current_asmdata.CurrAsmList,cgsize); + cg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,cgsize,cgsize,procdefinition.funcretloc[callerside].register,location.register,mms_movescalar); end; else @@ -638,7 +638,7 @@ implementation emit_reg(A_FSTP,S_NO,NR_FPU_RESULT_REG); {$endif x86} if cgsize<>OS_NO then - location_free(exprasmlist,procdefinition.funcretloc[callerside]); + location_free(current_asmdata.CurrAsmList,procdefinition.funcretloc[callerside]); location_reset(location,LOC_VOID,OS_NO); end; end; @@ -650,8 +650,8 @@ implementation if location.loc=LOC_REFERENCE then begin if resulttype.def.needs_inittable then - cg.g_finalize(exprasmlist,resulttype.def,location.reference); - tg.ungetiftemp(exprasmlist,location.reference) + cg.g_finalize(current_asmdata.CurrAsmList,resulttype.def,location.reference); + tg.ungetiftemp(current_asmdata.CurrAsmList,location.reference) end; end; end; @@ -671,7 +671,7 @@ implementation { don't release the funcret temp } if not(assigned(ppn.parasym)) or not(vo_is_funcret in ppn.parasym.varoptions) then - location_freetemp(exprasmlist,ppn.left.location); + location_freetemp(current_asmdata.CurrAsmList,ppn.left.location); { process also all nodes of an array of const } hp:=ppn.left; while (hp.nodetype=typeconvn) do @@ -681,7 +681,7 @@ implementation begin while assigned(hp) do begin - location_freetemp(exprasmlist,tarrayconstructornode(hp).left.location); + location_freetemp(current_asmdata.CurrAsmList,tarrayconstructornode(hp).left.location); hp:=tarrayconstructornode(hp).right; end; end; @@ -709,7 +709,7 @@ implementation { better check for the real location of the parameter here, when stack passed parameters are saved temporary in registers, checking for the tmpparaloc.loc is wrong } - paramanager.freeparaloc(exprasmlist,ppn.tempcgpara); + paramanager.freeparaloc(current_asmdata.CurrAsmList,ppn.tempcgpara); tmpparaloc:=ppn.tempcgpara.location; sizeleft:=ppn.tempcgpara.intsize; callerparaloc:=ppn.parasym.paraloc[callerside].location; @@ -726,8 +726,8 @@ implementation if tmpparaloc^.loc<>LOC_REGISTER then internalerror(200408221); if getsupreg(callerparaloc^.register)<first_int_imreg then - cg.getcpuregister(exprasmlist,callerparaloc^.register); - cg.a_load_reg_reg(exprasmlist,tmpparaloc^.size,tmpparaloc^.size, + cg.getcpuregister(current_asmdata.CurrAsmList,callerparaloc^.register); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size, tmpparaloc^.register,callerparaloc^.register); end; LOC_FPUREGISTER: @@ -735,16 +735,16 @@ implementation if tmpparaloc^.loc<>LOC_FPUREGISTER then internalerror(200408222); if getsupreg(callerparaloc^.register)<first_fpu_imreg then - cg.getcpuregister(exprasmlist,callerparaloc^.register); - cg.a_loadfpu_reg_reg(exprasmlist,ppn.tempcgpara.size,tmpparaloc^.register,callerparaloc^.register); + cg.getcpuregister(current_asmdata.CurrAsmList,callerparaloc^.register); + cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,ppn.tempcgpara.size,tmpparaloc^.register,callerparaloc^.register); end; LOC_MMREGISTER: begin if tmpparaloc^.loc<>LOC_MMREGISTER then internalerror(200408223); if getsupreg(callerparaloc^.register)<first_mm_imreg then - cg.getcpuregister(exprasmlist,callerparaloc^.register); - cg.a_loadmm_reg_reg(exprasmlist,tmpparaloc^.size,tmpparaloc^.size, + cg.getcpuregister(current_asmdata.CurrAsmList,callerparaloc^.register); + cg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size, tmpparaloc^.register,callerparaloc^.register,mms_movescalar); end; LOC_REFERENCE: @@ -767,16 +767,16 @@ implementation { use concatcopy, because it can also be a float which fails when load_ref_ref is used } if (ppn.tempcgpara.size <> OS_NO) then - cg.g_concatcopy(exprasmlist,htempref,href,tcgsize2size[tmpparaloc^.size]) + cg.g_concatcopy(current_asmdata.CurrAsmList,htempref,href,tcgsize2size[tmpparaloc^.size]) else - cg.g_concatcopy(exprasmlist,htempref,href,sizeleft) + cg.g_concatcopy(current_asmdata.CurrAsmList,htempref,href,sizeleft) end; LOC_REGISTER: - cg.a_load_reg_ref(exprasmlist,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href); LOC_FPUREGISTER: - cg.a_loadfpu_reg_ref(exprasmlist,tmpparaloc^.size,tmpparaloc^.register,href); + cg.a_loadfpu_reg_ref(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.register,href); LOC_MMREGISTER: - cg.a_loadmm_reg_ref(exprasmlist,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href,mms_movescalar); + cg.a_loadmm_reg_ref(current_asmdata.CurrAsmList,tmpparaloc^.size,tmpparaloc^.size,tmpparaloc^.register,href,mms_movescalar); else internalerror(200402081); end; @@ -804,7 +804,7 @@ implementation if (ppn.left.nodetype<>nothingn) then begin if (ppn.parasym.paraloc[callerside].location^.loc <> LOC_REFERENCE) then - paramanager.freeparaloc(exprasmlist,ppn.parasym.paraloc[callerside]); + paramanager.freeparaloc(current_asmdata.CurrAsmList,ppn.parasym.paraloc[callerside]); end; ppn:=tcgcallparanode(ppn.right); end; @@ -835,8 +835,8 @@ implementation not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) and not assigned(funcretnode) then begin - tg.gettemptyped(exprasmlist,resulttype.def,tt_normal,refcountedtemp); - cg.g_decrrefcount(exprasmlist,resulttype.def,refcountedtemp); + tg.gettemptyped(current_asmdata.CurrAsmList,resulttype.def,tt_normal,refcountedtemp); + cg.g_decrrefcount(current_asmdata.CurrAsmList,resulttype.def,refcountedtemp); end; regs_to_save_int:=paramanager.get_volatile_registers_int(procdefinition.proccalloption); @@ -890,23 +890,23 @@ implementation { Load VMT from self } if methodpointer.resulttype.def.deftype=objectdef then - gen_load_vmt_register(exprasmlist,tobjectdef(methodpointer.resulttype.def),methodpointer.location,vmtreg) + gen_load_vmt_register(current_asmdata.CurrAsmList,tobjectdef(methodpointer.resulttype.def),methodpointer.location,vmtreg) else begin { Load VMT value in register } - location_force_reg(exprasmlist,methodpointer.location,OS_ADDR,false); + location_force_reg(current_asmdata.CurrAsmList,methodpointer.location,OS_ADDR,false); vmtreg:=methodpointer.location.register; end; { test validity of VMT } if not(is_interface(tprocdef(procdefinition)._class)) and not(is_cppclass(tprocdef(procdefinition)._class)) then - cg.g_maybe_testvmt(exprasmlist,vmtreg,tprocdef(procdefinition)._class); + cg.g_maybe_testvmt(current_asmdata.CurrAsmList,vmtreg,tprocdef(procdefinition)._class); - pvreg:=cg.getintregister(exprasmlist,OS_ADDR); + pvreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR); reference_reset_base(href,vmtreg, tprocdef(procdefinition)._class.vmtmethodoffset(tprocdef(procdefinition).extnumber)); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,pvreg); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,pvreg); { Load parameters that are in temporary registers in the correct parameter register } @@ -917,15 +917,15 @@ implementation freeparas; end; - cg.alloccpuregisters(exprasmlist,R_INTREGISTER,regs_to_save_int); + cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int); if cg.uses_registers(R_FPUREGISTER) then - cg.alloccpuregisters(exprasmlist,R_FPUREGISTER,regs_to_save_fpu); + cg.alloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu); if cg.uses_registers(R_MMREGISTER) then - cg.alloccpuregisters(exprasmlist,R_MMREGISTER,regs_to_save_mm); + cg.alloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm); { call method } extra_call_code; - cg.a_call_reg(exprasmlist,pvreg); + cg.a_call_reg(current_asmdata.CurrAsmList,pvreg); extra_post_call_code; end else @@ -939,11 +939,11 @@ implementation freeparas; end; - cg.alloccpuregisters(exprasmlist,R_INTREGISTER,regs_to_save_int); + cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int); if cg.uses_registers(R_FPUREGISTER) then - cg.alloccpuregisters(exprasmlist,R_FPUREGISTER,regs_to_save_fpu); + cg.alloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu); if cg.uses_registers(R_MMREGISTER) then - cg.alloccpuregisters(exprasmlist,R_MMREGISTER,regs_to_save_mm); + cg.alloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm); if procdefinition.proccalloption=pocall_syscall then do_syscall @@ -954,7 +954,7 @@ implementation if (po_interrupt in procdefinition.procoptions) then extra_interrupt_code; extra_call_code; - cg.a_call_name(exprasmlist,tprocdef(procdefinition).mangledname); + cg.a_call_name(current_asmdata.CurrAsmList,tprocdef(procdefinition).mangledname); extra_post_call_code; end; end; @@ -964,13 +964,13 @@ implementation begin secondpass(right); - pvreg:=cg.getintregister(exprasmlist,OS_ADDR); + pvreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR); { Only load OS_ADDR from the reference } if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,right.location.reference,pvreg) + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,right.location.reference,pvreg) else - cg.a_load_loc_reg(exprasmlist,OS_ADDR,right.location,pvreg); - location_freetemp(exprasmlist,right.location); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_ADDR,right.location,pvreg); + location_freetemp(current_asmdata.CurrAsmList,right.location); { Load parameters that are in temporary registers in the correct parameter register } @@ -981,18 +981,18 @@ implementation freeparas; end; - cg.alloccpuregisters(exprasmlist,R_INTREGISTER,regs_to_save_int); + cg.alloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int); if cg.uses_registers(R_FPUREGISTER) then - cg.alloccpuregisters(exprasmlist,R_FPUREGISTER,regs_to_save_fpu); + cg.alloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu); if cg.uses_registers(R_MMREGISTER) then - cg.alloccpuregisters(exprasmlist,R_MMREGISTER,regs_to_save_mm); + cg.alloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm); { Calling interrupt from the same code requires some extra code } if (po_interrupt in procdefinition.procoptions) then extra_interrupt_code; extra_call_code; - cg.a_call_reg(exprasmlist,pvreg); + cg.a_call_reg(current_asmdata.CurrAsmList,pvreg); extra_post_call_code; end; @@ -1040,10 +1040,10 @@ implementation end; end; if cg.uses_registers(R_MMREGISTER) then - cg.dealloccpuregisters(exprasmlist,R_MMREGISTER,regs_to_save_mm); + cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_MMREGISTER,regs_to_save_mm); if cg.uses_registers(R_FPUREGISTER) then - cg.dealloccpuregisters(exprasmlist,R_FPUREGISTER,regs_to_save_fpu); - cg.dealloccpuregisters(exprasmlist,R_INTREGISTER,regs_to_save_int); + cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_FPUREGISTER,regs_to_save_fpu); + cg.dealloccpuregisters(current_asmdata.CurrAsmList,R_INTREGISTER,regs_to_save_int); { handle function results } if (not is_void(resulttype.def)) then @@ -1059,9 +1059,9 @@ implementation (right=nil) and not(po_virtualmethod in procdefinition.procoptions) then begin - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_IOCHECK'); - cg.deallocallcpuregisters(exprasmlist); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_IOCHECK'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); end; { release temps of paras } diff --git a/compiler/ncgcnv.pas b/compiler/ncgcnv.pas index 97a0067f96..e62145361a 100644 --- a/compiler/ncgcnv.pas +++ b/compiler/ncgcnv.pas @@ -61,7 +61,7 @@ interface aasmbase,aasmtai,aasmcpu,symconst,symdef,paramgr, ncon,ncal, cpubase,systems, - pass_2, + procinfo,pass_2, cgbase, cgutils,cgobj, ncgutil, @@ -80,7 +80,7 @@ interface { insert range check if not explicit conversion } if not(nf_explicit in flags) then - cg.g_rangecheck(exprasmlist,left.location,left.resulttype.def,resulttype.def); + cg.g_rangecheck(current_asmdata.CurrAsmList,left.location,left.resulttype.def,resulttype.def); { is the result size smaller? when typecasting from void we always reuse the current location, because there is @@ -101,7 +101,7 @@ interface inc(location.reference.offset,leftsize-ressize); end else - location_force_reg(exprasmlist,location,newsize,false); + location_force_reg(current_asmdata.CurrAsmList,location,newsize,false); {$ifndef cpu64bit} // if is_signed(left.resulttype) and {$endif cpu64bit} @@ -121,9 +121,9 @@ interface (location.loc in [LOC_REGISTER,LOC_CREGISTER]) and (orgsize <> newsize) then begin - location.register := cg.getintregister(exprasmlist,newsize); + location.register := cg.getintregister(current_asmdata.CurrAsmList,newsize); location.loc := LOC_REGISTER; - cg.a_load_reg_reg(exprasmlist,orgsize,newsize,left.location.register,location.register); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,orgsize,newsize,left.location.register,location.register); end; end; end; @@ -141,28 +141,28 @@ interface case tstringconstnode(left).cst_type of cst_conststring : begin - location.register:=cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,location.register); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,location.register); end; cst_shortstring : begin inc(left.location.reference.offset); - location.register:=cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,location.register); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,location.register); end; cst_ansistring : begin if tstringconstnode(left).len=0 then begin reference_reset(hr); - hr.symbol:=objectlibrary.newasmsymbol('FPC_EMPTYCHAR',AB_EXTERNAL,AT_DATA); - location.register:=cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register); + hr.symbol:=current_asmdata.newasmsymbol('FPC_EMPTYCHAR',AB_EXTERNAL,AT_DATA); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register); end else begin - location.register:=cg.getaddressregister(exprasmlist); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.reference,location.register); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.reference,location.register); end; end; cst_longstring: @@ -175,14 +175,14 @@ interface if tstringconstnode(left).len=0 then begin reference_reset(hr); - hr.symbol:=objectlibrary.newasmsymbol('FPC_EMPTYCHAR',AB_EXTERNAL,AT_DATA); - location.register:=cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register); + hr.symbol:=current_asmdata.newasmsymbol('FPC_EMPTYCHAR',AB_EXTERNAL,AT_DATA); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register); end else begin - location.register:=cg.getintregister(exprasmlist,OS_INT); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_INT,left.location.reference, + location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_INT,left.location.reference, location.register); end; end; @@ -214,8 +214,8 @@ interface begin location_reset(location,LOC_REGISTER,OS_ADDR); - location.register:=cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,location.register); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,location.register); end; @@ -229,8 +229,8 @@ interface {$ifdef cpu_uses_separate_address_registers} if getregtype(left.location.register)<>R_ADDRESSREGISTER then begin - location.reference.base:=rg.getaddressregister(exprasmlist); - cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR, + location.reference.base:=rg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR, left.location.register,location.reference.base); end else @@ -239,17 +239,17 @@ interface end; LOC_CREGISTER : begin - location.reference.base:=cg.getaddressregister(exprasmlist); - cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.register, + location.reference.base:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.register, location.reference.base); end; LOC_REFERENCE, LOC_CREFERENCE : begin - location.reference.base:=cg.getaddressregister(exprasmlist); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.reference, + location.reference.base:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.reference, location.reference.base); - location_freetemp(exprasmlist,left.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); end; else internalerror(2002032216); @@ -263,10 +263,10 @@ interface case tstringdef(resulttype.def).string_typ of st_shortstring : begin - tg.GetTemp(exprasmlist,256,tt_normal,location.reference); - cg.a_load_loc_ref(exprasmlist,left.location.size,left.location, + tg.GetTemp(current_asmdata.CurrAsmList,256,tt_normal,location.reference); + cg.a_load_loc_ref(current_asmdata.CurrAsmList,left.location.size,left.location, location.reference); - location_freetemp(exprasmlist,left.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); end; { the rest is removed in the resulttype pass and converted to compilerprocs } else @@ -285,7 +285,7 @@ interface if (expectloc=LOC_MMREGISTER) and (left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) and (left.location.size=OS_F80) then - location_force_fpureg(exprasmlist,left.location,false); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,false); {$endif x86} case left.location.loc of LOC_FPUREGISTER, @@ -297,7 +297,7 @@ interface LOC_FPUREGISTER: ; LOC_MMREGISTER: - location_force_mmregscalar(exprasmlist,location,false); + location_force_mmregscalar(current_asmdata.CurrAsmList,location,false); else internalerror(2003012262); end; @@ -309,15 +309,15 @@ interface if expectloc=LOC_MMREGISTER then begin location_reset(location,LOC_MMREGISTER,def_cgsize(resulttype.def)); - location.register:=cg.getmmregister(exprasmlist,location.size); - cg.a_loadmm_loc_reg(exprasmlist,location.size,left.location,location.register,mms_movescalar) + location.register:=cg.getmmregister(current_asmdata.CurrAsmList,location.size); + cg.a_loadmm_loc_reg(current_asmdata.CurrAsmList,location.size,left.location,location.register,mms_movescalar) end else begin - location.register:=cg.getfpuregister(exprasmlist,left.location.size); - cg.a_loadfpu_loc_reg(exprasmlist,left.location,location.register); + location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,left.location.size); + cg.a_loadfpu_loc_reg(current_asmdata.CurrAsmList,left.location,location.register); end; - location_freetemp(exprasmlist,left.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); end; LOC_MMREGISTER, LOC_CMMREGISTER: @@ -326,7 +326,7 @@ interface case expectloc of LOC_FPUREGISTER: begin - location_force_fpureg(exprasmlist,location,false); + location_force_fpureg(current_asmdata.CurrAsmList,location,false); location.size:=def_cgsize(resulttype.def); end; LOC_MMREGISTER: @@ -354,8 +354,8 @@ interface if tabstractprocdef(resulttype.def).is_addressonly then begin location_reset(location,LOC_REGISTER,OS_ADDR); - location.register:=cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,location.register); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,location.register); end else location_copy(location,left.location); @@ -364,12 +364,12 @@ interface procedure tcgtypeconvnode.second_bool_to_int; var - oldtruelabel,oldfalselabel : tasmlabel; + oldTrueLabel,oldFalseLabel : tasmlabel; begin - oldtruelabel:=truelabel; - oldfalselabel:=falselabel; - objectlibrary.getjumplabel(truelabel); - objectlibrary.getjumplabel(falselabel); + oldTrueLabel:=current_procinfo.CurrTrueLabel; + oldFalseLabel:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); secondpass(left); location_copy(location,left.location); { byte(boolean) or word(wordbool) or longint(longbool) must } @@ -377,9 +377,9 @@ interface if not((nf_explicit in flags) and (left.resulttype.def.size=resulttype.def.size) and (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER])) then - location_force_reg(exprasmlist,location,def_cgsize(resulttype.def),false); - truelabel:=oldtruelabel; - falselabel:=oldfalselabel; + location_force_reg(current_asmdata.CurrAsmList,location,def_cgsize(resulttype.def),false); + current_procinfo.CurrTrueLabel:=oldTrueLabel; + current_procinfo.CurrFalseLabel:=oldFalseLabel; end; @@ -405,15 +405,15 @@ interface hr : treference; begin location_reset(location,LOC_REGISTER,OS_ADDR); - objectlibrary.getjumplabel(l1); + current_asmdata.getjumplabel(l1); case left.location.loc of LOC_CREGISTER,LOC_REGISTER: begin {$ifdef cpu_uses_separate_address_registers} if getregtype(left.location.register)<>R_ADDRESSREGISTER then begin - location.register:=cg.getaddressregister(exprasmlist); - cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR, + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR, left.location.register,location.register); end else @@ -422,17 +422,17 @@ interface end; LOC_CREFERENCE,LOC_REFERENCE: begin - location.register:=cg.getaddressregister(exprasmlist); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.reference,location.register); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.reference,location.register); end; else internalerror(2002032214); end; - cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_NE,0,location.register,l1); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_NE,0,location.register,l1); reference_reset(hr); - hr.symbol:=objectlibrary.newasmsymbol('FPC_EMPTYCHAR',AB_EXTERNAL,AT_DATA); - cg.a_loadaddr_ref_reg(exprasmlist,hr,location.register); - cg.a_label(exprasmlist,l1); + hr.symbol:=current_asmdata.newasmsymbol('FPC_EMPTYCHAR',AB_EXTERNAL,AT_DATA); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register); + cg.a_label(current_asmdata.CurrAsmList,l1); end; @@ -446,28 +446,28 @@ interface LOC_CREFERENCE, LOC_REFERENCE: begin - location.register:=cg.getaddressregister(exprasmlist); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.reference,location.register); - location_freetemp(exprasmlist,left.location); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.reference,location.register); + location_freetemp(current_asmdata.CurrAsmList,left.location); end; LOC_CREGISTER: begin - location.register:=cg.getaddressregister(exprasmlist); - cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.register,location.register); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.register,location.register); end; LOC_REGISTER: location.register:=left.location.register; else internalerror(121120001); end; - objectlibrary.getjumplabel(l1); - cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,location.register,l1); + current_asmdata.getjumplabel(l1); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_EQ,0,location.register,l1); hd:=tobjectdef(left.resulttype.def); while assigned(hd) do begin if hd.implementedinterfaces.searchintf(resulttype.def)<>-1 then begin - cg.a_op_const_reg(exprasmlist,OP_ADD,OS_ADDR, + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_ADD,OS_ADDR, hd.implementedinterfaces.ioffsets( hd.implementedinterfaces.searchintf(resulttype.def)),location.register); break; @@ -476,7 +476,7 @@ interface end; if hd=nil then internalerror(2002081301); - cg.a_label(exprasmlist,l1); + cg.a_label(current_asmdata.CurrAsmList,l1); end; @@ -510,7 +510,7 @@ interface (left.resulttype.def.deftype=floatdef) xor (resulttype.def.deftype=floatdef) ) then - location_force_mem(exprasmlist,location); + location_force_mem(current_asmdata.CurrAsmList,location); { but use the new size, but we don't know the size of all arrays } newsize:=def_cgsize(resulttype.def); diff --git a/compiler/ncgcon.pas b/compiler/ncgcon.pas index 57f96f533d..793eac69b9 100644 --- a/compiler/ncgcon.pas +++ b/compiler/ncgcon.pas @@ -100,7 +100,7 @@ implementation if not assigned(lab_real) then begin { tries to find an old entry } - hp1:=tai(asmlist[al_typedconsts].first); + hp1:=tai(current_asmdata.asmlists[al_typedconsts].first); while assigned(hp1) do begin if hp1.typ=ait_label then @@ -136,19 +136,19 @@ implementation { :-(, we must generate a new entry } if not assigned(lab_real) then begin - objectlibrary.getdatalabel(lastlabel); + current_asmdata.getdatalabel(lastlabel); lab_real:=lastlabel; - maybe_new_object_file(asmlist[al_typedconsts]); - new_section(asmlist[al_typedconsts],sec_rodata,lastlabel.name,const_align(resulttype.def.size)); - asmlist[al_typedconsts].concat(Tai_label.Create(lastlabel)); + maybe_new_object_file(current_asmdata.asmlists[al_typedconsts]); + new_section(current_asmdata.asmlists[al_typedconsts],sec_rodata,lastlabel.name,const_align(resulttype.def.size)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(lastlabel)); case realait of ait_real_32bit : begin - asmlist[al_typedconsts].concat(Tai_real_32bit.Create(ts32real(value_real))); + current_asmdata.asmlists[al_typedconsts].concat(Tai_real_32bit.Create(ts32real(value_real))); { range checking? } if ((cs_check_range in aktlocalswitches) or (cs_check_overflow in aktlocalswitches)) and - (tai_real_32bit(asmlist[al_typedconsts].last).value=double(MathInf)) then + (tai_real_32bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then Message(parser_e_range_check_error); end; @@ -156,37 +156,37 @@ implementation begin {$ifdef ARM} if hiloswapped then - asmlist[al_typedconsts].concat(Tai_real_64bit.Create_hiloswapped(ts64real(value_real))) + current_asmdata.asmlists[al_typedconsts].concat(Tai_real_64bit.Create_hiloswapped(ts64real(value_real))) else {$endif ARM} - asmlist[al_typedconsts].concat(Tai_real_64bit.Create(ts64real(value_real))); + current_asmdata.asmlists[al_typedconsts].concat(Tai_real_64bit.Create(ts64real(value_real))); { range checking? } if ((cs_check_range in aktlocalswitches) or (cs_check_overflow in aktlocalswitches)) and - (tai_real_64bit(asmlist[al_typedconsts].last).value=double(MathInf)) then + (tai_real_64bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then Message(parser_e_range_check_error); end; ait_real_80bit : begin - asmlist[al_typedconsts].concat(Tai_real_80bit.Create(value_real)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_real_80bit.Create(value_real)); { range checking? } if ((cs_check_range in aktlocalswitches) or (cs_check_overflow in aktlocalswitches)) and - (tai_real_80bit(asmlist[al_typedconsts].last).value=double(MathInf)) then + (tai_real_80bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then Message(parser_e_range_check_error); end; {$ifdef cpufloat128} ait_real_128bit : begin - asmlist[al_typedconsts].concat(Tai_real_128bit.Create(value_real)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_real_128bit.Create(value_real)); { range checking? } if ((cs_check_range in aktlocalswitches) or (cs_check_overflow in aktlocalswitches)) and - (tai_real_128bit(asmlist[al_typedconsts].last).value=double(MathInf)) then + (tai_real_128bit(current_asmdata.asmlists[al_typedconsts].last).value=double(MathInf)) then Message(parser_e_range_check_error); end; {$endif cpufloat128} @@ -196,7 +196,7 @@ implementation if (value_real>9223372036854775807.0) or (value_real<-9223372036854775808.0) then message(parser_e_range_check_error) else - asmlist[al_typedconsts].concat(Tai_comp_64bit.Create(round(value_real))); + current_asmdata.asmlists[al_typedconsts].concat(Tai_comp_64bit.Create(round(value_real))); else internalerror(10120); end; @@ -269,7 +269,7 @@ implementation if not(is_widestring(resulttype.def)) then begin { tries to find an old entry } - hp1:=tai(asmlist[al_typedconsts].first); + hp1:=tai(current_asmdata.asmlists[al_typedconsts].first); while assigned(hp1) do begin if hp1.typ=ait_label then @@ -382,32 +382,32 @@ implementation { :-(, we must generate a new entry } if not assigned(lab_str) then begin - objectlibrary.getdatalabel(lastlabel); + current_asmdata.getdatalabel(lastlabel); lab_str:=lastlabel; - maybe_new_object_file(asmlist[al_typedconsts]); - new_section(asmlist[al_typedconsts],sec_rodata,lastlabel.name,const_align(sizeof(aint))); - asmlist[al_typedconsts].concat(Tai_label.Create(lastlabel)); + maybe_new_object_file(current_asmdata.asmlists[al_typedconsts]); + new_section(current_asmdata.asmlists[al_typedconsts],sec_rodata,lastlabel.name,const_align(sizeof(aint))); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(lastlabel)); { generate an ansi string ? } case cst_type of cst_ansistring: begin { an empty ansi string is nil! } if len=0 then - asmlist[al_typedconsts].concat(Tai_const.Create_sym(nil)) + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_sym(nil)) else begin - objectlibrary.getdatalabel(l1); - objectlibrary.getdatalabel(l2); - asmlist[al_typedconsts].concat(Tai_label.Create(l2)); - asmlist[al_typedconsts].concat(Tai_const.Create_sym(l1)); - asmlist[al_typedconsts].concat(Tai_const.Create_aint(-1)); - asmlist[al_typedconsts].concat(Tai_const.Create_aint(len)); - asmlist[al_typedconsts].concat(Tai_label.Create(l1)); + current_asmdata.getdatalabel(l1); + current_asmdata.getdatalabel(l2); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(l2)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_sym(l1)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_aint(-1)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_aint(len)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(l1)); { include also terminating zero } getmem(pc,len+1); move(value_str^,pc^,len); pc[len]:=#0; - asmlist[al_typedconsts].concat(Tai_string.Create_pchar(pc,len+1)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_string.Create_pchar(pc,len+1)); { return the offset of the real string } lab_str:=l2; end; @@ -416,24 +416,24 @@ implementation begin { an empty wide string is nil! } if len=0 then - asmlist[al_typedconsts].concat(Tai_const.Create_sym(nil)) + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_sym(nil)) else begin - objectlibrary.getdatalabel(l1); - objectlibrary.getdatalabel(l2); - asmlist[al_typedconsts].concat(Tai_label.Create(l2)); - asmlist[al_typedconsts].concat(Tai_const.Create_sym(l1)); + current_asmdata.getdatalabel(l1); + current_asmdata.getdatalabel(l2); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(l2)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_sym(l1)); { we use always UTF-16 coding for constants } { at least for now } { Consts.concat(Tai_const.Create_8bit(2)); } - asmlist[al_typedconsts].concat(Tai_const.Create_aint(-1)); - asmlist[al_typedconsts].concat(Tai_const.Create_aint(len*cwidechartype.def.size)); - asmlist[al_typedconsts].concat(Tai_label.Create(l1)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_aint(-1)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_aint(len*cwidechartype.def.size)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(l1)); for i:=0 to len-1 do - asmlist[al_typedconsts].concat(Tai_const.Create_16bit(pcompilerwidestring(value_str)^.data[i])); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(pcompilerwidestring(value_str)^.data[i])); { terminating zero } - asmlist[al_typedconsts].concat(Tai_const.Create_16bit(0)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(0)); { return the offset of the real string } lab_str:=l2; end; @@ -450,7 +450,7 @@ implementation move(value_str^,pc[1],l); pc[0]:=chr(l); pc[l+1]:=#0; - asmlist[al_typedconsts].concat(Tai_string.Create_pchar(pc,l+2)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_string.Create_pchar(pc,l+2)); end; cst_conststring: begin @@ -458,7 +458,7 @@ implementation getmem(pc,len+1); move(value_str^,pc[0],len); pc[len]:=#0; - asmlist[al_typedconsts].concat(Tai_string.Create_pchar(pc,len+1)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_string.Create_pchar(pc,len+1)); end; end; end; @@ -503,7 +503,7 @@ implementation if not assigned(lab_set) then begin { tries to found an old entry } - hp1:=tai(asmlist[al_typedconsts].first); + hp1:=tai(current_asmdata.asmlists[al_typedconsts].first); while assigned(hp1) do begin if hp1.typ=ait_label then @@ -554,11 +554,11 @@ implementation { :-(, we must generate a new entry } if not assigned(lab_set) then begin - objectlibrary.getdatalabel(lastlabel); + current_asmdata.getdatalabel(lastlabel); lab_set:=lastlabel; - maybe_new_object_file(asmlist[al_typedconsts]); - new_section(asmlist[al_typedconsts],sec_rodata,lastlabel.name,const_align(sizeof(aint))); - asmlist[al_typedconsts].concat(Tai_label.Create(lastlabel)); + maybe_new_object_file(current_asmdata.asmlists[al_typedconsts]); + new_section(current_asmdata.asmlists[al_typedconsts],sec_rodata,lastlabel.name,const_align(sizeof(aint))); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(lastlabel)); { already handled at the start of this method?? (JM) if tsetdef(resulttype.def).settype=smallset then begin @@ -569,7 +569,7 @@ implementation } begin for i:=0 to 31 do - asmlist[al_typedconsts].concat(Tai_const.Create_8bit(Psetbytes(value_set)^[i xor indexadjust])); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_8bit(Psetbytes(value_set)^[i xor indexadjust])); end; end; end; @@ -599,14 +599,14 @@ implementation begin location_reset(location,LOC_CREFERENCE,OS_NO); { label for GUID } - objectlibrary.getdatalabel(tmplabel); - asmlist[al_typedconsts].concat(tai_align.create(const_align(16))); - asmlist[al_typedconsts].concat(Tai_label.Create(tmplabel)); - asmlist[al_typedconsts].concat(Tai_const.Create_32bit(longint(value.D1))); - asmlist[al_typedconsts].concat(Tai_const.Create_16bit(value.D2)); - asmlist[al_typedconsts].concat(Tai_const.Create_16bit(value.D3)); + current_asmdata.getdatalabel(tmplabel); + current_asmdata.asmlists[al_typedconsts].concat(tai_align.create(const_align(16))); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(tmplabel)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit(longint(value.D1))); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(value.D2)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(value.D3)); for i:=low(value.D4) to high(value.D4) do - asmlist[al_typedconsts].concat(Tai_const.Create_8bit(value.D4[i])); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_8bit(value.D4[i])); location.reference.symbol:=tmplabel; end; diff --git a/compiler/ncgflw.pas b/compiler/ncgflw.pas index 9691f5341c..bb1c08a703 100644 --- a/compiler/ncgflw.pas +++ b/compiler/ncgflw.pas @@ -119,11 +119,11 @@ implementation { we have to synchronise both the regvars used in the loop } { and the ones in the while/until condition } get_used_regvars(self,usedregvars); - gen_sync_regvars(exprasmlist,usedregvars); + gen_sync_regvars(current_asmdata.CurrAsmList,usedregvars); end else begin - gen_sync_regvars(exprasmlist,usedregvars); + gen_sync_regvars(current_asmdata.CurrAsmList,usedregvars); usedregvars.intregvars.done; usedregvars.fpuregvars.done; usedregvars.mmregvars.done; @@ -141,63 +141,63 @@ implementation begin location_reset(location,LOC_VOID,OS_NO); - objectlibrary.getjumplabel(lloop); - objectlibrary.getjumplabel(lcont); - objectlibrary.getjumplabel(lbreak); + current_asmdata.getjumplabel(lloop); + current_asmdata.getjumplabel(lcont); + current_asmdata.getjumplabel(lbreak); { arrange continue and breaklabels: } oldflowcontrol:=flowcontrol; - oldclabel:=aktcontinuelabel; - oldblabel:=aktbreaklabel; + oldclabel:=current_procinfo.CurrContinueLabel; + oldblabel:=current_procinfo.CurrBreakLabel; sync_regvars(true); {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} { handling code at the end as it is much more efficient, and makes while equal to repeat loop, only the end true/false is swapped (PFV) } if lnf_testatbegin in loopflags then - cg.a_jmp_always(exprasmlist,lcont); + cg.a_jmp_always(current_asmdata.CurrAsmList,lcont); if not(cs_opt_size in aktoptimizerswitches) then { align loop target } - exprasmList.concat(Tai_align.Create(aktalignment.loopalign)); + current_asmdata.CurrAsmList.concat(Tai_align.Create(aktalignment.loopalign)); - cg.a_label(exprasmlist,lloop); + cg.a_label(current_asmdata.CurrAsmList,lloop); - aktcontinuelabel:=lcont; - aktbreaklabel:=lbreak; + current_procinfo.CurrContinueLabel:=lcont; + current_procinfo.CurrBreakLabel:=lbreak; if assigned(right) then secondpass(right); {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} - cg.a_label(exprasmlist,lcont); - otlabel:=truelabel; - oflabel:=falselabel; + cg.a_label(current_asmdata.CurrAsmList,lcont); + otlabel:=current_procinfo.CurrTrueLabel; + oflabel:=current_procinfo.CurrFalseLabel; if lnf_checknegate in loopflags then begin - truelabel:=lbreak; - falselabel:=lloop; + current_procinfo.CurrTrueLabel:=lbreak; + current_procinfo.CurrFalseLabel:=lloop; end else begin - truelabel:=lloop; - falselabel:=lbreak; + current_procinfo.CurrTrueLabel:=lloop; + current_procinfo.CurrFalseLabel:=lbreak; end; secondpass(left); - maketojumpbool(exprasmlist,left,lr_load_regvars); - cg.a_label(exprasmlist,lbreak); + maketojumpbool(current_asmdata.CurrAsmList,left,lr_load_regvars); + cg.a_label(current_asmdata.CurrAsmList,lbreak); sync_regvars(false); - truelabel:=otlabel; - falselabel:=oflabel; + current_procinfo.CurrTrueLabel:=otlabel; + current_procinfo.CurrFalseLabel:=oflabel; - aktcontinuelabel:=oldclabel; - aktbreaklabel:=oldblabel; + current_procinfo.CurrContinueLabel:=oldclabel; + current_procinfo.CurrBreakLabel:=oldblabel; { a break/continue in a while/repeat block can't be seen outside } flowcontrol:=oldflowcontrol+(flowcontrol-[fc_break,fc_continue]); end; @@ -220,16 +220,16 @@ implementation else_regvar_loaded_int : Tsuperregisterset; org_list, then_list, - else_list : taasmoutput; + else_list : TAsmList; *) begin location_reset(location,LOC_VOID,OS_NO); - otlabel:=truelabel; - oflabel:=falselabel; - objectlibrary.getjumplabel(truelabel); - objectlibrary.getjumplabel(falselabel); + otlabel:=current_procinfo.CurrTrueLabel; + oflabel:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); secondpass(left); (* @@ -237,11 +237,11 @@ implementation { when processing the else-block } if cs_opt_regvar in aktoptimizerswitches then begin - org_list := exprasmlist; - exprasmlist := taasmoutput.create; + org_list := current_asmdata.CurrAsmList; + current_asmdata.CurrAsmList := TAsmList.create; end; *) - maketojumpbool(exprasmlist,left,lr_dont_load_regvars); + maketojumpbool(current_asmdata.CurrAsmList,left,lr_dont_load_regvars); (* if cs_opt_regvar in aktoptimizerswitches then @@ -253,7 +253,7 @@ implementation if assigned(right) then begin - cg.a_label(exprasmlist,truelabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); secondpass(right); end; @@ -266,8 +266,8 @@ implementation then_regvar_loaded_other := rg.regvar_loaded_other; rg.regvar_loaded_int := org_regvar_loaded_int; rg.regvar_loaded_other := org_regvar_loaded_other; - then_list := exprasmlist; - exprasmlist := taasmoutput.create; + then_list := current_asmdata.CurrAsmList; + current_asmdata.CurrAsmList := TAsmList.create; end; } @@ -275,20 +275,20 @@ implementation begin if assigned(right) then begin - objectlibrary.getjumplabel(hl); + current_asmdata.getjumplabel(hl); { do go back to if line !! } (* if not(cs_opt_regvar in aktoptimizerswitches) then *) - aktfilepos:=exprasmList.getlasttaifilepos^ + aktfilepos:=current_asmdata.CurrAsmList.getlasttaifilepos^ (* else aktfilepos:=then_list.getlasttaifilepos^ *) ; - cg.a_jmp_always(exprasmlist,hl); + cg.a_jmp_always(current_asmdata.CurrAsmList,hl); end; - cg.a_label(exprasmlist,falselabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); secondpass(t1); (* { save current asmlist (previous instructions + else-block) } @@ -297,12 +297,12 @@ implementation begin { else_regvar_loaded_int := rg.regvar_loaded_int; else_regvar_loaded_other := rg.regvar_loaded_other;} - else_list := exprasmlist; - exprasmlist := taasmoutput.create; + else_list := current_asmdata.CurrAsmList; + current_asmdata.CurrAsmList := TAsmList.create; end; *) if assigned(right) then - cg.a_label(exprasmlist,hl); + cg.a_label(current_asmdata.CurrAsmList,hl); end else begin @@ -311,15 +311,15 @@ implementation begin { else_regvar_loaded_int := rg.regvar_loaded_int; else_regvar_loaded_other := rg.regvar_loaded_other;} - else_list := exprasmlist; - exprasmlist := taasmoutput.create; + else_list := current_asmdata.CurrAsmList; + current_asmdata.CurrAsmList := TAsmList.create; end; *) - cg.a_label(exprasmlist,falselabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); end; if not(assigned(right)) then begin - cg.a_label(exprasmlist,truelabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); end; (* @@ -351,14 +351,14 @@ implementation then_list.free; org_list.concatlist(else_list); else_list.free; - org_list.concatlist(exprasmlist); - exprasmlist.free; - exprasmlist := org_list; + org_list.concatlist(current_asmdata.CurrAsmList); + current_asmdata.CurrAsmList.free; + current_asmdata.CurrAsmList := org_list; end; *) - truelabel:=otlabel; - falselabel:=oflabel; + current_procinfo.CurrTrueLabel:=otlabel; + current_procinfo.CurrFalseLabel:=oflabel; end; @@ -389,11 +389,11 @@ implementation if (t1.location.loc = LOC_CREGISTER) then get_used_regvars(t1,usedregvars); - gen_sync_regvars(exprasmlist,usedregvars); + gen_sync_regvars(current_asmdata.CurrAsmList,usedregvars); end else begin - gen_sync_regvars(exprasmlist,usedregvars); + gen_sync_regvars(current_asmdata.CurrAsmList,usedregvars); usedregvars.intregvars.done; usedregvars.fpuregvars.done; usedregvars.mmregvars.done; @@ -416,11 +416,11 @@ implementation begin location_reset(location,LOC_VOID,OS_NO); oldflowcontrol:=flowcontrol; - oldclabel:=aktcontinuelabel; - oldblabel:=aktbreaklabel; - objectlibrary.getjumplabel(aktcontinuelabel); - objectlibrary.getjumplabel(aktbreaklabel); - objectlibrary.getjumplabel(l3); + oldclabel:=current_procinfo.CurrContinueLabel; + oldblabel:=current_procinfo.CurrBreakLabel; + current_asmdata.getjumplabel(current_procinfo.CurrContinueLabel); + current_asmdata.getjumplabel(current_procinfo.CurrBreakLabel); + current_asmdata.getjumplabel(l3); { only calculate reference } opsize := def_cgsize(left.resulttype.def); @@ -441,7 +441,7 @@ implementation if t1.nodetype<>ordconstn then begin do_loopvar_at_end:=false; - location_force_reg(exprasmlist,t1.location,t1.location.size,true); + location_force_reg(current_asmdata.CurrAsmList,t1.location,t1.location.size,true); temptovalue:=true; end else @@ -453,10 +453,10 @@ implementation case left.location.loc of LOC_REFERENCE, LOC_CREFERENCE : - cg.a_load_loc_ref(exprasmlist,left.location.size,right.location,left.location.reference); + cg.a_load_loc_ref(current_asmdata.CurrAsmList,left.location.size,right.location,left.location.reference); LOC_REGISTER, LOC_CREGISTER : - cg.a_load_loc_reg(exprasmlist,left.location.size,right.location,left.location.register); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,left.location.size,right.location,left.location.register); else internalerror(200501311); end; @@ -474,21 +474,21 @@ implementation sync_regvars(true); {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} if temptovalue then begin - cg.a_cmp_reg_loc_label(exprasmlist,opsize,hcond, - t1.location.register,left.location,aktbreaklabel); + cg.a_cmp_reg_loc_label(current_asmdata.CurrAsmList,opsize,hcond, + t1.location.register,left.location,current_procinfo.CurrBreakLabel); end else begin if lnf_testatbegin in loopflags then begin - cg.a_cmp_const_loc_label(exprasmlist,opsize,hcond, + cg.a_cmp_const_loc_label(current_asmdata.CurrAsmList,opsize,hcond, tordconstnode(t1).value, - left.location,aktbreaklabel); + left.location,current_procinfo.CurrBreakLabel); end; end; @@ -501,16 +501,16 @@ implementation hop:=OP_ADD else hop:=OP_SUB; - cg.a_op_const_loc(exprasmlist,hop,1,left.location); + cg.a_op_const_loc(current_asmdata.CurrAsmList,hop,1,left.location); end; if assigned(entrylabel) then - cg.a_jmp_always(exprasmlist,tcglabelnode(entrylabel).getasmlabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,tcglabelnode(entrylabel).getasmlabel); { align loop target } if not(cs_opt_size in aktoptimizerswitches) then - exprasmList.concat(Tai_align.Create(aktalignment.loopalign)); - cg.a_label(exprasmlist,l3); + current_asmdata.CurrAsmList.concat(Tai_align.Create(aktalignment.loopalign)); + cg.a_label(current_asmdata.CurrAsmList,l3); {If the loopvar doesn't mind on exit, we avoid the loopvar inc/dec after the loop body instead of here.} @@ -521,14 +521,14 @@ implementation hop:=OP_SUB else hop:=OP_ADD; - cg.a_op_const_loc(exprasmlist,hop,1,left.location); + cg.a_op_const_loc(current_asmdata.CurrAsmList,hop,1,left.location); end; if assigned(t2) then begin secondpass(t2); {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} end; @@ -541,10 +541,10 @@ implementation hop:=OP_SUB else hop:=OP_ADD; - cg.a_op_const_loc(exprasmlist,hop,1,left.location); + cg.a_op_const_loc(current_asmdata.CurrAsmList,hop,1,left.location); end; - cg.a_label(exprasmlist,aktcontinuelabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrContinueLabel); if do_loopvar_at_end then if lnf_backward in loopflags then @@ -569,14 +569,14 @@ implementation else hcond:=OC_B; {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} { produce comparison and the corresponding } { jump } if temptovalue then begin - cg.a_cmp_reg_loc_label(exprasmlist,opsize,hcond,t1.location.register, + cg.a_cmp_reg_loc_label(current_asmdata.CurrAsmList,opsize,hcond,t1.location.register, left.location,l3); end else @@ -744,17 +744,17 @@ implementation end; end; - cg.a_cmp_const_loc_label(exprasmlist,opsize,hcond, - cmp_const,left.location,l3); + cg.a_cmp_const_loc_label(current_asmdata.CurrAsmList,opsize,hcond, + aint(cmp_const),left.location,l3); end; { this is the break label: } - cg.a_label(exprasmlist,aktbreaklabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrBreakLabel); sync_regvars(false); - aktcontinuelabel:=oldclabel; - aktbreaklabel:=oldblabel; + current_procinfo.CurrContinueLabel:=oldclabel; + current_procinfo.CurrBreakLabel:=oldblabel; { a break/continue in a while/repeat block can't be seen outside } flowcontrol:=oldflowcontrol+(flowcontrol-[fc_break,fc_continue]); end; @@ -772,7 +772,7 @@ implementation if assigned(left) then secondpass(left); - cg.a_jmp_always(exprasmlist,current_procinfo.aktexitlabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrExitLabel); end; @@ -785,12 +785,12 @@ implementation location_reset(location,LOC_VOID,OS_NO); include(flowcontrol,fc_break); - if aktbreaklabel<>nil then + if current_procinfo.CurrBreakLabel<>nil then begin {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} - cg.a_jmp_always(exprasmlist,aktbreaklabel) + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrBreakLabel) end else CGMessage(cg_e_break_not_allowed); @@ -806,12 +806,12 @@ implementation location_reset(location,LOC_VOID,OS_NO); include(flowcontrol,fc_continue); - if aktcontinuelabel<>nil then + if current_procinfo.CurrContinueLabel<>nil then begin {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} - cg.a_jmp_always(exprasmlist,aktcontinuelabel) + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrContinueLabel) end else CGMessage(cg_e_continue_not_allowed); @@ -828,9 +828,9 @@ implementation location_reset(location,LOC_VOID,OS_NO); {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} - cg.a_jmp_always(exprasmlist,tcglabelnode(labelnode).getasmlabel) + cg.a_jmp_always(current_asmdata.CurrAsmList,tcglabelnode(labelnode).getasmlabel) end; @@ -841,7 +841,7 @@ implementation function tcglabelnode.getasmlabel : tasmlabel; begin if not(assigned(asmlabel)) then - objectlibrary.getjumplabel(asmlabel); + current_asmdata.getjumplabel(asmlabel); result:=asmlabel end; @@ -851,9 +851,9 @@ implementation location_reset(location,LOC_VOID,OS_NO); {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} - cg.a_label(exprasmlist,getasmlabel); + cg.a_label(current_asmdata.CurrAsmList,getasmlabel); secondpass(left); end; @@ -893,46 +893,46 @@ implementation { Push parameters } if assigned(right) then begin - paramanager.allocparaloc(exprasmlist,paraloc3); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc3); if assigned(frametree) then - cg.a_param_loc(exprasmlist,frametree.location,paraloc3) + cg.a_param_loc(current_asmdata.CurrAsmList,frametree.location,paraloc3) else - cg.a_param_const(exprasmlist,OS_INT,0,paraloc3); + cg.a_param_const(current_asmdata.CurrAsmList,OS_INT,0,paraloc3); { push address } - paramanager.allocparaloc(exprasmlist,paraloc2); - cg.a_param_loc(exprasmlist,right.location,paraloc2); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc2); + cg.a_param_loc(current_asmdata.CurrAsmList,right.location,paraloc2); end else begin { get current address } - objectlibrary.getaddrlabel(a); - cg.a_label(exprasmlist,a); + current_asmdata.getaddrlabel(a); + cg.a_label(current_asmdata.CurrAsmList,a); reference_reset_symbol(href2,a,0); { push current frame } - paramanager.allocparaloc(exprasmlist,paraloc3); - cg.a_param_reg(exprasmlist,OS_ADDR,NR_FRAME_POINTER_REG,paraloc3); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc3); + cg.a_param_reg(current_asmdata.CurrAsmList,OS_ADDR,NR_FRAME_POINTER_REG,paraloc3); { push current address } - paramanager.allocparaloc(exprasmlist,paraloc2); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc2); if target_info.system <> system_powerpc_macos then - cg.a_paramaddr_ref(exprasmlist,href2,paraloc2) + cg.a_paramaddr_ref(current_asmdata.CurrAsmList,href2,paraloc2) else - cg.a_param_const(exprasmlist,OS_INT,0,paraloc2); + cg.a_param_const(current_asmdata.CurrAsmList,OS_INT,0,paraloc2); end; - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_loc(exprasmlist,left.location,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc2); - paramanager.freeparaloc(exprasmlist,paraloc3); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_RAISEEXCEPTION'); - cg.deallocallcpuregisters(exprasmlist); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_loc(current_asmdata.CurrAsmList,left.location,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc2); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc3); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_RAISEEXCEPTION'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); end else begin - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK'); - cg.a_call_name(exprasmlist,'FPC_RERAISE'); - cg.deallocallcpuregisters(exprasmlist); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK'); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_RERAISE'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); end; paraloc1.done; paraloc2.done; @@ -954,17 +954,17 @@ implementation var paraloc1 : tcgpara; begin - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_POPOBJECTSTACK'); - cg.deallocallcpuregisters(exprasmlist); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPOBJECTSTACK'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); paraloc1.init; paramanager.getintparaloc(pocall_default,1,paraloc1); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_reg(exprasmlist,OS_ADDR,NR_FUNCTION_RESULT_REG,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_DESTROYEXCEPTION'); - cg.deallocallcpuregisters(exprasmlist); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_reg(current_asmdata.CurrAsmList,OS_ADDR,NR_FUNCTION_RESULT_REG,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DESTROYEXCEPTION'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); paraloc1.done; end; @@ -982,9 +982,9 @@ implementation breaktrylabel, doobjectdestroy, doobjectdestroyandreraise, - oldaktexitlabel, - oldaktcontinuelabel, - oldaktbreaklabel : tasmlabel; + oldCurrExitLabel, + oldContinueLabel, + oldBreakLabel : tasmlabel; oldflowcontrol,tryflowcontrol, exceptflowcontrol : tflowcontrol; destroytemps, @@ -998,44 +998,44 @@ implementation oldflowcontrol:=flowcontrol; flowcontrol:=[]; { this can be called recursivly } - oldaktbreaklabel:=nil; - oldaktcontinuelabel:=nil; + oldBreakLabel:=nil; + oldContinueLabel:=nil; oldendexceptlabel:=endexceptlabel; { save the old labels for control flow statements } - oldaktexitlabel:=current_procinfo.aktexitlabel; - if assigned(aktbreaklabel) then + oldCurrExitLabel:=current_procinfo.CurrExitLabel; + if assigned(current_procinfo.CurrBreakLabel) then begin - oldaktcontinuelabel:=aktcontinuelabel; - oldaktbreaklabel:=aktbreaklabel; + oldContinueLabel:=current_procinfo.CurrContinueLabel; + oldBreakLabel:=current_procinfo.CurrBreakLabel; end; { get new labels for the control flow statements } - objectlibrary.getjumplabel(exittrylabel); - objectlibrary.getjumplabel(exitexceptlabel); - if assigned(aktbreaklabel) then + current_asmdata.getjumplabel(exittrylabel); + current_asmdata.getjumplabel(exitexceptlabel); + if assigned(current_procinfo.CurrBreakLabel) then begin - objectlibrary.getjumplabel(breaktrylabel); - objectlibrary.getjumplabel(continuetrylabel); - objectlibrary.getjumplabel(breakexceptlabel); - objectlibrary.getjumplabel(continueexceptlabel); + current_asmdata.getjumplabel(breaktrylabel); + current_asmdata.getjumplabel(continuetrylabel); + current_asmdata.getjumplabel(breakexceptlabel); + current_asmdata.getjumplabel(continueexceptlabel); end; - objectlibrary.getjumplabel(exceptlabel); - objectlibrary.getjumplabel(doexceptlabel); - objectlibrary.getjumplabel(endexceptlabel); - objectlibrary.getjumplabel(lastonlabel); + current_asmdata.getjumplabel(exceptlabel); + current_asmdata.getjumplabel(doexceptlabel); + current_asmdata.getjumplabel(endexceptlabel); + current_asmdata.getjumplabel(lastonlabel); - get_exception_temps(exprasmlist,excepttemps); - new_exception(exprasmlist,excepttemps,exceptlabel); + get_exception_temps(current_asmdata.CurrAsmList,excepttemps); + new_exception(current_asmdata.CurrAsmList,excepttemps,exceptlabel); { try block } { set control flow labels for the try block } - current_procinfo.aktexitlabel:=exittrylabel; - if assigned(oldaktbreaklabel) then + current_procinfo.CurrExitLabel:=exittrylabel; + if assigned(oldBreakLabel) then begin - aktcontinuelabel:=continuetrylabel; - aktbreaklabel:=breaktrylabel; + current_procinfo.CurrContinueLabel:=continuetrylabel; + current_procinfo.CurrBreakLabel:=breaktrylabel; end; flowcontrol:=[]; @@ -1044,19 +1044,19 @@ implementation if codegenerror then goto errorexit; - cg.a_label(exprasmlist,exceptlabel); + cg.a_label(current_asmdata.CurrAsmList,exceptlabel); - free_exception(exprasmlist, excepttemps, 0, endexceptlabel, false); + free_exception(current_asmdata.CurrAsmList, excepttemps, 0, endexceptlabel, false); - cg.a_label(exprasmlist,doexceptlabel); + cg.a_label(current_asmdata.CurrAsmList,doexceptlabel); { set control flow labels for the except block } { and the on statements } - current_procinfo.aktexitlabel:=exitexceptlabel; - if assigned(oldaktbreaklabel) then + current_procinfo.CurrExitLabel:=exitexceptlabel; + if assigned(oldBreakLabel) then begin - aktcontinuelabel:=continueexceptlabel; - aktbreaklabel:=breakexceptlabel; + current_procinfo.CurrContinueLabel:=continueexceptlabel; + current_procinfo.CurrBreakLabel:=breakexceptlabel; end; flowcontrol:=[]; @@ -1064,7 +1064,7 @@ implementation if assigned(right) then secondpass(right); - cg.a_label(exprasmlist,lastonlabel); + cg.a_label(current_asmdata.CurrAsmList,lastonlabel); { default handling except handling } if assigned(t1) then begin @@ -1073,142 +1073,142 @@ implementation } paraloc1.init; paramanager.getintparaloc(pocall_default,1,paraloc1); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_const(exprasmlist,OS_ADDR,-1,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_CATCHES'); - cg.deallocallcpuregisters(exprasmlist); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_const(current_asmdata.CurrAsmList,OS_ADDR,-1,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_CATCHES'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); paraloc1.done; { the destruction of the exception object must be also } { guarded by an exception frame } - objectlibrary.getjumplabel(doobjectdestroy); - objectlibrary.getjumplabel(doobjectdestroyandreraise); + current_asmdata.getjumplabel(doobjectdestroy); + current_asmdata.getjumplabel(doobjectdestroyandreraise); - get_exception_temps(exprasmlist,destroytemps); - new_exception(exprasmlist,destroytemps,doobjectdestroyandreraise); + get_exception_temps(current_asmdata.CurrAsmList,destroytemps); + new_exception(current_asmdata.CurrAsmList,destroytemps,doobjectdestroyandreraise); { here we don't have to reset flowcontrol } { the default and on flowcontrols are handled equal } secondpass(t1); exceptflowcontrol:=flowcontrol; - cg.a_label(exprasmlist,doobjectdestroyandreraise); + cg.a_label(current_asmdata.CurrAsmList,doobjectdestroyandreraise); - free_exception(exprasmlist,destroytemps,0,doobjectdestroy,false); + free_exception(current_asmdata.CurrAsmList,destroytemps,0,doobjectdestroy,false); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_POPSECONDOBJECTSTACK'); - cg.deallocallcpuregisters(exprasmlist); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPSECONDOBJECTSTACK'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); paraloc1.init; paramanager.getintparaloc(pocall_default,1,paraloc1); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_reg(exprasmlist, OS_ADDR, NR_FUNCTION_RESULT_REG, paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_DESTROYEXCEPTION'); - cg.deallocallcpuregisters(exprasmlist); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_reg(current_asmdata.CurrAsmList, OS_ADDR, NR_FUNCTION_RESULT_REG, paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DESTROYEXCEPTION'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); paraloc1.done; { we don't need to restore esi here because reraise never } { returns } - cg.a_call_name(exprasmlist,'FPC_RERAISE'); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_RERAISE'); - cg.a_label(exprasmlist,doobjectdestroy); + cg.a_label(current_asmdata.CurrAsmList,doobjectdestroy); cleanupobjectstack; - unget_exception_temps(exprasmlist,destroytemps); - cg.a_jmp_always(exprasmlist,endexceptlabel); + unget_exception_temps(current_asmdata.CurrAsmList,destroytemps); + cg.a_jmp_always(current_asmdata.CurrAsmList,endexceptlabel); end else begin - cg.a_call_name(exprasmlist,'FPC_RERAISE'); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_RERAISE'); exceptflowcontrol:=flowcontrol; end; if fc_exit in exceptflowcontrol then begin { do some magic for exit in the try block } - cg.a_label(exprasmlist,exitexceptlabel); + cg.a_label(current_asmdata.CurrAsmList,exitexceptlabel); { we must also destroy the address frame which guards } { exception object } - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK'); - cg.deallocallcpuregisters(exprasmlist); - cg.g_exception_reason_load(exprasmlist,excepttemps.reasonbuf); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); + cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf); cleanupobjectstack; - cg.a_jmp_always(exprasmlist,oldaktexitlabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,oldCurrExitLabel); end; if fc_break in exceptflowcontrol then begin - cg.a_label(exprasmlist,breakexceptlabel); + cg.a_label(current_asmdata.CurrAsmList,breakexceptlabel); { we must also destroy the address frame which guards } { exception object } - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK'); - cg.deallocallcpuregisters(exprasmlist); - cg.g_exception_reason_load(exprasmlist,excepttemps.reasonbuf); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); + cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf); cleanupobjectstack; - cg.a_jmp_always(exprasmlist,oldaktbreaklabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,oldBreakLabel); end; if fc_continue in exceptflowcontrol then begin - cg.a_label(exprasmlist,continueexceptlabel); + cg.a_label(current_asmdata.CurrAsmList,continueexceptlabel); { we must also destroy the address frame which guards } { exception object } - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK'); - cg.deallocallcpuregisters(exprasmlist); - cg.g_exception_reason_load(exprasmlist,excepttemps.reasonbuf); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); + cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf); cleanupobjectstack; - cg.a_jmp_always(exprasmlist,oldaktcontinuelabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,oldContinueLabel); end; if fc_exit in tryflowcontrol then begin { do some magic for exit in the try block } - cg.a_label(exprasmlist,exittrylabel); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK'); - cg.deallocallcpuregisters(exprasmlist); - cg.g_exception_reason_load(exprasmlist,excepttemps.reasonbuf); - cg.a_jmp_always(exprasmlist,oldaktexitlabel); + cg.a_label(current_asmdata.CurrAsmList,exittrylabel); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); + cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf); + cg.a_jmp_always(current_asmdata.CurrAsmList,oldCurrExitLabel); end; if fc_break in tryflowcontrol then begin - cg.a_label(exprasmlist,breaktrylabel); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK'); - cg.deallocallcpuregisters(exprasmlist); - cg.g_exception_reason_load(exprasmlist,excepttemps.reasonbuf); - cg.a_jmp_always(exprasmlist,oldaktbreaklabel); + cg.a_label(current_asmdata.CurrAsmList,breaktrylabel); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); + cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf); + cg.a_jmp_always(current_asmdata.CurrAsmList,oldBreakLabel); end; if fc_continue in tryflowcontrol then begin - cg.a_label(exprasmlist,continuetrylabel); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_POPADDRSTACK'); - cg.deallocallcpuregisters(exprasmlist); - cg.g_exception_reason_load(exprasmlist,excepttemps.reasonbuf); - cg.a_jmp_always(exprasmlist,oldaktcontinuelabel); + cg.a_label(current_asmdata.CurrAsmList,continuetrylabel); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPADDRSTACK'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); + cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf); + cg.a_jmp_always(current_asmdata.CurrAsmList,oldContinueLabel); end; - unget_exception_temps(exprasmlist,excepttemps); - cg.a_label(exprasmlist,endexceptlabel); + unget_exception_temps(current_asmdata.CurrAsmList,excepttemps); + cg.a_label(current_asmdata.CurrAsmList,endexceptlabel); errorexit: { restore all saved labels } endexceptlabel:=oldendexceptlabel; { restore the control flow labels } - current_procinfo.aktexitlabel:=oldaktexitlabel; - if assigned(oldaktbreaklabel) then + current_procinfo.CurrExitLabel:=oldCurrExitLabel; + if assigned(oldBreakLabel) then begin - aktcontinuelabel:=oldaktcontinuelabel; - aktbreaklabel:=oldaktbreaklabel; + current_procinfo.CurrContinueLabel:=oldContinueLabel; + current_procinfo.CurrBreakLabel:=oldBreakLabel; end; { return all used control flow statements } @@ -1223,11 +1223,11 @@ implementation exitonlabel, continueonlabel, breakonlabel, - oldaktexitlabel, - oldaktcontinuelabel, + oldCurrExitLabel, + oldContinueLabel, doobjectdestroyandreraise, doobjectdestroy, - oldaktbreaklabel : tasmlabel; + oldBreakLabel : tasmlabel; oldflowcontrol : tflowcontrol; excepttemps : texceptiontemps; exceptref, @@ -1239,93 +1239,93 @@ implementation oldflowcontrol:=flowcontrol; flowcontrol:=[]; - objectlibrary.getjumplabel(nextonlabel); + current_asmdata.getjumplabel(nextonlabel); { send the vmt parameter } - reference_reset_symbol(href2,objectlibrary.newasmsymbol(excepttype.vmt_mangledname,AB_EXTERNAL,AT_DATA),0); + reference_reset_symbol(href2,current_asmdata.newasmsymbol(excepttype.vmt_mangledname,AB_EXTERNAL,AT_DATA),0); paramanager.getintparaloc(pocall_default,1,paraloc1); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_paramaddr_ref(exprasmlist,href2,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_CATCHES'); - cg.deallocallcpuregisters(exprasmlist); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_paramaddr_ref(current_asmdata.CurrAsmList,href2,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_CATCHES'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); { is it this catch? No. go to next onlabel } - cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,NR_FUNCTION_RESULT_REG,nextonlabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_EQ,0,NR_FUNCTION_RESULT_REG,nextonlabel); { what a hack ! } if assigned(exceptsymtable) then begin tlocalvarsym(exceptsymtable.symindex.first).localloc.loc:=LOC_REFERENCE; tlocalvarsym(exceptsymtable.symindex.first).localloc.size:=OS_ADDR; - tg.GetLocal(exprasmlist,sizeof(aint),voidpointertype.def, + tg.GetLocal(current_asmdata.CurrAsmList,sizeof(aint),voidpointertype.def, tlocalvarsym(exceptsymtable.symindex.first).localloc.reference); - cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,tlocalvarsym(exceptsymtable.symindex.first).localloc.reference); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,tlocalvarsym(exceptsymtable.symindex.first).localloc.reference); end else begin - tg.GetTemp(exprasmlist,sizeof(aint),tt_normal,exceptref); - cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,exceptref); + tg.GetTemp(current_asmdata.CurrAsmList,sizeof(aint),tt_normal,exceptref); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,exceptref); end; { in the case that another exception is risen we've to destroy the old one } - objectlibrary.getjumplabel(doobjectdestroyandreraise); + current_asmdata.getjumplabel(doobjectdestroyandreraise); { call setjmp, and jump to finally label on non-zero result } - get_exception_temps(exprasmlist,excepttemps); - new_exception(exprasmlist,excepttemps,doobjectdestroyandreraise); + get_exception_temps(current_asmdata.CurrAsmList,excepttemps); + new_exception(current_asmdata.CurrAsmList,excepttemps,doobjectdestroyandreraise); - oldaktbreaklabel:=nil; - oldaktcontinuelabel:=nil; + oldBreakLabel:=nil; + oldContinueLabel:=nil; if assigned(right) then begin - oldaktexitlabel:=current_procinfo.aktexitlabel; - objectlibrary.getjumplabel(exitonlabel); - current_procinfo.aktexitlabel:=exitonlabel; - if assigned(aktbreaklabel) then + oldCurrExitLabel:=current_procinfo.CurrExitLabel; + current_asmdata.getjumplabel(exitonlabel); + current_procinfo.CurrExitLabel:=exitonlabel; + if assigned(current_procinfo.CurrBreakLabel) then begin - oldaktcontinuelabel:=aktcontinuelabel; - oldaktbreaklabel:=aktbreaklabel; - objectlibrary.getjumplabel(breakonlabel); - objectlibrary.getjumplabel(continueonlabel); - aktcontinuelabel:=continueonlabel; - aktbreaklabel:=breakonlabel; + oldContinueLabel:=current_procinfo.CurrContinueLabel; + oldBreakLabel:=current_procinfo.CurrBreakLabel; + current_asmdata.getjumplabel(breakonlabel); + current_asmdata.getjumplabel(continueonlabel); + current_procinfo.CurrContinueLabel:=continueonlabel; + current_procinfo.CurrBreakLabel:=breakonlabel; end; secondpass(right); end; - objectlibrary.getjumplabel(doobjectdestroy); - cg.a_label(exprasmlist,doobjectdestroyandreraise); + current_asmdata.getjumplabel(doobjectdestroy); + cg.a_label(current_asmdata.CurrAsmList,doobjectdestroyandreraise); - free_exception(exprasmlist,excepttemps,0,doobjectdestroy,false); + free_exception(current_asmdata.CurrAsmList,excepttemps,0,doobjectdestroy,false); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_POPSECONDOBJECTSTACK'); - cg.deallocallcpuregisters(exprasmlist); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_POPSECONDOBJECTSTACK'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); paramanager.getintparaloc(pocall_default,1,paraloc1); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_reg(exprasmlist, OS_ADDR, NR_FUNCTION_RESULT_REG, paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_DESTROYEXCEPTION'); - cg.deallocallcpuregisters(exprasmlist); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_reg(current_asmdata.CurrAsmList, OS_ADDR, NR_FUNCTION_RESULT_REG, paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DESTROYEXCEPTION'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); { we don't need to store/restore registers here because reraise never returns } - cg.a_call_name(exprasmlist,'FPC_RERAISE'); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_RERAISE'); - cg.a_label(exprasmlist,doobjectdestroy); + cg.a_label(current_asmdata.CurrAsmList,doobjectdestroy); cleanupobjectstack; { clear some stuff } if assigned(exceptsymtable) then begin - tg.UngetLocal(exprasmlist,tlocalvarsym(exceptsymtable.symindex.first).localloc.reference); + tg.UngetLocal(current_asmdata.CurrAsmList,tlocalvarsym(exceptsymtable.symindex.first).localloc.reference); tlocalvarsym(exceptsymtable.symindex.first).localloc.loc:=LOC_INVALID; end else - tg.Ungettemp(exprasmlist,exceptref); - cg.a_jmp_always(exprasmlist,endexceptlabel); + tg.Ungettemp(current_asmdata.CurrAsmList,exceptref); + cg.a_jmp_always(current_asmdata.CurrAsmList,endexceptlabel); if assigned(right) then begin @@ -1333,34 +1333,34 @@ implementation if fc_exit in flowcontrol then begin { the address and object pop does secondtryexcept } - cg.a_label(exprasmlist,exitonlabel); - cg.a_jmp_always(exprasmlist,oldaktexitlabel); + cg.a_label(current_asmdata.CurrAsmList,exitonlabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,oldCurrExitLabel); end; if fc_break in flowcontrol then begin { the address and object pop does secondtryexcept } - cg.a_label(exprasmlist,breakonlabel); - cg.a_jmp_always(exprasmlist,oldaktbreaklabel); + cg.a_label(current_asmdata.CurrAsmList,breakonlabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,oldBreakLabel); end; if fc_continue in flowcontrol then begin { the address and object pop does secondtryexcept } - cg.a_label(exprasmlist,continueonlabel); - cg.a_jmp_always(exprasmlist,oldaktcontinuelabel); + cg.a_label(current_asmdata.CurrAsmList,continueonlabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,oldContinueLabel); end; - current_procinfo.aktexitlabel:=oldaktexitlabel; - if assigned(oldaktbreaklabel) then + current_procinfo.CurrExitLabel:=oldCurrExitLabel; + if assigned(oldBreakLabel) then begin - aktcontinuelabel:=oldaktcontinuelabel; - aktbreaklabel:=oldaktbreaklabel; + current_procinfo.CurrContinueLabel:=oldContinueLabel; + current_procinfo.CurrBreakLabel:=oldBreakLabel; end; end; - unget_exception_temps(exprasmlist,excepttemps); - cg.a_label(exprasmlist,nextonlabel); + unget_exception_temps(current_asmdata.CurrAsmList,excepttemps); + cg.a_label(current_asmdata.CurrAsmList,nextonlabel); flowcontrol:=oldflowcontrol+flowcontrol; paraloc1.done; @@ -1381,9 +1381,9 @@ implementation exitfinallylabel, continuefinallylabel, breakfinallylabel, - oldaktexitlabel, - oldaktcontinuelabel, - oldaktbreaklabel : tasmlabel; + oldCurrExitLabel, + oldContinueLabel, + oldBreakLabel : tasmlabel; oldflowcontrol,tryflowcontrol : tflowcontrol; decconst : longint; excepttemps : texceptiontemps; @@ -1393,22 +1393,22 @@ implementation { check if child nodes do a break/continue/exit } oldflowcontrol:=flowcontrol; flowcontrol:=[]; - objectlibrary.getjumplabel(finallylabel); - objectlibrary.getjumplabel(endfinallylabel); - objectlibrary.getjumplabel(reraiselabel); + current_asmdata.getjumplabel(finallylabel); + current_asmdata.getjumplabel(endfinallylabel); + current_asmdata.getjumplabel(reraiselabel); { the finally block must catch break, continue and exit } { statements } - oldaktexitlabel:=current_procinfo.aktexitlabel; + oldCurrExitLabel:=current_procinfo.CurrExitLabel; if implicitframe then exitfinallylabel:=finallylabel else - objectlibrary.getjumplabel(exitfinallylabel); - current_procinfo.aktexitlabel:=exitfinallylabel; - if assigned(aktbreaklabel) then + current_asmdata.getjumplabel(exitfinallylabel); + current_procinfo.CurrExitLabel:=exitfinallylabel; + if assigned(current_procinfo.CurrBreakLabel) then begin - oldaktcontinuelabel:=aktcontinuelabel; - oldaktbreaklabel:=aktbreaklabel; + oldContinueLabel:=current_procinfo.CurrContinueLabel; + oldBreakLabel:=current_procinfo.CurrBreakLabel; if implicitframe then begin breakfinallylabel:=finallylabel; @@ -1416,16 +1416,16 @@ implementation end else begin - objectlibrary.getjumplabel(breakfinallylabel); - objectlibrary.getjumplabel(continuefinallylabel); + current_asmdata.getjumplabel(breakfinallylabel); + current_asmdata.getjumplabel(continuefinallylabel); end; - aktcontinuelabel:=continuefinallylabel; - aktbreaklabel:=breakfinallylabel; + current_procinfo.CurrContinueLabel:=continuefinallylabel; + current_procinfo.CurrBreakLabel:=breakfinallylabel; end; { call setjmp, and jump to finally label on non-zero result } - get_exception_temps(exprasmlist,excepttemps); - new_exception(exprasmlist,excepttemps,finallylabel); + get_exception_temps(current_asmdata.CurrAsmList,excepttemps); + new_exception(current_asmdata.CurrAsmList,excepttemps,finallylabel); { try code } if assigned(left) then @@ -1436,9 +1436,9 @@ implementation exit; end; - cg.a_label(exprasmlist,finallylabel); + cg.a_label(current_asmdata.CurrAsmList,finallylabel); { just free the frame information } - free_exception(exprasmlist,excepttemps,1,finallylabel,true); + free_exception(current_asmdata.CurrAsmList,excepttemps,1,finallylabel,true); { finally code } flowcontrol:=[]; @@ -1449,10 +1449,10 @@ implementation exit; { the value should now be in the exception handler } - cg.g_exception_reason_load(exprasmlist,excepttemps.reasonbuf); + cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf); if implicitframe then begin - cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,endfinallylabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,endfinallylabel); { finally code only needed to be executed on exception } flowcontrol:=[]; secondpass(t1); @@ -1460,67 +1460,67 @@ implementation CGMessage(cg_e_control_flow_outside_finally); if codegenerror then exit; - cg.a_call_name(exprasmlist,'FPC_RERAISE'); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_RERAISE'); end else begin - cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,endfinallylabel); - cg.a_op_const_reg(exprasmlist,OP_SUB,OS_INT,1,NR_FUNCTION_RESULT_REG); - cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,reraiselabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,endfinallylabel); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,1,NR_FUNCTION_RESULT_REG); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,reraiselabel); if fc_exit in tryflowcontrol then begin - cg.a_op_const_reg(exprasmlist,OP_SUB,OS_INT,1,NR_FUNCTION_RESULT_REG); - cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldaktexitlabel); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,1,NR_FUNCTION_RESULT_REG); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldCurrExitLabel); decconst:=1; end else decconst:=2; if fc_break in tryflowcontrol then begin - cg.a_op_const_reg(exprasmlist,OP_SUB,OS_INT,decconst,NR_FUNCTION_RESULT_REG); - cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldaktbreaklabel); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,decconst,NR_FUNCTION_RESULT_REG); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldBreakLabel); decconst:=1; end else inc(decconst); if fc_continue in tryflowcontrol then begin - cg.a_op_const_reg(exprasmlist,OP_SUB,OS_INT,decconst,NR_FUNCTION_RESULT_REG); - cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldaktcontinuelabel); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT,decconst,NR_FUNCTION_RESULT_REG); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,0,NR_FUNCTION_RESULT_REG,oldContinueLabel); end; - cg.a_label(exprasmlist,reraiselabel); - cg.a_call_name(exprasmlist,'FPC_RERAISE'); + cg.a_label(current_asmdata.CurrAsmList,reraiselabel); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_RERAISE'); { do some magic for exit,break,continue in the try block } if fc_exit in tryflowcontrol then begin - cg.a_label(exprasmlist,exitfinallylabel); - cg.g_exception_reason_load(exprasmlist,excepttemps.reasonbuf); - cg.g_exception_reason_save_const(exprasmlist,excepttemps.reasonbuf,2); - cg.a_jmp_always(exprasmlist,finallylabel); + cg.a_label(current_asmdata.CurrAsmList,exitfinallylabel); + cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf); + cg.g_exception_reason_save_const(current_asmdata.CurrAsmList,excepttemps.reasonbuf,2); + cg.a_jmp_always(current_asmdata.CurrAsmList,finallylabel); end; if fc_break in tryflowcontrol then begin - cg.a_label(exprasmlist,breakfinallylabel); - cg.g_exception_reason_load(exprasmlist,excepttemps.reasonbuf); - cg.g_exception_reason_save_const(exprasmlist,excepttemps.reasonbuf,3); - cg.a_jmp_always(exprasmlist,finallylabel); + cg.a_label(current_asmdata.CurrAsmList,breakfinallylabel); + cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf); + cg.g_exception_reason_save_const(current_asmdata.CurrAsmList,excepttemps.reasonbuf,3); + cg.a_jmp_always(current_asmdata.CurrAsmList,finallylabel); end; if fc_continue in tryflowcontrol then begin - cg.a_label(exprasmlist,continuefinallylabel); - cg.g_exception_reason_load(exprasmlist,excepttemps.reasonbuf); - cg.g_exception_reason_save_const(exprasmlist,excepttemps.reasonbuf,4); - cg.a_jmp_always(exprasmlist,finallylabel); + cg.a_label(current_asmdata.CurrAsmList,continuefinallylabel); + cg.g_exception_reason_load(current_asmdata.CurrAsmList,excepttemps.reasonbuf); + cg.g_exception_reason_save_const(current_asmdata.CurrAsmList,excepttemps.reasonbuf,4); + cg.a_jmp_always(current_asmdata.CurrAsmList,finallylabel); end; end; - unget_exception_temps(exprasmlist,excepttemps); - cg.a_label(exprasmlist,endfinallylabel); + unget_exception_temps(current_asmdata.CurrAsmList,excepttemps); + cg.a_label(current_asmdata.CurrAsmList,endfinallylabel); - current_procinfo.aktexitlabel:=oldaktexitlabel; - if assigned(aktbreaklabel) then + current_procinfo.CurrExitLabel:=oldCurrExitLabel; + if assigned(current_procinfo.CurrBreakLabel) then begin - aktcontinuelabel:=oldaktcontinuelabel; - aktbreaklabel:=oldaktbreaklabel; + current_procinfo.CurrContinueLabel:=oldContinueLabel; + current_procinfo.CurrBreakLabel:=oldBreakLabel; end; flowcontrol:=oldflowcontrol+tryflowcontrol; end; diff --git a/compiler/ncginl.pas b/compiler/ncginl.pas index cf5147363f..947401bda4 100644 --- a/compiler/ncginl.pas +++ b/compiler/ncginl.pas @@ -194,13 +194,13 @@ implementation paramanager.getintparaloc(pocall_default,2,paraloc2); paramanager.getintparaloc(pocall_default,3,paraloc3); paramanager.getintparaloc(pocall_default,4,paraloc4); - otlabel:=truelabel; - oflabel:=falselabel; - objectlibrary.getjumplabel(truelabel); - objectlibrary.getjumplabel(falselabel); + otlabel:=current_procinfo.CurrTrueLabel; + oflabel:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); secondpass(tcallparanode(left).left); - maketojumpbool(exprasmlist,tcallparanode(left).left,lr_load_regvars); - cg.a_label(exprasmlist,falselabel); + maketojumpbool(current_asmdata.CurrAsmList,tcallparanode(left).left,lr_load_regvars); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); { First call secondpass() before we can push the parameters, otherwise parameters allocated in the registers can be destroyed } { generate filename string parameter } @@ -215,30 +215,30 @@ implementation if codegenerror then exit; { push erroraddr } - paramanager.allocparaloc(exprasmlist,paraloc4); - cg.a_param_reg(exprasmlist,OS_ADDR,NR_FRAME_POINTER_REG,paraloc4); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc4); + cg.a_param_reg(current_asmdata.CurrAsmList,OS_ADDR,NR_FRAME_POINTER_REG,paraloc4); { push lineno } - paramanager.allocparaloc(exprasmlist,paraloc3); - cg.a_param_const(exprasmlist,OS_INT,aktfilepos.line,paraloc3); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc3); + cg.a_param_const(current_asmdata.CurrAsmList,OS_INT,aktfilepos.line,paraloc3); { push filename } - paramanager.allocparaloc(exprasmlist,paraloc2); - cg.a_paramaddr_ref(exprasmlist,hp2.location.reference,paraloc2); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc2); + cg.a_paramaddr_ref(current_asmdata.CurrAsmList,hp2.location.reference,paraloc2); { push msg } - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_paramaddr_ref(exprasmlist,hp3.location.reference,paraloc1); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_paramaddr_ref(current_asmdata.CurrAsmList,hp3.location.reference,paraloc1); { call } - paramanager.freeparaloc(exprasmlist,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc2); - paramanager.freeparaloc(exprasmlist,paraloc3); - paramanager.freeparaloc(exprasmlist,paraloc4); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_ASSERT'); - cg.deallocallcpuregisters(exprasmlist); - location_freetemp(exprasmlist,hp3.location); - location_freetemp(exprasmlist,hp2.location); - cg.a_label(exprasmlist,truelabel); - truelabel:=otlabel; - falselabel:=oflabel; + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc2); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc3); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc4); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_ASSERT'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); + location_freetemp(current_asmdata.CurrAsmList,hp3.location); + location_freetemp(current_asmdata.CurrAsmList,hp2.location); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); + current_procinfo.CurrTrueLabel:=otlabel; + current_procinfo.CurrFalseLabel:=oflabel; paraloc1.done; paraloc2.done; paraloc3.done; @@ -265,14 +265,14 @@ implementation { for both cases load vmt } if left.nodetype=typen then begin - hregister:=cg.getaddressregister(exprasmlist); - reference_reset_symbol(href,objectlibrary.newasmsymbol(tobjectdef(left.resulttype.def).vmt_mangledname,AB_EXTERNAL,AT_DATA),0); - cg.a_loadaddr_ref_reg(exprasmlist,href,hregister); + hregister:=cg.getaddressregister(current_asmdata.CurrAsmList); + reference_reset_symbol(href,current_asmdata.newasmsymbol(tobjectdef(left.resulttype.def).vmt_mangledname,AB_EXTERNAL,AT_DATA),0); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister); end else begin secondpass(left); - hregister:=cg.getaddressregister(exprasmlist); + hregister:=cg.getaddressregister(current_asmdata.CurrAsmList); { handle self inside a method of a class } case left.location.loc of @@ -281,12 +281,12 @@ implementation begin if (left.resulttype.def.deftype=classrefdef) or (po_staticmethod in current_procinfo.procdef.procoptions) then - cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.register,hregister) + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.register,hregister) else begin { load VMT pointer } reference_reset_base(hrefvmt,left.location.register,tobjectdef(left.resulttype.def).vmt_offset); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,hrefvmt,hregister); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hrefvmt,hregister); end end; LOC_REFERENCE, @@ -295,18 +295,18 @@ implementation if is_class(left.resulttype.def) then begin { deref class } - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.reference,hregister); - cg.g_maybe_testself(exprasmlist,hregister); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.reference,hregister); + cg.g_maybe_testself(current_asmdata.CurrAsmList,hregister); { load VMT pointer } reference_reset_base(hrefvmt,hregister,tobjectdef(left.resulttype.def).vmt_offset); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,hrefvmt,hregister); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hrefvmt,hregister); end else begin { load VMT pointer, but not for classrefdefs } if (left.resulttype.def.deftype=objectdef) then inc(left.location.reference.offset,tobjectdef(left.resulttype.def).vmt_offset); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.reference,hregister); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.reference,hregister); end; end; else @@ -317,8 +317,8 @@ implementation if inlinenumber=in_sizeof_x then begin reference_reset_base(href,hregister,0); - hregister:=cg.getintregister(exprasmlist,OS_INT); - cg.a_load_ref_reg(exprasmlist,OS_INT,OS_INT,href,hregister); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,href,hregister); end; location.register:=hregister; end; @@ -344,15 +344,15 @@ implementation else begin { length in ansi/wide strings is at offset -sizeof(aint) } - location_force_reg(exprasmlist,left.location,OS_ADDR,false); - objectlibrary.getjumplabel(lengthlab); - cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,left.location.register,lengthlab); + location_force_reg(current_asmdata.CurrAsmList,left.location,OS_ADDR,false); + current_asmdata.getjumplabel(lengthlab); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_EQ,0,left.location.register,lengthlab); reference_reset_base(href,left.location.register,-sizeof(aint)); - hregister:=cg.makeregsize(exprasmlist,left.location.register,OS_INT); - cg.a_load_ref_reg(exprasmlist,OS_INT,OS_INT,href,hregister); + hregister:=cg.makeregsize(current_asmdata.CurrAsmList,left.location.register,OS_INT); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,href,hregister); if is_widestring(left.resulttype.def) then - cg.a_op_const_reg(exprasmlist,OP_SHR,OS_INT,1,hregister); - cg.a_label(exprasmlist,lengthlab); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SHR,OS_INT,1,hregister); + cg.a_label(current_asmdata.CurrAsmList,lengthlab); location_reset(location,LOC_REGISTER,OS_INT); location.register:=hregister; end; @@ -377,16 +377,16 @@ implementation { we need a value in a register } location_copy(location,left.location); - location_force_reg(exprasmlist,location,cgsize,false); + location_force_reg(current_asmdata.CurrAsmList,location,cgsize,false); {$ifndef cpu64bit} if cgsize in [OS_64,OS_S64] then - cg64.a_op64_const_reg(exprasmlist,cgop,cgsize,1,location.register64) + cg64.a_op64_const_reg(current_asmdata.CurrAsmList,cgop,cgsize,1,location.register64) else {$endif cpu64bit} - cg.a_op_const_reg(exprasmlist,cgop,location.size,1,location.register); + cg.a_op_const_reg(current_asmdata.CurrAsmList,cgop,location.size,1,location.register); - cg.g_rangecheck(exprasmlist,location,resulttype.def,resulttype.def); + cg.g_rangecheck(current_asmdata.CurrAsmList,location,resulttype.def,resulttype.def); end; @@ -434,14 +434,14 @@ implementation addvalue:=addvalue*get_ordinal_value(tcallparanode(tcallparanode(left).right).left) else begin - location_force_reg(exprasmlist,tcallparanode(tcallparanode(left).right).left.location,cgsize,addvalue<=1); + location_force_reg(current_asmdata.CurrAsmList,tcallparanode(tcallparanode(left).right).left.location,cgsize,addvalue<=1); hregister:=tcallparanode(tcallparanode(left).right).left.location.register; {$ifndef cpu64bit} hregisterhi:=tcallparanode(tcallparanode(left).right).left.location.register64.reghi; {$endif cpu64bit} { insert multiply with addvalue if its >1 } if addvalue>1 then - cg.a_op_const_reg(exprasmlist,OP_IMUL,cgsize,addvalue,hregister); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_IMUL,cgsize,addvalue,hregister); addconstant:=false; end; end; @@ -450,25 +450,25 @@ implementation begin {$ifndef cpu64bit} if cgsize in [OS_64,OS_S64] then - cg64.a_op64_const_loc(exprasmlist,addsubop[inlinenumber],cgsize,addvalue,tcallparanode(left).left.location) + cg64.a_op64_const_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber],cgsize,addvalue,tcallparanode(left).left.location) else {$endif cpu64bit} - cg.a_op_const_loc(exprasmlist,addsubop[inlinenumber], + cg.a_op_const_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber], aint(addvalue),tcallparanode(left).left.location); end else begin {$ifndef cpu64bit} if cgsize in [OS_64,OS_S64] then - cg64.a_op64_reg_loc(exprasmlist,addsubop[inlinenumber],cgsize, + cg64.a_op64_reg_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber],cgsize, joinreg64(hregister,hregisterhi),tcallparanode(left).left.location) else {$endif cpu64bit} - cg.a_op_reg_loc(exprasmlist,addsubop[inlinenumber], + cg.a_op_reg_loc(current_asmdata.CurrAsmList,addsubop[inlinenumber], hregister,tcallparanode(left).left.location); end; - cg.g_overflowcheck(exprasmlist,tcallparanode(left).left.location,tcallparanode(left).resulttype.def); - cg.g_rangecheck(exprasmlist,tcallparanode(left).left.location,tcallparanode(left).left.resulttype.def, + cg.g_overflowcheck(current_asmdata.CurrAsmList,tcallparanode(left).left.location,tcallparanode(left).resulttype.def); + cg.g_rangecheck(current_asmdata.CurrAsmList,tcallparanode(left).left.location,tcallparanode(left).left.resulttype.def, tcallparanode(left).left.resulttype.def); end; @@ -481,9 +481,9 @@ implementation href : treference; begin location_reset(location,LOC_REGISTER,OS_ADDR); - location.register:=cg.getaddressregister(exprasmlist); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); reference_reset_symbol(href,tstoreddef(left.resulttype.def).get_rtti_label(fullrtti),0); - cg.a_loadaddr_ref_reg(exprasmlist,href,location.register); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,location.register); end; @@ -522,10 +522,10 @@ implementation begin inc(tcallparanode(left).left.location.reference.offset, (tordconstnode(tcallparanode(tcallparanode(left).right).left).value div bitsperop)*tcgsize2size[opsize]); - cg.a_op_const_ref(exprasmlist,cgop,opsize,l,tcallparanode(left).left.location.reference); + cg.a_op_const_ref(current_asmdata.CurrAsmList,cgop,opsize,l,tcallparanode(left).left.location.reference); end; LOC_CREGISTER : - cg.a_op_const_reg(exprasmlist,cgop,tcallparanode(left).left.location.size,l,tcallparanode(left).left.location.register); + cg.a_op_const_reg(current_asmdata.CurrAsmList,cgop,tcallparanode(left).left.location.size,l,tcallparanode(left).left.location.register); else internalerror(200405021); end; @@ -546,17 +546,17 @@ implementation secondpass(tcallparanode(tcallparanode(left).right).left); { bitnumber - which must be loaded into register } - hregister:=cg.getintregister(exprasmlist,opsize); - hregister2:=cg.getintregister(exprasmlist,opsize); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,opsize); + hregister2:=cg.getintregister(current_asmdata.CurrAsmList,opsize); - cg.a_load_loc_reg(exprasmlist,opsize, + cg.a_load_loc_reg(current_asmdata.CurrAsmList,opsize, tcallparanode(tcallparanode(left).right).left.location,hregister); if use_small then begin { hregister contains the bitnumber to add } - cg.a_load_const_reg(exprasmlist, opsize, 1, hregister2); - cg.a_op_reg_reg(exprasmlist, OP_SHL, opsize, hregister, hregister2); + cg.a_load_const_reg(current_asmdata.CurrAsmList, opsize, 1, hregister2); + cg.a_op_reg_reg(current_asmdata.CurrAsmList, OP_SHL, opsize, hregister, hregister2); { possiblities : bitnumber : LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER @@ -565,13 +565,13 @@ implementation { location of set } if inlinenumber=in_include_x_y then begin - cg.a_op_reg_loc(exprasmlist, OP_OR, hregister2, + cg.a_op_reg_loc(current_asmdata.CurrAsmList, OP_OR, hregister2, tcallparanode(left).left.location); end else begin - cg.a_op_reg_reg(exprasmlist, OP_NOT, opsize, hregister2,hregister2); - cg.a_op_reg_loc(exprasmlist, OP_AND, hregister2, + cg.a_op_reg_reg(current_asmdata.CurrAsmList, OP_NOT, opsize, hregister2,hregister2); + cg.a_op_reg_loc(current_asmdata.CurrAsmList, OP_AND, hregister2, tcallparanode(left).left.location); end; end @@ -584,29 +584,29 @@ implementation { hregister contains the bitnumber (div 32 to get the correct offset) } { hregister contains the bitnumber to add } - cg.a_op_const_reg_reg(exprasmlist, OP_SHR, opsize, 5, hregister,hregister2); - cg.a_op_const_reg(exprasmlist, OP_SHL, opsize, 2, hregister2); - addrreg:=cg.getaddressregister(exprasmlist); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, opsize, 5, hregister,hregister2); + cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SHL, opsize, 2, hregister2); + addrreg:=cg.getaddressregister(current_asmdata.CurrAsmList); { we need an extra address register to be able to do an ADD operation } - addrreg2:=cg.getaddressregister(exprasmlist); - cg.a_load_reg_reg(exprasmlist,opsize,OS_ADDR,hregister2,addrreg2); + addrreg2:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,opsize,OS_ADDR,hregister2,addrreg2); { calculate the correct address of the operand } - cg.a_loadaddr_ref_reg(exprasmlist, tcallparanode(left).left.location.reference,addrreg); - cg.a_op_reg_reg(exprasmlist, OP_ADD, OS_ADDR, addrreg2, addrreg); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList, tcallparanode(left).left.location.reference,addrreg); + cg.a_op_reg_reg(current_asmdata.CurrAsmList, OP_ADD, OS_ADDR, addrreg2, addrreg); { hregister contains the bitnumber to add } - cg.a_load_const_reg(exprasmlist, opsize, 1, hregister2); - cg.a_op_const_reg(exprasmlist, OP_AND, opsize, 31, hregister); - cg.a_op_reg_reg(exprasmlist, OP_SHL, opsize, hregister, hregister2); + cg.a_load_const_reg(current_asmdata.CurrAsmList, opsize, 1, hregister2); + cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_AND, opsize, 31, hregister); + cg.a_op_reg_reg(current_asmdata.CurrAsmList, OP_SHL, opsize, hregister, hregister2); reference_reset_base(href,addrreg,0); if inlinenumber=in_include_x_y then - cg.a_op_reg_ref(exprasmlist, OP_OR, opsize, hregister2, href) + cg.a_op_reg_ref(current_asmdata.CurrAsmList, OP_OR, opsize, hregister2, href) else begin - cg.a_op_reg_reg(exprasmlist, OP_NOT, opsize, hregister2, hregister2); - cg.a_op_reg_ref(exprasmlist, OP_AND, opsize, hregister2, href); + cg.a_op_reg_reg(current_asmdata.CurrAsmList, OP_NOT, opsize, hregister2, hregister2); + cg.a_op_reg_ref(current_asmdata.CurrAsmList, OP_AND, opsize, hregister2, href); end; end; end; @@ -677,8 +677,8 @@ implementation secondpass(tcallparanode(left).left); { force left to be an OS_ADDR, since in case of method procvars } { the size is 2*OS_ADDR (JM) } - cg.a_cmp_const_loc_label(exprasmlist,OS_ADDR,OC_NE,0,tcallparanode(left).left.location,truelabel); - cg.a_jmp_always(exprasmlist,falselabel); + cg.a_cmp_const_loc_label(current_asmdata.CurrAsmList,OS_ADDR,OC_NE,0,tcallparanode(left).left.location,current_procinfo.CurrTrueLabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); location_reset(location,LOC_JUMP,OS_NO); end; diff --git a/compiler/ncgld.pas b/compiler/ncgld.pas index aff7eb8860..47e914b676 100644 --- a/compiler/ncgld.pas +++ b/compiler/ncgld.pas @@ -72,7 +72,7 @@ implementation begin {$ifndef sparc} location.reference.base:=current_procinfo.got; - location.reference.symbol:=objectlibrary.newasmsymbol(tglobalvarsym(symtableentry).mangledname+'@GOT',AB_EXTERNAL,AT_DATA); + location.reference.symbol:=current_asmdata.newasmsymbol(tglobalvarsym(symtableentry).mangledname+'@GOT',AB_EXTERNAL,AT_DATA); {$endif sparc} end; @@ -105,7 +105,7 @@ implementation location.reference.offset:=tabsolutevarsym(symtableentry).addroffset; end; toasm : - location.reference.symbol:=objectlibrary.newasmsymbol(tabsolutevarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA); + location.reference.symbol:=current_asmdata.newasmsymbol(tabsolutevarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA); else internalerror(200310283); end; @@ -115,7 +115,7 @@ implementation if tconstsym(symtableentry).consttyp=constresourcestring then begin location_reset(location,LOC_CREFERENCE,OS_ADDR); - location.reference.symbol:=objectlibrary.newasmsymbol(make_mangledname('RESSTR',symtableentry.owner,symtableentry.name),AB_EXTERNAL,AT_DATA); + location.reference.symbol:=current_asmdata.newasmsymbol(make_mangledname('RESSTR',symtableentry.owner,symtableentry.name),AB_EXTERNAL,AT_DATA); { Resourcestring layout: TResourceStringRecord = Packed Record Name, @@ -136,7 +136,7 @@ implementation if (symtableentry.typ = globalvarsym) and ([vo_is_dll_var,vo_is_external] * tglobalvarsym(symtableentry).varoptions <> []) then begin - location.reference.base := cg.g_indirect_sym_load(exprasmlist,tglobalvarsym(symtableentry).mangledname); + location.reference.base := cg.g_indirect_sym_load(current_asmdata.CurrAsmList,tglobalvarsym(symtableentry).mangledname); if (location.reference.base <> NR_NO) then exit; end; @@ -146,9 +146,9 @@ implementation if (vo_is_dll_var in tabstractvarsym(symtableentry).varoptions) then { DLL variable } begin - hregister:=cg.getaddressregister(exprasmlist); - location.reference.symbol:=objectlibrary.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,location.reference,hregister); + hregister:=cg.getaddressregister(current_asmdata.CurrAsmList); + location.reference.symbol:=current_asmdata.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,location.reference,hregister); reference_reset_base(location.reference,hregister,0); end { Thread variable } @@ -165,37 +165,37 @@ implementation call and then the address load to be sure that the register that is used for returning is the same (PFV) } - objectlibrary.getjumplabel(norelocatelab); - objectlibrary.getjumplabel(endrelocatelab); + current_asmdata.getjumplabel(norelocatelab); + current_asmdata.getjumplabel(endrelocatelab); { make sure hregister can't allocate the register necessary for the parameter } paraloc1.init; paramanager.getintparaloc(pocall_default,1,paraloc1); - hregister:=cg.getaddressregister(exprasmlist); - reference_reset_symbol(href,objectlibrary.newasmsymbol('FPC_THREADVAR_RELOCATE',AB_EXTERNAL,AT_DATA),0); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,hregister); - cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,hregister,norelocatelab); + hregister:=cg.getaddressregister(current_asmdata.CurrAsmList); + reference_reset_symbol(href,current_asmdata.newasmsymbol('FPC_THREADVAR_RELOCATE',AB_EXTERNAL,AT_DATA),0); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,hregister); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_ADDR,OC_EQ,0,hregister,norelocatelab); { don't save the allocated register else the result will be destroyed later } - reference_reset_symbol(href,objectlibrary.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),0); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_ref(exprasmlist,OS_32,href,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); + reference_reset_symbol(href,current_asmdata.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),0); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_ref(current_asmdata.CurrAsmList,OS_32,href,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); paraloc1.done; - cg.allocallcpuregisters(exprasmlist); - cg.a_call_reg(exprasmlist,hregister); - cg.deallocallcpuregisters(exprasmlist); - cg.getcpuregister(exprasmlist,NR_FUNCTION_RESULT_REG); - cg.ungetcpuregister(exprasmlist,NR_FUNCTION_RESULT_REG); - hregister:=cg.getaddressregister(exprasmlist); - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_ADDR,NR_FUNCTION_RESULT_REG,hregister); - cg.a_jmp_always(exprasmlist,endrelocatelab); - cg.a_label(exprasmlist,norelocatelab); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_reg(current_asmdata.CurrAsmList,hregister); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_FUNCTION_RESULT_REG); + hregister:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_ADDR,NR_FUNCTION_RESULT_REG,hregister); + cg.a_jmp_always(current_asmdata.CurrAsmList,endrelocatelab); + cg.a_label(current_asmdata.CurrAsmList,norelocatelab); { no relocation needed, load the address of the variable only, the layout of a threadvar is (4 bytes pointer): 0 - Threadvar index 4 - Threadvar value in single threading } - reference_reset_symbol(href,objectlibrary.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),sizeof(aint)); - cg.a_loadaddr_ref_reg(exprasmlist,href,hregister); - cg.a_label(exprasmlist,endrelocatelab); + reference_reset_symbol(href,current_asmdata.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),sizeof(aint)); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister); + cg.a_label(current_asmdata.CurrAsmList,endrelocatelab); location.reference.base:=hregister; end { Nested variable } @@ -246,7 +246,7 @@ implementation staticsymtable : begin if tabstractnormalvarsym(symtableentry).localloc.loc=LOC_INVALID then - reference_reset_symbol(location.reference,objectlibrary.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),0) + reference_reset_symbol(location.reference,current_asmdata.newasmsymbol(tglobalvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA),0) else location:=tglobalvarsym(symtableentry).localloc; {$ifdef i386} @@ -277,10 +277,10 @@ implementation hregister:=location.register else begin - hregister:=cg.getaddressregister(exprasmlist); + hregister:=cg.getaddressregister(current_asmdata.CurrAsmList); { we need to load only an address } location.size:=OS_ADDR; - cg.a_load_loc_reg(exprasmlist,location.size,location,hregister); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,location.size,location,hregister); end; location_reset(location,LOC_REFERENCE,newsize); location.reference.base:=hregister; @@ -310,7 +310,7 @@ implementation location_reset(location,LOC_CREFERENCE,OS_128) else internalerror(20020520); - tg.GetTemp(exprasmlist,2*sizeof(aint),tt_normal,location.reference); + tg.GetTemp(current_asmdata.CurrAsmList,2*sizeof(aint),tt_normal,location.reference); secondpass(left); { load class instance address } @@ -326,12 +326,12 @@ implementation LOC_CREFERENCE, LOC_REFERENCE: begin - hregister:=cg.getaddressregister(exprasmlist); + hregister:=cg.getaddressregister(current_asmdata.CurrAsmList); if is_class_or_interface(left.resulttype.def) then - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.reference,hregister) + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.reference,hregister) else - cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,hregister); - location_freetemp(exprasmlist,left.location); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,hregister); + location_freetemp(current_asmdata.CurrAsmList,left.location); end; else internalerror(26019); @@ -340,7 +340,7 @@ implementation { store the class instance address } href:=location.reference; inc(href.offset,sizeof(aint)); - cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,href); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hregister,href); { virtual method ? } if (po_virtualmethod in procdef.procoptions) and @@ -348,35 +348,35 @@ implementation begin { load vmt pointer } reference_reset_base(href,hregister,0); - hregister:=cg.getaddressregister(exprasmlist); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,hregister); + hregister:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,hregister); { load method address } reference_reset_base(href,hregister,procdef._class.vmtmethodoffset(procdef.extnumber)); - hregister:=cg.getaddressregister(exprasmlist); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,hregister); + hregister:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,hregister); { ... and store it } - cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,location.reference); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hregister,location.reference); end else begin { load address of the function } - reference_reset_symbol(href,objectlibrary.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION),0); - hregister:=cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,href,hregister); - cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,location.reference); + reference_reset_symbol(href,current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION),0); + hregister:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,hregister); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,hregister,location.reference); end; end else begin if (po_external in tprocsym(symtableentry).procdef[1].procoptions) then - location.reference.base := cg.g_indirect_sym_load(exprasmlist,tprocsym(symtableentry).procdef[1].mangledname); + location.reference.base := cg.g_indirect_sym_load(current_asmdata.CurrAsmList,tprocsym(symtableentry).procdef[1].mangledname); {!!!!! Be aware, work on virtual methods too } if (location.reference.base = NR_NO) then - location.reference.symbol:=objectlibrary.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION); + location.reference.symbol:=current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION); end; end; typedconstsym : - location.reference.symbol:=objectlibrary.newasmsymbol(ttypedconstsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA); + location.reference.symbol:=current_asmdata.newasmsymbol(ttypedconstsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA); labelsym : location.reference.symbol:=tcglabelnode((tlabelsym(symtableentry).code)).getasmlabel; else internalerror(200510032); @@ -400,10 +400,10 @@ implementation begin location_reset(location,LOC_VOID,OS_NO); - otlabel:=truelabel; - oflabel:=falselabel; - objectlibrary.getjumplabel(truelabel); - objectlibrary.getjumplabel(falselabel); + otlabel:=current_procinfo.CurrTrueLabel; + oflabel:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); { in most cases we can process first the right node which contains @@ -430,9 +430,9 @@ implementation if (right.resulttype.def.needs_inittable) and (right.nodetype<>stringconstn) then begin - location_force_mem(exprasmlist,right.location); - location_get_data_ref(exprasmlist,right.location,href,false); - cg.g_incrrefcount(exprasmlist,right.resulttype.def,href); + location_force_mem(current_asmdata.CurrAsmList,right.location); + location_get_data_ref(current_asmdata.CurrAsmList,right.location,href,false); + cg.g_incrrefcount(current_asmdata.CurrAsmList,right.resulttype.def,href); end; if codegenerror then exit; @@ -445,8 +445,8 @@ implementation { decrement destination reference counter } if (left.resulttype.def.needs_inittable) then begin - location_get_data_ref(exprasmlist,left.location,href,false); - cg.g_decrrefcount(exprasmlist,left.resulttype.def,href); + location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false); + cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resulttype.def,href); end; if codegenerror then exit; @@ -462,8 +462,8 @@ implementation { decrement destination reference counter } if (left.resulttype.def.needs_inittable) then begin - location_get_data_ref(exprasmlist,left.location,href,false); - cg.g_decrrefcount(exprasmlist,left.resulttype.def,href); + location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false); + cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resulttype.def,href); end; if codegenerror then exit; @@ -477,9 +477,9 @@ implementation if (right.resulttype.def.needs_inittable) and (right.nodetype<>stringconstn) then begin - location_force_mem(exprasmlist,right.location); - location_get_data_ref(exprasmlist,right.location,href,false); - cg.g_incrrefcount(exprasmlist,right.resulttype.def,href); + location_force_mem(current_asmdata.CurrAsmList,right.location); + location_get_data_ref(current_asmdata.CurrAsmList,right.location,href,false); + cg.g_incrrefcount(current_asmdata.CurrAsmList,right.resulttype.def,href); end; if codegenerror then @@ -495,7 +495,7 @@ implementation (left.location.loc = LOC_REFERENCE) and (right.location.loc = LOC_REFERENCE) and tg.istemp(right.location.reference) and - (tg.sizeoftemp(exprasmlist,right.location.reference) = tg.sizeoftemp(exprasmlist,left.location.reference)) then + (tg.sizeoftemp(current_asmdata.CurrAsmList,right.location.reference) = tg.sizeoftemp(current_asmdata.CurrAsmList,left.location.reference)) then begin { in theory, we should also make sure the left temp type is } { already more or less of the same kind (ie. we must not } @@ -518,7 +518,7 @@ implementation if (right.nodetype=stringconstn) and (tstringconstnode(right).len=0) then begin - cg.a_load_const_ref(exprasmlist,OS_8,0,left.location.reference); + cg.a_load_const_ref(current_asmdata.CurrAsmList,OS_8,0,left.location.reference); end { char loading } else if is_char(right.resulttype.def) then @@ -526,27 +526,27 @@ implementation if right.nodetype=ordconstn then begin if (target_info.endian = endian_little) then - cg.a_load_const_ref(exprasmlist,OS_16,(tordconstnode(right).value shl 8) or 1, + cg.a_load_const_ref(current_asmdata.CurrAsmList,OS_16,(tordconstnode(right).value shl 8) or 1, left.location.reference) else - cg.a_load_const_ref(exprasmlist,OS_16,tordconstnode(right).value or (1 shl 8), + cg.a_load_const_ref(current_asmdata.CurrAsmList,OS_16,tordconstnode(right).value or (1 shl 8), left.location.reference); end else begin href:=left.location.reference; - cg.a_load_const_ref(exprasmlist,OS_8,1,href); + cg.a_load_const_ref(current_asmdata.CurrAsmList,OS_8,1,href); inc(href.offset,1); case right.location.loc of LOC_REGISTER, LOC_CREGISTER : begin - r:=cg.makeregsize(exprasmlist,right.location.register,OS_8); - cg.a_load_reg_ref(exprasmlist,OS_8,OS_8,r,href); + r:=cg.makeregsize(current_asmdata.CurrAsmList,right.location.register,OS_8); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_8,OS_8,r,href); end; LOC_REFERENCE, LOC_CREFERENCE : - cg.a_load_ref_ref(exprasmlist,OS_8,OS_8,right.location.reference,href); + cg.a_load_ref_ref(current_asmdata.CurrAsmList,OS_8,OS_8,right.location.reference,href); else internalerror(200205111); end; @@ -562,10 +562,10 @@ implementation begin {$ifndef cpu64bit} if right.location.size in [OS_64,OS_S64] then - cg64.a_load64_const_loc(exprasmlist,right.location.value64,left.location) + cg64.a_load64_const_loc(current_asmdata.CurrAsmList,right.location.value64,left.location) else {$endif cpu64bit} - cg.a_load_const_loc(exprasmlist,right.location.value,left.location); + cg.a_load_const_loc(current_asmdata.CurrAsmList,right.location.value,left.location); end; LOC_REFERENCE, LOC_CREFERENCE : @@ -576,15 +576,15 @@ implementation begin {$ifndef cpu64bit} if left.location.size in [OS_64,OS_S64] then - cg64.a_load64_ref_reg(exprasmlist,right.location.reference,left.location.register64) + cg64.a_load64_ref_reg(current_asmdata.CurrAsmList,right.location.reference,left.location.register64) else {$endif cpu64bit} - cg.a_load_ref_reg(exprasmlist,right.location.size,left.location.size,right.location.reference,left.location.register); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,right.location.size,left.location.size,right.location.reference,left.location.register); end; LOC_FPUREGISTER, LOC_CFPUREGISTER : begin - cg.a_loadfpu_ref_reg(exprasmlist, + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList, right.location.size, right.location.reference, left.location.register); @@ -598,13 +598,13 @@ implementation if (right.location.reference.offset mod sizeof(aint)<>0) or (left.location.reference.offset mod sizeof(aint)<>0) or (right.resulttype.def.alignment<sizeof(aint)) then - cg.g_concatcopy_unaligned(exprasmlist,right.location.reference,left.location.reference,len) + cg.g_concatcopy_unaligned(current_asmdata.CurrAsmList,right.location.reference,left.location.reference,len) else - cg.g_concatcopy(exprasmlist,right.location.reference,left.location.reference,len); + cg.g_concatcopy(current_asmdata.CurrAsmList,right.location.reference,left.location.reference,len); end; LOC_MMREGISTER, LOC_CMMREGISTER: - cg.a_loadmm_ref_reg(exprasmlist, + cg.a_loadmm_ref_reg(current_asmdata.CurrAsmList, right.location.size, left.location.size, right.location.reference, @@ -618,9 +618,9 @@ implementation LOC_MMXREGISTER: begin if left.location.loc=LOC_CMMXREGISTER then - cg.a_loadmm_reg_reg(exprasmlist,OS_M64,OS_M64,right.location.register,left.location.register,nil) + cg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,OS_M64,OS_M64,right.location.register,left.location.register,nil) else - cg.a_loadmm_reg_ref(exprasmlist,OS_M64,OS_M64,right.location.register,left.location.reference,nil); + cg.a_loadmm_reg_ref(current_asmdata.CurrAsmList,OS_M64,OS_M64,right.location.register,left.location.reference,nil); end; {$endif SUPPORT_MMX} LOC_MMREGISTER, @@ -632,9 +632,9 @@ implementation else begin if left.location.loc=LOC_CMMREGISTER then - cg.a_loadmm_reg_reg(exprasmlist,right.location.size,left.location.size,right.location.register,left.location.register,mms_movescalar) + cg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,right.location.size,left.location.size,right.location.register,left.location.register,mms_movescalar) else - cg.a_loadmm_reg_ref(exprasmlist,right.location.size,left.location.size,right.location.register,left.location.reference,mms_movescalar); + cg.a_loadmm_reg_ref(current_asmdata.CurrAsmList,right.location.size,left.location.size,right.location.register,left.location.reference,mms_movescalar); end; end; LOC_REGISTER, @@ -642,11 +642,11 @@ implementation begin {$ifndef cpu64bit} if left.location.size in [OS_64,OS_S64] then - cg64.a_load64_reg_loc(exprasmlist, + cg64.a_load64_reg_loc(current_asmdata.CurrAsmList, right.location.register64,left.location) else {$endif cpu64bit} - cg.a_load_reg_loc(exprasmlist,right.location.size,right.location.register,left.location); + cg.a_load_reg_loc(current_asmdata.CurrAsmList,right.location.size,right.location.register,left.location); end; LOC_FPUREGISTER, LOC_CFPUREGISTER : @@ -665,37 +665,37 @@ implementation { we can't do direct moves between fpu and mm registers } if left.location.loc in [LOC_MMREGISTER,LOC_CMMREGISTER] then begin - location_force_mmregscalar(exprasmlist,right.location,false); - cg.a_loadmm_reg_reg(exprasmlist, + location_force_mmregscalar(current_asmdata.CurrAsmList,right.location,false); + cg.a_loadmm_reg_reg(current_asmdata.CurrAsmList, tfloat2tcgsize[fputyp],tfloat2tcgsize[fputyp], right.location.register,left.location.register,mms_movescalar); end else - cg.a_loadfpu_reg_loc(exprasmlist, + cg.a_loadfpu_reg_loc(current_asmdata.CurrAsmList, tfloat2tcgsize[fputyp], right.location.register,left.location); end; LOC_JUMP : begin - objectlibrary.getjumplabel(hlabel); - cg.a_label(exprasmlist,truelabel); - cg.a_load_const_loc(exprasmlist,1,left.location); - cg.a_jmp_always(exprasmlist,hlabel); - cg.a_label(exprasmlist,falselabel); - cg.a_load_const_loc(exprasmlist,0,left.location); - cg.a_label(exprasmlist,hlabel); + current_asmdata.getjumplabel(hlabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); + cg.a_load_const_loc(current_asmdata.CurrAsmList,1,left.location); + cg.a_jmp_always(current_asmdata.CurrAsmList,hlabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); + cg.a_load_const_loc(current_asmdata.CurrAsmList,0,left.location); + cg.a_label(current_asmdata.CurrAsmList,hlabel); end; {$ifdef cpuflags} LOC_FLAGS : begin {This can be a wordbool or longbool too, no?} if left.location.loc in [LOC_REGISTER,LOC_CREGISTER] then - cg.g_flags2reg(exprasmlist,def_cgsize(left.resulttype.def),right.location.resflags,left.location.register) + cg.g_flags2reg(current_asmdata.CurrAsmList,def_cgsize(left.resulttype.def),right.location.resflags,left.location.register) else begin if not(left.location.loc = LOC_REFERENCE) then internalerror(200203273); - cg.g_flags2ref(exprasmlist,def_cgsize(left.resulttype.def),right.location.resflags,left.location.reference); + cg.g_flags2ref(current_asmdata.CurrAsmList,def_cgsize(left.resulttype.def),right.location.resflags,left.location.reference); end; end; {$endif cpuflags} @@ -703,10 +703,10 @@ implementation end; if releaseright then - location_freetemp(exprasmlist,right.location); + location_freetemp(current_asmdata.CurrAsmList,right.location); - truelabel:=otlabel; - falselabel:=oflabel; + current_procinfo.CurrTrueLabel:=otlabel; + current_procinfo.CurrFalseLabel:=oflabel; end; @@ -759,9 +759,9 @@ implementation { Allocate always a temp, also if no elements are required, to be sure that location is valid (PFV) } if tarraydef(resulttype.def).highrange=-1 then - tg.GetTemp(exprasmlist,elesize,tt_normal,location.reference) + tg.GetTemp(current_asmdata.CurrAsmList,elesize,tt_normal,location.reference) else - tg.GetTemp(exprasmlist,(tarraydef(resulttype.def).highrange+1)*elesize,tt_normal,location.reference); + tg.GetTemp(current_asmdata.CurrAsmList,(tarraydef(resulttype.def).highrange+1)*elesize,tt_normal,location.reference); href:=location.reference; { Process nodes in array constructor } hp:=self; @@ -775,7 +775,7 @@ implementation exit; { Move flags and jump in register } if hp.left.location.loc in [LOC_FLAGS,LOC_JUMP] then - location_force_reg(exprasmlist,hp.left.location,def_cgsize(hp.left.resulttype.def),false); + location_force_reg(current_asmdata.CurrAsmList,hp.left.location,def_cgsize(hp.left.resulttype.def),false); if dovariant then begin { find the correct vtype value } @@ -879,16 +879,16 @@ implementation inc(href.offset,sizeof(aint)); if vaddr then begin - location_force_mem(exprasmlist,hp.left.location); - tmpreg:=cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,hp.left.location.reference,tmpreg); - cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,tmpreg,href); + location_force_mem(current_asmdata.CurrAsmList,hp.left.location); + tmpreg:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hp.left.location.reference,tmpreg); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,tmpreg,href); end else - cg.a_load_loc_ref(exprasmlist,OS_ADDR,hp.left.location,href); + cg.a_load_loc_ref(current_asmdata.CurrAsmList,OS_ADDR,hp.left.location,href); { update href to the vtype field and write it } dec(href.offset,sizeof(aint)); - cg.a_load_const_ref(exprasmlist, OS_INT,vtype,href); + cg.a_load_const_ref(current_asmdata.CurrAsmList, OS_INT,vtype,href); { goto next array element } inc(href.offset,sizeof(aint)*2); end @@ -900,30 +900,30 @@ implementation case hp.left.location.loc of LOC_FPUREGISTER, LOC_CFPUREGISTER : - cg.a_loadfpu_reg_ref(exprasmlist,hp.left.location.size,hp.left.location.register,href); + cg.a_loadfpu_reg_ref(current_asmdata.CurrAsmList,hp.left.location.size,hp.left.location.register,href); LOC_REFERENCE, LOC_CREFERENCE : begin if is_shortstring(hp.left.resulttype.def) then - cg.g_copyshortstring(exprasmlist,hp.left.location.reference,href, + cg.g_copyshortstring(current_asmdata.CurrAsmList,hp.left.location.reference,href, Tstringdef(hp.left.resulttype.def).len) else - cg.g_concatcopy(exprasmlist,hp.left.location.reference,href,elesize); + cg.g_concatcopy(current_asmdata.CurrAsmList,hp.left.location.reference,href,elesize); end; else begin {$ifndef cpu64bit} if hp.left.location.size in [OS_64,OS_S64] then - cg64.a_load64_loc_ref(exprasmlist,hp.left.location,href) + cg64.a_load64_loc_ref(current_asmdata.CurrAsmList,hp.left.location,href) else {$endif cpu64bit} - cg.a_load_loc_ref(exprasmlist,hp.left.location.size,hp.left.location,href); + cg.a_load_loc_ref(current_asmdata.CurrAsmList,hp.left.location.size,hp.left.location,href); end; end; inc(href.offset,elesize); end; if freetemp then - location_freetemp(exprasmlist,hp.left.location); + location_freetemp(current_asmdata.CurrAsmList,hp.left.location); end; { load next entry } hp:=tarrayconstructornode(hp.right); diff --git a/compiler/ncgmat.pas b/compiler/ncgmat.pas index af03b0876a..a3442575c0 100644 --- a/compiler/ncgmat.pas +++ b/compiler/ncgmat.pas @@ -149,9 +149,9 @@ implementation { get a temporary memory reference to store the floating point value } - tg.gettemp(exprasmlist,tcgsize2size[_size],tt_normal,href); + tg.gettemp(current_asmdata.CurrAsmList,tcgsize2size[_size],tt_normal,href); { store the floating point value in the temporary memory area } - cg.a_loadfpu_reg_ref(exprasmlist,_size,r,href); + cg.a_loadfpu_reg_ref(current_asmdata.CurrAsmList,_size,r,href); { only single and double ieee are supported, for little endian the signed bit is in the second dword } href2:=href; @@ -165,9 +165,9 @@ implementation internalerror(200406021); end; { flip sign-bit (bit 31/63) of single/double } - cg.a_op_const_ref(exprasmlist,OP_XOR,OS_32,aint($80000000),href2); - cg.a_loadfpu_ref_reg(exprasmlist,_size,href,r); - tg.ungetiftemp(exprasmlist,href); + cg.a_op_const_ref(current_asmdata.CurrAsmList,OP_XOR,OS_32,aint($80000000),href2); + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,_size,href,r); + tg.ungetiftemp(current_asmdata.CurrAsmList,href); end; @@ -177,8 +177,8 @@ implementation secondpass(left); { load left operator in a register } location_copy(location,left.location); - location_force_reg(exprasmlist,location,OS_64,false); - cg64.a_op64_loc_reg(exprasmlist,OP_NEG,OS_64, + location_force_reg(current_asmdata.CurrAsmList,location,OS_64,false); + cg64.a_op64_loc_reg(current_asmdata.CurrAsmList,OP_NEG,OS_64, location,joinreg64(location.register64.reglo,location.register64.reghi)); end; {$endif cpu64bit} @@ -191,8 +191,8 @@ implementation LOC_REFERENCE, LOC_CREFERENCE : begin - location.register:=cg.getfpuregister(exprasmlist,location.size); - cg.a_loadfpu_ref_reg(exprasmlist, + location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList, def_cgsize(left.resulttype.def), left.location.reference,location.register); emit_float_sign_change(location.register,def_cgsize(left.resulttype.def)); @@ -204,8 +204,8 @@ implementation end; LOC_CFPUREGISTER: begin - location.register:=cg.getfpuregister(exprasmlist,location.size); - cg.a_loadfpu_reg_reg(exprasmlist,left.location.size,left.location.register,location.register); + location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); + cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,location.register); emit_float_sign_change(location.register,def_cgsize(left.resulttype.def)); end; else @@ -219,8 +219,8 @@ implementation secondpass(left); { load left operator in a register } location_copy(location,left.location); - location_force_reg(exprasmlist,location,OS_SINT,false); - cg.a_op_reg_reg(exprasmlist,OP_NEG,OS_SINT,location.register,location.register); + location_force_reg(current_asmdata.CurrAsmList,location,OS_SINT,false); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NEG,OS_SINT,location.register,location.register); end; @@ -281,9 +281,9 @@ implementation { this code valid for 64-bit cpu's only , otherwise helpers are called in pass_1 } - location_force_reg(exprasmlist,location,OS_64,false); + location_force_reg(current_asmdata.CurrAsmList,location,OS_64,false); location_copy(location,left.location); - location_force_reg(exprasmlist,right.location,OS_64,false); + location_force_reg(current_asmdata.CurrAsmList,right.location,OS_64,false); emit64_div_reg_reg(is_signed(left.resulttype.def), joinreg64(right.location.register64.reglo,right.location.register64.reghi), joinreg64(location.register64.reglo,location.register64.reghi)); @@ -292,7 +292,7 @@ implementation {$endif cpu64bit} begin { put numerator in register } - location_force_reg(exprasmlist,left.location,OS_INT,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,OS_INT,false); hreg1:=left.location.register; if (nodetype=divn) and @@ -304,17 +304,17 @@ implementation "Cardinal($ffffffff) div 16" overflows! (JM) } If is_signed(left.resulttype.def) Then Begin - objectlibrary.getjumplabel(hl); - cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_GT,0,hreg1,hl); + current_asmdata.getjumplabel(hl); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_GT,0,hreg1,hl); if power=1 then - cg.a_op_const_reg(exprasmlist,OP_ADD,OS_INT,1,hreg1) + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_ADD,OS_INT,1,hreg1) else - cg.a_op_const_reg(exprasmlist,OP_ADD,OS_INT,tordconstnode(right).value-1,hreg1); - cg.a_label(exprasmlist,hl); - cg.a_op_const_reg(exprasmlist,OP_SAR,OS_INT,power,hreg1); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_ADD,OS_INT,tordconstnode(right).value-1,hreg1); + cg.a_label(current_asmdata.CurrAsmList,hl); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SAR,OS_INT,power,hreg1); End Else { not signed } - cg.a_op_const_reg(exprasmlist,OP_SHR,OS_INT,power,hreg1); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SHR,OS_INT,power,hreg1); End else begin @@ -322,21 +322,21 @@ implementation { hdenom is always free, it's } { only used for temporary } { purposes } - hdenom := cg.getintregister(exprasmlist,OS_INT); - cg.a_load_loc_reg(exprasmlist,right.location.size,right.location,hdenom); + hdenom := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,right.location.size,right.location,hdenom); { verify if the divisor is zero, if so return an error immediately } - objectlibrary.getjumplabel(hl); - cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_NE,0,hdenom,hl); + current_asmdata.getjumplabel(hl); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_NE,0,hdenom,hl); paraloc1.init; paramanager.getintparaloc(pocall_default,1,paraloc1); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_const(exprasmlist,OS_S32,200,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); - cg.a_call_name(exprasmlist,'FPC_HANDLERROR'); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_const(current_asmdata.CurrAsmList,OS_S32,200,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_HANDLERROR'); paraloc1.done; - cg.a_label(exprasmlist,hl); + cg.a_label(current_asmdata.CurrAsmList,hl); if nodetype = modn then emit_mod_reg_reg(is_signed(left.resulttype.def),hdenom,hreg1) else @@ -345,7 +345,7 @@ implementation location_reset(location,LOC_REGISTER,OS_INT); location.register:=hreg1; end; - cg.g_overflowcheck(exprasmlist,location,resulttype.def); + cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def); end; @@ -375,7 +375,7 @@ implementation end; { load left operators in a register } location_copy(location,left.location); - location_force_reg(exprasmlist,location,OS_INT,false); + location_force_reg(current_asmdata.CurrAsmList,location,OS_INT,false); { shifting by a constant directly coded: } if (right.nodetype=ordconstn) then @@ -383,7 +383,7 @@ implementation { l shl 32 should 0 imho, but neither TP nor Delphi do it in this way (FK) if right.value<=31 then } - cg.a_op_const_reg(exprasmlist,op,location.size, + cg.a_op_const_reg(current_asmdata.CurrAsmList,op,location.size, tordconstnode(right).value and 31,location.register); { else @@ -399,12 +399,12 @@ implementation } if right.location.loc<>LOC_REGISTER then begin - hcountreg:=cg.getintregister(exprasmlist,OS_INT); - cg.a_load_loc_reg(exprasmlist,right.location.size,right.location,hcountreg); + hcountreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,right.location.size,right.location,hcountreg); end else hcountreg:=right.location.register; - cg.a_op_reg_reg(exprasmlist,op,OS_INT,hcountreg,location.register); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,op,OS_INT,hcountreg,location.register); end; end; @@ -430,10 +430,10 @@ implementation procedure tcgnotnode.second_64bit; begin secondpass(left); - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),false); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),false); location_copy(location,left.location); { perform the NOT operation } - cg64.a_op64_reg_reg(exprasmlist,OP_NOT,location.size,left.location.register64,location.register64); + cg64.a_op64_reg_reg(current_asmdata.CurrAsmList,OP_NOT,location.size,left.location.register64,location.register64); end; {$endif cpu64bit} @@ -441,10 +441,10 @@ implementation procedure tcgnotnode.second_integer; begin secondpass(left); - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),false); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),false); location_copy(location,left.location); { perform the NOT operation } - cg.a_op_reg_reg(exprasmlist,OP_NOT,location.size,location.register,location.register); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,location.size,location.register,location.register); end; diff --git a/compiler/ncgmem.pas b/compiler/ncgmem.pas index 13bc38d309..f6608389ba 100644 --- a/compiler/ncgmem.pas +++ b/compiler/ncgmem.pas @@ -101,15 +101,15 @@ implementation if (left.nodetype=typen) then begin reference_reset_symbol(href, - objectlibrary.newasmsymbol(tobjectdef(tclassrefdef(resulttype.def).pointertype.def).vmt_mangledname,AB_EXTERNAL,AT_DATA),0); - location.register:=cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,href,location.register); + current_asmdata.newasmsymbol(tobjectdef(tclassrefdef(resulttype.def).pointertype.def).vmt_mangledname,AB_EXTERNAL,AT_DATA),0); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,location.register); end else begin { left contains self, load vmt from self } secondpass(left); - gen_load_vmt_register(exprasmlist,tobjectdef(left.resulttype.def),left.location,location.register); + gen_load_vmt_register(current_asmdata.CurrAsmList,tobjectdef(left.resulttype.def),left.location,location.register); end; end; @@ -133,12 +133,12 @@ implementation begin currpi:=current_procinfo; location_reset(location,LOC_REGISTER,OS_ADDR); - location.register:=cg.getaddressregister(exprasmlist); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); { load framepointer of current proc } hsym:=tparavarsym(currpi.procdef.parast.search('parentfp')); if not assigned(hsym) then internalerror(200309281); - cg.a_load_loc_reg(exprasmlist,OS_ADDR,hsym.localloc,location.register); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_ADDR,hsym.localloc,location.register); { walk parents } while (currpi.procdef.owner.symtablelevel>parentpd.parast.symtablelevel) do begin @@ -153,7 +153,7 @@ implementation internalerror(200309283); reference_reset_base(href,location.register,hsym.localloc.reference.offset); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,location.register); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,location.register); end; end; end; @@ -168,8 +168,8 @@ implementation secondpass(left); location_reset(location,LOC_REGISTER,OS_ADDR); - location.register:=cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,location.register); + location.register:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,location.register); end; @@ -190,8 +190,8 @@ implementation {$ifdef cpu_uses_separate_address_registers} if getregtype(left.location.register)<>R_ADDRESSREGISTER then begin - location.reference.base := cg.getaddressregister(exprasmlist); - cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.register, + location.reference.base := cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.register, location.reference.base); end else @@ -201,8 +201,8 @@ implementation LOC_CREFERENCE, LOC_REFERENCE: begin - location.reference.base:=cg.getaddressregister(exprasmlist); - cg.a_load_loc_reg(exprasmlist,OS_ADDR,left.location,location.reference.base); + location.reference.base:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_ADDR,left.location,location.reference.base); end; LOC_CONSTANT: begin @@ -219,13 +219,13 @@ implementation begin paraloc1.init; paramanager.getintparaloc(pocall_default,1,paraloc1); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_reg(exprasmlist, OS_ADDR,location.reference.base,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_reg(current_asmdata.CurrAsmList, OS_ADDR,location.reference.base,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); paraloc1.done; - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_CHECKPOINTER'); - cg.deallocallcpuregisters(exprasmlist); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_CHECKPOINTER'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); end; end; @@ -253,8 +253,8 @@ implementation {$ifdef cpu_uses_separate_address_registers} if getregtype(left.location.register)<>R_ADDRESSREGISTER then begin - location.reference.base:=rg.getaddressregister(exprasmlist); - cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR, + location.reference.base:=rg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR, left.location.register,location.reference.base); end else @@ -264,8 +264,8 @@ implementation LOC_CREFERENCE, LOC_REFERENCE: begin - location.reference.base:=cg.getaddressregister(exprasmlist); - cg.a_load_loc_reg(exprasmlist,OS_ADDR,left.location,location.reference.base); + location.reference.base:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_ADDR,left.location,location.reference.base); end; end; { implicit deferencing } @@ -274,31 +274,31 @@ implementation not(cs_compilesystem in aktmoduleswitches) then begin paramanager.getintparaloc(pocall_default,1,paraloc1); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_reg(exprasmlist, OS_ADDR,location.reference.base,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_CHECKPOINTER'); - cg.deallocallcpuregisters(exprasmlist); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_reg(current_asmdata.CurrAsmList, OS_ADDR,location.reference.base,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_CHECKPOINTER'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); end; end else if is_interfacecom(left.resulttype.def) then begin location_reset(location,LOC_REFERENCE,def_cgsize(resulttype.def)); - tg.GetTempTyped(exprasmlist,left.resulttype.def,tt_normal,location.reference); - cg.a_load_loc_ref(exprasmlist,OS_ADDR,left.location,location.reference); + tg.GetTempTyped(current_asmdata.CurrAsmList,left.resulttype.def,tt_normal,location.reference); + cg.a_load_loc_ref(current_asmdata.CurrAsmList,OS_ADDR,left.location,location.reference); { implicit deferencing also for interfaces } if (cs_use_heaptrc in aktglobalswitches) and (cs_checkpointer in aktlocalswitches) and not(cs_compilesystem in aktmoduleswitches) then begin paramanager.getintparaloc(pocall_default,1,paraloc1); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_reg(exprasmlist, OS_ADDR,location.reference.base,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_CHECKPOINTER'); - cg.deallocallcpuregisters(exprasmlist); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_reg(current_asmdata.CurrAsmList, OS_ADDR,location.reference.base,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_CHECKPOINTER'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); end; end else @@ -349,23 +349,23 @@ implementation if location.reference.base=NR_NO then begin if l<>1 then - cg.a_op_const_reg(exprasmlist,OP_IMUL,OS_ADDR,l,reg); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_IMUL,OS_ADDR,l,reg); location.reference.base:=reg; end else if location.reference.index=NR_NO then begin if l<>1 then - cg.a_op_const_reg(exprasmlist,OP_IMUL,OS_ADDR,l,reg); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_IMUL,OS_ADDR,l,reg); location.reference.index:=reg; end else begin - hreg := cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,location.reference,hreg); + hreg := cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,location.reference,hreg); reference_reset_base(location.reference,hreg,0); { insert new index register } if l<>1 then - cg.a_op_const_reg(exprasmlist,OP_IMUL,OS_ADDR,l,reg); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_IMUL,OS_ADDR,l,reg); location.reference.index:=reg; end; end; @@ -405,19 +405,19 @@ implementation secondpass(hightree); { generate compares } if (right.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then - hreg:=cg.makeregsize(exprasmlist,right.location.register,OS_INT) + hreg:=cg.makeregsize(current_asmdata.CurrAsmList,right.location.register,OS_INT) else begin - hreg:=cg.getintregister(exprasmlist,OS_INT); - cg.a_load_loc_reg(exprasmlist,OS_INT,right.location,hreg); + hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_INT,right.location,hreg); end; - objectlibrary.getjumplabel(neglabel); - objectlibrary.getjumplabel(poslabel); - cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_LT,0,hreg,poslabel); - cg.a_cmp_loc_reg_label(exprasmlist,OS_INT,OC_BE,hightree.location,hreg,neglabel); - cg.a_label(exprasmlist,poslabel); - cg.a_call_name(exprasmlist,'FPC_RANGEERROR'); - cg.a_label(exprasmlist,neglabel); + current_asmdata.getjumplabel(neglabel); + current_asmdata.getjumplabel(poslabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_LT,0,hreg,poslabel); + cg.a_cmp_loc_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_BE,hightree.location,hreg,neglabel); + cg.a_label(current_asmdata.CurrAsmList,poslabel); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_RANGEERROR'); + cg.a_label(current_asmdata.CurrAsmList,neglabel); { release hightree } hightree.free; end; @@ -427,18 +427,18 @@ implementation begin paramanager.getintparaloc(pocall_default,1,paraloc1); paramanager.getintparaloc(pocall_default,2,paraloc2); - paramanager.allocparaloc(exprasmlist,paraloc2); - cg.a_param_loc(exprasmlist,right.location,paraloc2); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_loc(exprasmlist,left.location,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc2); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_DYNARRAY_RANGECHECK'); - cg.deallocallcpuregisters(exprasmlist); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc2); + cg.a_param_loc(current_asmdata.CurrAsmList,right.location,paraloc2); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_loc(current_asmdata.CurrAsmList,left.location,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc2); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DYNARRAY_RANGECHECK'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); end else - cg.g_rangecheck(exprasmlist,right.location,right.resulttype.def,left.resulttype.def); + cg.g_rangecheck(current_asmdata.CurrAsmList,right.location,right.resulttype.def,left.resulttype.def); paraloc1.done; paraloc2.done; end; @@ -484,8 +484,8 @@ implementation LOC_CREFERENCE, LOC_REFERENCE : begin - location.reference.base:=cg.getaddressregister(exprasmlist); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,left.location.reference,location.reference.base); + location.reference.base:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,left.location.reference,location.reference.base); end; else internalerror(2002032218); @@ -496,12 +496,12 @@ implementation if (cs_check_range in aktlocalswitches) then begin paramanager.getintparaloc(pocall_default,1,paraloc1); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_reg(exprasmlist,OS_ADDR,location.reference.base,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_CHECKZERO'); - cg.deallocallcpuregisters(exprasmlist); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_reg(current_asmdata.CurrAsmList,OS_ADDR,location.reference.base,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_CHECKZERO'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); end; { in ansistrings/widestrings S[1] is p<w>char(S)[0] !! } @@ -520,8 +520,8 @@ implementation LOC_REFERENCE, LOC_CREFERENCE : begin - location.reference.base:=cg.getaddressregister(exprasmlist); - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR, + location.reference.base:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR, left.location.reference,location.reference.base); end; else @@ -580,17 +580,17 @@ implementation begin paramanager.getintparaloc(pocall_default,1,paraloc1); paramanager.getintparaloc(pocall_default,2,paraloc2); - paramanager.allocparaloc(exprasmlist,paraloc2); - cg.a_param_const(exprasmlist,OS_INT,tordconstnode(right).value,paraloc2); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc2); + cg.a_param_const(current_asmdata.CurrAsmList,OS_INT,tordconstnode(right).value,paraloc2); href:=location.reference; dec(href.offset,sizeof(aint)-offsetdec); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_ref(exprasmlist,OS_INT,href,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc2); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK'); - cg.deallocallcpuregisters(exprasmlist); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_ref(current_asmdata.CurrAsmList,OS_INT,href,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc2); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); end; st_shortstring: @@ -676,20 +676,20 @@ implementation isjump:=(right.expectloc=LOC_JUMP); if isjump then begin - otl:=truelabel; - objectlibrary.getjumplabel(truelabel); - ofl:=falselabel; - objectlibrary.getjumplabel(falselabel); + otl:=current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + ofl:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); end; secondpass(right); { if mulsize = 1, we won't have to modify the index } - location_force_reg(exprasmlist,right.location,OS_ADDR,(mulsize = 1)); + location_force_reg(current_asmdata.CurrAsmList,right.location,OS_ADDR,(mulsize = 1)); if isjump then begin - truelabel:=otl; - falselabel:=ofl; + current_procinfo.CurrTrueLabel:=otl; + current_procinfo.CurrFalseLabel:=ofl; end else if (right.location.loc = LOC_JUMP) then internalerror(2006010801); @@ -717,18 +717,18 @@ implementation begin paramanager.getintparaloc(pocall_default,1,paraloc1); paramanager.getintparaloc(pocall_default,2,paraloc2); - paramanager.allocparaloc(exprasmlist,paraloc2); - cg.a_param_reg(exprasmlist,OS_INT,right.location.register,paraloc2); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc2); + cg.a_param_reg(current_asmdata.CurrAsmList,OS_INT,right.location.register,paraloc2); href:=location.reference; dec(href.offset,sizeof(aint)-offsetdec); //dec(href.offset,7); - paramanager.allocparaloc(exprasmlist,paraloc1); - cg.a_param_ref(exprasmlist,OS_INT,href,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc1); - paramanager.freeparaloc(exprasmlist,paraloc2); - cg.allocallcpuregisters(exprasmlist); - cg.a_call_name(exprasmlist,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK'); - cg.deallocallcpuregisters(exprasmlist); + paramanager.allocparaloc(current_asmdata.CurrAsmList,paraloc1); + cg.a_param_ref(current_asmdata.CurrAsmList,OS_INT,href,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc1); + paramanager.freeparaloc(current_asmdata.CurrAsmList,paraloc2); + cg.allocallcpuregisters(current_asmdata.CurrAsmList); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_'+upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK'); + cg.deallocallcpuregisters(current_asmdata.CurrAsmList); end; st_shortstring: begin diff --git a/compiler/ncgopt.pas b/compiler/ncgopt.pas index 133fb025b3..0400a8344d 100644 --- a/compiler/ncgopt.pas +++ b/compiler/ncgopt.pas @@ -93,12 +93,12 @@ begin { ti386addnode.pass_2 } secondpass(left); if not(tg.istemp(left.location.reference) and - (tg.sizeoftemp(exprasmlist,left.location.reference) = 256)) and + (tg.sizeoftemp(current_asmdata.CurrAsmList,left.location.reference) = 256)) and not(nf_use_strconcat in flags) then begin - tg.Gettemp(exprasmlist,256,tt_normal,href); - cg.g_copyshortstring(exprasmlist,left.location.reference,href,255); - location_freetemp(exprasmlist,left.location); + tg.Gettemp(current_asmdata.CurrAsmList,256,tt_normal,href); + cg.g_copyshortstring(current_asmdata.CurrAsmList,left.location.reference,href,255); + location_freetemp(current_asmdata.CurrAsmList,left.location); { return temp reference } location_reset(left.location,LOC_REFERENCE,def_cgsize(resulttype.def)); left.location.reference:=href; @@ -116,16 +116,16 @@ begin if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then begin { get register for the char } - hreg := cg.getintregister(exprasmlist,OS_8); - cg.a_load_ref_reg(exprasmlist,OS_8,OS_8,right.location.reference,hreg); + hreg := cg.getintregister(current_asmdata.CurrAsmList,OS_8); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_8,OS_8,right.location.reference,hreg); { I don't think a temp char exists, but it won't hurt (JM) } - tg.ungetiftemp(exprasmlist,right.location.reference); + tg.ungetiftemp(current_asmdata.CurrAsmList,right.location.reference); end else hreg := right.location.register; { load the current string length } - lengthreg := cg.getintregister(exprasmlist,OS_INT); - cg.a_load_ref_reg(exprasmlist,OS_8,OS_INT,left.location.reference,lengthreg); + lengthreg := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_8,OS_INT,left.location.reference,lengthreg); { do we have to check the length ? } if tg.istemp(left.location.reference) then @@ -135,12 +135,12 @@ begin if checklength then begin { is it already maximal? } - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); if tg.istemp(left.location.reference) then len:=255 else len:=tstringdef(left.resulttype.def).len; - cg.a_cmp_const_reg_label(exprasmlist,OS_INT,OC_EQ,len,lengthreg,l) + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,OC_EQ,len,lengthreg,l) end; { no, so increase the length and add the new character } @@ -155,7 +155,7 @@ begin { they're not free, so add the base reg to } { the string length (since the index can } { have a scalefactor) and use lengthreg as base } - cg.a_op_reg_reg(exprasmlist,OP_ADD,OS_INT,href2.base,lengthreg); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_ADD,OS_INT,href2.base,lengthreg); href2.base := lengthreg; end else @@ -176,16 +176,16 @@ begin begin { no new_reference(href2) because it's only } { used once (JM) } - cg.a_load_reg_ref(exprasmlist,OS_8,OS_8,hreg,href2); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_8,OS_8,hreg,href2); end else - cg.a_load_const_ref(exprasmlist,OS_8,tordconstnode(right).value,href2); - lengthreg:=cg.makeregsize(exprasmlist,lengthreg,OS_8); + cg.a_load_const_ref(current_asmdata.CurrAsmList,OS_8,tordconstnode(right).value,href2); + lengthreg:=cg.makeregsize(current_asmdata.CurrAsmList,lengthreg,OS_8); { increase the string length } - cg.a_op_const_reg(exprasmlist,OP_ADD,OS_8,1,lengthreg); - cg.a_load_reg_ref(exprasmlist,OS_8,OS_8,lengthreg,left.location.reference); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_ADD,OS_8,1,lengthreg); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_8,OS_8,lengthreg,left.location.reference); if checklength then - cg.a_label(exprasmlist,l); + cg.a_label(current_asmdata.CurrAsmList,l); location_copy(location,left.location); end; diff --git a/compiler/ncgset.pas b/compiler/ncgset.pas index b7d31397a2..eb2ba0ccc1 100644 --- a/compiler/ncgset.pas +++ b/compiler/ncgset.pas @@ -46,7 +46,7 @@ interface instructions to do bit tests. } - procedure emit_bit_test_reg_reg(list : taasmoutput; + procedure emit_bit_test_reg_reg(list : TAsmList; bitsize: tcgsize; bitnumber,value : tregister; ressize: tcgsize; res :tregister);virtual; end; @@ -88,7 +88,7 @@ implementation verbose, symconst,symdef,defutil, paramgr, - pass_2,tgobj, + procinfo,pass_2,tgobj, nbas,ncon,nflw, ncgutil,regvars, cgutils; @@ -103,7 +103,7 @@ implementation { load first value in 32bit register } secondpass(left); if left.location.loc in [LOC_REGISTER,LOC_CREGISTER] then - location_force_reg(exprasmlist,left.location,OS_32,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,OS_32,false); { also a second value ? } if assigned(right) then @@ -112,7 +112,7 @@ implementation if codegenerror then exit; if right.location.loc in [LOC_REGISTER,LOC_CREGISTER] then - location_force_reg(exprasmlist,right.location,OS_32,false); + location_force_reg(current_asmdata.CurrAsmList,right.location,OS_32,false); end; { we doesn't modify the left side, we check only the type } @@ -131,7 +131,7 @@ implementation { __Result register is set to 1, if the bit is set otherwise, __Result} { is set to zero. __RESULT register is also used as scratch. } {**********************************************************************} - procedure tcginnode.emit_bit_test_reg_reg(list : taasmoutput; + procedure tcginnode.emit_bit_test_reg_reg(list : TAsmList; bitsize: tcgsize; bitnumber,value : tregister; ressize: tcgsize; res :tregister); begin @@ -271,14 +271,14 @@ implementation if genjumps then begin { allocate a register for the result } - location.register := cg.getintregister(exprasmlist,location.size); + location.register := cg.getintregister(current_asmdata.CurrAsmList,location.size); { Get a label to jump to the end } - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); { clear the register value, indicating result is FALSE } - cg.a_load_const_reg(exprasmlist,location.size,0,location.register); + cg.a_load_const_reg(current_asmdata.CurrAsmList,location.size,0,location.register); { If register is used, use only lower 8 bits } - location_force_reg(exprasmlist,left.location,opsize,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,false); pleftreg := left.location.register; { how much have we already substracted from the x in the } @@ -302,16 +302,16 @@ implementation if (left.location.loc = LOC_CREGISTER) and (hr<>pleftreg) then begin - cg.a_op_const_reg(exprasmlist,OP_SUB,opsize,setparts[i].start,pleftreg); - hr:=cg.getintregister(exprasmlist,opsize); - cg.a_load_reg_reg(exprasmlist,opsize,opsize,pleftreg,hr); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,opsize,setparts[i].start,pleftreg); + hr:=cg.getintregister(current_asmdata.CurrAsmList,opsize); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,opsize,opsize,pleftreg,hr); pleftreg:=hr; end else begin { otherwise, the value is already in a register } { that can be modified } - cg.a_op_const_reg(exprasmlist,OP_SUB,opsize, + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,opsize, setparts[i].start-adjustment,pleftreg) end; { new total value substracted from x: } @@ -322,32 +322,32 @@ implementation { we need a carry in case the element is in the range } { (this will never overflow since we check at the } { beginning whether stop-start <> 255) } - cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_B, + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize, OC_B, setparts[i].stop-setparts[i].start+1,pleftreg,l); end else { if setparts[i].start = 0 and setparts[i].stop = 255, } { it's always true since "in" is only allowed for bytes } begin - cg.a_jmp_always(exprasmlist,l); + cg.a_jmp_always(current_asmdata.CurrAsmList,l); end; end else begin { Emit code to check if left is an element } - cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ, + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize, OC_EQ, setparts[i].stop-adjustment,pleftreg,l); end; { To compensate for not doing a second pass } right.location.reference.symbol:=nil; - objectlibrary.getjumplabel(l3); - cg.a_jmp_always(exprasmlist,l3); + current_asmdata.getjumplabel(l3); + cg.a_jmp_always(current_asmdata.CurrAsmList,l3); { Now place the end label if IN success } - cg.a_label(exprasmlist,l); + cg.a_label(current_asmdata.CurrAsmList,l); { result register is 1 } - cg.a_load_const_reg(exprasmlist,location.size,1,location.register); + cg.a_load_const_reg(current_asmdata.CurrAsmList,location.size,1,location.register); { in case value is not found } - cg.a_label(exprasmlist,l3); + cg.a_label(current_asmdata.CurrAsmList,l3); end else {*****************************************************************} @@ -361,21 +361,21 @@ implementation {**************************** SMALL SET **********************} if left.nodetype=ordconstn then begin - location_force_reg(exprasmlist,right.location,opsize,true); - location.register:=cg.getintregister(exprasmlist,location.size); + location_force_reg(current_asmdata.CurrAsmList,right.location,opsize,true); + location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size); { first SHR the register } - cg.a_op_const_reg_reg(exprasmlist,OP_SHR,opsize,tordconstnode(left).value and 31,right.location.register,location.register); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHR,opsize,tordconstnode(left).value and 31,right.location.register,location.register); { then extract the lowest bit } - cg.a_op_const_reg(exprasmlist,OP_AND,opsize,1,location.register); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_AND,opsize,1,location.register); end else begin - location_force_reg(exprasmlist,left.location,opsize,false); - location_force_reg(exprasmlist,right.location,opsize,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,false); + location_force_reg(current_asmdata.CurrAsmList,right.location,opsize,false); { allocate a register for the result } - location.register:=cg.getintregister(exprasmlist,location.size); + location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size); { emit bit test operation } - emit_bit_test_reg_reg(exprasmlist,left.location.size,left.location.register, + emit_bit_test_reg_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register, right.location.register,location.size,location.register); end; end @@ -391,27 +391,27 @@ implementation { assumption (other cases will be caught by range checking) (JM) } { load left in register } - location_force_reg(exprasmlist,left.location,opsize,true); + location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,true); if left.location.loc = LOC_CREGISTER then - hr := cg.getintregister(exprasmlist,opsize) + hr := cg.getintregister(current_asmdata.CurrAsmList,opsize) else hr := left.location.register; { load right in register } - hr2:=cg.getintregister(exprasmlist,opsize); - cg.a_load_const_reg(exprasmlist,opsize,right.location.value,hr2); + hr2:=cg.getintregister(current_asmdata.CurrAsmList,opsize); + cg.a_load_const_reg(current_asmdata.CurrAsmList,opsize,right.location.value,hr2); { emit bit test operation } - emit_bit_test_reg_reg(exprasmlist,left.location.size,left.location.register,hr2,opsize,hr2); + emit_bit_test_reg_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,hr2,opsize,hr2); { if left > 31 then hr := 0 else hr := $ffffffff } - cg.a_op_const_reg_reg(exprasmlist,OP_SUB,opsize,32,left.location.register,hr); - cg.a_op_const_reg(exprasmlist,OP_SAR,opsize,31,hr); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SUB,opsize,32,left.location.register,hr); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SAR,opsize,31,hr); { if left > 31, then result := 0 else result := result of bit test } - cg.a_op_reg_reg(exprasmlist,OP_AND,opsize,hr,hr2); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_AND,opsize,hr,hr2); { allocate a register for the result } - location.register := cg.getintregister(exprasmlist,location.size); - cg.a_load_reg_reg(exprasmlist,opsize,location.size,hr2,location.register); + location.register := cg.getintregister(current_asmdata.CurrAsmList,location.size); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,opsize,location.size,hr2,location.register); end { of right.location.loc=LOC_CONSTANT } { do search in a normal set which could have >32 elementsm but also used if the left side contains higher values > 32 } @@ -424,21 +424,21 @@ implementation { adjust for endianess differences } inc(right.location.reference.offset,(tordconstnode(left).value shr 3) xor 3); { allocate a register for the result } - location.register := cg.getintregister(exprasmlist,location.size); - cg.a_load_ref_reg(exprasmlist,OS_8,location.size,right.location.reference, location.register); - cg.a_op_const_reg(exprasmlist,OP_SHR,location.size,tordconstnode(left).value and 7, + location.register := cg.getintregister(current_asmdata.CurrAsmList,location.size); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_8,location.size,right.location.reference, location.register); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SHR,location.size,tordconstnode(left).value and 7, location.register); - cg.a_op_const_reg(exprasmlist,OP_AND,location.size,1,location.register); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_AND,location.size,1,location.register); end else begin - location_force_reg(exprasmlist,left.location,OS_INT,true); + location_force_reg(current_asmdata.CurrAsmList,left.location,OS_INT,true); pleftreg := left.location.register; - location_freetemp(exprasmlist,left.location); - hr := cg.getaddressregister(exprasmlist); - cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_INT,5,pleftreg,hr); - cg.a_op_const_reg(exprasmlist,OP_SHL,OS_INT,2,hr); + location_freetemp(current_asmdata.CurrAsmList,left.location); + hr := cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHR,OS_INT,5,pleftreg,hr); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SHL,OS_INT,2,hr); href := right.location.reference; if (href.base = NR_NO) then @@ -447,23 +447,23 @@ implementation href.index := hr else begin - hr2 := cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,href, hr2); + hr2 := cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href, hr2); reference_reset_base(href,hr2,0); href.index := hr; end; { allocate a register for the result } - location.register := cg.getintregister(exprasmlist,opsize); - cg.a_load_ref_reg(exprasmlist,opsize,opsize,href,location.register); + location.register := cg.getintregister(current_asmdata.CurrAsmList,opsize); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,opsize,opsize,href,location.register); - hr := cg.getintregister(exprasmlist,opsize); - cg.a_op_const_reg_reg(exprasmlist,OP_AND,opsize,31,pleftreg,hr); - cg.a_op_reg_reg(exprasmlist,OP_SHR,opsize,hr,location.register); - cg.a_op_const_reg(exprasmlist,OP_AND,opsize,1,location.register); + hr := cg.getintregister(current_asmdata.CurrAsmList,opsize); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_AND,opsize,31,pleftreg,hr); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_SHR,opsize,hr,location.register); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_AND,opsize,1,location.register); end; end; end; - location_freetemp(exprasmlist,right.location); + location_freetemp(current_asmdata.CurrAsmList,right.location); end; {***************************************************************************** @@ -512,8 +512,8 @@ implementation to move the result before subtract to help the register allocator } - cg.a_load_reg_reg(exprasmlist, opsize, opsize, hregister, scratch_reg); - cg.a_op_const_reg(exprasmlist, OP_SUB, opsize, value, hregister); + cg.a_load_reg_reg(current_asmdata.CurrAsmList, opsize, opsize, hregister, scratch_reg); + cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_SUB, opsize, value, hregister); end; begin @@ -521,15 +521,15 @@ implementation genitem(t^.less); { do we need to test the first value? } if first and (t^._low>get_min_value(left.resulttype.def)) then - cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,aint(t^._low),hregister,elselabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_lt,aint(t^._low),hregister,elselabel); if t^._low=t^._high then begin if t^._low-last=0 then - cg.a_cmp_const_reg_label(exprasmlist,opsize,OC_EQ,0,hregister,blocklabel(t^.blockid)) + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_EQ,0,hregister,blocklabel(t^.blockid)) else begin gensub(aint(t^._low-last)); - cg.a_cmp_const_reg_label(exprasmlist,opsize,OC_EQ,aint(t^._low-last),scratch_reg,blocklabel(t^.blockid)); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_EQ,aint(t^._low-last),scratch_reg,blocklabel(t^.blockid)); end; last:=t^._low; end @@ -550,10 +550,10 @@ implementation { present label then the lower limit can be checked } { immediately. else check the range in between: } gensub(aint(t^._low-last)); - cg.a_cmp_const_reg_label(exprasmlist, opsize,jmp_lt,aint(t^._low-last),scratch_reg,elselabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize,jmp_lt,aint(t^._low-last),scratch_reg,elselabel); end; gensub(aint(t^._high-t^._low)); - cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_le,aint(t^._high-t^._low),scratch_reg,blocklabel(t^.blockid)); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_le,aint(t^._high-t^._low),scratch_reg,blocklabel(t^.blockid)); last:=t^._high; end; first:=false; @@ -569,9 +569,9 @@ implementation begin last:=0; first:=true; - scratch_reg:=cg.getintregister(exprasmlist,opsize); + scratch_reg:=cg.getintregister(current_asmdata.CurrAsmList,opsize); genitem(hp); - cg.a_jmp_always(exprasmlist,elselabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,elselabel); end; end; @@ -597,15 +597,15 @@ implementation {$ifndef cpu64bit} if opsize in [OS_S64,OS_64] then begin - objectlibrary.getjumplabel(l1); - cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_NE, aint(hi(int64(t^._low))),hregister2,l1); - cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_EQ, aint(lo(int64(t^._low))),hregister, blocklabel(t^.blockid)); - cg.a_label(exprasmlist,l1); + current_asmdata.getjumplabel(l1); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, OS_32, OC_NE, aint(hi(int64(t^._low))),hregister2,l1); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, OS_32, OC_EQ, aint(lo(int64(t^._low))),hregister, blocklabel(t^.blockid)); + cg.a_label(current_asmdata.CurrAsmList,l1); end else {$endif cpu64bit} begin - cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ, aint(t^._low),hregister, blocklabel(t^.blockid)); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize, OC_EQ, aint(t^._low),hregister, blocklabel(t^.blockid)); end; { Reset last here, because we've only checked for one value and need to compare for the next range both the lower and upper bound } @@ -621,37 +621,37 @@ implementation {$ifndef cpu64bit} if opsize in [OS_64,OS_S64] then begin - objectlibrary.getjumplabel(l1); - cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aint(hi(int64(t^._low))), + current_asmdata.getjumplabel(l1); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, OS_32, jmp_lt, aint(hi(int64(t^._low))), hregister2, elselabel); - cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aint(hi(int64(t^._low))), + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, OS_32, jmp_gt, aint(hi(int64(t^._low))), hregister2, l1); { the comparisation of the low dword must be always unsigned! } - cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_B, aint(lo(int64(t^._low))), hregister, elselabel); - cg.a_label(exprasmlist,l1); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, OS_32, OC_B, aint(lo(int64(t^._low))), hregister, elselabel); + cg.a_label(current_asmdata.CurrAsmList,l1); end else {$endif cpu64bit} begin - cg.a_cmp_const_reg_label(exprasmlist, opsize, jmp_lt, aint(t^._low), hregister, + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize, jmp_lt, aint(t^._low), hregister, elselabel); end; end; {$ifndef cpu64bit} if opsize in [OS_S64,OS_64] then begin - objectlibrary.getjumplabel(l1); - cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_lt, aint(hi(int64(t^._high))), hregister2, + current_asmdata.getjumplabel(l1); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, OS_32, jmp_lt, aint(hi(int64(t^._high))), hregister2, blocklabel(t^.blockid)); - cg.a_cmp_const_reg_label(exprasmlist, OS_32, jmp_gt, aint(hi(int64(t^._high))), hregister2, + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, OS_32, jmp_gt, aint(hi(int64(t^._high))), hregister2, l1); - cg.a_cmp_const_reg_label(exprasmlist, OS_32, OC_BE, aint(lo(int64(t^._high))), hregister, blocklabel(t^.blockid)); - cg.a_label(exprasmlist,l1); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, OS_32, OC_BE, aint(lo(int64(t^._high))), hregister, blocklabel(t^.blockid)); + cg.a_label(current_asmdata.CurrAsmList,l1); end else {$endif cpu64bit} begin - cg.a_cmp_const_reg_label(exprasmlist, opsize, jmp_le, aint(t^._high), hregister, blocklabel(t^.blockid)); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize, jmp_le, aint(t^._high), hregister, blocklabel(t^.blockid)); end; last:=t^._high; @@ -665,7 +665,7 @@ implementation last:=0; lastwasrange:=false; genitem(hp); - cg.a_jmp_always(exprasmlist,elselabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,elselabel); end; @@ -684,10 +684,10 @@ implementation location_reset(location,LOC_VOID,OS_NO); { Allocate labels } - objectlibrary.getjumplabel(endlabel); - objectlibrary.getjumplabel(elselabel); + current_asmdata.getjumplabel(endlabel); + current_asmdata.getjumplabel(elselabel); for i:=0 to blocks.count-1 do - objectlibrary.getjumplabel(pcaseblock(blocks[i])^.blocklabel); + current_asmdata.getjumplabel(pcaseblock(blocks[i])^.blocklabel); with_sign:=is_signed(left.resulttype.def); if with_sign then @@ -703,21 +703,21 @@ implementation jmp_le:=OC_BE; end; - { save current truelabel and falselabel } + { save current current_procinfo.CurrTrueLabel and current_procinfo.CurrFalseLabel } isjump:=false; if left.location.loc=LOC_JUMP then begin - otl:=truelabel; - objectlibrary.getjumplabel(truelabel); - ofl:=falselabel; - objectlibrary.getjumplabel(falselabel); + otl:=current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + ofl:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); isjump:=true; end; secondpass(left); { determines the size of the operand } opsize:=def_cgsize(left.resulttype.def); { copy the case expression to a register } - location_force_reg(exprasmlist,left.location,opsize,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,false); {$ifndef cpu64bit} if opsize in [OS_S64,OS_64] then begin @@ -729,8 +729,8 @@ implementation hregister:=left.location.register; if isjump then begin - truelabel:=otl; - falselabel:=ofl; + current_procinfo.CurrTrueLabel:=otl; + current_procinfo.CurrFalseLabel:=ofl; end; { we need the min_label always to choose between } @@ -739,7 +739,7 @@ implementation { Generate the jumps } {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} {$ifndef cpu64bit} if opsize in [OS_64,OS_S64] then @@ -824,25 +824,25 @@ implementation { generate the instruction blocks } for i:=0 to blocks.count-1 do begin - cg.a_label(exprasmlist,pcaseblock(blocks[i])^.blocklabel); + cg.a_label(current_asmdata.CurrAsmList,pcaseblock(blocks[i])^.blocklabel); secondpass(pcaseblock(blocks[i])^.statement); { don't come back to case line } - aktfilepos:=exprasmList.getlasttaifilepos^; + aktfilepos:=current_asmdata.CurrAsmList.getlasttaifilepos^; {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} - cg.a_jmp_always(exprasmlist,endlabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,endlabel); end; { ...and the else block } - cg.a_label(exprasmlist,elselabel); + cg.a_label(current_asmdata.CurrAsmList,elselabel); if assigned(elseblock) then begin secondpass(elseblock); {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} end; - cg.a_label(exprasmlist,endlabel); + cg.a_label(current_asmdata.CurrAsmList,endlabel); { Reset labels } for i:=0 to blocks.count-1 do diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas index d9e00c9335..e9f0ba87c7 100644 --- a/compiler/ncgutil.pas +++ b/compiler/ncgutil.pas @@ -57,39 +57,39 @@ interface } procedure firstcomplex(p : tbinarynode); - procedure maketojumpbool(list:TAAsmoutput; p : tnode; loadregvars: tloadregvars); + procedure maketojumpbool(list:TAsmList; p : tnode; loadregvars: tloadregvars); // procedure remove_non_regvars_from_loc(const t: tlocation; var regs:Tsuperregisterset); - procedure location_force_reg(list:TAAsmoutput;var l:tlocation;dst_size:TCGSize;maybeconst:boolean); - procedure location_force_fpureg(list:TAAsmoutput;var l: tlocation;maybeconst:boolean); - procedure location_force_mem(list:TAAsmoutput;var l:tlocation); - procedure location_force_mmregscalar(list:TAAsmoutput;var l: tlocation;maybeconst:boolean); + procedure location_force_reg(list:TAsmList;var l:tlocation;dst_size:TCGSize;maybeconst:boolean); + procedure location_force_fpureg(list:TAsmList;var l: tlocation;maybeconst:boolean); + procedure location_force_mem(list:TAsmList;var l:tlocation); + procedure location_force_mmregscalar(list:TAsmList;var l: tlocation;maybeconst:boolean); { Retrieve the location of the data pointed to in location l, when the location is a register it is expected to contain the address of the data } - procedure location_get_data_ref(list:TAAsmoutput;const l:tlocation;var ref:treference;loadref:boolean); + procedure location_get_data_ref(list:TAsmList;const l:tlocation;var ref:treference;loadref:boolean); - function maybe_pushfpu(list:taasmoutput;needed : byte;var l:tlocation) : boolean; + function maybe_pushfpu(list:TAsmList;needed : byte;var l:tlocation) : boolean; procedure alloc_proc_symbol(pd: tprocdef); - procedure gen_proc_symbol(list:Taasmoutput); - procedure gen_proc_symbol_end(list:Taasmoutput); - procedure gen_proc_entry_code(list:Taasmoutput); - procedure gen_proc_exit_code(list:Taasmoutput); - procedure gen_stack_check_size_para(list:Taasmoutput); - procedure gen_stack_check_call(list:Taasmoutput); - procedure gen_save_used_regs(list:TAAsmoutput); - procedure gen_restore_used_regs(list:TAAsmoutput); - procedure gen_initialize_code(list:TAAsmoutput); - procedure gen_finalize_code(list:TAAsmoutput); - procedure gen_entry_code(list:TAAsmoutput); - procedure gen_exit_code(list:TAAsmoutput); - procedure gen_load_para_value(list:TAAsmoutput); - procedure gen_load_return_value(list:TAAsmoutput); - - procedure gen_external_stub(list:taasmoutput;pd:tprocdef;const externalname:string); - procedure gen_intf_wrappers(list:taasmoutput;st:tsymtable); - procedure gen_load_vmt_register(list:taasmoutput;objdef:tobjectdef;selfloc:tlocation;var vmtreg:tregister); + procedure gen_proc_symbol(list:TAsmList); + procedure gen_proc_symbol_end(list:TAsmList); + procedure gen_proc_entry_code(list:TAsmList); + procedure gen_proc_exit_code(list:TAsmList); + procedure gen_stack_check_size_para(list:TAsmList); + procedure gen_stack_check_call(list:TAsmList); + procedure gen_save_used_regs(list:TAsmList); + procedure gen_restore_used_regs(list:TAsmList); + procedure gen_initialize_code(list:TAsmList); + procedure gen_finalize_code(list:TAsmList); + procedure gen_entry_code(list:TAsmList); + procedure gen_exit_code(list:TAsmList); + procedure gen_load_para_value(list:TAsmList); + procedure gen_load_return_value(list:TAsmList); + + procedure gen_external_stub(list:TAsmList;pd:tprocdef;const externalname:string); + procedure gen_intf_wrappers(list:TAsmList;st:tsymtable); + procedure gen_load_vmt_register(list:TAsmList;objdef:tobjectdef;selfloc:tlocation;var vmtreg:tregister); procedure get_used_regvars(n: tnode; var rv: tusedregvars); { adds the regvars used in n and its children to rv.allregvars, @@ -99,7 +99,7 @@ interface find out which regvars are used in two different node trees (e.g. in the "else" and "then" path, or in various case blocks } // procedure get_used_regvars_common(n: tnode; var rv: tusedregvarscommon); - procedure gen_sync_regvars(list:TAAsmoutput; var rv: tusedregvars); + procedure gen_sync_regvars(list:TAsmList; var rv: tusedregvars); {# @@ -128,26 +128,26 @@ interface reasonbuf : treference; end; - procedure get_exception_temps(list:taasmoutput;var t:texceptiontemps); - procedure unget_exception_temps(list:taasmoutput;const t:texceptiontemps); - procedure new_exception(list:TAAsmoutput;const t:texceptiontemps;exceptlabel:tasmlabel); - procedure free_exception(list:TAAsmoutput;const t:texceptiontemps;a:aint;endexceptlabel:tasmlabel;onlyfree:boolean); + procedure get_exception_temps(list:TAsmList;var t:texceptiontemps); + procedure unget_exception_temps(list:TAsmList;const t:texceptiontemps); + procedure new_exception(list:TAsmList;const t:texceptiontemps;exceptlabel:tasmlabel); + procedure free_exception(list:TAsmList;const t:texceptiontemps;a:aint;endexceptlabel:tasmlabel;onlyfree:boolean); procedure insertbssdata(sym : tglobalvarsym); - procedure gen_alloc_symtable(list:TAAsmoutput;st:tsymtable); - procedure gen_free_symtable(list:TAAsmoutput;st:tsymtable); + procedure gen_alloc_symtable(list:TAsmList;st:tsymtable); + procedure gen_free_symtable(list:TAsmList;st:tsymtable); { rtti and init/final } procedure generate_rtti(p:Ttypesym); procedure generate_inittable(p:tsym); - procedure location_free(list: taasmoutput; const location : TLocation); + procedure location_free(list: TAsmList; const location : TLocation); function getprocalign : shortint; - procedure gen_pic_helpers(list : taasmoutput); - procedure gen_got_load(list : taasmoutput); + procedure gen_pic_helpers(list : TAsmList); + procedure gen_got_load(list : TAsmList); implementation @@ -174,7 +174,7 @@ implementation Misc Helpers *****************************************************************************} - procedure location_free(list: taasmoutput; const location : TLocation); + procedure location_free(list: TAsmList; const location : TLocation); begin case location.loc of LOC_VOID: @@ -249,7 +249,7 @@ implementation end; - procedure maketojumpbool(list:TAAsmoutput; p : tnode; loadregvars: tloadregvars); + procedure maketojumpbool(list:TAsmList; p : tnode; loadregvars: tloadregvars); { produces jumps to true respectively false labels using boolean expressions @@ -275,9 +275,9 @@ implementation if is_constboolnode(p) then begin if tordconstnode(p).value<>0 then - cg.a_jmp_always(list,truelabel) + cg.a_jmp_always(list,current_procinfo.CurrTrueLabel) else - cg.a_jmp_always(list,falselabel) + cg.a_jmp_always(list,current_procinfo.CurrFalseLabel) end else begin @@ -289,16 +289,16 @@ implementation if (p.location.loc = LOC_CREGISTER) then load_regvar_reg(list,p.location.register); {$endif OLDREGVARS} - cg.a_cmp_const_loc_label(list,opsize,OC_NE,0,p.location,truelabel); - cg.a_jmp_always(list,falselabel); + cg.a_cmp_const_loc_label(list,opsize,OC_NE,0,p.location,current_procinfo.CurrTrueLabel); + cg.a_jmp_always(list,current_procinfo.CurrFalseLabel); end; LOC_JUMP: ; {$ifdef cpuflags} LOC_FLAGS : begin - cg.a_jmp_flags(list,p.location.resflags,truelabel); - cg.a_jmp_always(list,falselabel); + cg.a_jmp_flags(list,p.location.resflags,current_procinfo.CurrTrueLabel); + cg.a_jmp_always(list,current_procinfo.CurrFalseLabel); end; {$endif cpuflags} else @@ -347,7 +347,7 @@ implementation EXCEPTION MANAGEMENT *****************************************************************************} - procedure get_exception_temps(list:taasmoutput;var t:texceptiontemps); + procedure get_exception_temps(list:TAsmList;var t:texceptiontemps); var srsym : ttypesym; begin @@ -362,7 +362,7 @@ implementation end; - procedure unget_exception_temps(list:taasmoutput;const t:texceptiontemps); + procedure unget_exception_temps(list:TAsmList;const t:texceptiontemps); begin tg.Ungettemp(list,t.jmpbuf); tg.ungettemp(list,t.envbuf); @@ -370,7 +370,7 @@ implementation end; - procedure new_exception(list:TAAsmoutput;const t:texceptiontemps;exceptlabel:tasmlabel); + procedure new_exception(list:TAsmList;const t:texceptiontemps;exceptlabel:tasmlabel); var paraloc1,paraloc2,paraloc3 : tcgpara; begin @@ -410,7 +410,7 @@ implementation end; - procedure free_exception(list:TAAsmoutput;const t:texceptiontemps;a:aint;endexceptlabel:tasmlabel;onlyfree:boolean); + procedure free_exception(list:TAsmList;const t:texceptiontemps;a:aint;endexceptlabel:tasmlabel;onlyfree:boolean); begin cg.allocallcpuregisters(list); cg.a_call_name(list,'FPC_POPADDRSTACK'); @@ -430,7 +430,7 @@ implementation {$ifndef cpu64bit} { 32-bit version } - procedure location_force_reg(list:TAAsmoutput;var l:tlocation;dst_size:TCGSize;maybeconst:boolean); + procedure location_force_reg(list:TAsmList;var l:tlocation;dst_size:TCGSize;maybeconst:boolean); var hregister, hregisterhi : tregister; @@ -461,11 +461,11 @@ implementation cg.g_flags2reg(list,OS_INT,l.resflags,hregister); LOC_JUMP : begin - cg.a_label(list,truelabel); + cg.a_label(list,current_procinfo.CurrTrueLabel); cg.a_load_const_reg(list,OS_INT,1,hregister); - objectlibrary.getjumplabel(hl); + current_asmdata.getjumplabel(hl); cg.a_jmp_always(list,hl); - cg.a_label(list,falselabel); + cg.a_label(list,current_procinfo.CurrFalseLabel); cg.a_load_const_reg(list,OS_INT,0,hregister); cg.a_label(list,hl); end; @@ -547,11 +547,11 @@ implementation cg.g_flags2reg(list,dst_size,l.resflags,hregister); LOC_JUMP : begin - cg.a_label(list,truelabel); + cg.a_label(list,current_procinfo.CurrTrueLabel); cg.a_load_const_reg(list,dst_size,1,hregister); - objectlibrary.getjumplabel(hl); + current_asmdata.getjumplabel(hl); cg.a_jmp_always(list,hl); - cg.a_label(list,falselabel); + cg.a_label(list,current_procinfo.CurrFalseLabel); cg.a_load_const_reg(list,dst_size,0,hregister); cg.a_label(list,hl); end; @@ -596,7 +596,7 @@ implementation {$else cpu64bit} { 64-bit version } - procedure location_force_reg(list:TAAsmoutput;var l:tlocation;dst_size:TCGSize;maybeconst:boolean); + procedure location_force_reg(list:TAsmList;var l:tlocation;dst_size:TCGSize;maybeconst:boolean); var hregister : tregister; hl : tasmlabel; @@ -610,11 +610,11 @@ implementation cg.g_flags2reg(list,dst_size,l.resflags,hregister); LOC_JUMP : begin - cg.a_label(list,truelabel); + cg.a_label(list,current_procinfo.CurrTrueLabel); cg.a_load_const_reg(list,dst_size,1,hregister); - objectlibrary.getjumplabel(hl); + current_asmdata.getjumplabel(hl); cg.a_jmp_always(list,hl); - cg.a_label(list,falselabel); + cg.a_label(list,current_procinfo.CurrFalseLabel); cg.a_load_const_reg(list,dst_size,0,hregister); cg.a_label(list,hl); end; @@ -658,7 +658,7 @@ implementation {$endif cpu64bit} - procedure location_force_fpureg(list:TAAsmoutput;var l: tlocation;maybeconst:boolean); + procedure location_force_fpureg(list:TAsmList;var l: tlocation;maybeconst:boolean); var reg : tregister; href : treference; @@ -683,7 +683,7 @@ implementation end; - procedure location_force_mmregscalar(list:TAAsmoutput;var l: tlocation;maybeconst:boolean); + procedure location_force_mmregscalar(list:TAsmList;var l: tlocation;maybeconst:boolean); var reg : tregister; href : treference; @@ -708,7 +708,7 @@ implementation end; - procedure location_force_mem(list:TAAsmoutput;var l:tlocation); + procedure location_force_mem(list:TAsmList;var l:tlocation); var r : treference; begin @@ -751,7 +751,7 @@ implementation end; - procedure location_get_data_ref(list:TAAsmoutput;const l:tlocation;var ref:treference;loadref:boolean); + procedure location_get_data_ref(list:TAsmList;const l:tlocation;var ref:treference;loadref:boolean); begin case l.loc of LOC_REGISTER, @@ -782,7 +782,7 @@ implementation Maybe_Save *****************************************************************************} - function maybe_pushfpu(list:taasmoutput;needed : byte;var l:tlocation) : boolean; + function maybe_pushfpu(list:TAsmList;needed : byte;var l:tlocation) : boolean; begin {$ifdef i386} if (needed>=maxfpuregs) and @@ -807,12 +807,12 @@ implementation var href : treference; hreg : tregister; - list : TAAsmoutput; + list : TAsmList; hsym : tparavarsym; l : longint; localcopyloc : tlocation; begin - list:=taasmoutput(arg); + list:=TAsmList(arg); if (tsym(p).typ=paravarsym) and (tparavarsym(p).varspez=vs_value) and (paramanager.push_addr_param(tparavarsym(p).varspez,tparavarsym(p).vartype.def,current_procinfo.procdef.proccalloption)) then @@ -866,12 +866,12 @@ implementation begin case tglobalvarsym(p).localloc.loc of LOC_CREGISTER : - cg.a_load_const_reg(taasmoutput(arg),reg_cgsize(tglobalvarsym(p).localloc.register),0, + cg.a_load_const_reg(TAsmList(arg),reg_cgsize(tglobalvarsym(p).localloc.register),0, tglobalvarsym(p).localloc.register); LOC_REFERENCE : ; LOC_CMMREGISTER : { clear the whole register } - cg.a_opmm_reg_reg(taasmoutput(arg),OP_XOR,reg_cgsize(tglobalvarsym(p).localloc.register), + cg.a_opmm_reg_reg(TAsmList(arg),OP_XOR,reg_cgsize(tglobalvarsym(p).localloc.register), tglobalvarsym(p).localloc.register, tglobalvarsym(p).localloc.register, nil); @@ -887,7 +887,7 @@ implementation { generates the code for initialisation of local data } procedure initialize_data(p : tnamedindexitem;arg:pointer); var - oldexprasmlist : TAAsmoutput; + OldAsmList : TAsmList; hp : tnode; begin if (tsym(p).typ in [globalvarsym,localvarsym]) and @@ -896,30 +896,30 @@ implementation not(is_class(tabstractvarsym(p).vartype.def)) and tabstractvarsym(p).vartype.def.needs_inittable then begin - oldexprasmlist:=exprasmlist; - exprasmlist:=taasmoutput(arg); + OldAsmList:=current_asmdata.CurrAsmList; + current_asmdata.CurrAsmList:=TAsmList(arg); hp:=initialize_data_node(cloadnode.create(tsym(p),tsym(p).owner)); firstpass(hp); secondpass(hp); hp.free; - exprasmlist:=oldexprasmlist; + current_asmdata.CurrAsmList:=OldAsmList; end; end; - procedure finalize_sym(asmlist:taasmoutput;sym:tsym); + procedure finalize_sym(asmlist:TAsmList;sym:tsym); var hp : tnode; - oldexprasmlist : TAAsmoutput; + OldAsmList : TAsmList; begin include(current_procinfo.flags,pi_needs_implicit_finally); - oldexprasmlist:=exprasmlist; - exprasmlist:=asmlist; + OldAsmList:=current_asmdata.CurrAsmList; + current_asmdata.CurrAsmList:=asmlist; hp:=finalize_data_node(cloadnode.create(sym,sym.owner)); firstpass(hp); secondpass(hp); hp.free; - exprasmlist:=oldexprasmlist; + current_asmdata.CurrAsmList:=OldAsmList; end; @@ -932,7 +932,7 @@ implementation not(vo_is_funcret in tlocalvarsym(p).varoptions) and not(is_class(tlocalvarsym(p).vartype.def)) and tlocalvarsym(p).vartype.def.needs_inittable then - finalize_sym(taasmoutput(arg),tsym(p)); + finalize_sym(TAsmList(arg),tsym(p)); end; @@ -947,7 +947,7 @@ implementation begin if ttypedconstsym(p).is_writable and ttypedconstsym(p).typedconsttype.def.needs_inittable then - finalize_sym(taasmoutput(arg),tsym(p)); + finalize_sym(TAsmList(arg),tsym(p)); end; procsym : begin @@ -979,13 +979,13 @@ implementation not(vo_is_external in tglobalvarsym(p).varoptions) and not(is_class(tglobalvarsym(p).vartype.def)) and tglobalvarsym(p).vartype.def.needs_inittable then - finalize_sym(taasmoutput(arg),tsym(p)); + finalize_sym(TAsmList(arg),tsym(p)); end; typedconstsym : begin if ttypedconstsym(p).is_writable and ttypedconstsym(p).typedconsttype.def.needs_inittable then - finalize_sym(taasmoutput(arg),tsym(p)); + finalize_sym(TAsmList(arg),tsym(p)); end; procsym : begin @@ -1008,9 +1008,9 @@ implementation var href : treference; tmpreg : tregister; - list : TAAsmoutput; + list : TAsmList; begin - list:=taasmoutput(arg); + list:=TAsmList(arg); if (tsym(p).typ=paravarsym) and not is_class_or_interface(tparavarsym(p).vartype.def) and tparavarsym(p).vartype.def.needs_inittable then @@ -1036,12 +1036,12 @@ implementation { generates the code for decrementing the reference count of parameters } procedure final_paras(p : tnamedindexitem;arg:pointer); var - list : TAAsmoutput; + list : TAsmList; href : treference; begin if not(tsym(p).typ=paravarsym) then exit; - list:=taasmoutput(arg); + list:=TAsmList(arg); if not is_class_or_interface(tparavarsym(p).vartype.def) and tparavarsym(p).vartype.def.needs_inittable then begin @@ -1066,7 +1066,7 @@ implementation { Initialize temp ansi/widestrings,interfaces } - procedure inittempvariables(list:taasmoutput); + procedure inittempvariables(list:TAsmList); var hp : ptemprecord; href : treference; @@ -1085,7 +1085,7 @@ implementation end; - procedure finalizetempvariables(list:taasmoutput); + procedure finalizetempvariables(list:TAsmList); var hp : ptemprecord; href : treference; @@ -1105,7 +1105,7 @@ implementation end; - procedure gen_load_return_value(list:TAAsmoutput); + procedure gen_load_return_value(list:TAsmList); var {$ifndef cpu64bit} href : treference; @@ -1262,7 +1262,7 @@ implementation end; - procedure gen_alloc_regvar(list:TAAsmoutput;sym: tabstractnormalvarsym); + procedure gen_alloc_regvar(list:TAsmList;sym: tabstractnormalvarsym); begin case sym.localloc.loc of LOC_CREGISTER: @@ -1304,7 +1304,7 @@ implementation end; - procedure gen_load_para_value(list:TAAsmoutput); + procedure gen_load_para_value(list:TAsmList); procedure get_para(const paraloc:TCGParaLocation); begin @@ -1593,7 +1593,7 @@ implementation end; - procedure gen_initialize_code(list:TAAsmoutput); + procedure gen_initialize_code(list:TAsmList); begin { initialize local data like ansistrings } case current_procinfo.procdef.proctypeoption of @@ -1630,7 +1630,7 @@ implementation end; - procedure gen_finalize_code(list:TAAsmoutput); + procedure gen_finalize_code(list:TAsmList); begin {$ifdef OLDREGVARS} cleanup_regvars(list); @@ -1664,7 +1664,7 @@ implementation end; - procedure gen_entry_code(list:TAAsmoutput); + procedure gen_entry_code(list:TAsmList); var paraloc1, paraloc2 : tcgpara; @@ -1709,7 +1709,7 @@ implementation end; - procedure gen_exit_code(list:TAAsmoutput); + procedure gen_exit_code(list:TAsmList); begin { call __EXIT for main program } if (not DLLsource) and @@ -1731,15 +1731,15 @@ implementation begin if (cs_profile in aktmoduleswitches) or (po_global in current_procinfo.procdef.procoptions) then - objectlibrary.newasmsymbol(item.str,AB_GLOBAL,AT_FUNCTION) + current_asmdata.newasmsymbol(item.str,AB_GLOBAL,AT_FUNCTION) else - objectlibrary.newasmsymbol(item.str,AB_GLOBAL,AT_FUNCTION); + current_asmdata.newasmsymbol(item.str,AB_GLOBAL,AT_FUNCTION); item := tstringlistitem(item.next); end; end; - procedure gen_proc_symbol(list:Taasmoutput); + procedure gen_proc_symbol(list:TAsmList); var hs : string; begin @@ -1761,7 +1761,7 @@ implementation - procedure gen_proc_symbol_end(list:Taasmoutput); + procedure gen_proc_symbol_end(list:TAsmList); begin list.concat(Tai_symbol_end.Createname(current_procinfo.procdef.mangledname)); @@ -1809,7 +1809,7 @@ implementation end; - procedure gen_proc_entry_code(list:Taasmoutput); + procedure gen_proc_entry_code(list:TAsmList); var hitemp, lotemp : longint; @@ -1839,7 +1839,7 @@ implementation end; - procedure gen_proc_exit_code(list:Taasmoutput); + procedure gen_proc_exit_code(list:TAsmList); var parasize : longint; begin @@ -1866,7 +1866,7 @@ implementation end; - procedure gen_stack_check_size_para(list:Taasmoutput); + procedure gen_stack_check_size_para(list:TAsmList); var paraloc1 : tcgpara; begin @@ -1879,7 +1879,7 @@ implementation end; - procedure gen_stack_check_call(list:Taasmoutput); + procedure gen_stack_check_call(list:TAsmList); var paraloc1 : tcgpara; begin @@ -1896,7 +1896,7 @@ implementation end; - procedure gen_save_used_regs(list:TAAsmoutput); + procedure gen_save_used_regs(list:TAsmList); begin { Pure assembler routines need to save the registers themselves } if (po_assembler in current_procinfo.procdef.procoptions) then @@ -1908,7 +1908,7 @@ implementation end; - procedure gen_restore_used_regs(list:TAAsmoutput); + procedure gen_restore_used_regs(list:TAsmList); begin { Pure assembler routines need to save the registers themselves } if (po_assembler in current_procinfo.procdef.procoptions) then @@ -1920,7 +1920,7 @@ implementation end; - procedure gen_got_load(list : taasmoutput); + procedure gen_got_load(list : TAsmList); begin { if loading got is necessary for more cpus, it can be moved to the cg } @@ -1932,7 +1932,7 @@ implementation begin current_module.requires_ebx_pic_helper:=true; cg.a_call_name_static(list,'fpc_geteipasebx'); - list.concat(taicpu.op_sym_ofs_reg(A_ADD,S_L,objectlibrary.newasmsymbol('_GLOBAL_OFFSET_TABLE_',AB_EXTERNAL,AT_DATA),0,NR_PIC_OFFSET_REG)); + list.concat(taicpu.op_sym_ofs_reg(A_ADD,S_L,current_asmdata.newasmsymbol('_GLOBAL_OFFSET_TABLE_',AB_EXTERNAL,AT_DATA),0,NR_PIC_OFFSET_REG)); list.concat(tai_regalloc.alloc(NR_PIC_OFFSET_REG,nil)); { ecx could be used in leave procedures } current_procinfo.got:=NR_EBX; @@ -1944,7 +1944,7 @@ implementation External handling ****************************************************************************} - procedure gen_external_stub(list:taasmoutput;pd:tprocdef;const externalname:string); + procedure gen_external_stub(list:TAsmList;pd:tprocdef;const externalname:string); begin { add the procedure to the al_procedures } maybe_new_object_file(list); @@ -1966,7 +1966,7 @@ implementation l : aint; varalign : shortint; storefilepos : tfileposinfo; - list : Taasmoutput; + list : TAsmList; sectype : TAsmSectiontype; begin storefilepos:=aktfilepos; @@ -1976,12 +1976,12 @@ implementation begin if (vo_is_thread_var in sym.varoptions) then begin - list:=asmlist[al_threadvars]; + list:=current_asmdata.asmlists[al_threadvars]; sectype:=sec_threadvar; end else begin - list:=asmlist[al_globals]; + list:=current_asmdata.asmlists[al_globals]; sectype:=sec_bss; end; end @@ -1989,7 +1989,7 @@ implementation begin if (vo_is_thread_var in sym.varoptions) then inc(l,sizeof(aint)); - list:=asmlist[al_globals]; + list:=current_asmdata.asmlists[al_globals]; sectype:=sec_bss; end; varalign:=var_align(size_2_align(l)); @@ -2034,7 +2034,7 @@ implementation end; - procedure gen_alloc_symtable(list:TAAsmoutput;st:tsymtable); + procedure gen_alloc_symtable(list:TAsmList;st:tsymtable); var sym : tsym; isaddr : boolean; @@ -2102,7 +2102,7 @@ implementation { PIC, DLL and Threadvar need extra code and are handled in ncgld } if not(vo_is_dll_var in varoptions) and ((tf_section_threadvars in target_info.flags) or not(vo_is_thread_var in varoptions)) then - reference_reset_symbol(localloc.reference,objectlibrary.newasmsymbol(mangledname,AB_EXTERNAL,AT_DATA),0); + reference_reset_symbol(localloc.reference,current_asmdata.newasmsymbol(mangledname,AB_EXTERNAL,AT_DATA),0); end; else internalerror(200410103); @@ -2220,7 +2220,7 @@ implementation end; *) - procedure gen_sync_regvars(list:TAAsmoutput; var rv: tusedregvars); + procedure gen_sync_regvars(list:TAsmList; var rv: tusedregvars); var count: longint; begin @@ -2233,7 +2233,7 @@ implementation end; - procedure gen_free_symtable(list:TAAsmoutput;st:tsymtable); + procedure gen_free_symtable(list:TAsmList;st:tsymtable); var sym : tsym; begin @@ -2305,11 +2305,11 @@ implementation def.rttitablesym:=rsym; { write rtti data } def.write_child_rtti_data(fullrtti); - maybe_new_object_file(asmlist[al_rtti]); - new_section(asmlist[al_rtti],sec_rodata,rsym.get_label.name,const_align(sizeof(aint))); - asmlist[al_rtti].concat(Tai_symbol.Create_global(rsym.get_label,0)); + maybe_new_object_file(current_asmdata.asmlists[al_rtti]); + new_section(current_asmdata.asmlists[al_rtti],sec_rodata,rsym.get_label.name,const_align(sizeof(aint))); + current_asmdata.asmlists[al_rtti].concat(Tai_symbol.Create_global(rsym.get_label,0)); def.write_rtti_data(fullrtti); - asmlist[al_rtti].concat(Tai_symbol_end.Create(rsym.get_label)); + current_asmdata.asmlists[al_rtti].concat(Tai_symbol_end.Create(rsym.get_label)); end; end; @@ -2345,17 +2345,17 @@ implementation def.inittablesym:=rsym; { write inittable data } def.write_child_rtti_data(initrtti); - maybe_new_object_file(asmlist[al_rtti]); - new_section(asmlist[al_rtti],sec_rodata,rsym.get_label.name,const_align(sizeof(aint))); - asmlist[al_rtti].concat(Tai_symbol.Create_global(rsym.get_label,0)); + maybe_new_object_file(current_asmdata.asmlists[al_rtti]); + new_section(current_asmdata.asmlists[al_rtti],sec_rodata,rsym.get_label.name,const_align(sizeof(aint))); + current_asmdata.asmlists[al_rtti].concat(Tai_symbol.Create_global(rsym.get_label,0)); def.write_rtti_data(initrtti); - asmlist[al_rtti].concat(Tai_symbol_end.Create(rsym.get_label)); + current_asmdata.asmlists[al_rtti].concat(Tai_symbol_end.Create(rsym.get_label)); end; end; - procedure gen_intf_wrapper(list:taasmoutput;_class:tobjectdef); + procedure gen_intf_wrapper(list:TAsmList;_class:tobjectdef); var i,j, proccount : longint; @@ -2383,7 +2383,7 @@ implementation end; - procedure gen_intf_wrappers(list:taasmoutput;st:tsymtable); + procedure gen_intf_wrappers(list:TAsmList;st:tsymtable); var def : tstoreddef; begin @@ -2397,7 +2397,7 @@ implementation end; - procedure gen_load_vmt_register(list:taasmoutput;objdef:tobjectdef;selfloc:tlocation;var vmtreg:tregister); + procedure gen_load_vmt_register(list:TAsmList;objdef:tobjectdef;selfloc:tlocation;var vmtreg:tregister); var href : treference; begin @@ -2461,7 +2461,7 @@ implementation end; - procedure gen_pic_helpers(list : taasmoutput); + procedure gen_pic_helpers(list : TAsmList); var href : treference; begin diff --git a/compiler/nobj.pas b/compiler/nobj.pas index f264c58d40..561c20f4d8 100644 --- a/compiler/nobj.pas +++ b/compiler/nobj.pas @@ -92,12 +92,12 @@ interface function newvmtentry(sym:tprocsym):pvmtentry; procedure eachsym(sym : tnamedindexitem;arg:pointer); procedure disposevmttree; - procedure writevirtualmethods(List:TAAsmoutput); + procedure writevirtualmethods(List:TAsmList); private { interface tables } function gintfgetvtbllabelname(intfindex: integer): string; - procedure gintfcreatevtbl(intfindex: integer; rawdata: TAAsmoutput); - procedure gintfgenentry(intfindex, contintfindex: integer; rawdata: TAAsmoutput); + procedure gintfcreatevtbl(intfindex: integer; rawdata: TAsmList); + procedure gintfgenentry(intfindex, contintfindex: integer; rawdata: TAsmList); procedure gintfoptimizevtbls; procedure gintfwritedata; function gintfgetcprocdef(proc: tprocdef;const name: string): tprocdef; @@ -258,16 +258,16 @@ implementation ca : pchar; len : longint; begin - objectlibrary.getdatalabel(p^.nl); + current_asmdata.getdatalabel(p^.nl); if assigned(p^.l) then writenames(p^.l); - asmlist[al_globals].concat(cai_align.create(const_align(sizeof(aint)))); - asmlist[al_globals].concat(Tai_label.Create(p^.nl)); + current_asmdata.asmlists[al_globals].concat(cai_align.create(const_align(sizeof(aint)))); + current_asmdata.asmlists[al_globals].concat(Tai_label.Create(p^.nl)); len:=strlen(p^.data.messageinf.str); - asmlist[al_globals].concat(tai_const.create_8bit(len)); + current_asmdata.asmlists[al_globals].concat(tai_const.create_8bit(len)); getmem(ca,len+1); move(p^.data.messageinf.str^,ca^,len+1); - asmlist[al_globals].concat(Tai_string.Create_pchar(ca,len)); + current_asmdata.asmlists[al_globals].concat(Tai_string.Create_pchar(ca,len)); if assigned(p^.r) then writenames(p^.r); end; @@ -279,8 +279,8 @@ implementation writestrentry(p^.l); { write name label } - asmlist[al_globals].concat(Tai_const.Create_sym(p^.nl)); - asmlist[al_globals].concat(Tai_const.Createname(p^.data.mangledname,AT_FUNCTION,0)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(p^.nl)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(p^.data.mangledname,AT_FUNCTION,0)); if assigned(p^.r) then writestrentry(p^.r); @@ -302,11 +302,11 @@ implementation writenames(root); { now start writing of the message string table } - objectlibrary.getdatalabel(r); - asmlist[al_globals].concat(cai_align.create(const_align(sizeof(aint)))); - asmlist[al_globals].concat(Tai_label.Create(r)); + current_asmdata.getdatalabel(r); + current_asmdata.asmlists[al_globals].concat(cai_align.create(const_align(sizeof(aint)))); + current_asmdata.asmlists[al_globals].concat(Tai_label.Create(r)); genstrmsgtab:=r; - asmlist[al_globals].concat(Tai_const.Create_aint(count)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_aint(count)); if assigned(root) then begin writestrentry(root); @@ -321,8 +321,8 @@ implementation writeintentry(p^.l); { write name label } - asmlist[al_globals].concat(Tai_const.Create_32bit(p^.data.messageinf.i)); - asmlist[al_globals].concat(Tai_const.Createname(p^.data.mangledname,AT_FUNCTION,0)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_32bit(p^.data.messageinf.i)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(p^.data.mangledname,AT_FUNCTION,0)); if assigned(p^.r) then writeintentry(p^.r); @@ -340,11 +340,11 @@ implementation _class.symtable.foreach(@insertmsgint,@count); { now start writing of the message string table } - objectlibrary.getdatalabel(r); - asmlist[al_globals].concat(cai_align.create(const_align(sizeof(aint)))); - asmlist[al_globals].concat(Tai_label.Create(r)); + current_asmdata.getdatalabel(r); + current_asmdata.asmlists[al_globals].concat(cai_align.create(const_align(sizeof(aint)))); + current_asmdata.asmlists[al_globals].concat(Tai_label.Create(r)); genintmsgtab:=r; - asmlist[al_globals].concat(Tai_const.Create_32bit(count)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_32bit(count)); if assigned(root) then begin writeintentry(root); @@ -417,7 +417,7 @@ implementation if count>0 then begin - objectlibrary.getdatalabel(r); + current_asmdata.getdatalabel(r); gendmt:=r; al_globals.concat(cai_align.create(const_align(sizeof(aint)))); al_globals.concat(Tai_label.Create(r)); @@ -473,18 +473,18 @@ implementation if (pd.procsym=tsym(p)) and (sp_published in pd.symoptions) then begin - objectlibrary.getdatalabel(l); + current_asmdata.getdatalabel(l); - asmlist[al_typedconsts].concat(cai_align.create(const_align(sizeof(aint)))); - asmlist[al_typedconsts].concat(Tai_label.Create(l)); - asmlist[al_typedconsts].concat(Tai_const.Create_8bit(length(tsym(p).realname))); - asmlist[al_typedconsts].concat(Tai_string.Create(tsym(p).realname)); + current_asmdata.asmlists[al_typedconsts].concat(cai_align.create(const_align(sizeof(aint)))); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(l)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_8bit(length(tsym(p).realname))); + current_asmdata.asmlists[al_typedconsts].concat(Tai_string.Create(tsym(p).realname)); - asmlist[al_globals].concat(Tai_const.Create_sym(l)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(l)); if po_abstractmethod in pd.procoptions then - asmlist[al_globals].concat(Tai_const.Create_sym(nil)) + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil)) else - asmlist[al_globals].concat(Tai_const.Createname(pd.mangledname,AT_FUNCTION,0)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(pd.mangledname,AT_FUNCTION,0)); end; end; end; @@ -502,10 +502,10 @@ implementation _class.symtable.foreach(@do_count_published_methods,@count); if count>0 then begin - objectlibrary.getdatalabel(l); - asmlist[al_globals].concat(cai_align.create(const_align(sizeof(aint)))); - asmlist[al_globals].concat(Tai_label.Create(l)); - asmlist[al_globals].concat(Tai_const.Create_32bit(count)); + current_asmdata.getdatalabel(l); + current_asmdata.asmlists[al_globals].concat(cai_align.create(const_align(sizeof(aint)))); + current_asmdata.asmlists[al_globals].concat(Tai_label.Create(l)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_32bit(count)); _class.symtable.foreach(@do_gen_published_methods,nil); genpublishedmethodstable:=l; end @@ -865,7 +865,7 @@ implementation end; - procedure tclassheader.gintfcreatevtbl(intfindex: integer; rawdata: TAAsmoutput); + procedure tclassheader.gintfcreatevtbl(intfindex: integer; rawdata: TAsmList); var implintf: timplementedinterfaces; curintf: tobjectdef; @@ -890,7 +890,7 @@ implementation end; - procedure tclassheader.gintfgenentry(intfindex, contintfindex: integer; rawdata: TAAsmoutput); + procedure tclassheader.gintfgenentry(intfindex, contintfindex: integer; rawdata: TAsmList); var implintf: timplementedinterfaces; curintf: tobjectdef; @@ -903,7 +903,7 @@ implementation if curintf.objecttype in [odt_interfacecom] then begin { label for GUID } - objectlibrary.getdatalabel(tmplabel); + current_asmdata.getdatalabel(tmplabel); rawdata.concat(cai_align.create(const_align(sizeof(aint)))); rawdata.concat(Tai_label.Create(tmplabel)); rawdata.concat(Tai_const.Create_32bit(longint(curintf.iidguid^.D1))); @@ -911,19 +911,19 @@ implementation rawdata.concat(Tai_const.Create_16bit(curintf.iidguid^.D3)); for i:=Low(curintf.iidguid^.D4) to High(curintf.iidguid^.D4) do rawdata.concat(Tai_const.Create_8bit(curintf.iidguid^.D4[i])); - asmlist[al_globals].concat(Tai_const.Create_sym(tmplabel)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(tmplabel)); end else begin { nil for Corba interfaces } - asmlist[al_globals].concat(Tai_const.Create_sym(nil)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil)); end; { VTable } - asmlist[al_globals].concat(Tai_const.Createname(gintfgetvtbllabelname(contintfindex),AT_DATA,0)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(gintfgetvtbllabelname(contintfindex),AT_DATA,0)); { IOffset field } - asmlist[al_globals].concat(Tai_const.Create_aint(implintf.ioffsets(contintfindex))); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_aint(implintf.ioffsets(contintfindex))); { IIDStr } - objectlibrary.getdatalabel(tmplabel); + current_asmdata.getdatalabel(tmplabel); rawdata.concat(cai_align.create(const_align(sizeof(aint)))); rawdata.concat(Tai_label.Create(tmplabel)); rawdata.concat(Tai_const.Create_8bit(length(curintf.iidstr^))); @@ -931,7 +931,7 @@ implementation rawdata.concat(Tai_string.Create(upper(curintf.iidstr^))) else rawdata.concat(Tai_string.Create(curintf.iidstr^)); - asmlist[al_globals].concat(Tai_const.Create_sym(tmplabel)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(tmplabel)); end; @@ -1036,12 +1036,12 @@ implementation procedure tclassheader.gintfwritedata; var - rawdata: taasmoutput; + rawdata: TAsmList; max,i,j : smallint; begin max:=_class.implementedinterfaces.count; - rawdata:=TAAsmOutput.Create; + rawdata:=TAsmList.Create; { Two pass, one for allocation and vtbl creation } for i:=1 to max do begin @@ -1059,7 +1059,7 @@ implementation end; end; { second pass: for fill interfacetable and remained ioffsets } - asmlist[al_globals].concat(Tai_const.Create_aint(max)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_aint(max)); for i:=1 to max do begin j:=_class.implementedinterfaces.implindex(i); @@ -1067,7 +1067,7 @@ implementation _class.implementedinterfaces.setioffsets(i,_class.implementedinterfaces.ioffsets(j)); gintfgenentry(i,j,rawdata); end; - asmlist[al_globals].concatlist(rawdata); + current_asmdata.asmlists[al_globals].concatlist(rawdata); rawdata.free; end; @@ -1167,9 +1167,9 @@ implementation { 2. Optimize interface tables to reuse wrappers } gintfoptimizevtbls; { 3. Calculate offsets in object map and Write interface tables } - objectlibrary.getdatalabel(intftable); - asmlist[al_globals].concat(cai_align.create(const_align(sizeof(aint)))); - asmlist[al_globals].concat(Tai_label.Create(intftable)); + current_asmdata.getdatalabel(intftable); + current_asmdata.asmlists[al_globals].concat(cai_align.create(const_align(sizeof(aint)))); + current_asmdata.asmlists[al_globals].concat(Tai_label.Create(intftable)); gintfwritedata; genintftable:=intftable; end; @@ -1184,25 +1184,25 @@ implementation if assigned(_class.iidguid) then begin s:=make_mangledname('IID',_class.owner,_class.objname^); - maybe_new_object_file(asmlist[al_globals]); - new_section(asmlist[al_globals],sec_rodata,s,const_align(sizeof(aint))); - asmlist[al_globals].concat(Tai_symbol.Createname_global(s,AT_DATA,0)); - asmlist[al_globals].concat(Tai_const.Create_32bit(longint(_class.iidguid^.D1))); - asmlist[al_globals].concat(Tai_const.Create_16bit(_class.iidguid^.D2)); - asmlist[al_globals].concat(Tai_const.Create_16bit(_class.iidguid^.D3)); + maybe_new_object_file(current_asmdata.asmlists[al_globals]); + new_section(current_asmdata.asmlists[al_globals],sec_rodata,s,const_align(sizeof(aint))); + current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global(s,AT_DATA,0)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_32bit(longint(_class.iidguid^.D1))); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_16bit(_class.iidguid^.D2)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_16bit(_class.iidguid^.D3)); for i:=Low(_class.iidguid^.D4) to High(_class.iidguid^.D4) do - asmlist[al_globals].concat(Tai_const.Create_8bit(_class.iidguid^.D4[i])); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_8bit(_class.iidguid^.D4[i])); end; - maybe_new_object_file(asmlist[al_globals]); + maybe_new_object_file(current_asmdata.asmlists[al_globals]); s:=make_mangledname('IIDSTR',_class.owner,_class.objname^); - new_section(asmlist[al_globals],sec_rodata,s,0); - asmlist[al_globals].concat(Tai_symbol.Createname_global(s,AT_DATA,0)); - asmlist[al_globals].concat(Tai_const.Create_8bit(length(_class.iidstr^))); - asmlist[al_globals].concat(Tai_string.Create(_class.iidstr^)); + new_section(current_asmdata.asmlists[al_globals],sec_rodata,s,0); + current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global(s,AT_DATA,0)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_8bit(length(_class.iidstr^))); + current_asmdata.asmlists[al_globals].concat(Tai_string.Create(_class.iidstr^)); end; - procedure tclassheader.writevirtualmethods(List:TAAsmoutput); + procedure tclassheader.writevirtualmethods(List:TAsmList); var vmtentry : pvmtentry; procdefcoll : pprocdefcoll; @@ -1262,9 +1262,9 @@ implementation class is written, because we need the labels defined } if is_class(_class) then begin - objectlibrary.getdatalabel(classnamelabel); - maybe_new_object_file(asmlist[al_globals]); - new_section(asmlist[al_globals],sec_rodata,classnamelabel.name,const_align(sizeof(aint))); + current_asmdata.getdatalabel(classnamelabel); + maybe_new_object_file(current_asmdata.asmlists[al_globals]); + new_section(current_asmdata.asmlists[al_globals],sec_rodata,classnamelabel.name,const_align(sizeof(aint))); { interface table } if _class.implementedinterfaces.count>0 then @@ -1273,9 +1273,9 @@ implementation methodnametable:=genpublishedmethodstable; fieldtablelabel:=_class.generate_field_table; { write class name } - asmlist[al_globals].concat(Tai_label.Create(classnamelabel)); - asmlist[al_globals].concat(Tai_const.Create_8bit(length(_class.objrealname^))); - asmlist[al_globals].concat(Tai_string.Create(_class.objrealname^)); + current_asmdata.asmlists[al_globals].concat(Tai_label.Create(classnamelabel)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_8bit(length(_class.objrealname^))); + current_asmdata.asmlists[al_globals].concat(Tai_string.Create(_class.objrealname^)); { generate message and dynamic tables } if (oo_has_msgstr in _class.objectoptions) then @@ -1285,21 +1285,21 @@ implementation end; { write debug info } - maybe_new_object_file(asmlist[al_globals]); - new_section(asmlist[al_globals],sec_rodata,_class.vmt_mangledname,const_align(sizeof(aint))); - asmlist[al_globals].concat(Tai_symbol.Createname_global(_class.vmt_mangledname,AT_DATA,0)); + maybe_new_object_file(current_asmdata.asmlists[al_globals]); + new_section(current_asmdata.asmlists[al_globals],sec_rodata,_class.vmt_mangledname,const_align(sizeof(aint))); + current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global(_class.vmt_mangledname,AT_DATA,0)); { determine the size with symtable.datasize, because } { size gives back 4 for classes } - asmlist[al_globals].concat(Tai_const.Create(aitconst_ptr,tobjectsymtable(_class.symtable).datasize)); - asmlist[al_globals].concat(Tai_const.Create(aitconst_ptr,-int64(tobjectsymtable(_class.symtable).datasize))); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create(aitconst_ptr,tobjectsymtable(_class.symtable).datasize)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create(aitconst_ptr,-int64(tobjectsymtable(_class.symtable).datasize))); {$ifdef WITHDMT} if _class.classtype=ct_object then begin if assigned(dmtlabel) then - asmlist[al_globals].concat(Tai_const_symbol.Create(dmtlabel))) + current_asmdata.asmlists[al_globals].concat(Tai_const_symbol.Create(dmtlabel))) else - asmlist[al_globals].concat(Tai_const.Create_ptr(0)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_ptr(0)); end; {$endif WITHDMT} { write pointer to parent VMT, this isn't implemented in TP } @@ -1308,52 +1308,52 @@ implementation { it is not written for parents that don't have any vmt !! } if assigned(_class.childof) and (oo_has_vmt in _class.childof.objectoptions) then - asmlist[al_globals].concat(Tai_const.Createname(_class.childof.vmt_mangledname,AT_DATA,0)) + current_asmdata.asmlists[al_globals].concat(Tai_const.Createname(_class.childof.vmt_mangledname,AT_DATA,0)) else - asmlist[al_globals].concat(Tai_const.Create_sym(nil)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil)); { write extended info for classes, for the order see rtl/inc/objpash.inc } if is_class(_class) then begin { pointer to class name string } - asmlist[al_globals].concat(Tai_const.Create_sym(classnamelabel)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(classnamelabel)); { pointer to dynamic table or nil } if (oo_has_msgint in _class.objectoptions) then - asmlist[al_globals].concat(Tai_const.Create_sym(intmessagetable)) + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(intmessagetable)) else - asmlist[al_globals].concat(Tai_const.Create_sym(nil)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil)); { pointer to method table or nil } - asmlist[al_globals].concat(Tai_const.Create_sym(methodnametable)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(methodnametable)); { pointer to field table } - asmlist[al_globals].concat(Tai_const.Create_sym(fieldtablelabel)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(fieldtablelabel)); { pointer to type info of published section } if (oo_can_have_published in _class.objectoptions) then - asmlist[al_globals].concat(Tai_const.Create_sym(_class.get_rtti_label(fullrtti))) + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(_class.get_rtti_label(fullrtti))) else - asmlist[al_globals].concat(Tai_const.Create_sym(nil)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil)); { inittable for con-/destruction } if _class.members_need_inittable then - asmlist[al_globals].concat(Tai_const.Create_sym(_class.get_rtti_label(initrtti))) + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(_class.get_rtti_label(initrtti))) else - asmlist[al_globals].concat(Tai_const.Create_sym(nil)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil)); { auto table } - asmlist[al_globals].concat(Tai_const.Create_sym(nil)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil)); { interface table } if _class.implementedinterfaces.count>0 then - asmlist[al_globals].concat(Tai_const.Create_sym(interfacetable)) + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(interfacetable)) else - asmlist[al_globals].concat(Tai_const.Create_sym(nil)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil)); { table for string messages } if (oo_has_msgstr in _class.objectoptions) then - asmlist[al_globals].concat(Tai_const.Create_sym(strmessagetable)) + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(strmessagetable)) else - asmlist[al_globals].concat(Tai_const.Create_sym(nil)); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil)); end; { write virtual methods } - writevirtualmethods(asmlist[al_globals]); - asmlist[al_globals].concat(Tai_const.create(aitconst_ptr,0)); + writevirtualmethods(current_asmdata.asmlists[al_globals]); + current_asmdata.asmlists[al_globals].concat(Tai_const.create(aitconst_ptr,0)); { write the size of the VMT } - asmlist[al_globals].concat(Tai_symbol_end.Createname(_class.vmt_mangledname)); + current_asmdata.asmlists[al_globals].concat(Tai_symbol_end.Createname(_class.vmt_mangledname)); end; diff --git a/compiler/node.pas b/compiler/node.pas index 5a963dab18..f2d9b48dd6 100644 --- a/compiler/node.pas +++ b/compiler/node.pas @@ -350,7 +350,7 @@ interface { this node is the anchestor for all nodes with at least } { one child, you have to use it if you want to use } - { true- and falselabel } + { true- and current_procinfo.CurrFalseLabel } punarynode = ^tunarynode; tunarynode = class(tnode) left : tnode; diff --git a/compiler/ogbase.pas b/compiler/ogbase.pas index c6838e7964..ad521b6dfb 100644 --- a/compiler/ogbase.pas +++ b/compiler/ogbase.pas @@ -300,7 +300,6 @@ interface { writer } FWriter : TObjectwriter; commonObjSection : TObjSection; - commonobjdata, internalobjdata : TObjData; EntrySym : TObjSymbol; SectionDataAlign, @@ -317,6 +316,7 @@ interface procedure Load_EntryName(const aname:string);virtual; procedure Load_Symbol(const aname:string);virtual; procedure Order_Start;virtual; + procedure Order_End;virtual; procedure Order_ExeSection(const aname:string);virtual; procedure Order_Align(const aname:string);virtual; procedure Order_Zeros(const aname:string);virtual; @@ -487,6 +487,7 @@ implementation relocations.free; ObjSymbolRefs.Free; ObjSymbolDefines.Free; + inherited destroy; end; @@ -656,6 +657,7 @@ implementation {$ifdef MEMDEBUG} d.free; {$endif} + inherited destroy; end; @@ -1009,6 +1011,7 @@ implementation destructor TObjOutput.destroy; begin + inherited destroy; end; @@ -1081,6 +1084,7 @@ implementation destructor tExeSection.destroy; begin ObjSectionList.Free; + inherited destroy; end; @@ -1145,6 +1149,7 @@ implementation FExeSectionList.free; objdatalist.free; FWriter.free; + inherited destroy; end; @@ -1185,15 +1190,10 @@ implementation ObjDataList.Clear; { Globals defined in the linker script } if not assigned(internalobjdata) then - internalobjdata:=CObjData.create('*GLOBALS*'); + internalobjdata:=CObjData.create('*Internal*'); AddObjData(internalobjdata); - { Common data } - if not assigned(commonobjdata) then - begin - commonobjdata:=CObjData.create('*COMMON*'); - commonObjSection:=commonobjdata.createsection(sec_bss,''); - end; - AddObjData(commonobjdata); + { Common data section } + commonObjSection:=internalobjdata.createsection(sec_bss,''); end; @@ -1215,6 +1215,12 @@ implementation end; + procedure TExeOutput.Order_End; + begin + internalobjdata.afterwrite; + end; + + procedure TExeOutput.Order_ExeSection(const aname:string); var sec : TExeSection; @@ -1284,7 +1290,6 @@ implementation { Create an empty section with the required aligning } inc(Fzeronr); objsec:=internalobjdata.createsection('*align'+tostr(Fzeronr),alignval,CurrExeSec.SecOptions+[oso_data,oso_keep]); - internalobjdata.afterwrite; CurrExeSec.AddObjSection(objsec); end; @@ -1305,7 +1310,6 @@ implementation inc(Fzeronr); objsec:=internalobjdata.createsection('*zeros'+tostr(Fzeronr),0,CurrExeSec.SecOptions+[oso_data,oso_keep]); internalobjdata.writebytes(zeros,len); - internalobjdata.afterwrite; CurrExeSec.AddObjSection(objsec); end; @@ -1570,10 +1574,10 @@ implementation exemap.AddCommonSymbolsHeader; firstcommon:=false; end; - commonobjdata.setsection(commonObjSection); - commonsym:=commonobjdata.symboldefine(objsym.name,AB_GLOBAL,AT_FUNCTION); + internalobjdata.setsection(commonObjSection); + commonsym:=internalobjdata.symboldefine(objsym.name,AB_GLOBAL,AT_FUNCTION); commonsym.size:=objsym.size; - commonobjdata.alloc(objsym.size); + internalobjdata.alloc(objsym.size); if assigned(exemap) then exemap.AddCommonSymbol(commonsym); { Assign to the exesymbol } @@ -1581,8 +1585,6 @@ implementation end; end; end; - if not firstcommon then - commonobjdata.afterwrite; { Generate a list of Unresolved External symbols } for i:=0 to ExeSymbolList.count-1 do @@ -1793,6 +1795,8 @@ implementation AddToObjSectionWorkList(refobjsec); end; end; + ObjSectionWorkList.Free; + ObjSectionWorkList:=nil; { Remove unused objsections from exesections } for i:=0 to ExeSections.Count-1 do @@ -1824,6 +1828,8 @@ implementation objdata.fixuprelocs; end; end; + + {**************************************************************************** TObjInput ****************************************************************************} @@ -1838,6 +1844,7 @@ implementation destructor TObjInput.destroy; begin FReader.free; + inherited destroy; end; diff --git a/compiler/ogcoff.pas b/compiler/ogcoff.pas index e20243363b..6401da3f44 100644 --- a/compiler/ogcoff.pas +++ b/compiler/ogcoff.pas @@ -97,6 +97,7 @@ interface function writedata(data:TObjData):boolean;override; public constructor createcoff(AWriter:TObjectWriter;awin32:boolean); + destructor destroy; end; TDJCoffObjOutput = class(TCoffObjOutput) @@ -107,6 +108,37 @@ interface constructor create(AWriter:TObjectWriter);override; end; + TCoffObjInput = class(tObjInput) + private + FCoffsyms, + FCoffStrs : tdynamicarray; + { Convert symidx -> TObjSymbol } + FSymTbl : ^TObjSymbolArray; + { Convert secidx -> TObjSection } + FSecCount : smallint; + FSecTbl : ^TObjSectionArray; + win32 : boolean; + function GetSection(secidx:longint):TObjSection; + function Read_str(strpos:longint):string; + procedure read_relocs(s:TCoffObjSection); + procedure read_symbols(objdata:TObjData); + procedure ObjSections_read_data(p:TObject;arg:pointer); + procedure ObjSections_read_relocs(p:TObject;arg:pointer); + protected + function readObjData(objdata:TObjData):boolean;override; + public + constructor createcoff(awin32:boolean); + destructor destroy;override; + end; + + TDJCoffObjInput = class(TCoffObjInput) + constructor create;override; + end; + + TPECoffObjInput = class(TCoffObjInput) + constructor create;override; + end; + TCoffExeSection = class(TExeSection) private win32 : boolean; @@ -163,36 +195,6 @@ interface TObjSymbolArray = array[0..high(word)] of TObjSymbolrec; TObjSectionArray = array[0..high(smallint)] of TObjSection; - TCoffObjInput = class(tObjInput) - private - FCoffsyms, - FCoffStrs : tdynamicarray; - { Convert symidx -> TObjSymbol } - FSymTbl : ^TObjSymbolArray; - { Convert secidx -> TObjSection } - FSecCount : smallint; - FSecTbl : ^TObjSectionArray; - win32 : boolean; - function GetSection(secidx:longint):TObjSection; - function Read_str(strpos:longint):string; - procedure read_relocs(s:TCoffObjSection); - procedure read_symbols(objdata:TObjData); - procedure ObjSections_read_data(p:TObject;arg:pointer); - procedure ObjSections_read_relocs(p:TObject;arg:pointer); - protected - function readObjData(objdata:TObjData):boolean;override; - public - constructor createcoff(awin32:boolean); - end; - - TDJCoffObjInput = class(TCoffObjInput) - constructor create;override; - end; - - TPECoffObjInput = class(TCoffObjInput) - constructor create;override; - end; - TDJCoffAssembler = class(tinternalassembler) constructor create(smart:boolean);override; end; @@ -1025,6 +1027,16 @@ const win32stub : array[0..131] of byte=( end; + destructor TCoffObjOutput.destroy; + begin + if assigned(FCoffSyms) then + FCoffSyms.free; + if assigned(FCoffStrs) then + FCoffStrs.free; + inherited destroy; + end; + + procedure TCoffObjOutput.write_symbol(const name:string;value:aint;section:smallint;typ,aux:byte); var sym : coffsymbol; @@ -1323,6 +1335,21 @@ const win32stub : array[0..131] of byte=( begin inherited create; win32:=awin32; + FSymTbl:=nil; + end; + + + destructor TCoffObjInput.destroy; + begin + if assigned(FCoffSyms) then + FCoffSyms.free; + if assigned(FCoffStrs) then + FCoffStrs.free; + if assigned(FSymTbl) then + freemem(FSymTbl); + if assigned(FSecTbl) then + freemem(FSecTbl); + inherited destroy; end; @@ -1658,7 +1685,9 @@ const win32stub : array[0..131] of byte=( ObjSectionList.ForEachCall(@objsections_read_relocs,nil); end; FCoffStrs.Free; + FCoffStrs:=nil; FCoffSyms.Free; + FCoffSyms:=nil; result:=true; end; @@ -2240,6 +2269,7 @@ const win32stub : array[0..131] of byte=( UnresolvedExeSymbols.Pack; if assigned(idata2objsection) then EndImport; + DLLReader.Free; end; diff --git a/compiler/paramgr.pas b/compiler/paramgr.pas index 91304ac1ac..99b0ce2eda 100644 --- a/compiler/paramgr.pas +++ b/compiler/paramgr.pas @@ -81,14 +81,14 @@ unit paramgr; @param(list Current assembler list) @param(loc Parameter location) } - procedure allocparaloc(list: taasmoutput; const cgpara: TCGPara); virtual; + procedure allocparaloc(list: TAsmList; const cgpara: TCGPara); virtual; {# free a parameter location allocated with alloccgpara @param(list Current assembler list) @param(loc Parameter location) } - procedure freeparaloc(list: taasmoutput; const cgpara: TCGPara); virtual; + procedure freeparaloc(list: TAsmList; const cgpara: TCGPara); virtual; { This is used to populate the location information on all parameters for the routine as seen in either the caller or the callee. It returns @@ -108,8 +108,8 @@ unit paramgr; } function create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargsparalist):longint;virtual;abstract; - procedure createtempparaloc(list: taasmoutput;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara);virtual; - procedure duplicateparaloc(list: taasmoutput;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); + procedure createtempparaloc(list: TAsmList;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara);virtual; + procedure duplicateparaloc(list: TAsmList;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); function parseparaloc(parasym : tparavarsym;const s : string) : boolean;virtual;abstract; function parsefuncretloc(p : tabstractprocdef; const s : string) : boolean;virtual;abstract; @@ -216,7 +216,7 @@ implementation end; - procedure tparamanager.allocparaloc(list: taasmoutput; const cgpara: TCGPara); + procedure tparamanager.allocparaloc(list: TAsmList; const cgpara: TCGPara); var paraloc : pcgparalocation; begin @@ -248,7 +248,7 @@ implementation end; - procedure tparamanager.freeparaloc(list: taasmoutput; const cgpara: TCGPara); + procedure tparamanager.freeparaloc(list: TAsmList; const cgpara: TCGPara); var paraloc : Pcgparalocation; href : treference; @@ -297,7 +297,7 @@ implementation end; - procedure tparamanager.createtempparaloc(list: taasmoutput;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); + procedure tparamanager.createtempparaloc(list: TAsmList;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); var href : treference; len : aint; @@ -347,7 +347,7 @@ implementation end; - procedure tparamanager.duplicateparaloc(list: taasmoutput;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); + procedure tparamanager.duplicateparaloc(list: TAsmList;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); var paraloc, newparaloc : pcgparalocation; diff --git a/compiler/parser.pas b/compiler/parser.pas index 9b27a5a4a4..076f0f1f70 100644 --- a/compiler/parser.pas +++ b/compiler/parser.pas @@ -68,9 +68,9 @@ implementation testcurobject:=0; { Current compiled module/proc } - objectlibrary:=nil; current_module:=nil; compiled_module:=nil; + current_asmdata:=nil; current_procinfo:=nil; SetCompileModule(nil); @@ -133,10 +133,10 @@ implementation begin { Reset current compiling info, so destroy routines can't reference the data that might already be destroyed } - objectlibrary:=nil; current_module:=nil; compiled_module:=nil; current_procinfo:=nil; + current_asmdata:=nil; SetCompileModule(nil); { unload units } @@ -249,47 +249,6 @@ implementation {***************************************************************************** - Create information for a new module -*****************************************************************************} - - procedure init_module; - var - i : Tasmlist; - begin - exprasmlist:=taasmoutput.create; - for i:=low(Tasmlist) to high(Tasmlist) do - asmlist[i]:=Taasmoutput.create; - - { PIC data } - if (target_info.system in [system_powerpc_darwin,system_i386_darwin]) then - asmlist[al_picdata].concat(tai_directive.create(asd_non_lazy_symbol_pointer,'')); - - { use the librarydata from current_module } - objectlibrary:=current_module.librarydata; - end; - - - procedure done_module; - var -{$ifdef MEMDEBUG} - d : tmemdebug; -{$endif} - i:Tasmlist; - begin -{$ifdef MEMDEBUG} - d:=tmemdebug.create(current_module.modulename^+' - asmlists'); -{$endif} - for i:=low(Tasmlist) to high(Tasmlist) do - if asmlist[i]<>nil then - asmlist[i].free; -{$ifdef MEMDEBUG} - d.free; -{$endif} - objectlibrary:=nil; - end; - - -{***************************************************************************** Compile a source file *****************************************************************************} @@ -311,10 +270,6 @@ implementation oldaktprocsym : tprocsym; { cg } oldparse_only : boolean; - { asmlists } - oldexprasmlist:Taasmoutput; - oldasmlist:array[Tasmlist] of Taasmoutput; - oldobjectlibrary : TObjLibraryData; { akt.. things } oldaktlocalswitches : tlocalswitches; oldaktmoduleswitches : tmoduleswitches; @@ -364,10 +319,6 @@ implementation oldsourcecodepage:=aktsourcecodepage; { save cg } oldparse_only:=parse_only; - { save assembler lists } - oldasmlist:=asmlist; - oldexprasmlist:=exprasmlist; - oldobjectlibrary:=objectlibrary; { save akt... state } { handle the postponed case first } if localswitcheschanged then @@ -445,6 +396,9 @@ implementation aktasmmode:=initasmmode; aktinterfacetype:=initinterfacetype; + { load current asmdata from current_module } + current_asmdata:=TAsmData(current_module.asmdata); + { startup scanner and load the first file } current_scanner:=tscannerfile.Create(filename); current_scanner.firstfile; @@ -458,9 +412,6 @@ implementation { read the first token } current_scanner.readtoken(false); - { init code generator for a new module } - init_module; - { If the compile level > 1 we get a nice "unit expected" error message if we are trying to use a program as unit.} try @@ -484,9 +435,6 @@ implementation end; end; finally - { restore old state } - done_module; - if assigned(current_module) then begin { module is now compiled } @@ -499,6 +447,13 @@ implementation tppumodule(current_module).ppufile:=nil; end; + { free asmdata } + if assigned(current_module.asmdata) then + begin + current_module.asmdata.free; + current_module.asmdata:=nil; + end; + { free scanner } if assigned(current_module.scanner) then begin @@ -533,11 +488,11 @@ implementation block_type:=old_block_type; { restore cg } parse_only:=oldparse_only; - { restore asmlists } - exprasmlist:=oldexprasmlist; - asmlist:=oldasmlist; - { object data } - objectlibrary:=oldobjectlibrary; + { asm data } + if assigned(old_compiled_module) then + current_asmdata:=tasmdata(old_compiled_module.asmdata) + else + current_asmdata:=nil; { restore previous scanner } if assigned(old_compiled_module) then current_scanner:=tscannerfile(old_compiled_module.scanner) diff --git a/compiler/pass_2.pas b/compiler/pass_2.pas index 9905c27e65..14d6b943da 100644 --- a/compiler/pass_2.pas +++ b/compiler/pass_2.pas @@ -143,7 +143,7 @@ implementation p := strpnew('second '+secondnames[ht]+' (entry)') else p := strpnew('second '+secondnames[ht]+' (exit)'); - exprasmlist.concat(tai_comment.create(p)); + current_asmdata.CurrAsmList.concat(tai_comment.create(p)); end; {$endif EXTDEBUG} @@ -195,8 +195,8 @@ implementation function do_secondpass(var p : tnode) : boolean; begin - { exprasmlist must be empty } - if not exprasmlist.empty then + { current_asmdata.CurrAsmList must be empty } + if not current_asmdata.CurrAsmList.empty then internalerror(200405201); { clear errors before starting } diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index 4b101d8e63..1546586c25 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -72,10 +72,10 @@ implementation { Recreate import section } if (target_info.system in [system_i386_win32,system_i386_wdosx]) then begin - if assigned(asmlist[al_imports]) then - asmlist[al_imports].clear + if assigned(current_asmdata.asmlists[al_imports]) then + current_asmdata.asmlists[al_imports].clear else - asmlist[al_imports]:=taasmoutput.Create; + current_asmdata.asmlists[al_imports]:=TAsmList.Create; importlib.generatelib; end; { Readd the not processed files } @@ -101,10 +101,10 @@ implementation (not use_smartlink_section) then begin { regenerate the importssection for win32 } - if assigned(asmlist[al_imports]) and + if assigned(current_asmdata.asmlists[al_imports]) and (target_info.system in [system_i386_win32,system_i386_wdosx, system_arm_wince,system_i386_wince]) then begin - asmlist[al_imports].clear; + current_asmdata.asmlists[al_imports].clear; importlib.generatesmartlib; end; @@ -143,8 +143,8 @@ implementation if (tf_needs_dwarf_cfi in target_info.flags) and (af_supports_dwarf in target_asm.flags) then begin - asmlist[al_dwarf]:=taasmoutput.create; - dwarfcfi.generate_code(asmlist[al_dwarf]); + current_asmdata.asmlists[al_dwarf]:=TAsmList.create; + dwarfcfi.generate_code(current_asmdata.asmlists[al_dwarf]); end; end; @@ -152,12 +152,12 @@ implementation procedure InsertThreadvarTablesTable; var hp : tused_unit; - ltvTables : taasmoutput; + ltvTables : TAsmList; count : longint; begin if (tf_section_threadvars in target_info.flags) then exit; - ltvTables:=TAAsmOutput.Create; + ltvTables:=TAsmList.Create; count:=0; hp:=tused_unit(usedunits.first); while assigned(hp) do @@ -178,19 +178,19 @@ implementation { Insert TableCount at start } ltvTables.insert(Tai_const.Create_32bit(count)); { insert in data segment } - maybe_new_object_file(asmlist[al_globals]); - new_section(asmlist[al_globals],sec_data,'FPC_THREADVARTABLES',sizeof(aint)); - asmlist[al_globals].concat(Tai_symbol.Createname_global('FPC_THREADVARTABLES',AT_DATA,0)); - asmlist[al_globals].concatlist(ltvTables); - asmlist[al_globals].concat(Tai_symbol_end.Createname('FPC_THREADVARTABLES')); + maybe_new_object_file(current_asmdata.asmlists[al_globals]); + new_section(current_asmdata.asmlists[al_globals],sec_data,'FPC_THREADVARTABLES',sizeof(aint)); + current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('FPC_THREADVARTABLES',AT_DATA,0)); + current_asmdata.asmlists[al_globals].concatlist(ltvTables); + current_asmdata.asmlists[al_globals].concat(Tai_symbol_end.Createname('FPC_THREADVARTABLES')); ltvTables.free; end; procedure AddToThreadvarList(p:tnamedindexitem;arg:pointer); var - ltvTable : taasmoutput; + ltvTable : TAsmList; begin - ltvTable:=taasmoutput(arg); + ltvTable:=TAsmList(arg); if (tsym(p).typ=globalvarsym) and (vo_is_thread_var in tglobalvarsym(p).varoptions) then begin @@ -205,11 +205,11 @@ implementation procedure InsertThreadvars; var s : string; - ltvTable : TAAsmoutput; + ltvTable : TAsmList; begin if (tf_section_threadvars in target_info.flags) then exit; - ltvTable:=TAAsmoutput.create; + ltvTable:=TAsmList.create; if assigned(current_module.globalsymtable) then current_module.globalsymtable.foreach_static(@AddToThreadvarList,ltvTable); current_module.localsymtable.foreach_static(@AddToThreadvarList,ltvTable); @@ -219,11 +219,11 @@ implementation { end of the list marker } ltvTable.concat(tai_const.create_sym(nil)); { add to datasegment } - maybe_new_object_file(asmlist[al_globals]); - new_section(asmlist[al_globals],sec_data,s,sizeof(aint)); - asmlist[al_globals].concat(Tai_symbol.Createname_global(s,AT_DATA,0)); - asmlist[al_globals].concatlist(ltvTable); - asmlist[al_globals].concat(Tai_symbol_end.Createname(s)); + maybe_new_object_file(current_asmdata.asmlists[al_globals]); + new_section(current_asmdata.asmlists[al_globals],sec_data,s,sizeof(aint)); + current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global(s,AT_DATA,0)); + current_asmdata.asmlists[al_globals].concatlist(ltvTable); + current_asmdata.asmlists[al_globals].concat(Tai_symbol_end.Createname(s)); current_module.flags:=current_module.flags or uf_threadvars; end; ltvTable.Free; @@ -236,7 +236,7 @@ implementation hp : tused_unit; found : Boolean; I : Integer; - ResourceInfo : taasmoutput; + ResourceInfo : TAsmList; begin if target_res.id=res_elf then @@ -250,7 +250,7 @@ implementation Found:=((hp.u.flags and uf_has_resourcefiles)=uf_has_resourcefiles); hp:=tused_unit(hp.next); end; - ResourceInfo:=TAAsmOutput.Create; + ResourceInfo:=TAsmList.Create; if found then begin { Valid pointer to resource information } @@ -271,8 +271,8 @@ implementation ResourceInfo.concat(Tai_symbol.Createname_global('FPC_RESLOCATION',AT_DATA,0)); ResourceInfo.Concat(Tai_const.Create_32bit(0)); end; - maybe_new_object_file(asmlist[al_globals]); - asmlist[al_globals].concatlist(ResourceInfo); + maybe_new_object_file(current_asmdata.asmlists[al_globals]); + current_asmdata.asmlists[al_globals].concatlist(ResourceInfo); ResourceInfo.free; end; end; @@ -281,10 +281,10 @@ implementation procedure InsertInitFinalTable; var hp : tused_unit; - unitinits : taasmoutput; + unitinits : TAsmList; count : longint; begin - unitinits:=TAAsmOutput.Create; + unitinits:=TAsmList.Create; count:=0; hp:=tused_unit(usedunits.first); while assigned(hp) do @@ -321,11 +321,11 @@ implementation unitinits.insert(Tai_const.Create_32bit(0)); unitinits.insert(Tai_const.Create_32bit(count)); { Add to data segment } - maybe_new_object_file(asmlist[al_globals]); - new_section(asmlist[al_globals],sec_data,'INITFINAL',sizeof(aint)); - asmlist[al_globals].concat(Tai_symbol.Createname_global('INITFINAL',AT_DATA,0)); - asmlist[al_globals].concatlist(unitinits); - asmlist[al_globals].concat(Tai_symbol_end.Createname('INITFINAL')); + maybe_new_object_file(current_asmdata.asmlists[al_globals]); + new_section(current_asmdata.asmlists[al_globals],sec_data,'INITFINAL',sizeof(aint)); + current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('INITFINAL',AT_DATA,0)); + current_asmdata.asmlists[al_globals].concatlist(unitinits); + current_asmdata.asmlists[al_globals].concat(Tai_symbol_end.Createname('INITFINAL')); unitinits.free; end; @@ -337,10 +337,10 @@ implementation {$ENDIF POWERPC} begin { stacksize can be specified and is now simulated } - maybe_new_object_file(asmlist[al_globals]); - new_section(asmlist[al_globals],sec_data,'__stklen', sizeof(aint)); - asmlist[al_globals].concat(Tai_symbol.Createname_global('__stklen',AT_DATA,sizeof(aint))); - asmlist[al_globals].concat(Tai_const.Create_aint(stacksize)); + maybe_new_object_file(current_asmdata.asmlists[al_globals]); + new_section(current_asmdata.asmlists[al_globals],sec_data,'__stklen', sizeof(aint)); + current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('__stklen',AT_DATA,sizeof(aint))); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_aint(stacksize)); {$IFDEF POWERPC} { AmigaOS4 "stack cookie" support } if ( target_info.system = system_powerpc_amiga ) then @@ -350,17 +350,17 @@ implementation { note: won't work for m68k amigaos or morphos. (KB) } str(stacksize,stkcookie); stkcookie:='$STACK: '+stkcookie+#0; - maybe_new_object_file(asmlist[al_globals]); - new_section(asmlist[al_globals],sec_data,'__stack_cookie',length(stkcookie)); - asmlist[al_globals].concat(Tai_symbol.Createname_global('__stack_cookie',AT_DATA,length(stkcookie))); - asmlist[al_globals].concat(Tai_string.Create(stkcookie)); + maybe_new_object_file(current_asmdata.asmlists[al_globals]); + new_section(current_asmdata.asmlists[al_globals],sec_data,'__stack_cookie',length(stkcookie)); + current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('__stack_cookie',AT_DATA,length(stkcookie))); + current_asmdata.asmlists[al_globals].concat(Tai_string.Create(stkcookie)); end; {$ENDIF POWERPC} { Initial heapsize } - maybe_new_object_file(asmlist[al_globals]); - new_section(asmlist[al_globals],sec_data,'__heapsize',sizeof(aint)); - asmlist[al_globals].concat(Tai_symbol.Createname_global('__heapsize',AT_DATA,sizeof(aint))); - asmlist[al_globals].concat(Tai_const.Create_aint(heapsize)); + maybe_new_object_file(current_asmdata.asmlists[al_globals]); + new_section(current_asmdata.asmlists[al_globals],sec_data,'__heapsize',sizeof(aint)); + current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('__heapsize',AT_DATA,sizeof(aint))); + current_asmdata.asmlists[al_globals].concat(Tai_const.Create_aint(heapsize)); end; @@ -754,13 +754,13 @@ implementation function is_assembler_generated:boolean; var - hal : tasmlist; + hal : tasmlisttype; begin result:=false; if Errorcount=0 then begin - for hal:=low(Tasmlist) to high(Tasmlist) do - if not asmlist[hal].empty then + for hal:=low(TasmlistType) to high(TasmlistType) do + if not current_asmdata.asmlists[hal].empty then begin result:=true; exit; @@ -1053,11 +1053,11 @@ implementation debuginfo.inserttypeinfo; { generate wrappers for interfaces } - gen_intf_wrappers(asmlist[al_procedures],current_module.globalsymtable); - gen_intf_wrappers(asmlist[al_procedures],current_module.localsymtable); + gen_intf_wrappers(current_asmdata.asmlists[al_procedures],current_module.globalsymtable); + gen_intf_wrappers(current_asmdata.asmlists[al_procedures],current_module.localsymtable); { generate pic helpers to load eip if necessary } - gen_pic_helpers(asmlist[al_procedures]); + gen_pic_helpers(current_asmdata.asmlists[al_procedures]); { Tables } insertThreadVars; @@ -1289,7 +1289,7 @@ implementation if assigned(exportlib) and (target_info.system in [system_i386_win32,system_i386_wdosx]) and ((current_module.flags and uf_has_exports)<>0) then - asmlist[al_procedures].concat(tai_const.create_sym(exportlib.edatalabel)); + current_asmdata.asmlists[al_procedures].concat(tai_const.create_sym(exportlib.edatalabel)); { finalize? } if token=_FINALIZATION then @@ -1353,10 +1353,10 @@ implementation InsertThreadvars; { generate wrappers for interfaces } - gen_intf_wrappers(asmlist[al_procedures],current_module.localsymtable); + gen_intf_wrappers(current_asmdata.asmlists[al_procedures],current_module.localsymtable); { generate pic helpers to load eip if necessary } - gen_pic_helpers(asmlist[al_procedures]); + gen_pic_helpers(current_asmdata.asmlists[al_procedures]); { generate imports } if current_module.uses_imports then diff --git a/compiler/powerpc/aasmcpu.pas b/compiler/powerpc/aasmcpu.pas index 3f8386010a..5deaa42d91 100644 --- a/compiler/powerpc/aasmcpu.pas +++ b/compiler/powerpc/aasmcpu.pas @@ -98,7 +98,7 @@ uses function spilling_create_load(const ref:treference;r:tregister): tai; function spilling_create_store(r:tregister; const ref:treference): tai; - procedure fixup_jmps(list: taasmoutput); + procedure fixup_jmps(list: TAsmList); implementation @@ -431,7 +431,7 @@ uses cutils, cclasses; end; - procedure fixup_jmps(list: taasmoutput); + procedure fixup_jmps(list: TAsmList); var p: tai; newjmp: taicpu; @@ -489,7 +489,7 @@ uses cutils, cclasses; (ptruint(abs(ptrint(labelpositions[tasmlabel(taicpu(p).oper[0]^.ref^.symbol).labelnr]-instrpos)) - (low(smallint) div 4)) > ptruint((high(smallint) - low(smallint)) div 4)) then begin // add a new label after this jump - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); list.insertafter(tai_label.create(l),p); // add a new unconditional jump between this jump and the label newjmp := taicpu.op_sym(A_B,taicpu(p).oper[0]^.ref^.symbol); diff --git a/compiler/powerpc/agppcmpw.pas b/compiler/powerpc/agppcmpw.pas index 41e7335dd1..2e3a6a7800 100644 --- a/compiler/powerpc/agppcmpw.pas +++ b/compiler/powerpc/agppcmpw.pas @@ -35,7 +35,7 @@ interface type TPPCMPWAssembler = class(TExternalAssembler) - procedure WriteTree(p:TAAsmoutput);override; + procedure WriteTree(p:TAsmList);override; procedure WriteAsmList;override; Function DoAssemble:boolean;override; procedure WriteExternals; @@ -673,7 +673,7 @@ interface (#9'dc.l'#9,#9'dc.w'#9,#9'dc.b'#9); - procedure TPPCMPWAssembler.WriteTree(p:TAAsmoutput); + procedure TPPCMPWAssembler.WriteTree(p:TAsmList); var s, prefix, @@ -700,7 +700,7 @@ interface { lineinfo is only needed for al_procedures (PFV) } do_line:=((cs_asm_source in aktglobalswitches) or (cs_lineinfo in aktmoduleswitches)) - and (p=asmlist[al_procedures]); + and (p=current_asmdata.asmlists[al_procedures]); DoNotSplitLine:=false; hp:=tai(p.first); while assigned(hp) do @@ -1108,9 +1108,9 @@ interface end; ait_marker : begin - if tai_marker(hp).kind=InlineStart then + if tai_marker(hp).kind=mark_InlineStart then inc(InlineLevel) - else if tai_marker(hp).kind=InlineEnd then + else if tai_marker(hp).kind=mark_InlineEnd then dec(InlineLevel); end; else @@ -1204,7 +1204,7 @@ interface procedure TPPCMPWAssembler.WriteExternals; begin currentasmlist:=self; - objectlibrary.symbolsearch.foreach_static(@writeexternal,nil); + current_asmdata.asmsymboldict.foreach_static(@writeexternal,nil); end; @@ -1253,7 +1253,7 @@ interface procedure TPPCMPWAssembler.WriteAsmList; var - hal : tasmlist; + hal : tasmlisttype; begin {$ifdef EXTDEBUG} if assigned(current_module.mainsource) then @@ -1264,11 +1264,11 @@ interface WriteAsmFileHeader; WriteExternals; - for hal:=low(Tasmlist) to high(Tasmlist) do + for hal:=low(TasmlistType) to high(TasmlistType) do begin - AsmWriteLn(target_asm.comment+'Begin asmlist '+TasmlistStr[hal]); - writetree(asmlist[hal]); - AsmWriteLn(target_asm.comment+'End asmlist '+TasmlistStr[hal]); + AsmWriteLn(target_asm.comment+'Begin asmlist '+AsmListTypeStr[hal]); + writetree(current_asmdata.asmlists[hal]); + AsmWriteLn(target_asm.comment+'End asmlist '+AsmListTypeStr[hal]); end; AsmWriteLn(#9'end'); diff --git a/compiler/powerpc/cgcpu.pas b/compiler/powerpc/cgcpu.pas index 4d0b6d62fc..e64c865adf 100644 --- a/compiler/powerpc/cgcpu.pas +++ b/compiler/powerpc/cgcpu.pas @@ -42,68 +42,68 @@ unit cgcpu; { left to right), this allows to move the parameter to } { register, if the cpu supports register calling } { conventions } - procedure a_param_const(list : taasmoutput;size : tcgsize;a : aint;const paraloc : tcgpara);override; - procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const paraloc : tcgpara);override; - procedure a_paramaddr_ref(list : taasmoutput;const r : treference;const paraloc : tcgpara);override; + procedure a_param_const(list : TAsmList;size : tcgsize;a : aint;const paraloc : tcgpara);override; + procedure a_param_ref(list : TAsmList;size : tcgsize;const r : treference;const paraloc : tcgpara);override; + procedure a_paramaddr_ref(list : TAsmList;const r : treference;const paraloc : tcgpara);override; - procedure a_call_name(list : taasmoutput;const s : string);override; - procedure a_call_reg(list : taasmoutput;reg: tregister); override; + procedure a_call_name(list : TAsmList;const s : string);override; + procedure a_call_reg(list : TAsmList;reg: tregister); override; - procedure a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); override; - procedure a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; src, dst: TRegister); override; + procedure a_op_const_reg(list : TAsmList; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); override; + procedure a_op_reg_reg(list : TAsmList; Op: TOpCG; size: TCGSize; src, dst: TRegister); override; - procedure a_op_const_reg_reg(list: taasmoutput; op: TOpCg; + procedure a_op_const_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister); override; - procedure a_op_reg_reg_reg(list: taasmoutput; op: TOpCg; + procedure a_op_reg_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister); override; { move instructions } - procedure a_load_const_reg(list : taasmoutput; size: tcgsize; a : aint;reg : tregister);override; - procedure a_load_reg_ref(list : taasmoutput; fromsize, tosize: tcgsize; reg : tregister;const ref : treference);override; - procedure a_load_ref_reg(list : taasmoutput; fromsize, tosize : tcgsize;const Ref : treference;reg : tregister);override; - procedure a_load_reg_reg(list : taasmoutput; fromsize, tosize : tcgsize;reg1,reg2 : tregister);override; + procedure a_load_const_reg(list : TAsmList; size: tcgsize; a : aint;reg : tregister);override; + procedure a_load_reg_ref(list : TAsmList; fromsize, tosize: tcgsize; reg : tregister;const ref : treference);override; + procedure a_load_ref_reg(list : TAsmList; fromsize, tosize : tcgsize;const Ref : treference;reg : tregister);override; + procedure a_load_reg_reg(list : TAsmList; fromsize, tosize : tcgsize;reg1,reg2 : tregister);override; { fpu move instructions } - procedure a_loadfpu_reg_reg(list: taasmoutput; size: tcgsize; reg1, reg2: tregister); override; - procedure a_loadfpu_ref_reg(list: taasmoutput; size: tcgsize; const ref: treference; reg: tregister); override; - procedure a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: tregister; const ref: treference); override; + procedure a_loadfpu_reg_reg(list: TAsmList; size: tcgsize; reg1, reg2: tregister); override; + procedure a_loadfpu_ref_reg(list: TAsmList; size: tcgsize; const ref: treference; reg: tregister); override; + procedure a_loadfpu_reg_ref(list: TAsmList; size: tcgsize; reg: tregister; const ref: treference); override; { comparison operations } - procedure a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; + procedure a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; l : tasmlabel);override; - procedure a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override; + procedure a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override; - procedure a_jmp_name(list : taasmoutput;const s : string); override; - procedure a_jmp_always(list : taasmoutput;l: tasmlabel); override; - procedure a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); override; + procedure a_jmp_name(list : TAsmList;const s : string); override; + procedure a_jmp_always(list : TAsmList;l: tasmlabel); override; + procedure a_jmp_flags(list : TAsmList;const f : TResFlags;l: tasmlabel); override; - procedure g_flags2reg(list: taasmoutput; size: TCgSize; const f: TResFlags; reg: TRegister); override; + procedure g_flags2reg(list: TAsmList; size: TCgSize; const f: TResFlags; reg: TRegister); override; - procedure g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean);override; - procedure g_proc_exit(list : taasmoutput;parasize : longint;nostackframe:boolean); override; - procedure g_save_standard_registers(list:Taasmoutput); override; - procedure g_restore_standard_registers(list:Taasmoutput); override; + procedure g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean);override; + procedure g_proc_exit(list : TAsmList;parasize : longint;nostackframe:boolean); override; + procedure g_save_standard_registers(list:TAsmList); override; + procedure g_restore_standard_registers(list:TAsmList); override; - procedure a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister);override; + procedure a_loadaddr_ref_reg(list : TAsmList;const ref : treference;r : tregister);override; - procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint);override; + procedure g_concatcopy(list : TAsmList;const source,dest : treference;len : aint);override; - procedure g_overflowcheck(list: taasmoutput; const l: tlocation; def: tdef); override; + procedure g_overflowcheck(list: TAsmList; const l: tlocation; def: tdef); override; { find out whether a is of the form 11..00..11b or 00..11...00. If } { that's the case, we can use rlwinm to do an AND operation } function get_rlwi_const(a: aint; var l1, l2: longint): boolean; - procedure a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel); + procedure a_jmp_cond(list : TAsmList;cond : TOpCmp;l: tasmlabel); - procedure g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint);override; + procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);override; private (* NOT IN USE: *) - procedure g_stackframe_entry_mac(list : taasmoutput;localsize : longint); + procedure g_stackframe_entry_mac(list : TAsmList;localsize : longint); (* NOT IN USE: *) - procedure g_return_from_proc_mac(list : taasmoutput;parasize : aint); + procedure g_return_from_proc_mac(list : TAsmList;parasize : aint); { Make sure ref is a valid reference for the PowerPC and sets the } @@ -112,32 +112,32 @@ unit cgcpu; { offset or symbol, in which case the base will have been changed } { to a tempreg (which has to be freed by the caller) containing } { the sum of part of the original reference } - function fixref(list: taasmoutput; var ref: treference): boolean; + function fixref(list: TAsmList; var ref: treference): boolean; { returns whether a reference can be used immediately in a powerpc } { instruction } function issimpleref(const ref: treference): boolean; { contains the common code of a_load_reg_ref and a_load_ref_reg } - procedure a_load_store(list:taasmoutput;op: tasmop;reg:tregister; + procedure a_load_store(list:TAsmList;op: tasmop;reg:tregister; ref: treference); { creates the correct branch instruction for a given combination } { of asmcondflags and destination addressing mode } - procedure a_jmp(list: taasmoutput; op: tasmop; + procedure a_jmp(list: TAsmList; op: tasmop; c: tasmcondflag; crval: longint; l: tasmlabel); - function save_regs(list : taasmoutput):longint; - procedure restore_regs(list : taasmoutput); + function save_regs(list : TAsmList):longint; + procedure restore_regs(list : TAsmList); function get_darwin_call_stub(const s: string): tasmsymbol; end; tcg64fppc = class(tcg64f32) - procedure a_op64_reg_reg(list : taasmoutput;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64);override; - procedure a_op64_const_reg(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;reg : tregister64);override; - procedure a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64);override; - procedure a_op64_reg_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64);override; + procedure a_op64_reg_reg(list : TAsmList;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64);override; + procedure a_op64_const_reg(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;reg : tregister64);override; + procedure a_op64_const_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64);override; + procedure a_op64_reg_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64);override; end; @@ -211,7 +211,7 @@ const end; - procedure tcgppc.a_param_const(list : taasmoutput;size : tcgsize;a : aint;const paraloc : tcgpara); + procedure tcgppc.a_param_const(list : TAsmList;size : tcgsize;a : aint;const paraloc : tcgpara); var ref: treference; begin @@ -232,7 +232,7 @@ const end; - procedure tcgppc.a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const paraloc : tcgpara); + procedure tcgppc.a_param_ref(list : TAsmList;size : tcgsize;const r : treference;const paraloc : tcgpara); var tmpref, ref: treference; @@ -322,7 +322,7 @@ const end; - procedure tcgppc.a_paramaddr_ref(list : taasmoutput;const r : treference;const paraloc : tcgpara); + procedure tcgppc.a_paramaddr_ref(list : TAsmList;const r : treference;const paraloc : tcgpara); var ref: treference; tmpreg: tregister; @@ -357,48 +357,48 @@ const { doesn't work correctly, because this will also return a hit if we } { previously took the address of an external procedure. It doesn't } { really matter, the linker will remove all unnecessary stubs. } -{ result := objectlibrary.getasmsymbol(s); +{ result := current_asmdata.getasmsymbol(s); if not(assigned(result)) then begin } stubname := 'L'+s+'$stub'; - result := objectlibrary.getasmsymbol(stubname); + result := current_asmdata.getasmsymbol(stubname); { end; } if assigned(result) then exit; - if asmlist[al_imports]=nil then - asmlist[al_imports]:=TAAsmoutput.create; + if current_asmdata.asmlists[al_imports]=nil then + current_asmdata.asmlists[al_imports]:=TAsmList.create; - asmlist[al_imports].concat(Tai_section.create(sec_stub,'',0)); - asmlist[al_imports].concat(Tai_align.Create(16)); - result := objectlibrary.newasmsymbol(stubname,AB_EXTERNAL,AT_FUNCTION); - asmlist[al_imports].concat(Tai_symbol.Create(result,0)); - asmlist[al_imports].concat(tai_directive.create(asd_indirect_symbol,s)); - l1 := objectlibrary.newasmsymbol('L'+s+'$lazy_ptr',AB_EXTERNAL,AT_FUNCTION); + current_asmdata.asmlists[al_imports].concat(Tai_section.create(sec_stub,'',0)); + current_asmdata.asmlists[al_imports].concat(Tai_align.Create(16)); + result := current_asmdata.newasmsymbol(stubname,AB_EXTERNAL,AT_FUNCTION); + current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0)); + current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s)); + l1 := current_asmdata.newasmsymbol('L'+s+'$lazy_ptr',AB_EXTERNAL,AT_FUNCTION); reference_reset_symbol(href,l1,0); href.refaddr := addr_hi; - asmlist[al_imports].concat(taicpu.op_reg_ref(A_LIS,NR_R11,href)); + current_asmdata.asmlists[al_imports].concat(taicpu.op_reg_ref(A_LIS,NR_R11,href)); href.refaddr := addr_lo; href.base := NR_R11; - asmlist[al_imports].concat(taicpu.op_reg_ref(A_LWZU,NR_R12,href)); - asmlist[al_imports].concat(taicpu.op_reg(A_MTCTR,NR_R12)); - asmlist[al_imports].concat(taicpu.op_none(A_BCTR)); - asmlist[al_imports].concat(tai_directive.create(asd_lazy_symbol_pointer,'')); - asmlist[al_imports].concat(Tai_symbol.Create(l1,0)); - asmlist[al_imports].concat(tai_directive.create(asd_indirect_symbol,s)); - asmlist[al_imports].concat(tai_const.createname(strpnew('dyld_stub_binding_helper'),AT_FUNCTION,0)); + current_asmdata.asmlists[al_imports].concat(taicpu.op_reg_ref(A_LWZU,NR_R12,href)); + current_asmdata.asmlists[al_imports].concat(taicpu.op_reg(A_MTCTR,NR_R12)); + current_asmdata.asmlists[al_imports].concat(taicpu.op_none(A_BCTR)); + current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_lazy_symbol_pointer,'')); + current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(l1,0)); + current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s)); + current_asmdata.asmlists[al_imports].concat(tai_const.createname(strpnew('dyld_stub_binding_helper'),AT_FUNCTION,0)); end; { calling a procedure by name } - procedure tcgppc.a_call_name(list : taasmoutput;const s : string); + procedure tcgppc.a_call_name(list : TAsmList;const s : string); begin { MacOS: The linker on MacOS (PPCLink) inserts a call to glue code, if it is a cross-TOC call. If so, it also replaces the NOP with some restore code.} if (target_info.system <> system_powerpc_darwin) then begin - list.concat(taicpu.op_sym(A_BL,objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); + list.concat(taicpu.op_sym(A_BL,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); if target_info.system=system_powerpc_macos then list.concat(taicpu.op_none(A_NOP)); end @@ -414,7 +414,7 @@ const end; { calling a procedure by address } - procedure tcgppc.a_call_reg(list : taasmoutput;reg: tregister); + procedure tcgppc.a_call_reg(list : TAsmList;reg: tregister); var tmpreg : tregister; @@ -451,7 +451,7 @@ const {********************** load instructions ********************} - procedure tcgppc.a_load_const_reg(list : taasmoutput; size: TCGSize; a : aint; reg : TRegister); + procedure tcgppc.a_load_const_reg(list : TAsmList; size: TCGSize; a : aint; reg : TRegister); begin if not(size in [OS_8,OS_S8,OS_16,OS_S16,OS_32,OS_S32]) then @@ -472,7 +472,7 @@ const end; - procedure tcgppc.a_load_reg_ref(list : taasmoutput; fromsize, tosize: TCGSize; reg : tregister;const ref : treference); + procedure tcgppc.a_load_reg_ref(list : TAsmList; fromsize, tosize: TCGSize; reg : tregister;const ref : treference); const StoreInstr: Array[OS_8..OS_32,boolean, boolean] of TAsmOp = @@ -497,7 +497,7 @@ const End; - procedure tcgppc.a_load_ref_reg(list : taasmoutput; fromsize,tosize : tcgsize;const ref: treference;reg : tregister); + procedure tcgppc.a_load_ref_reg(list : TAsmList; fromsize,tosize : tcgsize;const ref: treference;reg : tregister); const LoadInstr: Array[OS_8..OS_S32,boolean, boolean] of TAsmOp = @@ -537,7 +537,7 @@ const end; - procedure tcgppc.a_load_reg_reg(list : taasmoutput;fromsize, tosize : tcgsize;reg1,reg2 : tregister); + procedure tcgppc.a_load_reg_reg(list : TAsmList;fromsize, tosize : tcgsize;reg1,reg2 : tregister); var instr: taicpu; @@ -562,7 +562,7 @@ const end; - procedure tcgppc.a_loadfpu_reg_reg(list: taasmoutput; size: tcgsize; reg1, reg2: tregister); + procedure tcgppc.a_loadfpu_reg_reg(list: TAsmList; size: tcgsize; reg1, reg2: tregister); var instr: taicpu; @@ -573,7 +573,7 @@ const end; - procedure tcgppc.a_loadfpu_ref_reg(list: taasmoutput; size: tcgsize; const ref: treference; reg: tregister); + procedure tcgppc.a_loadfpu_ref_reg(list: TAsmList; size: tcgsize; const ref: treference; reg: tregister); const FpuLoadInstr: Array[OS_F32..OS_F64,boolean, boolean] of TAsmOp = @@ -602,7 +602,7 @@ const end; - procedure tcgppc.a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: tregister; const ref: treference); + procedure tcgppc.a_loadfpu_reg_ref(list: TAsmList; size: tcgsize; reg: tregister; const ref: treference); const FpuStoreInstr: Array[OS_F32..OS_F64,boolean, boolean] of TAsmOp = @@ -623,21 +623,21 @@ const end; - procedure tcgppc.a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); + procedure tcgppc.a_op_const_reg(list : TAsmList; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); begin a_op_const_reg_reg(list,op,size,a,reg,reg); end; - procedure tcgppc.a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; src, dst: TRegister); + procedure tcgppc.a_op_reg_reg(list : TAsmList; Op: TOpCG; size: TCGSize; src, dst: TRegister); begin a_op_reg_reg_reg(list,op,size,src,dst,dst); end; - procedure tcgppc.a_op_const_reg_reg(list: taasmoutput; op: TOpCg; + procedure tcgppc.a_op_const_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister); var l1,l2: longint; @@ -810,7 +810,7 @@ const end; - procedure tcgppc.a_op_reg_reg_reg(list: taasmoutput; op: TOpCg; + procedure tcgppc.a_op_reg_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister); const @@ -836,7 +836,7 @@ const {*************** compare instructructions ****************} - procedure tcgppc.a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; + procedure tcgppc.a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; l : tasmlabel); var @@ -873,7 +873,7 @@ const end; - procedure tcgppc.a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp; + procedure tcgppc.a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp; reg1,reg2 : tregister;l : tasmlabel); var @@ -889,33 +889,33 @@ const end; - procedure tcgppc.a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel); + procedure tcgppc.a_jmp_cond(list : TAsmList;cond : TOpCmp;l: tasmlabel); begin a_jmp(list,A_BC,TOpCmp2AsmCond[cond],0,l); end; - procedure tcgppc.a_jmp_name(list : taasmoutput;const s : string); + procedure tcgppc.a_jmp_name(list : TAsmList;const s : string); var p : taicpu; begin if (target_info.system = system_powerpc_darwin) then p := taicpu.op_sym(A_B,get_darwin_call_stub(s)) else - p := taicpu.op_sym(A_B,objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)); + p := taicpu.op_sym(A_B,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)); p.is_jmp := true; list.concat(p) end; - procedure tcgppc.a_jmp_always(list : taasmoutput;l: tasmlabel); + procedure tcgppc.a_jmp_always(list : TAsmList;l: tasmlabel); begin a_jmp(list,A_B,C_None,0,l); end; - procedure tcgppc.a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); + procedure tcgppc.a_jmp_flags(list : TAsmList;const f : TResFlags;l: tasmlabel); var c: tasmcond; @@ -924,7 +924,7 @@ const a_jmp(list,A_BC,c.cond,c.cr-RS_CR0,l); end; - procedure tcgppc.g_flags2reg(list: taasmoutput; size: TCgSize; const f: TResFlags; reg: TRegister); + procedure tcgppc.g_flags2reg(list: TAsmList; size: TCgSize; const f: TResFlags; reg: TRegister); var testbit: byte; @@ -966,7 +966,7 @@ const end; (* - procedure tcgppc.g_cond2reg(list: taasmoutput; const f: TAsmCond; reg: TRegister); + procedure tcgppc.g_cond2reg(list: TAsmList; const f: TAsmCond; reg: TRegister); var testbit: byte; @@ -1019,19 +1019,19 @@ const { *********** entry/exit code and address loading ************ } - procedure tcgppc.g_save_standard_registers(list:Taasmoutput); + procedure tcgppc.g_save_standard_registers(list:TAsmList); begin { this work is done in g_proc_entry } end; - procedure tcgppc.g_restore_standard_registers(list:Taasmoutput); + procedure tcgppc.g_restore_standard_registers(list:TAsmList); begin { this work is done in g_proc_exit } end; - procedure tcgppc.g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean); + procedure tcgppc.g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean); { generated the entry code of a procedure/function. Note: localsize is the } { sum of the size necessary for local variables and the maximum possible } { combined size of ALL the parameters of a procedure called by the current } @@ -1108,11 +1108,11 @@ const { save floating-point registers if (cs_create_pic in aktmoduleswitches) and not(usesgpr) then begin - a_call_name(objectlibrary.newasmsymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+'_g',AB_EXTERNAL,AT_FUNCTION)); + a_call_name(current_asmdata.newasmsymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+'_g',AB_EXTERNAL,AT_FUNCTION)); gotgot:=true; end else - a_call_name(objectlibrary.newasmsymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14),AB_EXTERNAL,AT_FUNCTION)); + a_call_name(current_asmdata.newasmsymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14),AB_EXTERNAL,AT_FUNCTION)); } reference_reset_base(href,NR_R1,-8); @@ -1134,11 +1134,11 @@ const { if cs_create_pic in aktmoduleswitches then begin - a_call_name(objectlibrary.newasmsymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14)+'_g',AB_EXTERNAL,AT_FUNCTION)); + a_call_name(current_asmdata.newasmsymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14)+'_g',AB_EXTERNAL,AT_FUNCTION)); gotgot:=true; end else - a_call_name(objectlibrary.newasmsymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14),AB_EXTERNAL,AT_FUNCTION)) + a_call_name(current_asmdata.newasmsymbol('_savegpr_'+tostr(ord(firstreggpr)-ord(R_14)+14),AB_EXTERNAL,AT_FUNCTION)) } if (firstregint <= RS_R22) or ((cs_opt_size in aktoptimizerswitches) and @@ -1173,10 +1173,10 @@ const cond.simple:=false; cond.bo:=20; cond.bi:=31; - instr:=taicpu.op_sym(A_BCL,current_procinfo.gotlabel); + instr:=taicpu.op_sym(A_BCL,current_procinfo.CurrGOTLabel); instr.setcondition(cond); list.concat(instr); - a_label(list,current_procinfo.gotlabel); + a_label(list,current_procinfo.CurrGOTLabel); list.concat(taicpu.op_reg_reg(A_MFSPR,current_procinfo.got,NR_LR)); list.concat(taicpu.op_reg_reg(A_MTSPR,NR_LR,NR_R0)); end; @@ -1223,7 +1223,7 @@ const end; - procedure tcgppc.g_proc_exit(list : taasmoutput;parasize : longint;nostackframe:boolean); + procedure tcgppc.g_proc_exit(list : TAsmList;parasize : longint;nostackframe:boolean); { This procedure may be called before, as well as after g_stackframe_entry } { is called. NOTE registers are not to be allocated through the register } { allocator here, because the register colouring has already occured !! } @@ -1298,7 +1298,7 @@ const list.concat(taicpu.op_reg_reg_const(A_ADDI,r,r,(ord(R_F31)-ord(firstregfpu.enum)+1)*8)); { if (pi_do_call in current_procinfo.flags) then - a_call_name(objectlibrary.newasmsymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+ + a_call_name(current_asmdata.newasmsymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+ '_x',AB_EXTERNAL,AT_FUNCTION)) else { leaf node => lr haven't to be restored } @@ -1345,7 +1345,7 @@ const end; - function tcgppc.save_regs(list : taasmoutput):longint; + function tcgppc.save_regs(list : TAsmList):longint; {Generates code which saves used non-volatile registers in the save area right below the address the stackpointer point to. Returns the actual used save area size.} @@ -1425,7 +1425,7 @@ const save_regs:= -offset; end; - procedure tcgppc.restore_regs(list : taasmoutput); + procedure tcgppc.restore_regs(list : TAsmList); {Generates code which restores used non-volatile registers from the save area right below the address the stackpointer point to.} @@ -1506,7 +1506,7 @@ const end; - procedure tcgppc.g_stackframe_entry_mac(list : taasmoutput;localsize : longint); + procedure tcgppc.g_stackframe_entry_mac(list : TAsmList;localsize : longint); (* NOT IN USE *) { generated the entry code of a procedure/function. Note: localsize is the } @@ -1593,7 +1593,7 @@ const end; end; - procedure tcgppc.g_return_from_proc_mac(list : taasmoutput;parasize : aint); + procedure tcgppc.g_return_from_proc_mac(list : TAsmList;parasize : aint); (* NOT IN USE *) var @@ -1640,7 +1640,7 @@ const end; - procedure tcgppc.a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister); + procedure tcgppc.a_loadaddr_ref_reg(list : TAsmList;const ref : treference;r : tregister); var ref2, tmpref: treference; @@ -1732,7 +1732,7 @@ const maxmoveunit = 4; {$endif ppc603} - procedure tcgppc.g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint); + procedure tcgppc.g_concatcopy(list : TAsmList;const source,dest : treference;len : aint); var countreg: TRegister; @@ -1816,7 +1816,7 @@ const a_load_const_reg(list,OS_32,count,countreg); copyreg := getfpuregister(list,OS_F64); a_reg_sync(list,copyreg); - objectlibrary.getjumplabel(lab); + current_asmdata.getjumplabel(lab); a_label(list, lab); list.concat(taicpu.op_reg_reg_const(A_SUBIC_,countreg,countreg,1)); list.concat(taicpu.op_reg_ref(A_LFDU,copyreg,src)); @@ -1867,7 +1867,7 @@ const { explicitely allocate R_0 since it can be used safely here } { (for holding date that's being copied) } a_reg_alloc(list,NR_R0); - objectlibrary.getjumplabel(lab); + current_asmdata.getjumplabel(lab); a_label(list, lab); list.concat(taicpu.op_reg_reg_const(A_SUBIC_,countreg,countreg,1)); list.concat(taicpu.op_reg_ref(A_LWZU,NR_R0,src)); @@ -1913,13 +1913,13 @@ const end; - procedure tcgppc.g_overflowcheck(list: taasmoutput; const l: tlocation; def: tdef); + procedure tcgppc.g_overflowcheck(list: TAsmList; const l: tlocation; def: tdef); var hl : tasmlabel; begin if not(cs_check_overflow in aktlocalswitches) then exit; - objectlibrary.getjumplabel(hl); + current_asmdata.getjumplabel(hl); if not ((def.deftype=pointerdef) or ((def.deftype=orddef) and (torddef(def).typ in [u64bit,u16bit,u32bit,u8bit,uchar, @@ -1935,7 +1935,7 @@ const end; - procedure tcgppc.g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint); + procedure tcgppc.g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint); procedure loadvmttor11; var @@ -1999,7 +1999,7 @@ const end { case 0 } else - list.concat(taicpu.op_sym(A_B,objectlibrary.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); + list.concat(taicpu.op_sym(A_B,current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); List.concat(Tai_symbol_end.Createname(labelname)); end; @@ -2023,7 +2023,7 @@ const end; - function tcgppc.fixref(list: taasmoutput; var ref: treference): boolean; + function tcgppc.fixref(list: TAsmList; var ref: treference): boolean; var tmpreg: tregister; @@ -2139,7 +2139,7 @@ const end; - procedure tcgppc.a_load_store(list:taasmoutput;op: tasmop;reg:tregister; + procedure tcgppc.a_load_store(list:TAsmList;op: tasmop;reg:tregister; ref: treference); var @@ -2233,7 +2233,7 @@ const end; - procedure tcgppc.a_jmp(list: taasmoutput; op: tasmop; c: tasmcondflag; + procedure tcgppc.a_jmp(list: TAsmList; op: tasmop; c: tasmcondflag; crval: longint; l: tasmlabel); var p: taicpu; @@ -2247,19 +2247,19 @@ const end; - procedure tcg64fppc.a_op64_reg_reg(list : taasmoutput;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64); + procedure tcg64fppc.a_op64_reg_reg(list : TAsmList;op:TOpCG;size : tcgsize;regsrc,regdst : tregister64); begin a_op64_reg_reg_reg(list,op,size,regsrc,regdst,regdst); end; - procedure tcg64fppc.a_op64_const_reg(list : taasmoutput;op:TOpCG;size : tcgsize;value : int64;reg : tregister64); + procedure tcg64fppc.a_op64_const_reg(list : TAsmList;op:TOpCG;size : tcgsize;value : int64;reg : tregister64); begin a_op64_const_reg_reg(list,op,size,value,reg,reg); end; - procedure tcg64fppc.a_op64_reg_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64); + procedure tcg64fppc.a_op64_reg_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64); begin case op of OP_AND,OP_OR,OP_XOR: @@ -2283,7 +2283,7 @@ const end; - procedure tcg64fppc.a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64); + procedure tcg64fppc.a_op64_const_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64); const ops: array[boolean,1..3] of tasmop = ((A_ADDIC,A_ADDC,A_ADDZE), diff --git a/compiler/powerpc/cpupara.pas b/compiler/powerpc/cpupara.pas index 42394601a1..0e0d73cc3e 100644 --- a/compiler/powerpc/cpupara.pas +++ b/compiler/powerpc/cpupara.pas @@ -41,7 +41,7 @@ unit cpupara; function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override; function create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargsparalist):longint;override; procedure create_funcretloc_info(p : tabstractprocdef; side: tcallercallee); - procedure createtempparaloc(list: taasmoutput;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara);override; + procedure createtempparaloc(list: TAsmList;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara);override; private procedure init_values(var curintreg, curfloatreg, curmmreg: tsuperregister; var cur_stack_offset: aword); function create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras:tparalist; @@ -645,7 +645,7 @@ unit cpupara; end; - procedure tppcparamanager.createtempparaloc(list: taasmoutput;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); + procedure tppcparamanager.createtempparaloc(list: TAsmList;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); var paraloc : pcgparalocation; begin diff --git a/compiler/powerpc/nppcadd.pas b/compiler/powerpc/nppcadd.pas index ff85cbddfb..e0692825fc 100644 --- a/compiler/powerpc/nppcadd.pas +++ b/compiler/powerpc/nppcadd.pas @@ -56,7 +56,7 @@ interface symconst,symdef,paramgr, aasmbase,aasmtai,aasmcpu,defutil,htypechk, cgbase,cpuinfo,pass_1,pass_2,regvars, - cpupara,cgcpu,cgutils, + cpupara,cgcpu,cgutils,procinfo, ncon,nset, ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32; @@ -122,7 +122,7 @@ interface end; LOC_REFERENCE,LOC_CREFERENCE: begin - location_force_reg(exprasmlist,n.location,def_cgsize(n.resulttype.def),false); + location_force_reg(current_asmdata.CurrAsmList,n.location,def_cgsize(n.resulttype.def),false); if (not cmpop) and ((nodetype <> muln) or not is_64bit(resulttype.def)) then @@ -136,7 +136,7 @@ interface begin if load_constants then begin - location_force_reg(exprasmlist,n.location,def_cgsize(n.resulttype.def),false); + location_force_reg(current_asmdata.CurrAsmList,n.location,def_cgsize(n.resulttype.def),false); if (not cmpop) and ((nodetype <> muln) or not is_64bit(resulttype.def)) then @@ -156,10 +156,10 @@ interface if not(cmpop) then begin if (location.register = NR_NO) then - location.register := cg.getintregister(exprasmlist,OS_INT); + location.register := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); if is_64bit(resulttype.def) and (location.register64.reghi = NR_NO) then - location.register64.reghi := cg.getintregister(exprasmlist,OS_INT); + location.register64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); end; end; @@ -228,8 +228,8 @@ interface else begin useconst := false; - tmpreg := cg.getintregister(exprasmlist,OS_INT); - cg.a_load_const_reg(exprasmlist,OS_INT, + tmpreg := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT, right.location.value,tmpreg); end end @@ -251,12 +251,12 @@ interface if (right.location.loc = LOC_CONSTANT) then begin if useconst then - exprasmlist.concat(taicpu.op_reg_const(op,left.location.register,longint(right.location.value))) + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(op,left.location.register,longint(right.location.value))) else - exprasmlist.concat(taicpu.op_reg_reg(op,left.location.register,tmpreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,left.location.register,tmpreg)); end else - exprasmlist.concat(taicpu.op_reg_reg(op, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op, left.location.register,right.location.register)); end; @@ -296,18 +296,18 @@ interface isjump:=(left.expectloc=LOC_JUMP); if isjump then begin - otl:=truelabel; - objectlibrary.getjumplabel(truelabel); - ofl:=falselabel; - objectlibrary.getjumplabel(falselabel); + otl:=current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + ofl:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); end; secondpass(left); if left.location.loc in [LOC_FLAGS,LOC_JUMP] then - location_force_reg(exprasmlist,left.location,cgsize,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,cgsize,false); if isjump then begin - truelabel:=otl; - falselabel:=ofl; + current_procinfo.CurrTrueLabel:=otl; + current_procinfo.CurrFalseLabel:=ofl; end else if left.location.loc=LOC_JUMP then internalerror(2003122901); @@ -315,18 +315,18 @@ interface isjump:=(right.expectloc=LOC_JUMP); if isjump then begin - otl:=truelabel; - objectlibrary.getjumplabel(truelabel); - ofl:=falselabel; - objectlibrary.getjumplabel(falselabel); + otl:=current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + ofl:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); end; secondpass(right); if right.location.loc in [LOC_FLAGS,LOC_JUMP] then - location_force_reg(exprasmlist,right.location,cgsize,false); + location_force_reg(current_asmdata.CurrAsmList,right.location,cgsize,false); if isjump then begin - truelabel:=otl; - falselabel:=ofl; + current_procinfo.CurrTrueLabel:=otl; + current_procinfo.CurrFalseLabel:=ofl; end else if right.location.loc=LOC_JUMP then internalerror(200312292); @@ -350,10 +350,10 @@ interface equaln,unequaln : begin if (right.location.loc <> LOC_CONSTANT) then - exprasmlist.concat(taicpu.op_reg_reg(A_CMPLW, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLW, left.location.register,right.location.register)) else - exprasmlist.concat(taicpu.op_reg_const(A_CMPLWI, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMPLWI, left.location.register,longint(right.location.value))); location.resflags := getresflags; end; @@ -371,11 +371,11 @@ interface end; if right.location.loc <> LOC_CONSTANT then - cg.a_op_reg_reg_reg(exprasmlist,cgop,OS_INT, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,cgop,OS_INT, left.location.register,right.location.register, location.register) else - cg.a_op_const_reg_reg(exprasmlist,cgop,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,cgop,OS_INT, right.location.value,left.location.register, location.register); end; @@ -393,27 +393,27 @@ interface case nodetype of andn : begin - otl:=truelabel; - objectlibrary.getjumplabel(truelabel); + otl:=current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); secondpass(left); - maketojumpbool(exprasmlist,left,lr_load_regvars); - cg.a_label(exprasmlist,truelabel); - truelabel:=otl; + maketojumpbool(current_asmdata.CurrAsmList,left,lr_load_regvars); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); + current_procinfo.CurrTrueLabel:=otl; end; orn : begin - ofl:=falselabel; - objectlibrary.getjumplabel(falselabel); + ofl:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); secondpass(left); - maketojumpbool(exprasmlist,left,lr_load_regvars); - cg.a_label(exprasmlist,falselabel); - falselabel:=ofl; + maketojumpbool(current_asmdata.CurrAsmList,left,lr_load_regvars); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); + current_procinfo.CurrFalseLabel:=ofl; end; else internalerror(200403181); end; secondpass(right); - maketojumpbool(exprasmlist,right,lr_load_regvars); + maketojumpbool(current_asmdata.CurrAsmList,right,lr_load_regvars); end; end; end; @@ -457,8 +457,8 @@ interface swapleftright; // put both operands in a register - location_force_fpureg(exprasmlist,right.location,true); - location_force_fpureg(exprasmlist,left.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,right.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); // initialize de result if not cmpop then @@ -469,7 +469,7 @@ interface else if right.location.loc = LOC_FPUREGISTER then location.register := right.location.register else - location.register := cg.getfpuregister(exprasmlist,location.size); + location.register := cg.getfpuregister(current_asmdata.CurrAsmList,location.size); end else begin @@ -480,13 +480,13 @@ interface // emit the actual operation if not cmpop then begin - exprasmlist.concat(taicpu.op_reg_reg_reg(op, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op, location.register,left.location.register, right.location.register)) end else begin - exprasmlist.concat(taicpu.op_reg_reg_reg(op, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op, newreg(R_SPECIALREGISTER,location.resflags.cr,R_SUBNONE),left.location.register,right.location.register)) end; end; @@ -524,7 +524,7 @@ interface if not(cmpop) and (location.register = NR_NO) then - location.register := cg.getintregister(exprasmlist,OS_INT); + location.register := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); case nodetype of addn : @@ -538,20 +538,20 @@ interface if assigned(tsetelementnode(right).right) then internalerror(43244); if (right.location.loc = LOC_CONSTANT) then - cg.a_op_const_reg_reg(exprasmlist,OP_OR,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_INT, aint(aword(1) shl aword(right.location.value)), left.location.register,location.register) else begin - tmpreg := cg.getintregister(exprasmlist,OS_INT); - cg.a_load_const_reg(exprasmlist,OS_INT,1,tmpreg); - cg.a_op_reg_reg(exprasmlist,OP_SHL,OS_INT, + tmpreg := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT,1,tmpreg); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_INT, right.location.register,tmpreg); if left.location.loc <> LOC_CONSTANT then - cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_INT,tmpreg, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_INT,tmpreg, left.location.register,location.register) else - cg.a_op_const_reg_reg(exprasmlist,OP_OR,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_INT, left.location.value,tmpreg,location.register); end; opdone := true; @@ -582,14 +582,14 @@ interface begin if left.location.loc = LOC_CONSTANT then begin - tmpreg := cg.getintregister(exprasmlist,OS_INT); - cg.a_load_const_reg(exprasmlist,OS_INT, + tmpreg := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT, left.location.value,tmpreg); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ANDC, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ANDC, location.register,tmpreg,right.location.register)); end else - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ANDC, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ANDC, location.register,left.location.register, right.location.register)); end; @@ -608,12 +608,12 @@ interface (nodetype = gten)) then swapleftright; // now we have to check whether left >= right - tmpreg := cg.getintregister(exprasmlist,OS_INT); + tmpreg := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); if left.location.loc = LOC_CONSTANT then begin - cg.a_op_const_reg_reg(exprasmlist,OP_AND,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_AND,OS_INT, not(left.location.value),right.location.register,tmpreg); - exprasmlist.concat(taicpu.op_reg_const(A_CMPWI,tmpreg,0)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMPWI,tmpreg,0)); // the two instructions above should be folded together by // the peepholeoptimizer end @@ -621,13 +621,13 @@ interface begin if right.location.loc = LOC_CONSTANT then begin - cg.a_load_const_reg(exprasmlist,OS_INT, + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT, right.location.value,tmpreg); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ANDC_,tmpreg, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ANDC_,tmpreg, tmpreg,left.location.register)); end else - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ANDC_,tmpreg, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ANDC_,tmpreg, right.location.register,left.location.register)); end; location.resflags.cr := RS_CR0; @@ -644,11 +644,11 @@ interface if (left.location.loc = LOC_CONSTANT) then swapleftright; if (right.location.loc = LOC_CONSTANT) then - cg.a_op_const_reg_reg(exprasmlist,cgop,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,cgop,OS_INT, right.location.value,left.location.register, location.register) else - cg.a_op_reg_reg_reg(exprasmlist,cgop,OS_INT, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,cgop,OS_INT, right.location.register,left.location.register, location.register); end; @@ -703,16 +703,16 @@ interface oldnodetype: tnodetype; begin {$ifdef OLDREGVARS} - load_all_regvars(exprasmlist); + load_all_regvars(current_asmdata.CurrAsmList); {$endif OLDREGVARS} { the jump the sequence is a little bit hairy } case nodetype of ltn,gtn: begin - cg.a_jmp_flags(exprasmlist,getresflags,truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags,current_procinfo.CurrTrueLabel); { cheat a little bit for the negative test } toggleflag(nf_swaped); - cg.a_jmp_flags(exprasmlist,getresflags,falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags,current_procinfo.CurrFalseLabel); toggleflag(nf_swaped); end; lten,gten: @@ -722,24 +722,24 @@ interface nodetype:=ltn else nodetype:=gtn; - cg.a_jmp_flags(exprasmlist,getresflags,truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags,current_procinfo.CurrTrueLabel); { cheat for the negative test } if nodetype=ltn then nodetype:=gtn else nodetype:=ltn; - cg.a_jmp_flags(exprasmlist,getresflags,falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags,current_procinfo.CurrFalseLabel); nodetype:=oldnodetype; end; equaln: begin nodetype := unequaln; - cg.a_jmp_flags(exprasmlist,getresflags,falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags,current_procinfo.CurrFalseLabel); nodetype := equaln; end; unequaln: begin - cg.a_jmp_flags(exprasmlist,getresflags,truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags,current_procinfo.CurrTrueLabel); end; end; end; @@ -754,20 +754,20 @@ interface begin { the comparison of the low dword always has } { to be always unsigned! } - cg.a_jmp_flags(exprasmlist,getresflags,truelabel); - cg.a_jmp_always(exprasmlist,falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags,current_procinfo.CurrTrueLabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); end; equaln: begin nodetype := unequaln; - cg.a_jmp_flags(exprasmlist,getresflags,falselabel); - cg.a_jmp_always(exprasmlist,truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags,current_procinfo.CurrFalseLabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); nodetype := equaln; end; unequaln: begin - cg.a_jmp_flags(exprasmlist,getresflags,truelabel); - cg.a_jmp_always(exprasmlist,falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags,current_procinfo.CurrTrueLabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); end; end; end; @@ -860,11 +860,11 @@ interface else begin if (aint(right.location.value64) <> 0) then - tempreg64.reglo := cg.getintregister(exprasmlist,OS_32) + tempreg64.reglo := cg.getintregister(current_asmdata.CurrAsmList,OS_32) else tempreg64.reglo := left.location.register64.reglo; if ((right.location.value64 shr 32) <> 0) then - tempreg64.reghi := cg.getintregister(exprasmlist,OS_32) + tempreg64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_32) else tempreg64.reghi := left.location.register64.reghi; end; @@ -874,38 +874,38 @@ interface { positive values < 65535 using XOR. } if (longint(right.location.value64) >= -32767) and (longint(right.location.value64) < 0) then - cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT, aint(right.location.value64), left.location.register64.reglo,tempreg64.reglo) else - cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_XOR,OS_INT, aint(right.location.value64), left.location.register64.reglo,tempreg64.reglo); if ((right.location.value64 shr 32) <> 0) then if (longint(right.location.value64 shr 32) >= -32767) and (longint(right.location.value64 shr 32) < 0) then - cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT, aint(right.location.value64 shr 32), left.location.register64.reghi,tempreg64.reghi) else - cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_XOR,OS_INT, aint(right.location.value64 shr 32), left.location.register64.reghi,tempreg64.reghi); end else begin - tempreg64.reglo := cg.getintregister(exprasmlist,OS_INT); - tempreg64.reghi := cg.getintregister(exprasmlist,OS_INT); - cg64.a_op64_reg_reg_reg(exprasmlist,OP_XOR,location.size, + tempreg64.reglo := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + tempreg64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg64.a_op64_reg_reg_reg(current_asmdata.CurrAsmList,OP_XOR,location.size, left.location.register64,right.location.register64, tempreg64); end; - cg.a_reg_alloc(exprasmlist,NR_R0); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_OR_,NR_R0, + cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_R0); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_OR_,NR_R0, tempreg64.reglo,tempreg64.reghi)); - cg.a_reg_dealloc(exprasmlist,NR_R0); + cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_R0); location_reset(location,LOC_FLAGS,OS_NO); location.resflags := getresflags; @@ -914,17 +914,17 @@ interface begin if (location.register64.reglo = NR_NO) then begin - location.register64.reglo := cg.getintregister(exprasmlist,OS_INT); - location.register64.reghi := cg.getintregister(exprasmlist,OS_INT); + location.register64.reglo := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + location.register64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); end; if (left.location.loc = LOC_CONSTANT) then swapleftright; if (right.location.loc = LOC_CONSTANT) then - cg64.a_op64_const_reg_reg(exprasmlist,op,location.size,right.location.value64, + cg64.a_op64_const_reg_reg(current_asmdata.CurrAsmList,op,location.size,right.location.value64, left.location.register64,location.register64) else - cg64.a_op64_reg_reg_reg(exprasmlist,op,location.size,right.location.register64, + cg64.a_op64_reg_reg_reg(current_asmdata.CurrAsmList,op,location.size,right.location.register64, left.location.register64,location.register64); end; subn: @@ -933,17 +933,17 @@ interface begin if (location.register64.reglo = NR_NO) then begin - location.register64.reglo := cg.getintregister(exprasmlist,OS_INT); - location.register64.reghi := cg.getintregister(exprasmlist,OS_INT); + location.register64.reglo := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + location.register64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); end; if right.location.loc <> LOC_CONSTANT then // reg64 - reg64 - cg64.a_op64_reg_reg_reg(exprasmlist,OP_SUB,location.size, + cg64.a_op64_reg_reg_reg(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.register64,left.location.register64, location.register64) else // reg64 - const64 - cg64.a_op64_const_reg_reg(exprasmlist,OP_SUB,location.size, + cg64.a_op64_const_reg_reg(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.value64,left.location.register64, location.register64) end @@ -951,27 +951,27 @@ interface begin if (location.register64.reglo = NR_NO) then begin - location.register64.reglo := cg.getintregister(exprasmlist,OS_INT); - location.register64.reghi := cg.getintregister(exprasmlist,OS_INT); + location.register64.reglo := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + location.register64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); end; if (int64(left.location.value64) >= low(smallint)) and (int64(left.location.value64) <= high(smallint)) then begin // consts16 - reg64 - exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_SUBFIC, location.register64.reglo,right.location.register64.reglo, left.location.value)); end else begin // const32 - reg64 - location_force_reg(exprasmlist,left.location, + location_force_reg(current_asmdata.CurrAsmList,left.location, OS_32,true); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBC, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUBC, location.register64.reglo,left.location.register64.reglo, right.location.register64.reglo)); end; - exprasmlist.concat(taicpu.op_reg_reg(A_SUBFZE, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_SUBFZE, location.register64.reghi,right.location.register64.reghi)); end else if (aint(left.location.value64) = 0) then @@ -979,30 +979,30 @@ interface // (const32 shl 32) - reg64 if (location.register64.reglo = NR_NO) then begin - location.register64.reglo := cg.getintregister(exprasmlist,OS_INT); - location.register64.reghi := cg.getintregister(exprasmlist,OS_INT); + location.register64.reglo := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + location.register64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); end; - exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_SUBFIC, location.register64.reglo,right.location.register64.reglo,0)); left.location.value64 := left.location.value64 shr 32; - location_force_reg(exprasmlist,left.location,OS_32,true); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBFE, + location_force_reg(current_asmdata.CurrAsmList,left.location,OS_32,true); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUBFE, location.register64.reghi,right.location.register64.reghi, left.location.register)); end else begin // const64 - reg64 - location_force_reg(exprasmlist,left.location, + location_force_reg(current_asmdata.CurrAsmList,left.location, def_cgsize(left.resulttype.def),false); if (left.location.loc = LOC_REGISTER) then location.register64 := left.location.register64 else if (location.register64.reglo = NR_NO) then begin - location.register64.reglo := cg.getintregister(exprasmlist,OS_INT); - location.register64.reghi := cg.getintregister(exprasmlist,OS_INT); + location.register64.reglo := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + location.register64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); end; - cg64.a_op64_reg_reg_reg(exprasmlist,OP_SUB,location.size, + cg64.a_op64_reg_reg_reg(current_asmdata.CurrAsmList,OP_SUB,location.size, right.location.register64,left.location.register64, location.register64); end; @@ -1055,24 +1055,24 @@ interface end; end; end; - exprasmlist.concat(taicpu.op_reg_reg_reg(op1,location.register64.reglo, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op1,location.register64.reglo, left.location.register64.reglo,right.location.register64.reglo)); if (nodetype <> muln) then begin - exprasmlist.concat(taicpu.op_reg_reg_reg(op2,location.register64.reghi, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op2,location.register64.reghi, right.location.register64.reghi,left.location.register64.reghi)); if not(is_signed(resulttype.def)) then if nodetype = addn then - exprasmlist.concat(taicpu.op_reg_reg(A_CMPLW,location.register64.reghi,left.location.register64.reghi)) + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLW,location.register64.reghi,left.location.register64.reghi)) else - exprasmlist.concat(taicpu.op_reg_reg(A_CMPLW,left.location.register64.reghi,location.register64.reghi)); - cg.g_overflowcheck(exprasmlist,location,resulttype.def); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLW,left.location.register64.reghi,location.register64.reghi)); + cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def); end else begin { 32 * 32 -> 64 cannot overflow } - exprasmlist.concat(taicpu.op_reg_reg_reg(op2,location.register64.reghi, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op2,location.register64.reghi, left.location.register64.reglo,right.location.register64.reglo)); end end; @@ -1190,7 +1190,7 @@ interface { register variable ? } if (left.location.loc=LOC_CMMXREGISTER) then begin - hregister:=rg.getregistermm(exprasmlist); + hregister:=rg.getregistermm(current_asmdata.CurrAsmList); emit_reg_reg(A_MOVQ,S_NO,left.location.register,hregister); end else @@ -1198,9 +1198,9 @@ interface if not(left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then internalerror(200203245); - location_release(exprasmlist,left.location); + location_release(current_asmdata.CurrAsmList,left.location); - hregister:=rg.getregistermm(exprasmlist); + hregister:=rg.getregistermm(current_asmdata.CurrAsmList); emit_ref_reg(A_MOVQ,S_NO,left.location.reference,hregister); end; @@ -1227,7 +1227,7 @@ interface emit_ref_reg(A_MOVQ,S_NO,right.location.reference,R_MM7); emit_reg_reg(op,S_NO,left.location.register,R_MM7); emit_reg_reg(A_MOVQ,S_NO,R_MM7,left.location.register); - location_release(exprasmlist,right.location); + location_release(current_asmdata.CurrAsmList,right.location); end; end else @@ -1241,7 +1241,7 @@ interface if not(right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then internalerror(200203246); emit_ref_reg(op,S_NO,right.location.reference,left.location.register); - location_release(exprasmlist,right.location); + location_release(current_asmdata.CurrAsmList,right.location); end; end; end @@ -1260,12 +1260,12 @@ interface end; end; - location_freetemp(exprasmlist,right.location); - location_release(exprasmlist,right.location); + location_freetemp(current_asmdata.CurrAsmList,right.location); + location_release(current_asmdata.CurrAsmList,right.location); if cmpop then begin - location_freetemp(exprasmlist,left.location); - location_release(exprasmlist,left.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); + location_release(current_asmdata.CurrAsmList,left.location); end; set_result_location(cmpop,true); end; @@ -1365,7 +1365,7 @@ interface if (location.register = NR_NO) and not(cmpop) then - location.register := cg.getintregister(exprasmlist,OS_INT); + location.register := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); if not(cs_check_overflow in aktlocalswitches) or (cmpop) or @@ -1392,11 +1392,11 @@ interface if (left.location.loc = LOC_CONSTANT) then swapleftright; if (right.location.loc <> LOC_CONSTANT) then - cg.a_op_reg_reg_reg(exprasmlist,cgop,OS_INT, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,cgop,OS_INT, left.location.register,right.location.register, location.register) else - cg.a_op_const_reg_reg(exprasmlist,cgop,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,cgop,OS_INT, right.location.value,left.location.register, location.register); end; @@ -1406,27 +1406,27 @@ interface swapleftright; if left.location.loc <> LOC_CONSTANT then if right.location.loc <> LOC_CONSTANT then - cg.a_op_reg_reg_reg(exprasmlist,OP_SUB,OS_INT, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT, right.location.register,left.location.register, location.register) else - cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT, right.location.value,left.location.register, location.register) else if (longint(left.location.value) >= low(smallint)) and (longint(left.location.value) <= high(smallint)) then begin - exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_SUBFIC, location.register,right.location.register, longint(left.location.value))); end else begin - tmpreg := cg.getintregister(exprasmlist,OS_INT); - cg.a_load_const_reg(exprasmlist,OS_INT, + tmpreg := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT, left.location.value,tmpreg); - cg.a_op_reg_reg_reg(exprasmlist,OP_SUB,OS_INT, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_SUB,OS_INT, right.location.register,tmpreg,location.register); end; end; @@ -1455,44 +1455,44 @@ interface else internalerror(2002072601); end; - exprasmlist.concat(taicpu.op_reg_reg_reg(op,location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op,location.register, left.location.register,right.location.register)); - cg.g_overflowcheck(exprasmlist,location,resulttype.def); + cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def); end else begin case nodetype of addn: begin - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ADD,location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ADD,location.register, left.location.register,right.location.register)); - exprasmlist.concat(taicpu.op_reg_reg(A_CMPLW,location.register,left.location.register)); - cg.g_overflowcheck(exprasmlist,location,resulttype.def); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLW,location.register,left.location.register)); + cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def); end; subn: begin if nf_swaped in flags then swapleftright; - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUB,location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUB,location.register, left.location.register,right.location.register)); - exprasmlist.concat(taicpu.op_reg_reg(A_CMPLW,left.location.register,location.register)); - cg.g_overflowcheck(exprasmlist,location,resulttype.def); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLW,left.location.register,location.register)); + cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def); end; muln: begin { calculate the upper 32 bits of the product, = 0 if no overflow } - cg.a_reg_alloc(exprasmlist,NR_R0); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_MULHWU_,NR_R0, + cg.a_reg_alloc(current_asmdata.CurrAsmList,NR_R0); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULHWU_,NR_R0, left.location.register,right.location.register)); - cg.a_reg_dealloc(exprasmlist,NR_R0); + cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_R0); { calculate the real result } - exprasmlist.concat(taicpu.op_reg_reg_reg(A_MULLW,location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULLW,location.register, left.location.register,right.location.register)); { g_overflowcheck generates a OC_AE instead of OC_EQ :/ } - objectlibrary.getjumplabel(hl); - tcgppc(cg).a_jmp_cond(exprasmlist,OC_EQ,hl); - cg.a_call_name(exprasmlist,'FPC_OVERFLOW'); - cg.a_label(exprasmlist,hl); + current_asmdata.getjumplabel(hl); + tcgppc(cg).a_jmp_cond(current_asmdata.CurrAsmList,OC_EQ,hl); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_OVERFLOW'); + cg.a_label(current_asmdata.CurrAsmList,hl); end; end; end; diff --git a/compiler/powerpc/nppccal.pas b/compiler/powerpc/nppccal.pas index a29cbdf611..82320292d1 100644 --- a/compiler/powerpc/nppccal.pas +++ b/compiler/powerpc/nppccal.pas @@ -55,9 +55,9 @@ implementation if (target_info.abi = abi_powerpc_sysv) then begin if va_uses_float_reg in varargsparas.varargsinfo then - exprasmlist.concat(taicpu.op_const_const_const(A_CREQV,6,6,6)) + current_asmdata.CurrAsmList.concat(taicpu.op_const_const_const(A_CREQV,6,6,6)) else - exprasmlist.concat(taicpu.op_const_const_const(A_CRXOR,6,6,6)); + current_asmdata.CurrAsmList.concat(taicpu.op_const_const_const(A_CRXOR,6,6,6)); end; end; end; @@ -73,7 +73,7 @@ implementation // one syscall convention for Amiga/PowerPC // which is quite standard extra_call_code; - cg.a_call_name(exprasmlist,tprocdef(procdefinition).mangledname); + cg.a_call_name(current_asmdata.CurrAsmList,tprocdef(procdefinition).mangledname); extra_post_call_code; end; system_powerpc_morphos: @@ -81,60 +81,60 @@ implementation if (po_syscall_sysv in tprocdef(procdefinition).procoptions) or (po_syscall_sysvbase in tprocdef(procdefinition).procoptions) then begin - cg.getcpuregister(exprasmlist,NR_R0); - cg.getcpuregister(exprasmlist,NR_R31); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_R0); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_R31); reference_reset(tmpref); - tmpref.symbol:=objectlibrary.newasmsymbol(tglobalvarsym(tprocdef(procdefinition).libsym).mangledname,AB_EXTERNAL,AT_DATA); + tmpref.symbol:=current_asmdata.newasmsymbol(tglobalvarsym(tprocdef(procdefinition).libsym).mangledname,AB_EXTERNAL,AT_DATA); tmpref.refaddr:=addr_hi; - exprasmlist.concat(taicpu.op_reg_ref(A_LIS,NR_R31,tmpref)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LIS,NR_R31,tmpref)); tmpref.base:=NR_R31; tmpref.refaddr:=addr_lo; - exprasmlist.concat(taicpu.op_reg_ref(A_LWZ,NR_R31,tmpref)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LWZ,NR_R31,tmpref)); - exprasmlist.concat(taicpu.op_reg_reg_const(A_ADDI,NR_R31,NR_R31,-tprocdef(procdefinition).extnumber)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_ADDI,NR_R31,NR_R31,-tprocdef(procdefinition).extnumber)); reference_reset_base(tmpref,NR_R31,0); - exprasmlist.concat(taicpu.op_reg_ref(A_LWZ,NR_R0,tmpref)); - exprasmlist.concat(taicpu.op_reg(A_MTCTR,NR_R0)); - exprasmlist.concat(taicpu.op_none(A_BCTRL)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LWZ,NR_R0,tmpref)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_MTCTR,NR_R0)); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_BCTRL)); - cg.ungetcpuregister(exprasmlist,NR_R31); - cg.ungetcpuregister(exprasmlist,NR_R0); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_R31); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_R0); end else if (po_syscall_basesysv in tprocdef(procdefinition).procoptions) or (po_syscall_r12base in tprocdef(procdefinition).procoptions) then begin - cg.getcpuregister(exprasmlist,NR_R0); - cg.getcpuregister(exprasmlist,NR_R31); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_R0); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_R31); if (po_syscall_basesysv in tprocdef(procdefinition).procoptions) then - exprasmlist.concat(taicpu.op_reg_reg_const(A_ADDI,NR_R31,NR_R3,-tprocdef(procdefinition).extnumber)) + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_ADDI,NR_R31,NR_R3,-tprocdef(procdefinition).extnumber)) else - exprasmlist.concat(taicpu.op_reg_reg_const(A_ADDI,NR_R31,NR_R12,-tprocdef(procdefinition).extnumber)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_ADDI,NR_R31,NR_R12,-tprocdef(procdefinition).extnumber)); reference_reset_base(tmpref,NR_R31,0); - exprasmlist.concat(taicpu.op_reg_ref(A_LWZ,NR_R0,tmpref)); - exprasmlist.concat(taicpu.op_reg(A_MTCTR,NR_R0)); - exprasmlist.concat(taicpu.op_none(A_BCTRL)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LWZ,NR_R0,tmpref)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_MTCTR,NR_R0)); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_BCTRL)); - cg.ungetcpuregister(exprasmlist,NR_R31); - cg.ungetcpuregister(exprasmlist,NR_R0); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_R31); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_R0); end else if po_syscall_legacy in tprocdef(procdefinition).procoptions then begin - cg.getcpuregister(exprasmlist,NR_R0); - cg.getcpuregister(exprasmlist,NR_R3); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_R0); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_R3); { store call offset into R3 } - exprasmlist.concat(taicpu.op_reg_const(A_LI,NR_R3,-tprocdef(procdefinition).extnumber)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_LI,NR_R3,-tprocdef(procdefinition).extnumber)); { prepare LR, and call function } reference_reset_base(tmpref,NR_R2,100); { 100 ($64) is EmulDirectCallOS offset } - exprasmlist.concat(taicpu.op_reg_ref(A_LWZ,NR_R0,tmpref)); - exprasmlist.concat(taicpu.op_reg(A_MTLR,NR_R0)); - exprasmlist.concat(taicpu.op_none(A_BLRL)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_ref(A_LWZ,NR_R0,tmpref)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_MTLR,NR_R0)); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_BLRL)); - cg.ungetcpuregister(exprasmlist,NR_R0); - cg.ungetcpuregister(exprasmlist,NR_R3); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_R0); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_R3); end else internalerror(2005010403); diff --git a/compiler/powerpc/nppccnv.pas b/compiler/powerpc/nppccnv.pas index 4dca8d53d3..501ba9fb28 100644 --- a/compiler/powerpc/nppccnv.pas +++ b/compiler/powerpc/nppccnv.pas @@ -61,7 +61,7 @@ implementation defutil, cgbase,cgutils,pass_1,pass_2, ncon,ncal, - ncgutil, + ncgutil,procinfo, cpubase,aasmcpu, rgobj,tgobj,cgobj; @@ -146,7 +146,7 @@ implementation { stw R3,disp+4(R1) # store lower half } { lfd FR1,disp(R1) # float load double of value } { fsub FR1,FR1,FR2 # subtract 0x4330000000000000 } - tg.Gettemp(exprasmlist,8,tt_normal,ref); + tg.Gettemp(current_asmdata.CurrAsmList,8,tt_normal,ref); signed := is_signed(left.resulttype.def); @@ -178,51 +178,51 @@ implementation begin leftreg := left.location.register; if signed then - valuereg := cg.getintregister(exprasmlist,OS_INT) + valuereg := cg.getintregister(current_asmdata.CurrAsmList,OS_INT) else valuereg := leftreg; end; LOC_REFERENCE,LOC_CREFERENCE: begin - leftreg := cg.getintregister(exprasmlist,OS_INT); + leftreg := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); valuereg := leftreg; if signed then size := OS_S32 else size := OS_32; - cg.a_load_ref_reg(exprasmlist,def_cgsize(left.resulttype.def), + cg.a_load_ref_reg(current_asmdata.CurrAsmList,def_cgsize(left.resulttype.def), size,left.location.reference,leftreg); end else internalerror(200110012); end; - tempreg := cg.getintregister(exprasmlist,OS_INT); - exprasmlist.concat(taicpu.op_reg_const(A_LIS,tempreg,$4330)); - cg.a_load_reg_ref(exprasmlist,OS_32,OS_32,tempreg,ref); + tempreg := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_LIS,tempreg,$4330)); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_32,OS_32,tempreg,ref); if signed then - exprasmlist.concat(taicpu.op_reg_reg_const(A_XORIS,valuereg, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_XORIS,valuereg, { xoris expects a unsigned 16 bit int (FK) } leftreg,$8000)); inc(ref.offset,4); - cg.a_load_reg_ref(exprasmlist,OS_32,OS_32,valuereg,ref); + cg.a_load_reg_ref(current_asmdata.CurrAsmList,OS_32,OS_32,valuereg,ref); dec(ref.offset,4); - tmpfpureg := cg.getfpuregister(exprasmlist,OS_F64); - cg.a_loadfpu_ref_reg(exprasmlist,OS_F64,tempconst.location.reference, + tmpfpureg := cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64); + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,OS_F64,tempconst.location.reference, tmpfpureg); tempconst.free; - location.register := cg.getfpuregister(exprasmlist,OS_F64); - cg.a_loadfpu_ref_reg(exprasmlist,OS_F64,ref,location.register); + location.register := cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64); + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,OS_F64,ref,location.register); - tg.ungetiftemp(exprasmlist,ref); + tg.ungetiftemp(current_asmdata.CurrAsmList,ref); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_FSUB,location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_FSUB,location.register, location.register,tmpfpureg)); { work around bug in some PowerPC processors } if (tfloatdef(resulttype.def).typ = s32real) then - exprasmlist.concat(taicpu.op_reg_reg(A_FRSP,location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FRSP,location.register, location.register)); end; @@ -234,7 +234,7 @@ implementation { properly converted to singles } if (tfloatdef(left.resulttype.def).typ = s64real) and (tfloatdef(resulttype.def).typ = s32real) then - exprasmlist.concat(taicpu.op_reg_reg(A_FRSP,location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FRSP,location.register, location.register)); end; @@ -247,12 +247,12 @@ implementation href : treference; resflags : tresflags; opsize : tcgsize; - hlabel, oldtruelabel, oldfalselabel : tasmlabel; + hlabel, oldTrueLabel, oldFalseLabel : tasmlabel; begin - oldtruelabel:=truelabel; - oldfalselabel:=falselabel; - objectlibrary.getjumplabel(truelabel); - objectlibrary.getjumplabel(falselabel); + oldTrueLabel:=current_procinfo.CurrTrueLabel; + oldFalseLabel:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); secondpass(left); if codegenerror then exit; @@ -263,8 +263,8 @@ implementation (left.resulttype.def.size=resulttype.def.size) and (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then begin - truelabel:=oldtruelabel; - falselabel:=oldfalselabel; + current_procinfo.CurrTrueLabel:=oldTrueLabel; + current_procinfo.CurrFalseLabel:=oldFalseLabel; location_copy(location,left.location); exit; end; @@ -276,56 +276,56 @@ implementation begin if left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE] then begin - hreg1:=cg.getintregister(exprasmlist,OS_INT); + hreg1:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); if left.location.size in [OS_64,OS_S64] then begin - cg.a_load_ref_reg(exprasmlist,OS_INT,OS_INT,left.location.reference,hreg1); - hreg2:=cg.getintregister(exprasmlist,OS_INT); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,left.location.reference,hreg1); + hreg2:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); href:=left.location.reference; inc(href.offset,4); - cg.a_load_ref_reg(exprasmlist,OS_INT,OS_INT,href,hreg2); - cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,hreg1,hreg2,hreg1); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,href,hreg2); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,hreg1,hreg2,hreg1); end else - cg.a_load_ref_reg(exprasmlist,opsize,opsize,left.location.reference,hreg1); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,opsize,opsize,left.location.reference,hreg1); end else begin if left.location.size in [OS_64,OS_S64] then begin - hreg1:=cg.getintregister(exprasmlist,OS_32); - cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,left.location.register64.reghi,left.location.register64.reglo,hreg1); + hreg1:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,left.location.register64.reghi,left.location.register64.reglo,hreg1); end else hreg1 := left.location.register; end; - hreg2 := cg.getintregister(exprasmlist,OS_INT); - exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBIC,hreg2,hreg1,1)); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBFE,hreg1,hreg2,hreg1)); + hreg2 := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_SUBIC,hreg2,hreg1,1)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUBFE,hreg1,hreg2,hreg1)); end; LOC_FLAGS : begin - hreg1:=cg.getintregister(exprasmlist,OS_INT); + hreg1:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); resflags:=left.location.resflags; - cg.g_flags2reg(exprasmlist,location.size,resflags,hreg1); + cg.g_flags2reg(current_asmdata.CurrAsmList,location.size,resflags,hreg1); end; LOC_JUMP : begin - hreg1:=cg.getintregister(exprasmlist,OS_INT); - objectlibrary.getjumplabel(hlabel); - cg.a_label(exprasmlist,truelabel); - cg.a_load_const_reg(exprasmlist,OS_INT,1,hreg1); - cg.a_jmp_always(exprasmlist,hlabel); - cg.a_label(exprasmlist,falselabel); - cg.a_load_const_reg(exprasmlist,OS_INT,0,hreg1); - cg.a_label(exprasmlist,hlabel); + hreg1:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + current_asmdata.getjumplabel(hlabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT,1,hreg1); + cg.a_jmp_always(current_asmdata.CurrAsmList,hlabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT,0,hreg1); + cg.a_label(current_asmdata.CurrAsmList,hlabel); end; else internalerror(10062); end; location.register := hreg1; - truelabel:=oldtruelabel; - falselabel:=oldfalselabel; + current_procinfo.CurrTrueLabel:=oldTrueLabel; + current_procinfo.CurrFalseLabel:=oldFalseLabel; end; diff --git a/compiler/powerpc/nppcinl.pas b/compiler/powerpc/nppcinl.pas index 4d0b3b4720..27e92b8024 100644 --- a/compiler/powerpc/nppcinl.pas +++ b/compiler/powerpc/nppcinl.pas @@ -86,12 +86,12 @@ implementation begin location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def)); secondpass(left); - location_force_fpureg(exprasmlist,left.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); location_copy(location,left.location); if (location.loc = LOC_CFPUREGISTER) then begin location.loc := LOC_FPUREGISTER; - location.register := cg.getfpuregister(exprasmlist,OS_F64); + location.register := cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64); end; end; @@ -99,7 +99,7 @@ implementation begin location.loc:=LOC_FPUREGISTER; load_fpu_location; - exprasmlist.concat(taicpu.op_reg_reg(A_FABS,location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FABS,location.register, left.location.register)); end; @@ -107,7 +107,7 @@ implementation begin location.loc:=LOC_FPUREGISTER; load_fpu_location; - exprasmlist.concat(taicpu.op_reg_reg_reg(A_FMUL,location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_FMUL,location.register, left.location.register,left.location.register)); end; @@ -121,19 +121,19 @@ implementation LOC_CREFERENCE, LOC_REFERENCE: begin - r:=cg.getintregister(exprasmlist,OS_ADDR); + r:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR); if (left.location.reference.offset = 0) and not assigned(left.location.reference.symbol) then begin if (left.location.reference.index = NR_NO) then - exprasmlist.concat(taicpu.op_const_reg(A_DCBT,0,left.location.reference.base)) + current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_DCBT,0,left.location.reference.base)) else - exprasmlist.concat(taicpu.op_reg_reg(A_DCBT,left.location.reference.base,left.location.reference.index)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_DCBT,left.location.reference.base,left.location.reference.index)); end else begin - cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,r); - exprasmlist.concat(taicpu.op_const_reg(A_DCBT,0,r)); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,r); + current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_DCBT,0,r)); end; end; else diff --git a/compiler/powerpc/nppcmat.pas b/compiler/powerpc/nppcmat.pas index 1742357b6c..ea9d52dd7e 100644 --- a/compiler/powerpc/nppcmat.pas +++ b/compiler/powerpc/nppcmat.pas @@ -204,56 +204,56 @@ end; if (tordconstnode(right).value = 0) then begin internalerror(2005061701); end else if (tordconstnode(right).value = 1) then begin - cg.a_load_reg_reg(exprasmlist, OS_INT, OS_INT, numerator, resultreg); + cg.a_load_reg_reg(current_asmdata.CurrAsmList, OS_INT, OS_INT, numerator, resultreg); end else if (tordconstnode(right).value = -1) then begin // note: only in the signed case possible..., may overflow - exprasmlist.concat(taicpu.op_reg_reg(negops[cs_check_overflow in aktlocalswitches], resultreg, numerator)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(negops[cs_check_overflow in aktlocalswitches], resultreg, numerator)); end else if (ispowerof2(tordconstnode(right).value, power)) then begin if (is_signed(right.resulttype.def)) then begin { From "The PowerPC Compiler Writer's Guide", pg. 52ff } - cg.a_op_const_reg_reg(exprasmlist, OP_SAR, OS_INT, power, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SAR, OS_INT, power, numerator, resultreg); - exprasmlist.concat(taicpu.op_reg_reg(A_ADDZE, resultreg, resultreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_ADDZE, resultreg, resultreg)); end else begin - cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_INT, power, numerator, resultreg) + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, power, numerator, resultreg) end; end else begin { replace division by multiplication, both implementations } { from "The PowerPC Compiler Writer's Guide" pg. 53ff } - divreg := cg.getintregister(exprasmlist, OS_INT); + divreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); if (is_signed(right.resulttype.def)) then begin getmagic_signed32(tordconstnode(right).value, magic, shift); // load magic value - cg.a_load_const_reg(exprasmlist, OS_INT, magic, divreg); + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, magic, divreg); // multiply - exprasmlist.concat(taicpu.op_reg_reg_reg(A_MULHW, resultreg, numerator, divreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULHW, resultreg, numerator, divreg)); // add/subtract numerator if (tordconstnode(right).value > 0) and (magic < 0) then begin - cg.a_op_reg_reg_reg(exprasmlist, OP_ADD, OS_INT, numerator, resultreg, resultreg); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_ADD, OS_INT, numerator, resultreg, resultreg); end else if (tordconstnode(right).value < 0) and (magic > 0) then begin - cg.a_op_reg_reg_reg(exprasmlist, OP_SUB, OS_INT, numerator, resultreg, resultreg); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, numerator, resultreg, resultreg); end; // shift shift places to the right (arithmetic) - cg.a_op_const_reg_reg(exprasmlist, OP_SAR, OS_INT, shift, resultreg, resultreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SAR, OS_INT, shift, resultreg, resultreg); // extract and add sign bit if (tordconstnode(right).value >= 0) then begin - cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_INT, 31, numerator, divreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, 31, numerator, divreg); end else begin - cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_INT, 31, resultreg, divreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, 31, resultreg, divreg); end; - cg.a_op_reg_reg_reg(exprasmlist, OP_ADD, OS_INT, resultreg, divreg, resultreg); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_ADD, OS_INT, resultreg, divreg, resultreg); end else begin getmagic_unsigned32(tordconstnode(right).value, u_magic, u_add, u_shift); // load magic in divreg - cg.a_load_const_reg(exprasmlist, OS_INT, aint(u_magic), divreg); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_MULHWU, resultreg, numerator, divreg)); + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, aint(u_magic), divreg); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULHWU, resultreg, numerator, divreg)); if (u_add) then begin - cg.a_op_reg_reg_reg(exprasmlist, OP_SUB, OS_INT, resultreg, numerator, divreg); - cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_INT, 1, divreg, divreg); - cg.a_op_reg_reg_reg(exprasmlist, OP_ADD, OS_INT, divreg, resultreg, divreg); - cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_INT, u_shift-1, divreg, resultreg); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, resultreg, numerator, divreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, 1, divreg, divreg); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_ADD, OS_INT, divreg, resultreg, divreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, u_shift-1, divreg, resultreg); end else begin - cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_INT, u_shift, resultreg, resultreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, u_shift, resultreg, resultreg); end; end; end; @@ -268,30 +268,30 @@ end; internalerror(2005061702); end else if (abs(tordconstnode(right).value) = 1) then begin // x mod +/-1 is always zero - cg.a_load_const_reg(exprasmlist, OS_INT, 0, resultreg); + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, 0, resultreg); end else if (ispowerof2(tordconstnode(right).value, power)) then begin if (is_signed(right.resulttype.def)) then begin - tempreg := cg.getintregister(exprasmlist, OS_INT); - maskreg := cg.getintregister(exprasmlist, OS_INT); - modreg := cg.getintregister(exprasmlist, OS_INT); - - cg.a_load_const_reg(exprasmlist, OS_INT, abs(tordconstnode(right).value)-1, modreg); - cg.a_op_const_reg_reg(exprasmlist, OP_SAR, OS_INT, 31, numerator, maskreg); - cg.a_op_reg_reg_reg(exprasmlist, OP_AND, OS_INT, numerator, modreg, tempreg); - - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ANDC, maskreg, maskreg, modreg)); - exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC, modreg, tempreg, 0)); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBFE, modreg, modreg, modreg)); - cg.a_op_reg_reg_reg(exprasmlist, OP_AND, OS_INT, modreg, maskreg, maskreg); - cg.a_op_reg_reg_reg(exprasmlist, OP_OR, OS_INT, maskreg, tempreg, resultreg); + tempreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); + maskreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); + modreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); + + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, abs(tordconstnode(right).value)-1, modreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SAR, OS_INT, 31, numerator, maskreg); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_AND, OS_INT, numerator, modreg, tempreg); + + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ANDC, maskreg, maskreg, modreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_SUBFIC, modreg, tempreg, 0)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUBFE, modreg, modreg, modreg)); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_AND, OS_INT, modreg, maskreg, maskreg); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_OR, OS_INT, maskreg, tempreg, resultreg); end else begin - cg.a_op_const_reg_reg(exprasmlist, OP_AND, OS_INT, tordconstnode(right).value-1, numerator, resultreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_AND, OS_INT, tordconstnode(right).value-1, numerator, resultreg); end; end else begin genOrdConstNodeDiv(); - cg.a_op_const_reg_reg(exprasmlist, OP_MUL, OS_INT, tordconstnode(right).value, resultreg, resultreg); - cg.a_op_reg_reg_reg(exprasmlist, OP_SUB, OS_INT, resultreg, numerator, resultreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_MUL, OS_INT, tordconstnode(right).value, resultreg, resultreg); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, resultreg, numerator, resultreg); end; end; @@ -303,19 +303,19 @@ end; { put numerator in register } size:=def_cgsize(left.resulttype.def); - location_force_reg(exprasmlist,left.location, + location_force_reg(current_asmdata.CurrAsmList,left.location, size,true); location_copy(location,left.location); numerator := location.register; resultreg := location.register; if (location.loc = LOC_CREGISTER) then begin location.loc := LOC_REGISTER; - location.register := cg.getintregister(exprasmlist,size); + location.register := cg.getintregister(current_asmdata.CurrAsmList,size); resultreg := location.register; end else if (nodetype = modn) or (right.nodetype = ordconstn) then begin // for a modulus op, and for const nodes we need the result register // to be an extra register - resultreg := cg.getintregister(exprasmlist,size); + resultreg := cg.getintregister(current_asmdata.CurrAsmList,size); end; done := false; @@ -329,24 +329,24 @@ end; if (not done) then begin { load divider in a register if necessary } - location_force_reg(exprasmlist,right.location, + location_force_reg(current_asmdata.CurrAsmList,right.location, def_cgsize(right.resulttype.def),true); if (right.nodetype <> ordconstn) then - exprasmlist.concat(taicpu.op_reg_reg_const(A_CMPWI,NR_CR1, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_CMPWI,NR_CR1, right.location.register,0)); divider := right.location.register; { needs overflow checking, (-maxlongint-1) div (-1) overflows! } op := divops[is_signed(right.resulttype.def), cs_check_overflow in aktlocalswitches]; - exprasmlist.concat(taicpu.op_reg_reg_reg(op,resultreg,numerator, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op,resultreg,numerator, divider)); if (nodetype = modn) then begin - exprasmlist.concat(taicpu.op_reg_reg_reg(A_MULLW,resultreg, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULLW,resultreg, divider,resultreg)); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUB,location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUB,location.register, numerator,resultreg)); resultreg := location.register; end; @@ -356,16 +356,16 @@ end; location.register:=resultreg; if right.nodetype <> ordconstn then begin - objectlibrary.getjumplabel(hl); - exprasmlist.concat(taicpu.op_cond_sym(A_BC,zerocond,hl)); - cg.a_call_name(exprasmlist,'FPC_DIVBYZERO'); - cg.a_label(exprasmlist,hl); + current_asmdata.getjumplabel(hl); + current_asmdata.CurrAsmList.concat(taicpu.op_cond_sym(A_BC,zerocond,hl)); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DIVBYZERO'); + cg.a_label(current_asmdata.CurrAsmList,hl); end; { unsigned division/module can only overflow in case of division by zero } { (but checking this overflow flag is more convoluted than performing a } { simple comparison with 0) } if is_signed(right.resulttype.def) then - cg.g_overflowcheck(exprasmlist,location,resulttype.def); + cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def); end; @@ -393,7 +393,7 @@ end; if is_64bitint(left.resulttype.def) then begin - location_force_reg(exprasmlist,left.location, + location_force_reg(current_asmdata.CurrAsmList,left.location, def_cgsize(left.resulttype.def),true); location_copy(location,left.location); hreg64hi := location.register64.reghi; @@ -401,8 +401,8 @@ end; if (location.loc = LOC_CREGISTER) then begin location.loc := LOC_REGISTER; - location.register64.reghi := cg.getintregister(exprasmlist,OS_32); - location.register64.reglo := cg.getintregister(exprasmlist,OS_32); + location.register64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_32); + location.register64.reglo := cg.getintregister(current_asmdata.CurrAsmList,OS_32); end; if (right.nodetype = ordconstn) then begin @@ -414,47 +414,47 @@ end; if shiftval > 63 then begin - cg.a_load_const_reg(exprasmlist,OS_32,0,location.register64.reglo); - cg.a_load_const_reg(exprasmlist,OS_32,0,location.register64.reglo); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_32,0,location.register64.reglo); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_32,0,location.register64.reglo); end else } if shiftval > 31 then begin if nodetype = shln then begin - cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_32, shiftval and 31,hreg64lo,location.register64.reghi); - cg.a_load_const_reg(exprasmlist,OS_32,0,location.register64.reglo); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_32,0,location.register64.reglo); end else begin - cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHR,OS_32, shiftval and 31,hreg64hi,location.register64.reglo); - cg.a_load_const_reg(exprasmlist,OS_32,0,location.register64.reghi); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_32,0,location.register64.reghi); end; end else begin if nodetype = shln then begin - exprasmlist.concat(taicpu.op_reg_reg_const_const_const( + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const_const_const( A_RLWINM,location.register64.reghi,hreg64hi,shiftval, 0,31-shiftval)); - exprasmlist.concat(taicpu.op_reg_reg_const_const_const( + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const_const_const( A_RLWIMI,location.register64.reghi,hreg64lo,shiftval, 32-shiftval,31)); - exprasmlist.concat(taicpu.op_reg_reg_const_const_const( + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const_const_const( A_RLWINM,location.register64.reglo,hreg64lo,shiftval, 0,31-shiftval)); end else begin - exprasmlist.concat(taicpu.op_reg_reg_const_const_const( + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const_const_const( A_RLWINM,location.register64.reglo,hreg64lo,32-shiftval, shiftval,31)); - exprasmlist.concat(taicpu.op_reg_reg_const_const_const( + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const_const_const( A_RLWIMI,location.register64.reglo,hreg64hi,32-shiftval, 0,shiftval-1)); - exprasmlist.concat(taicpu.op_reg_reg_const_const_const( + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const_const_const( A_RLWINM,location.register64.reghi,hreg64hi,32-shiftval, shiftval,31)); end; @@ -463,7 +463,7 @@ end; else { no constant shiftcount } begin - location_force_reg(exprasmlist,right.location,OS_S32,true); + location_force_reg(current_asmdata.CurrAsmList,right.location,OS_S32,true); hregister1 := right.location.register; if nodetype = shln then begin @@ -482,24 +482,24 @@ end; location.register64.reglo := resultreg; end; - cg.getcpuregister(exprasmlist,NR_R0); - exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC, + cg.getcpuregister(current_asmdata.CurrAsmList,NR_R0); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_SUBFIC, NR_R0,hregister1,32)); - exprasmlist.concat(taicpu.op_reg_reg_reg(asmop1, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(asmop1, location.register64.reghi,hreg64hi,hregister1)); - exprasmlist.concat(taicpu.op_reg_reg_reg(asmop2, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(asmop2, NR_R0,hreg64lo,NR_R0)); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_OR, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_OR, location.register64.reghi,location.register64.reghi,NR_R0)); - exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBI, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_SUBI, NR_R0,hregister1,32)); - exprasmlist.concat(taicpu.op_reg_reg_reg(asmop1, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(asmop1, NR_R0,hreg64lo,NR_R0)); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_OR, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_OR, location.register64.reghi,location.register64.reghi,NR_R0)); - exprasmlist.concat(taicpu.op_reg_reg_reg(asmop1, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(asmop1, location.register64.reglo,hreg64lo,hregister1)); - cg.ungetcpuregister(exprasmlist,NR_R0); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_R0); if nodetype = shrn then begin @@ -512,14 +512,14 @@ end; else begin { load left operators in a register } - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),true); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true); location_copy(location,left.location); resultreg := location.register; hregister1 := location.register; if (location.loc = LOC_CREGISTER) then begin location.loc := LOC_REGISTER; - resultreg := cg.getintregister(exprasmlist,OS_32); + resultreg := cg.getintregister(current_asmdata.CurrAsmList,OS_32); location.register := resultreg; end; @@ -531,15 +531,15 @@ end; { shifting by a constant directly coded: } if (right.nodetype=ordconstn) then - cg.a_op_const_reg_reg(exprasmlist,op,OS_32, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,op,OS_32, tordconstnode(right).value and 31,hregister1,resultreg) else begin { load shift count in a register if necessary } - location_force_reg(exprasmlist,right.location,def_cgsize(right.resulttype.def),true); + location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(right.resulttype.def),true); hregister2 := right.location.register; - cg.a_op_reg_reg_reg(exprasmlist,op,OS_32,hregister2, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,op,OS_32,hregister2, hregister1,resultreg); end; end; @@ -560,21 +560,21 @@ end; secondpass(left); if is_64bitint(left.resulttype.def) then begin - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),true); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true); location_copy(location,left.location); if (location.loc = LOC_CREGISTER) then begin - location.register64.reglo := cg.getintregister(exprasmlist,OS_INT); - location.register64.reghi := cg.getintregister(exprasmlist,OS_INT); + location.register64.reglo := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + location.register64.reghi := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); location.loc := LOC_REGISTER; end; - exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_SUBFIC, location.register64.reglo,left.location.register64.reglo,0)); if not(cs_check_overflow in aktlocalswitches) then - exprasmlist.concat(taicpu.op_reg_reg(A_SUBFZE, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_SUBFZE, location.register64.reghi,left.location.register64.reghi)) else - exprasmlist.concat(taicpu.op_reg_reg(A_SUBFZEO_, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_SUBFZEO_, location.register64.reghi,left.location.register64.reghi)); end else @@ -591,25 +591,25 @@ end; begin src1 := left.location.register; if left.location.loc = LOC_CREGISTER then - location.register := cg.getintregister(exprasmlist,OS_INT) + location.register := cg.getintregister(current_asmdata.CurrAsmList,OS_INT) else - location.register := cg.getfpuregister(exprasmlist,location.size); + location.register := cg.getfpuregister(current_asmdata.CurrAsmList,location.size); end; LOC_REFERENCE,LOC_CREFERENCE: begin if (left.resulttype.def.deftype=floatdef) then begin - src1 := cg.getfpuregister(exprasmlist,def_cgsize(left.resulttype.def)); + src1 := cg.getfpuregister(current_asmdata.CurrAsmList,def_cgsize(left.resulttype.def)); location.register := src1; - cg.a_loadfpu_ref_reg(exprasmlist, + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList, def_cgsize(left.resulttype.def), left.location.reference,src1); end else begin - src1 := cg.getintregister(exprasmlist,OS_32); + src1 := cg.getintregister(current_asmdata.CurrAsmList,OS_32); location.register:= src1; - cg.a_load_ref_reg(exprasmlist,OS_32,OS_32, + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_32,OS_32, left.location.reference,src1); end; end; @@ -629,7 +629,7 @@ end; location.loc := LOC_FPUREGISTER; end; { emit operation } - exprasmlist.concat(taicpu.op_reg_reg(op,location.register,src1)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,location.register,src1)); end; { Here was a problem... } { Operand to be negated always } @@ -637,7 +637,7 @@ end; { 32-bit before doing neg!! } { So this is useless... } { that's not true: -2^31 gives an overflow error if it is negated (FK) } - cg.g_overflowcheck(exprasmlist,location,resulttype.def); + cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def); end; @@ -658,14 +658,14 @@ end; } if left.expectloc=LOC_JUMP then begin - hl:=truelabel; - truelabel:=falselabel; - falselabel:=hl; + hl:=current_procinfo.CurrTrueLabel; + current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel; + current_procinfo.CurrFalseLabel:=hl; secondpass(left); - maketojumpbool(exprasmlist,left,lr_load_regvars); - hl:=truelabel; - truelabel:=falselabel; - falselabel:=hl; + maketojumpbool(current_asmdata.CurrAsmList,left,lr_load_regvars); + hl:=current_procinfo.CurrTrueLabel; + current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel; + current_procinfo.CurrFalseLabel:=hl; location.loc:=LOC_JUMP; end else @@ -679,8 +679,8 @@ end; end; LOC_REGISTER, LOC_CREGISTER, LOC_REFERENCE, LOC_CREFERENCE : begin - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),true); - exprasmlist.concat(taicpu.op_reg_const(A_CMPWI,left.location.register,0)); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMPWI,left.location.register,0)); location_reset(location,LOC_FLAGS,OS_NO); location.resflags.cr:=RS_CR0; location.resflags.flag:=F_EQ; @@ -693,23 +693,23 @@ end; else if is_64bitint(left.resulttype.def) then begin secondpass(left); - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),false); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),false); location_copy(location,left.location); { perform the NOT operation } - exprasmlist.concat(taicpu.op_reg_reg(A_NOT,location.register64.reghi, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_NOT,location.register64.reghi, location.register64.reghi)); - exprasmlist.concat(taicpu.op_reg_reg(A_NOT,location.register64.reglo, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_NOT,location.register64.reglo, location.register64.reglo)); end else begin secondpass(left); - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),true); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true); location_copy(location,left.location); location.loc := LOC_REGISTER; - location.register := cg.getintregister(exprasmlist,OS_INT); + location.register := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); { perform the NOT operation } - cg.a_op_reg_reg(exprasmlist,OP_NOT,def_cgsize(resulttype.def),left.location.register, + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,def_cgsize(resulttype.def),left.location.register, location.register); end; end; diff --git a/compiler/powerpc/nppcset.pas b/compiler/powerpc/nppcset.pas index 3312a18288..28dab9d3ee 100644 --- a/compiler/powerpc/nppcset.pas +++ b/compiler/powerpc/nppcset.pas @@ -69,7 +69,7 @@ implementation indexreg : tregister; href : treference; - procedure genitem(list:taasmoutput;t : pcaselabel); + procedure genitem(list:TAsmList;t : pcaselabel); var i : aint; begin @@ -89,25 +89,25 @@ implementation if not(jumptable_no_range) then begin { case expr less than min_ => goto elselabel } - cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,aint(min_),hregister,elselabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_lt,aint(min_),hregister,elselabel); { case expr greater than max_ => goto elselabel } - cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_gt,aint(max_),hregister,elselabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_gt,aint(max_),hregister,elselabel); end; - objectlibrary.getjumplabel(table); + current_asmdata.getjumplabel(table); { make it a 32bit register } // allocate base and index registers register - indexreg:= cg.makeregsize(exprasmlist, hregister, OS_INT); + indexreg:= cg.makeregsize(current_asmdata.CurrAsmList, hregister, OS_INT); { indexreg := hregister; } - cg.a_load_reg_reg(exprasmlist, opsize, OS_INT, hregister, indexreg); + cg.a_load_reg_reg(current_asmdata.CurrAsmList, opsize, OS_INT, hregister, indexreg); { create reference, indexreg := indexreg * sizeof(OS_ADDR) } - cg.a_op_const_reg(exprasmlist, OP_MUL, OS_INT, tcgsize2size[OS_ADDR], indexreg); + cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_MUL, OS_INT, tcgsize2size[OS_ADDR], indexreg); reference_reset_symbol(href, table, (-aint(min_)) * tcgsize2size[OS_ADDR]); href.index := indexreg; - cg.a_load_ref_reg(exprasmlist, OS_INT, OS_INT, href, indexreg); + cg.a_load_ref_reg(current_asmdata.CurrAsmList, OS_INT, OS_INT, href, indexreg); - exprasmlist.concat(taicpu.op_reg(A_MTCTR, indexreg)); - exprasmlist.concat(taicpu.op_none(A_BCTR)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_MTCTR, indexreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_BCTR)); { generate jump table } new_section(current_procinfo.aktlocaldata,sec_rodata,current_procinfo.procdef.mangledname,sizeof(aint)); @@ -132,13 +132,13 @@ implementation value := -value; if (value >= low(smallint)) and (value <= high(smallint)) then - exprasmlist.concat(taicpu.op_reg_reg_const(A_ADDIC_,hregister, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_ADDIC_,hregister, hregister,value)) else begin - tmpreg := cg.getintregister(exprasmlist,OS_INT); - cg.a_load_const_reg(exprasmlist,OS_INT,value,tmpreg); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ADD_,hregister, + tmpreg := cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT,value,tmpreg); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ADD_,hregister, hregister,tmpreg)); end; end; @@ -149,15 +149,15 @@ implementation { need we to test the first value } if first and (t^._low>get_min_value(left.resulttype.def)) then begin - cg.a_cmp_const_reg_label(exprasmlist,OS_INT,jmp_lt,aword(t^._low),hregister,elselabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_INT,jmp_lt,aword(t^._low),hregister,elselabel); end; if t^._low=t^._high then begin if t^._low-last=0 then - cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ,0,hregister,blocklabel(t^.blockid)) + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize, OC_EQ,0,hregister,blocklabel(t^.blockid)) else gensub(longint(t^._low-last)); - tcgppc(cg).a_jmp_cond(exprasmlist,OC_EQ,blocklabel(t^.blockid)); + tcgppc(cg).a_jmp_cond(current_asmdata.CurrAsmList,OC_EQ,blocklabel(t^.blockid)); last:=t^._low; lastrange := false; end @@ -180,10 +180,10 @@ implementation gensub(longint(t^._low-last)); if ((t^._low-last) <> 1) or (not lastrange) then - tcgppc(cg).a_jmp_cond(exprasmlist,jmp_lt,elselabel); + tcgppc(cg).a_jmp_cond(current_asmdata.CurrAsmList,jmp_lt,elselabel); end; gensub(longint(t^._high-t^._low)); - tcgppc(cg).a_jmp_cond(exprasmlist,jmp_le,blocklabel(t^.blockid)); + tcgppc(cg).a_jmp_cond(current_asmdata.CurrAsmList,jmp_le,blocklabel(t^.blockid)); last:=t^._high; lastrange := true; end; @@ -203,7 +203,7 @@ implementation lastrange:=false; first:=true; genitem(hp); - cg.a_jmp_always(exprasmlist,elselabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,elselabel); end; end; diff --git a/compiler/powerpc/rgcpu.pas b/compiler/powerpc/rgcpu.pas index ccc09c9f03..4dad75077e 100644 --- a/compiler/powerpc/rgcpu.pas +++ b/compiler/powerpc/rgcpu.pas @@ -35,10 +35,10 @@ unit rgcpu; type trgcpu = class(trgobj) { - function getcpuregisterint(list: taasmoutput; reg: Tnewregister): tregister; override; - procedure ungetregisterint(list: taasmoutput; reg: tregister); override; - function getcpuregisterfpu(list : taasmoutput; r : Toldregister) : tregister;override; - procedure ungetregisterfpu(list: taasmoutput; r : tregister; size:TCGsize);override; + function getcpuregisterint(list: TAsmList; reg: Tnewregister): tregister; override; + procedure ungetregisterint(list: TAsmList; reg: tregister); override; + function getcpuregisterfpu(list : TAsmList; r : Toldregister) : tregister;override; + procedure ungetregisterfpu(list: TAsmList; r : tregister; size:TCGsize);override; procedure cleartempgen; override; private usedpararegs: Tsupregset; @@ -52,7 +52,7 @@ unit rgcpu; cgobj, verbose, cutils; (* - function trgcpu.getcpuregisterint(list: taasmoutput; reg: Tnewregister): tregister; + function trgcpu.getcpuregisterint(list: TAsmList; reg: Tnewregister): tregister; begin if ((reg shr 8) in [RS_R0]) and @@ -70,7 +70,7 @@ unit rgcpu; end; - procedure trgcpu.ungetregisterint(list: taasmoutput; reg: tregister); + procedure trgcpu.ungetregisterint(list: TAsmList; reg: tregister); begin if ((reg.number shr 8) in [RS_R0]) and @@ -87,7 +87,7 @@ unit rgcpu; end; - function trgcpu.getcpuregisterfpu(list : taasmoutput; r : Toldregister) : tregister; + function trgcpu.getcpuregisterfpu(list : TAsmList; r : Toldregister) : tregister; begin if (r in [R_F1..R_F13]) and not is_reg_var_other[r] then @@ -103,7 +103,7 @@ unit rgcpu; end; - procedure trgcpu.ungetregisterfpu(list: taasmoutput; r : tregister; size:TCGsize); + procedure trgcpu.ungetregisterfpu(list: TAsmList; r : tregister; size:TCGsize); begin if (r.enum in [R_F1..R_F13]) and not is_reg_var_other[r.enum] then diff --git a/compiler/powerpc64/aasmcpu.pas b/compiler/powerpc64/aasmcpu.pas index 4850e68300..f0cfe22abb 100644 --- a/compiler/powerpc64/aasmcpu.pas +++ b/compiler/powerpc64/aasmcpu.pas @@ -109,7 +109,7 @@ procedure DoneAsm; function spilling_create_load(const ref: treference; r: tregister): tai; function spilling_create_store(r: tregister; const ref: treference): tai; -procedure fixup_jmps(list: taasmoutput); +procedure fixup_jmps(list: TAsmList); implementation @@ -460,7 +460,7 @@ procedure DoneAsm; begin end; -procedure fixup_jmps(list: taasmoutput); +procedure fixup_jmps(list: TAsmList); var p: tai; newjmp: taicpu; @@ -518,7 +518,7 @@ begin (ptruint(abs(ptrint(labelpositions[tasmlabel(taicpu(p).oper[0]^.ref^.symbol).labelnr]-instrpos)) - (low(smallint) div 4)) > ptruint((high(smallint) - low(smallint)) div 4)) then begin // add a new label after this jump - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); list.insertafter(tai_label.create(l),p); // add a new unconditional jump between this jump and the label newjmp := taicpu.op_sym(A_B,taicpu(p).oper[0]^.ref^.symbol); diff --git a/compiler/powerpc64/cgcpu.pas b/compiler/powerpc64/cgcpu.pas index 866048def6..47a82c5e0f 100644 --- a/compiler/powerpc64/cgcpu.pas +++ b/compiler/powerpc64/cgcpu.pas @@ -42,81 +42,81 @@ type { left to right), this allows to move the parameter to } { register, if the cpu supports register calling } { conventions } - procedure a_param_const(list: taasmoutput; size: tcgsize; a: aint; const + procedure a_param_const(list: TAsmList; size: tcgsize; a: aint; const paraloc: tcgpara); override; - procedure a_param_ref(list: taasmoutput; size: tcgsize; const r: treference; + procedure a_param_ref(list: TAsmList; size: tcgsize; const r: treference; const paraloc: tcgpara); override; - procedure a_paramaddr_ref(list: taasmoutput; const r: treference; const + procedure a_paramaddr_ref(list: TAsmList; const r: treference; const paraloc: tcgpara); override; - procedure a_call_name(list: taasmoutput; const s: string); override; - procedure a_call_reg(list: taasmoutput; reg: tregister); override; + procedure a_call_name(list: TAsmList; const s: string); override; + procedure a_call_reg(list: TAsmList; reg: tregister); override; - procedure a_op_const_reg(list: taasmoutput; Op: TOpCG; size: TCGSize; a: + procedure a_op_const_reg(list: TAsmList; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); override; - procedure a_op_reg_reg(list: taasmoutput; Op: TOpCG; size: TCGSize; src, + procedure a_op_reg_reg(list: TAsmList; Op: TOpCG; size: TCGSize; src, dst: TRegister); override; - procedure a_op_const_reg_reg(list: taasmoutput; op: TOpCg; + procedure a_op_const_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister); override; - procedure a_op_reg_reg_reg(list: taasmoutput; op: TOpCg; + procedure a_op_reg_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister); override; { move instructions } - procedure a_load_const_reg(list: taasmoutput; size: tcgsize; a: aint; reg: + procedure a_load_const_reg(list: TAsmList; size: tcgsize; a: aint; reg: tregister); override; { stores the contents of register reg to the memory location described by ref } - procedure a_load_reg_ref(list: taasmoutput; fromsize, tosize: tcgsize; reg: + procedure a_load_reg_ref(list: TAsmList; fromsize, tosize: tcgsize; reg: tregister; const ref: treference); override; { loads the memory pointed to by ref into register reg } - procedure a_load_ref_reg(list: taasmoutput; fromsize, tosize: tcgsize; const + procedure a_load_ref_reg(list: TAsmList; fromsize, tosize: tcgsize; const Ref: treference; reg: tregister); override; - procedure a_load_reg_reg(list: taasmoutput; fromsize, tosize: tcgsize; reg1, + procedure a_load_reg_reg(list: TAsmList; fromsize, tosize: tcgsize; reg1, reg2: tregister); override; { fpu move instructions } - procedure a_loadfpu_reg_reg(list: taasmoutput; size: tcgsize; reg1, reg2: + procedure a_loadfpu_reg_reg(list: TAsmList; size: tcgsize; reg1, reg2: tregister); override; - procedure a_loadfpu_ref_reg(list: taasmoutput; size: tcgsize; const ref: + procedure a_loadfpu_ref_reg(list: TAsmList; size: tcgsize; const ref: treference; reg: tregister); override; - procedure a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: + procedure a_loadfpu_reg_ref(list: TAsmList; size: tcgsize; reg: tregister; const ref: treference); override; { comparison operations } - procedure a_cmp_const_reg_label(list: taasmoutput; size: tcgsize; cmp_op: + procedure a_cmp_const_reg_label(list: TAsmList; size: tcgsize; cmp_op: topcmp; a: aint; reg: tregister; l: tasmlabel); override; - procedure a_cmp_reg_reg_label(list: taasmoutput; size: tcgsize; cmp_op: + procedure a_cmp_reg_reg_label(list: TAsmList; size: tcgsize; cmp_op: topcmp; reg1, reg2: tregister; l: tasmlabel); override; - procedure a_jmp_name(list: taasmoutput; const s: string); override; - procedure a_jmp_always(list: taasmoutput; l: tasmlabel); override; - procedure a_jmp_flags(list: taasmoutput; const f: TResFlags; l: tasmlabel); + procedure a_jmp_name(list: TAsmList; const s: string); override; + procedure a_jmp_always(list: TAsmList; l: tasmlabel); override; + procedure a_jmp_flags(list: TAsmList; const f: TResFlags; l: tasmlabel); override; - procedure g_flags2reg(list: taasmoutput; size: TCgSize; const f: TResFlags; + procedure g_flags2reg(list: TAsmList; size: TCgSize; const f: TResFlags; reg: TRegister); override; - procedure g_proc_entry(list: taasmoutput; localsize: longint; nostackframe: + procedure g_proc_entry(list: TAsmList; localsize: longint; nostackframe: boolean); override; - procedure g_proc_exit(list: taasmoutput; parasize: longint; nostackframe: + procedure g_proc_exit(list: TAsmList; parasize: longint; nostackframe: boolean); override; - procedure g_save_standard_registers(list: Taasmoutput); override; - procedure g_restore_standard_registers(list: Taasmoutput); override; + procedure g_save_standard_registers(list: TAsmList); override; + procedure g_restore_standard_registers(list: TAsmList); override; - procedure a_loadaddr_ref_reg(list: taasmoutput; const ref: treference; r: + procedure a_loadaddr_ref_reg(list: TAsmList; const ref: treference; r: tregister); override; - procedure g_concatcopy(list: taasmoutput; const source, dest: treference; + procedure g_concatcopy(list: TAsmList; const source, dest: treference; len: aint); override; - procedure g_overflowcheck(list: taasmoutput; const l: tlocation; def: tdef); + procedure g_overflowcheck(list: TAsmList; const l: tlocation; def: tdef); override; - procedure a_jmp_cond(list: taasmoutput; cond: TOpCmp; l: tasmlabel); + procedure a_jmp_cond(list: TAsmList; cond: TOpCmp; l: tasmlabel); - procedure g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const + procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint); override; private @@ -126,21 +126,21 @@ type { offset or symbol, in which case the base will have been changed } { to a tempreg (which has to be freed by the caller) containing } { the sum of part of the original reference } - function fixref(list: taasmoutput; var ref: treference; const size : TCgsize): boolean; + function fixref(list: TAsmList; var ref: treference; const size : TCgsize): boolean; - function load_got_symbol(list : taasmoutput; symbol : string) : tregister; + function load_got_symbol(list : TAsmList; symbol : string) : tregister; { returns whether a reference can be used immediately in a powerpc } { instruction } function issimpleref(const ref: treference): boolean; { contains the common code of a_load_reg_ref and a_load_ref_reg } - procedure a_load_store(list: taasmoutput; op: tasmop; reg: tregister; + procedure a_load_store(list: TAsmList; op: tasmop; reg: tregister; ref: treference); { creates the correct branch instruction for a given combination } { of asmcondflags and destination addressing mode } - procedure a_jmp(list: taasmoutput; op: tasmop; + procedure a_jmp(list: TAsmList; op: tasmop; c: tasmcondflag; crval: longint; l: tasmlabel); { returns the lowest numbered FP register in use, and the number of used FP registers @@ -160,12 +160,12 @@ type if includeCall is true, the method is marked as having a call, not if false. This option is particularly useful to prevent generation of a larger stack frame for the register save and restore helper functions. } - procedure a_call_name_direct(list: taasmoutput; s: string; prependDot : boolean; + procedure a_call_name_direct(list: TAsmList; s: string; prependDot : boolean; addNOP : boolean; includeCall : boolean = true); { emits code to store the given value a into the TOC (if not already in there), and load it from there as well } - procedure loadConstantPIC(list : taasmoutput; size : TCGSize; a : aint; reg : TRegister); + procedure loadConstantPIC(list : TAsmList; size : TCGSize; a : aint; reg : TRegister); end; const @@ -392,7 +392,7 @@ begin inherited done_register_allocators; end; -procedure tcgppc.a_param_const(list: taasmoutput; size: tcgsize; a: aint; const +procedure tcgppc.a_param_const(list: TAsmList; size: tcgsize; a: aint; const paraloc: tcgpara); var ref: treference; @@ -413,7 +413,7 @@ begin end; end; -procedure tcgppc.a_param_ref(list: taasmoutput; size: tcgsize; const r: +procedure tcgppc.a_param_ref(list: TAsmList; size: tcgsize; const r: treference; const paraloc: tcgpara); var @@ -527,7 +527,7 @@ begin end; end; -procedure tcgppc.a_paramaddr_ref(list: taasmoutput; const r: treference; const +procedure tcgppc.a_paramaddr_ref(list: TAsmList; const r: treference; const paraloc: tcgpara); var ref: treference; @@ -554,16 +554,16 @@ end; { calling a procedure by name } -procedure tcgppc.a_call_name(list: taasmoutput; const s: string); +procedure tcgppc.a_call_name(list: TAsmList; const s: string); begin a_call_name_direct(list, s, true, true); end; -procedure tcgppc.a_call_name_direct(list: taasmoutput; s: string; prependDot : boolean; addNOP : boolean; includeCall : boolean); +procedure tcgppc.a_call_name_direct(list: TAsmList; s: string; prependDot : boolean; addNOP : boolean; includeCall : boolean); begin if (prependDot) then s := '.' + s; - list.concat(taicpu.op_sym(A_BL, objectlibrary.newasmsymbol(s, AB_EXTERNAL, + list.concat(taicpu.op_sym(A_BL, current_asmdata.newasmsymbol(s, AB_EXTERNAL, AT_FUNCTION))); if (addNOP) then list.concat(taicpu.op_none(A_NOP)); @@ -575,7 +575,7 @@ end; { calling a procedure by address } -procedure tcgppc.a_call_reg(list: taasmoutput; reg: tregister); +procedure tcgppc.a_call_reg(list: TAsmList; reg: tregister); var tmpref: treference; begin @@ -618,14 +618,14 @@ end; {********************** load instructions ********************} -procedure tcgppc.a_load_const_reg(list: taasmoutput; size: TCGSize; a: aint; +procedure tcgppc.a_load_const_reg(list: TAsmList; size: TCGSize; a: aint; reg: TRegister); { loads a 32 bit constant into the given register, using an optimal instruction sequence. This is either LIS, LI or LI+ADDIS. Returns true if during these operations the upper 32 bits were filled with 1 bits (e.g. sign extension was performed) } - function load32bitconstant(list : taasmoutput; size : TCGSize; a : longint; + function load32bitconstant(list : TAsmList; size : TCGSize; a : longint; reg : TRegister) : boolean; var is_half_signed : byte; @@ -648,7 +648,7 @@ procedure tcgppc.a_load_const_reg(list: taasmoutput; size: TCGSize; a: aint; This is either LIS, LI or LI+ORIS. Returns true if during these operations the upper 32 bits were filled with 1 bits (e.g. sign extension was performed) } - function load32bitconstantR0(list : taasmoutput; size : TCGSize; a : longint) : boolean; + function load32bitconstantR0(list : TAsmList; size : TCGSize; a : longint) : boolean; begin { if it's a value we can load with a single LI, do it } if (a >= low(smallint)) and (a <= high(smallint)) then begin @@ -666,7 +666,7 @@ procedure tcgppc.a_load_const_reg(list: taasmoutput; size: TCGSize; a: aint; { emits the code to load a constant by emitting various instructions into the output code} - procedure loadConstantNormal(list: taasmoutput; size : TCgSize; a: aint; reg: TRegister); + procedure loadConstantNormal(list: TAsmList; size : TCgSize; a: aint; reg: TRegister); var extendssign : boolean; begin @@ -719,7 +719,7 @@ begin loadConstantNormal(list, size, a, reg); end; -procedure tcgppc.a_load_reg_ref(list: taasmoutput; fromsize, tosize: TCGSize; +procedure tcgppc.a_load_reg_ref(list: TAsmList; fromsize, tosize: TCGSize; reg: tregister; const ref: treference); const @@ -743,7 +743,7 @@ begin a_load_store(list, op, reg, ref2); end; -procedure tcgppc.a_load_ref_reg(list: taasmoutput; fromsize, tosize: tcgsize; +procedure tcgppc.a_load_ref_reg(list: TAsmList; fromsize, tosize: tcgsize; const ref: treference; reg: tregister); const @@ -793,7 +793,7 @@ begin list.concat(taicpu.op_reg_reg(A_EXTSB, reg, reg)); end; -procedure tcgppc.a_load_reg_reg(list: taasmoutput; fromsize, tosize: tcgsize; +procedure tcgppc.a_load_reg_reg(list: TAsmList; fromsize, tosize: tcgsize; reg1, reg2: tregister); const @@ -827,7 +827,7 @@ begin rg[R_INTREGISTER].add_move_instruction(instr); end; -procedure tcgppc.a_loadfpu_reg_reg(list: taasmoutput; size: tcgsize; +procedure tcgppc.a_loadfpu_reg_reg(list: TAsmList; size: tcgsize; reg1, reg2: tregister); var instr: taicpu; @@ -837,7 +837,7 @@ begin rg[R_FPUREGISTER].add_move_instruction(instr); end; -procedure tcgppc.a_loadfpu_ref_reg(list: taasmoutput; size: tcgsize; +procedure tcgppc.a_loadfpu_ref_reg(list: TAsmList; size: tcgsize; const ref: treference; reg: tregister); const FpuLoadInstr: array[OS_F32..OS_F64, boolean, boolean] of TAsmOp = @@ -865,7 +865,7 @@ begin a_load_store(list, op, reg, ref2); end; -procedure tcgppc.a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: +procedure tcgppc.a_loadfpu_reg_ref(list: TAsmList; size: tcgsize; reg: tregister; const ref: treference); const FpuStoreInstr: array[OS_F32..OS_F64, boolean, boolean] of TAsmOp = @@ -885,19 +885,19 @@ begin a_load_store(list, op, reg, ref2); end; -procedure tcgppc.a_op_const_reg(list: taasmoutput; Op: TOpCG; size: TCGSize; a: +procedure tcgppc.a_op_const_reg(list: TAsmList; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); begin a_op_const_reg_reg(list, op, size, a, reg, reg); end; -procedure tcgppc.a_op_reg_reg(list: taasmoutput; Op: TOpCG; size: TCGSize; src, +procedure tcgppc.a_op_reg_reg(list: TAsmList; Op: TOpCG; size: TCGSize; src, dst: TRegister); begin a_op_reg_reg_reg(list, op, size, src, dst, dst); end; -procedure tcgppc.a_op_const_reg_reg(list: taasmoutput; op: TOpCg; +procedure tcgppc.a_op_const_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister); var useReg : boolean; @@ -933,7 +933,7 @@ var list.concat(taicpu.op_reg_reg_const(A_ANDI_, dst, src, word(a))); end; - procedure do_constant_div(list : taasmoutput; size : TCgSize; a : aint; src, dst : TRegister; + procedure do_constant_div(list : TAsmList; size : TCgSize; a : aint; src, dst : TRegister; signed : boolean); const negops : array[boolean] of tasmop = (A_NEG, A_NEGO); @@ -950,58 +950,58 @@ var if (a = 0) then begin internalerror(2005061701); end else if (a = 1) then begin - cg.a_load_reg_reg(exprasmlist, OS_INT, OS_INT, src, dst); + cg.a_load_reg_reg(current_asmdata.CurrAsmList, OS_INT, OS_INT, src, dst); end else if (a = -1) and (signed) then begin { note: only in the signed case possible..., may overflow } - exprasmlist.concat(taicpu.op_reg_reg(negops[cs_check_overflow in aktlocalswitches], dst, src)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(negops[cs_check_overflow in aktlocalswitches], dst, src)); end else if (ispowerof2(a, power, isNegPower)) then begin if (signed) then begin { From "The PowerPC Compiler Writer's Guide", pg. 52ff } - cg.a_op_const_reg_reg(exprasmlist, OP_SAR, OS_INT, power, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SAR, OS_INT, power, src, dst); - exprasmlist.concat(taicpu.op_reg_reg(A_ADDZE, dst, dst)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_ADDZE, dst, dst)); if (isNegPower) then - exprasmlist.concat(taicpu.op_reg_reg(A_NEG, dst, dst)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_NEG, dst, dst)); end else begin - cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_INT, power, src, dst) + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, power, src, dst) end; end else begin { replace division by multiplication, both implementations } { from "The PowerPC Compiler Writer's Guide" pg. 53ff } - divreg := cg.getintregister(exprasmlist, OS_INT); + divreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); if (signed) then begin getmagic_signedN(sizeof(aInt)*8, a, magic, shift); { load magic value } - cg.a_load_const_reg(exprasmlist, OS_INT, magic, divreg); + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, magic, divreg); { multiply } - exprasmlist.concat(taicpu.op_reg_reg_reg(A_MULHD, dst, src, divreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULHD, dst, src, divreg)); { add/subtract numerator } if (a > 0) and (magic < 0) then begin - cg.a_op_reg_reg_reg(exprasmlist, OP_ADD, OS_INT, src, dst, dst); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_ADD, OS_INT, src, dst, dst); end else if (a < 0) and (magic > 0) then begin - cg.a_op_reg_reg_reg(exprasmlist, OP_SUB, OS_INT, src, dst, dst); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, src, dst, dst); end; { shift shift places to the right (arithmetic) } - cg.a_op_const_reg_reg(exprasmlist, OP_SAR, OS_INT, shift, dst, dst); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SAR, OS_INT, shift, dst, dst); { extract and add sign bit } if (a >= 0) then begin - cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_INT, 63, src, divreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, 63, src, divreg); end else begin - cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_INT, 63, dst, divreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, 63, dst, divreg); end; - cg.a_op_reg_reg_reg(exprasmlist, OP_ADD, OS_INT, dst, divreg, dst); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_ADD, OS_INT, dst, divreg, dst); end else begin getmagic_unsignedN(sizeof(aWord)*8, a, u_magic, u_add, u_shift); { load magic in divreg } - cg.a_load_const_reg(exprasmlist, OS_INT, u_magic, divreg); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_MULHDU, dst, src, divreg)); + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, u_magic, divreg); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULHDU, dst, src, divreg)); if (u_add) then begin - cg.a_op_reg_reg_reg(exprasmlist, OP_SUB, OS_INT, dst, src, divreg); - cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_INT, 1, divreg, divreg); - cg.a_op_reg_reg_reg(exprasmlist, OP_ADD, OS_INT, divreg, dst, divreg); - cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_INT, u_shift-1, divreg, dst); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, dst, src, divreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, 1, divreg, divreg); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_ADD, OS_INT, divreg, dst, divreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, u_shift-1, divreg, dst); end else begin - cg.a_op_const_reg_reg(exprasmlist, OP_SHR, OS_INT, u_shift, dst, dst); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SHR, OS_INT, u_shift, dst, dst); end; end; end; @@ -1043,7 +1043,7 @@ begin else if ispowerof2(a, shift, isneg) then begin list.concat(taicpu.op_reg_reg_const(A_SLDI, dst, src, shift)); if (isneg) then - exprasmlist.concat(taicpu.op_reg_reg(A_NEG, dst, dst)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_NEG, dst, dst)); end else if (a >= low(smallint)) and (a <= high(smallint)) then list.concat(taicpu.op_reg_reg_const(A_MULLI, dst, src, smallint(a))) @@ -1105,7 +1105,7 @@ begin end; end; -procedure tcgppc.a_op_reg_reg_reg(list: taasmoutput; op: TOpCg; +procedure tcgppc.a_op_reg_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister); const op_reg_reg_opcg2asmop32: array[TOpCG] of tasmop = @@ -1136,7 +1136,7 @@ end; {*************** compare instructructions ****************} -procedure tcgppc.a_cmp_const_reg_label(list: taasmoutput; size: tcgsize; +procedure tcgppc.a_cmp_const_reg_label(list: TAsmList; size: tcgsize; cmp_op: topcmp; a: aint; reg: tregister; l: tasmlabel); var scratch_register: TRegister; @@ -1167,7 +1167,7 @@ begin a_jmp(list, A_BC, TOpCmp2AsmCond[cmp_op], 0, l); end; -procedure tcgppc.a_cmp_reg_reg_label(list: taasmoutput; size: tcgsize; +procedure tcgppc.a_cmp_reg_reg_label(list: TAsmList; size: tcgsize; cmp_op: topcmp; reg1, reg2: tregister; l: tasmlabel); var op: tasmop; @@ -1186,29 +1186,29 @@ begin a_jmp(list, A_BC, TOpCmp2AsmCond[cmp_op], 0, l); end; -procedure tcgppc.a_jmp_cond(list: taasmoutput; cond: TOpCmp; l: tasmlabel); +procedure tcgppc.a_jmp_cond(list: TAsmList; cond: TOpCmp; l: tasmlabel); begin a_jmp(list, A_BC, TOpCmp2AsmCond[cond], 0, l); end; -procedure tcgppc.a_jmp_name(list: taasmoutput; const s: string); +procedure tcgppc.a_jmp_name(list: TAsmList; const s: string); var p: taicpu; begin - p := taicpu.op_sym(A_B, objectlibrary.newasmsymbol(s, AB_EXTERNAL, + p := taicpu.op_sym(A_B, current_asmdata.newasmsymbol(s, AB_EXTERNAL, AT_LABEL)); p.is_jmp := true; list.concat(p) end; -procedure tcgppc.a_jmp_always(list: taasmoutput; l: tasmlabel); +procedure tcgppc.a_jmp_always(list: TAsmList; l: tasmlabel); begin a_jmp(list, A_B, C_None, 0, l); end; -procedure tcgppc.a_jmp_flags(list: taasmoutput; const f: TResFlags; l: +procedure tcgppc.a_jmp_flags(list: TAsmList; const f: TResFlags; l: tasmlabel); var @@ -1218,7 +1218,7 @@ begin a_jmp(list, A_BC, c.cond, c.cr - RS_CR0, l); end; -procedure tcgppc.g_flags2reg(list: taasmoutput; size: TCgSize; const f: +procedure tcgppc.g_flags2reg(list: TAsmList; size: TCgSize; const f: TResFlags; reg: TRegister); var testbit: byte; @@ -1259,13 +1259,13 @@ end; { *********** entry/exit code and address loading ************ } -procedure tcgppc.g_save_standard_registers(list: Taasmoutput); +procedure tcgppc.g_save_standard_registers(list: TAsmList); begin { this work is done in g_proc_entry; additionally it is not safe to use it because it is called at some weird time } end; -procedure tcgppc.g_restore_standard_registers(list: Taasmoutput); +procedure tcgppc.g_restore_standard_registers(list: TAsmList); begin { this work is done in g_proc_exit; mainly because it is not safe to put the register restore code here because it is called at some weird time } @@ -1311,7 +1311,7 @@ end; IMPORTANT: registers are not to be allocated through the register allocator here, because the register colouring has already occured !! } -procedure tcgppc.g_proc_entry(list: taasmoutput; localsize: longint; +procedure tcgppc.g_proc_entry(list: TAsmList; localsize: longint; nostackframe: boolean); var firstregfpu, firstreggpr: TSuperRegister; @@ -1445,7 +1445,7 @@ end; IMPORTANT: registers are not to be allocated through the register allocator here, because the register colouring has already occured !! } -procedure tcgppc.g_proc_exit(list: taasmoutput; parasize: longint; nostackframe: +procedure tcgppc.g_proc_exit(list: TAsmList; parasize: longint; nostackframe: boolean); var firstregfpu, firstreggpr: TSuperRegister; @@ -1562,7 +1562,7 @@ begin end; -procedure tcgppc.a_loadaddr_ref_reg(list: taasmoutput; const ref: treference; r: +procedure tcgppc.a_loadaddr_ref_reg(list: TAsmList; const ref: treference; r: tregister); var @@ -1646,7 +1646,7 @@ const maxmoveunit = 8; -procedure tcgppc.g_concatcopy(list: taasmoutput; const source, dest: treference; +procedure tcgppc.g_concatcopy(list: TAsmList; const source, dest: treference; len: aint); var @@ -1742,7 +1742,7 @@ begin { explicitely allocate F0 since it can be used safely here (for holding date that's being copied) } a_reg_alloc(list, NR_F0); - objectlibrary.getjumplabel(lab); + current_asmdata.getjumplabel(lab); a_label(list, lab); list.concat(taicpu.op_reg_reg_const(A_SUBIC_, countreg, countreg, 1)); list.concat(taicpu.op_reg_ref(A_LFDU, NR_F0, src)); @@ -1792,7 +1792,7 @@ begin end; -procedure tcgppc.g_overflowcheck(list: taasmoutput; const l: tlocation; def: +procedure tcgppc.g_overflowcheck(list: TAsmList; const l: tlocation; def: tdef); var hl: tasmlabel; @@ -1800,7 +1800,7 @@ var begin if not (cs_check_overflow in aktlocalswitches) then exit; - objectlibrary.getjumplabel(hl); + current_asmdata.getjumplabel(hl); if not ((def.deftype = pointerdef) or ((def.deftype = orddef) and (torddef(def).typ in [u64bit, u16bit, u32bit, u8bit, uchar, @@ -1821,7 +1821,7 @@ begin a_label(list, hl); end; -procedure tcgppc.g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const +procedure tcgppc.g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint); procedure loadvmttor11; @@ -1894,7 +1894,7 @@ begin end else {$note ts:todo add GOT change?? - think not needed :) } list.concat(taicpu.op_sym(A_B, - objectlibrary.newasmsymbol('.' + procdef.mangledname, AB_EXTERNAL, + current_asmdata.newasmsymbol('.' + procdef.mangledname, AB_EXTERNAL, AT_FUNCTION))); List.concat(Tai_symbol_end.Createname(labelname)); @@ -1917,20 +1917,20 @@ begin (ref.offset = 0))); end; -function tcgppc.load_got_symbol(list: taasmoutput; symbol : string) : tregister; +function tcgppc.load_got_symbol(list: TAsmList; symbol : string) : tregister; var l: tasmsymbol; ref: treference; symname : string; begin - maybe_new_object_file(asmlist[al_picdata]); - symname := '_$' + objectlibrary.name + '$got$' + symbol; - l:=objectlibrary.getasmsymbol(symname); + maybe_new_object_file(current_asmdata.asmlists[al_picdata]); + symname := '_$' + current_asmdata.name + '$got$' + symbol; + l:=current_asmdata.getasmsymbol(symname); if not(assigned(l)) then begin - l:=objectlibrary.newasmsymbol(symname, AB_COMMON, AT_DATA); - asmlist[al_picdata].concat(tai_section.create(sec_toc, '.toc', 8)); - asmlist[al_picdata].concat(tai_symbol.create_global(l,0)); - asmlist[al_picdata].concat(tai_directive.create(asd_toc_entry, symbol + '[TC], ' + symbol)); + l:=current_asmdata.newasmsymbol(symname, AB_COMMON, AT_DATA); + current_asmdata.asmlists[al_picdata].concat(tai_section.create(sec_toc, '.toc', 8)); + current_asmdata.asmlists[al_picdata].concat(tai_symbol.create_global(l,0)); + current_asmdata.asmlists[al_picdata].concat(tai_directive.create(asd_toc_entry, symbol + '[TC], ' + symbol)); end; reference_reset_symbol(ref,l,0); ref.base := NR_R2; @@ -1945,7 +1945,7 @@ begin end; -function tcgppc.fixref(list: taasmoutput; var ref: treference; const size : TCgsize): boolean; +function tcgppc.fixref(list: TAsmList; var ref: treference; const size : TCgsize): boolean; var tmpreg: tregister; name : string; @@ -1993,7 +1993,7 @@ begin {$ENDIF EXTDEBUG} end; -procedure tcgppc.a_load_store(list: taasmoutput; op: tasmop; reg: tregister; +procedure tcgppc.a_load_store(list: TAsmList; op: tasmop; reg: tregister; ref: treference); var tmpreg, tmpreg2: tregister; @@ -2139,13 +2139,13 @@ begin end; end; -procedure tcgppc.a_jmp(list: taasmoutput; op: tasmop; c: tasmcondflag; +procedure tcgppc.a_jmp(list: TAsmList; op: tasmop; c: tasmcondflag; crval: longint; l: tasmlabel); var p: taicpu; begin - p := taicpu.op_sym(op, objectlibrary.newasmsymbol(l.name, AB_EXTERNAL, + p := taicpu.op_sym(op, current_asmdata.newasmsymbol(l.name, AB_EXTERNAL, AT_LABEL)); if op <> A_B then create_cond_norm(c, crval, p.condition); @@ -2159,20 +2159,20 @@ begin result := aword(ref.offset-low(smallint)) > high(smallint)-low(smallint); end; -procedure tcgppc.loadConstantPIC(list : taasmoutput; size : TCGSize; a : aint; reg : TRegister); +procedure tcgppc.loadConstantPIC(list : TAsmList; size : TCGSize; a : aint; reg : TRegister); var l: tasmsymbol; ref: treference; symname : string; begin - maybe_new_object_file(asmlist[al_picdata]); - symname := '_$' + objectlibrary.name + '$toc$' + hexstr(a, sizeof(a)*2); - l:=objectlibrary.getasmsymbol(symname); + maybe_new_object_file(current_asmdata.asmlists[al_picdata]); + symname := '_$' + current_asmdata.name + '$toc$' + hexstr(a, sizeof(a)*2); + l:=current_asmdata.getasmsymbol(symname); if not(assigned(l)) then begin - l:=objectlibrary.newasmsymbol(symname,AB_GLOBAL, AT_DATA); - asmlist[al_picdata].concat(tai_section.create(sec_toc, '.toc', 8)); - asmlist[al_picdata].concat(tai_symbol.create_global(l,0)); - asmlist[al_picdata].concat(tai_directive.create(asd_toc_entry, symname + '[TC], ' + inttostr(a))); + l:=current_asmdata.newasmsymbol(symname,AB_GLOBAL, AT_DATA); + current_asmdata.asmlists[al_picdata].concat(tai_section.create(sec_toc, '.toc', 8)); + current_asmdata.asmlists[al_picdata].concat(tai_symbol.create_global(l,0)); + current_asmdata.asmlists[al_picdata].concat(tai_directive.create(asd_toc_entry, symname + '[TC], ' + inttostr(a))); end; reference_reset_symbol(ref,l,0); ref.base := NR_R2; diff --git a/compiler/powerpc64/cpupara.pas b/compiler/powerpc64/cpupara.pas index 25b3257921..044b185e0c 100644 --- a/compiler/powerpc64/cpupara.pas +++ b/compiler/powerpc64/cpupara.pas @@ -47,7 +47,7 @@ type tvarargsparalist): longint; override; procedure create_funcretloc_info(p: tabstractprocdef; side: tcallercallee); - procedure createtempparaloc(list: taasmoutput;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); + procedure createtempparaloc(list: TAsmList;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); private procedure init_values(var curintreg, curfloatreg, curmmreg: tsuperregister; var cur_stack_offset: aword); @@ -488,7 +488,7 @@ begin result := true; end; -procedure tppcparamanager.createtempparaloc(list: taasmoutput;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); +procedure tppcparamanager.createtempparaloc(list: TAsmList;calloption : tproccalloption;parasym : tparavarsym;var cgpara:TCGPara); var paraloc : pcgparalocation; begin diff --git a/compiler/powerpc64/nppcadd.pas b/compiler/powerpc64/nppcadd.pas index 67212ac3bb..7c2d20b705 100644 --- a/compiler/powerpc64/nppcadd.pas +++ b/compiler/powerpc64/nppcadd.pas @@ -52,7 +52,7 @@ uses symconst, symdef, paramgr, aasmbase, aasmtai, aasmcpu, defutil, htypechk, cgbase, cpuinfo, pass_1, pass_2, regvars, - cpupara, cgcpu, cgutils, + cpupara, cgcpu, cgutils,procinfo, ncon, nset, ncgutil, tgobj, rgobj, rgcpu, cgobj; @@ -106,7 +106,7 @@ procedure tppcaddnode.load_left_right(cmpop, load_constants: boolean); end; LOC_REFERENCE, LOC_CREFERENCE: begin - location_force_reg(exprasmlist, n.location, + location_force_reg(current_asmdata.CurrAsmList, n.location, def_cgsize(n.resulttype.def), false); if not cmpop then begin @@ -117,7 +117,7 @@ procedure tppcaddnode.load_left_right(cmpop, load_constants: boolean); begin if load_constants then begin - location_force_reg(exprasmlist, n.location, + location_force_reg(current_asmdata.CurrAsmList, n.location, def_cgsize(n.resulttype.def), false); if not cmpop then location.register := n.location.register; @@ -132,7 +132,7 @@ begin if not (cmpop) and (location.register = NR_NO) then begin - location.register := cg.getintregister(exprasmlist, OS_INT); + location.register := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); end; end; @@ -193,8 +193,8 @@ begin useconst := true else begin useconst := false; - tmpreg := cg.getintregister(exprasmlist, OS_INT); - cg.a_load_const_reg(exprasmlist, OS_INT, + tmpreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, right.location.value, tmpreg); end end else @@ -213,12 +213,12 @@ begin if (right.location.loc = LOC_CONSTANT) then begin if useconst then - exprasmlist.concat(taicpu.op_reg_const(op, left.location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(op, left.location.register, longint(right.location.value))) else - exprasmlist.concat(taicpu.op_reg_reg(op, left.location.register, tmpreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op, left.location.register, tmpreg)); end else - exprasmlist.concat(taicpu.op_reg_reg(op, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op, left.location.register, right.location.register)); end; @@ -256,18 +256,18 @@ begin isjump := (left.expectloc = LOC_JUMP); if isjump then begin - otl := truelabel; - objectlibrary.getjumplabel(truelabel); - ofl := falselabel; - objectlibrary.getjumplabel(falselabel); + otl := current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + ofl := current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); end; secondpass(left); if left.location.loc in [LOC_FLAGS, LOC_JUMP] then - location_force_reg(exprasmlist, left.location, cgsize, false); + location_force_reg(current_asmdata.CurrAsmList, left.location, cgsize, false); if isjump then begin - truelabel := otl; - falselabel := ofl; + current_procinfo.CurrTrueLabel := otl; + current_procinfo.CurrFalseLabel := ofl; end else if left.location.loc = LOC_JUMP then internalerror(2003122901); @@ -275,18 +275,18 @@ begin isjump := (right.expectloc = LOC_JUMP); if isjump then begin - otl := truelabel; - objectlibrary.getjumplabel(truelabel); - ofl := falselabel; - objectlibrary.getjumplabel(falselabel); + otl := current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + ofl := current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); end; secondpass(right); if right.location.loc in [LOC_FLAGS, LOC_JUMP] then - location_force_reg(exprasmlist, right.location, cgsize, false); + location_force_reg(current_asmdata.CurrAsmList, right.location, cgsize, false); if isjump then begin - truelabel := otl; - falselabel := ofl; + current_procinfo.CurrTrueLabel := otl; + current_procinfo.CurrFalseLabel := ofl; end else if right.location.loc = LOC_JUMP then internalerror(200312292); @@ -310,10 +310,10 @@ begin equaln, unequaln: begin if (right.location.loc <> LOC_CONSTANT) then - exprasmlist.concat(taicpu.op_reg_reg(A_CMPLW, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLW, left.location.register, right.location.register)) else - exprasmlist.concat(taicpu.op_reg_const(A_CMPLWI, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMPLWI, left.location.register, longint(right.location.value))); location.resflags := getresflags; end; @@ -331,11 +331,11 @@ begin end; if right.location.loc <> LOC_CONSTANT then - cg.a_op_reg_reg_reg(exprasmlist, cgop, OS_INT, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, cgop, OS_INT, left.location.register, right.location.register, location.register) else - cg.a_op_const_reg_reg(exprasmlist, cgop, OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, cgop, OS_INT, right.location.value, left.location.register, location.register); end; @@ -353,27 +353,27 @@ begin case nodetype of andn: begin - otl := truelabel; - objectlibrary.getjumplabel(truelabel); + otl := current_procinfo.CurrTrueLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); secondpass(left); - maketojumpbool(exprasmlist, left, lr_load_regvars); - cg.a_label(exprasmlist, truelabel); - truelabel := otl; + maketojumpbool(current_asmdata.CurrAsmList, left, lr_load_regvars); + cg.a_label(current_asmdata.CurrAsmList, current_procinfo.CurrTrueLabel); + current_procinfo.CurrTrueLabel := otl; end; orn: begin - ofl := falselabel; - objectlibrary.getjumplabel(falselabel); + ofl := current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); secondpass(left); - maketojumpbool(exprasmlist, left, lr_load_regvars); - cg.a_label(exprasmlist, falselabel); - falselabel := ofl; + maketojumpbool(current_asmdata.CurrAsmList, left, lr_load_regvars); + cg.a_label(current_asmdata.CurrAsmList, current_procinfo.CurrFalseLabel); + current_procinfo.CurrFalseLabel := ofl; end; else internalerror(200403181); end; secondpass(right); - maketojumpbool(exprasmlist, right, lr_load_regvars); + maketojumpbool(current_asmdata.CurrAsmList, right, lr_load_regvars); end; end; end; @@ -416,8 +416,8 @@ begin swapleftright; // put both operands in a register - location_force_fpureg(exprasmlist, right.location, true); - location_force_fpureg(exprasmlist, left.location, true); + location_force_fpureg(current_asmdata.CurrAsmList, right.location, true); + location_force_fpureg(current_asmdata.CurrAsmList, left.location, true); // initialize de result if not cmpop then @@ -428,7 +428,7 @@ begin else if right.location.loc = LOC_FPUREGISTER then location.register := right.location.register else - location.register := cg.getfpuregister(exprasmlist, location.size); + location.register := cg.getfpuregister(current_asmdata.CurrAsmList, location.size); end else begin @@ -439,13 +439,13 @@ begin // emit the actual operation if not cmpop then begin - exprasmlist.concat(taicpu.op_reg_reg_reg(op, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op, location.register, left.location.register, right.location.register)) end else begin - exprasmlist.concat(taicpu.op_reg_reg_reg(op, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op, newreg(R_SPECIALREGISTER, location.resflags.cr, R_SUBNONE), left.location.register, right.location.register)) end; @@ -487,10 +487,10 @@ begin if not (cmpop) and (location.register = NR_NO) then - location.register := cg.getintregister(exprasmlist, OS_64); + location.register := cg.getintregister(current_asmdata.CurrAsmList, OS_64); astring := 'addsmallset0 ' + inttostr(aword(1) shl aword(right.location.value)) + ' ' + inttostr(right.location.value); - exprasmlist.concat(tai_comment.create(strpnew(astring))); + current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew(astring))); case nodetype of @@ -506,26 +506,26 @@ begin if (right.location.loc = LOC_CONSTANT) then begin astring := 'addsmallset1 ' + inttostr(aword(1) shl aword(right.location.value)) + ' ' + inttostr(right.location.value); - exprasmlist.concat(tai_comment.create(strpnew(astring))); + current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew(astring))); - cg.a_op_const_reg_reg(exprasmlist, OP_OR, OS_64, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_OR, OS_64, aint(1) shl aint(right.location.value), left.location.register, location.register) end else begin - tmpreg := cg.getintregister(exprasmlist, OS_64); - cg.a_load_const_reg(exprasmlist, OS_64, 1, tmpreg); - cg.a_op_reg_reg(exprasmlist, OP_SHL, OS_64, + tmpreg := cg.getintregister(current_asmdata.CurrAsmList, OS_64); + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_64, 1, tmpreg); + cg.a_op_reg_reg(current_asmdata.CurrAsmList, OP_SHL, OS_64, right.location.register, tmpreg); if left.location.loc <> LOC_CONSTANT then begin - cg.a_op_reg_reg_reg(exprasmlist, OP_OR, OS_64, tmpreg, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_OR, OS_64, tmpreg, left.location.register, location.register) end else begin astring := 'addsmallset2 ' + inttostr(left.location.value); - exprasmlist.concat(tai_comment.create(strpnew(astring))); + current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew(astring))); - cg.a_op_const_reg_reg(exprasmlist, OP_OR, OS_64, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_OR, OS_64, left.location.value, tmpreg, location.register); end; end; @@ -555,14 +555,14 @@ begin if opdone then begin if left.location.loc = LOC_CONSTANT then begin - tmpreg := cg.getintregister(exprasmlist, OS_64); - cg.a_load_const_reg(exprasmlist, OS_64, + tmpreg := cg.getintregister(current_asmdata.CurrAsmList, OS_64); + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_64, left.location.value, tmpreg); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ANDC, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ANDC, location.register, tmpreg, right.location.register)); end else - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ANDC, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ANDC, location.register, left.location.register, right.location.register)); end; @@ -581,21 +581,21 @@ begin (nodetype = gten)) then swapleftright; // now we have to check whether left >= right - tmpreg := cg.getintregister(exprasmlist, OS_64); + tmpreg := cg.getintregister(current_asmdata.CurrAsmList, OS_64); if left.location.loc = LOC_CONSTANT then begin - cg.a_op_const_reg_reg(exprasmlist, OP_AND, OS_64, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_AND, OS_64, not (left.location.value), right.location.register, tmpreg); - exprasmlist.concat(taicpu.op_reg_const(A_CMPDI, tmpreg, 0)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMPDI, tmpreg, 0)); // the two instructions above should be folded together by // the peepholeoptimizer end else begin if right.location.loc = LOC_CONSTANT then begin - cg.a_load_const_reg(exprasmlist, OS_64, + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_64, right.location.value, tmpreg); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ANDC_, tmpreg, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ANDC_, tmpreg, tmpreg, left.location.register)); end else - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ANDC_, tmpreg, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ANDC_, tmpreg, right.location.register, left.location.register)); end; location.resflags.cr := RS_CR0; @@ -612,13 +612,13 @@ begin swapleftright; if (right.location.loc = LOC_CONSTANT) then begin astring := 'addsmallset4 ' + inttostr(right.location.value); - exprasmlist.concat(tai_comment.create(strpnew(astring))); + current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew(astring))); - cg.a_op_const_reg_reg(exprasmlist, cgop, OS_64, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, cgop, OS_64, right.location.value, left.location.register, location.register) end else begin - cg.a_op_reg_reg_reg(exprasmlist, cgop, OS_64, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, cgop, OS_64, right.location.register, left.location.register, location.register); end; @@ -711,7 +711,7 @@ begin if (location.register = NR_NO) and not (cmpop) then - location.register := cg.getintregister(exprasmlist, OS_INT); + location.register := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); if not (cs_check_overflow in aktlocalswitches) or (cmpop) or @@ -738,11 +738,11 @@ begin if (left.location.loc = LOC_CONSTANT) then swapleftright; if (right.location.loc <> LOC_CONSTANT) then - cg.a_op_reg_reg_reg(exprasmlist, cgop, OS_INT, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, cgop, OS_INT, left.location.register, right.location.register, location.register) else - cg.a_op_const_reg_reg(exprasmlist, cgop, OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, cgop, OS_INT, right.location.value, left.location.register, location.register); end; @@ -752,20 +752,20 @@ begin swapleftright; if left.location.loc <> LOC_CONSTANT then if right.location.loc <> LOC_CONSTANT then begin - cg.a_op_reg_reg_reg(exprasmlist, OP_SUB, OS_INT, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, right.location.register, left.location.register, location.register); end else begin - cg.a_op_const_reg_reg(exprasmlist, OP_SUB, OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, right.location.value, left.location.register, location.register); end else begin - tmpreg := cg.getintregister(exprasmlist, OS_INT); - cg.a_load_const_reg(exprasmlist, OS_INT, + tmpreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, left.location.value, tmpreg); - cg.a_op_reg_reg_reg(exprasmlist, OP_SUB, OS_INT, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, right.location.register, tmpreg, location.register); end; end; @@ -794,44 +794,44 @@ begin else internalerror(2002072601); end; - exprasmlist.concat(taicpu.op_reg_reg_reg(op, location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op, location.register, left.location.register, right.location.register)); - cg.g_overflowcheck(exprasmlist, location, resulttype.def); + cg.g_overflowcheck(current_asmdata.CurrAsmList, location, resulttype.def); end else begin case nodetype of addn: begin - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ADD, location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ADD, location.register, left.location.register, right.location.register)); - exprasmlist.concat(taicpu.op_reg_reg(A_CMPLD, location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLD, location.register, left.location.register)); - cg.g_overflowcheck(exprasmlist, location, resulttype.def); + cg.g_overflowcheck(current_asmdata.CurrAsmList, location, resulttype.def); end; subn: begin - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUB, location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUB, location.register, left.location.register, right.location.register)); - exprasmlist.concat(taicpu.op_reg_reg(A_CMPLD, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMPLD, left.location.register, location.register)); - cg.g_overflowcheck(exprasmlist, location, resulttype.def); + cg.g_overflowcheck(current_asmdata.CurrAsmList, location, resulttype.def); end; muln: begin { calculate the upper 64 bits of the product, = 0 if no overflow } - cg.a_reg_alloc(exprasmlist, NR_R0); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_MULHDU_, NR_R0, + cg.a_reg_alloc(current_asmdata.CurrAsmList, NR_R0); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULHDU_, NR_R0, left.location.register, right.location.register)); - cg.a_reg_dealloc(exprasmlist, NR_R0); + cg.a_reg_dealloc(current_asmdata.CurrAsmList, NR_R0); { calculate the real result } - exprasmlist.concat(taicpu.op_reg_reg_reg(A_MULLD, location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULLD, location.register, left.location.register, right.location.register)); { g_overflowcheck generates a OC_AE instead of OC_EQ :/ } - objectlibrary.getjumplabel(hl); - tcgppc(cg).a_jmp_cond(exprasmlist, OC_EQ, hl); - cg.a_call_name(exprasmlist, 'FPC_OVERFLOW'); - cg.a_label(exprasmlist, hl); + current_asmdata.getjumplabel(hl); + tcgppc(cg).a_jmp_cond(current_asmdata.CurrAsmList, OC_EQ, hl); + cg.a_call_name(current_asmdata.CurrAsmList, 'FPC_OVERFLOW'); + cg.a_label(current_asmdata.CurrAsmList, hl); end; end; end; diff --git a/compiler/powerpc64/nppccnv.pas b/compiler/powerpc64/nppccnv.pas index 7cdcf2a434..7da35ea0f6 100644 --- a/compiler/powerpc64/nppccnv.pas +++ b/compiler/powerpc64/nppccnv.pas @@ -60,7 +60,7 @@ uses symconst, symdef, aasmbase, aasmtai, defutil, cgbase, cgutils, pass_1, pass_2, - ncon, ncal, + ncon, ncal,procinfo, ncgutil, cpubase, aasmcpu, rgobj, tgobj, cgobj; @@ -127,7 +127,7 @@ begin { fcfid frD,frD # point integer (no round) } { fmadd frD,frC,frT1,frD # (2^32)*high + low } { # (only add can round) } - tg.Gettemp(exprasmlist, 8, tt_normal, disp); + tg.Gettemp(current_asmdata.CurrAsmList, 8, tt_normal, disp); { do the signed case for everything but 64 bit unsigned integers } signed := (left.location.size <> OS_64); @@ -145,7 +145,7 @@ begin internalerror(200110011); // allocate second temp memory - tg.Gettemp(exprasmlist, 8, tt_normal, disp2); + tg.Gettemp(current_asmdata.CurrAsmList, 8, tt_normal, disp2); end; case left.location.loc of @@ -158,13 +158,13 @@ begin end; LOC_REFERENCE, LOC_CREFERENCE: begin - leftreg := cg.getintregister(exprasmlist, OS_INT); + leftreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); valuereg := leftreg; if signed then size := OS_S64 else size := OS_64; - cg.a_load_ref_reg(exprasmlist, def_cgsize(left.resulttype.def), + cg.a_load_ref_reg(current_asmdata.CurrAsmList, def_cgsize(left.resulttype.def), size, left.location.reference, leftreg); end else @@ -173,55 +173,55 @@ begin if (signed) then begin // std rS, disp(r1) - cg.a_load_reg_ref(exprasmlist, OS_S64, OS_S64, valuereg, disp); + cg.a_load_reg_ref(current_asmdata.CurrAsmList, OS_S64, OS_S64, valuereg, disp); // lfd frD, disp(r1) - location.register := cg.getfpuregister(exprasmlist,OS_F64); - cg.a_loadfpu_ref_reg(exprasmlist,OS_F64, disp, location.register); + location.register := cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64); + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,OS_F64, disp, location.register); // fcfid frD, frD - exprasmlist.concat(taicpu.op_reg_reg(A_FCFID, location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FCFID, location.register, location.register)); end else begin { ts:todo use TOC for this constant or at least schedule better } // lfd frC, const - tmpfpuconst := cg.getfpuregister(exprasmlist,OS_F64); - cg.a_loadfpu_ref_reg(exprasmlist,OS_F64,tempconst.location.reference, + tmpfpuconst := cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64); + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,OS_F64,tempconst.location.reference, tmpfpuconst); tempconst.free; - tmpintreg1 := cg.getintregister(exprasmlist, OS_64); + tmpintreg1 := cg.getintregister(current_asmdata.CurrAsmList, OS_64); // rldicl rT1, rS, 32, 32 - exprasmlist.concat(taicpu.op_reg_reg_const_const(A_RLDICL, tmpintreg1, valuereg, 32, 32)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const_const(A_RLDICL, tmpintreg1, valuereg, 32, 32)); // rldicl rT2, rS, 0, 32 - tmpintreg2 := cg.getintregister(exprasmlist, OS_64); - exprasmlist.concat(taicpu.op_reg_reg_const_const(A_RLDICL, tmpintreg2, valuereg, 0, 32)); + tmpintreg2 := cg.getintregister(current_asmdata.CurrAsmList, OS_64); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const_const(A_RLDICL, tmpintreg2, valuereg, 0, 32)); // std rT1, disp(r1) - cg.a_load_reg_ref(exprasmlist, OS_S64, OS_S64, tmpintreg1, disp); + cg.a_load_reg_ref(current_asmdata.CurrAsmList, OS_S64, OS_S64, tmpintreg1, disp); // std rT2, disp2(r1) - cg.a_load_reg_ref(exprasmlist, OS_S64, OS_S64, tmpintreg2, disp2); + cg.a_load_reg_ref(current_asmdata.CurrAsmList, OS_S64, OS_S64, tmpintreg2, disp2); // lfd frT1, disp(R1) - tmpfpureg := cg.getfpuregister(exprasmlist,OS_F64); - cg.a_loadfpu_ref_reg(exprasmlist,OS_F64, disp, tmpfpureg); + tmpfpureg := cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64); + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,OS_F64, disp, tmpfpureg); // lfd frD, disp+8(R1) - location.register := cg.getfpuregister(exprasmlist,OS_F64); - cg.a_loadfpu_ref_reg(exprasmlist,OS_F64, disp2, location.register); + location.register := cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64); + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,OS_F64, disp2, location.register); // fcfid frT1, frT1 - exprasmlist.concat(taicpu.op_reg_reg(A_FCFID, tmpfpureg, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FCFID, tmpfpureg, tmpfpureg)); // fcfid frD, frD - exprasmlist.concat(taicpu.op_reg_reg(A_FCFID, location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FCFID, location.register, location.register)); // fmadd frD,frC,frT1,frD # (2^32)*high + low } - exprasmlist.concat(taicpu.op_reg_reg_reg_reg(A_FMADD, location.register, tmpfpuconst, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg_reg(A_FMADD, location.register, tmpfpuconst, tmpfpureg, location.register)); // free used temps - tg.ungetiftemp(exprasmlist, disp2); + tg.ungetiftemp(current_asmdata.CurrAsmList, disp2); end; // free reference - tg.ungetiftemp(exprasmlist, disp); + tg.ungetiftemp(current_asmdata.CurrAsmList, disp); end; @@ -231,12 +231,12 @@ var hreg2: tregister; resflags: tresflags; opsize: tcgsize; - hlabel, oldtruelabel, oldfalselabel: tasmlabel; + hlabel, oldTrueLabel, oldFalseLabel: tasmlabel; begin - oldtruelabel := truelabel; - oldfalselabel := falselabel; - objectlibrary.getjumplabel(truelabel); - objectlibrary.getjumplabel(falselabel); + oldTrueLabel := current_procinfo.CurrTrueLabel; + oldFalseLabel := current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); secondpass(left); if codegenerror then exit; @@ -247,8 +247,8 @@ begin (left.resulttype.def.size = resulttype.def.size) and (left.location.loc in [LOC_REFERENCE, LOC_CREFERENCE, LOC_CREGISTER]) then begin - truelabel := oldtruelabel; - falselabel := oldfalselabel; + current_procinfo.CurrTrueLabel := oldTrueLabel; + current_procinfo.CurrFalseLabel := oldFalseLabel; location_copy(location, left.location); exit; end; @@ -260,41 +260,41 @@ begin begin if left.location.loc in [LOC_CREFERENCE, LOC_REFERENCE] then begin - hreg1 := cg.getintregister(exprasmlist, OS_INT); - cg.a_load_ref_reg(exprasmlist, opsize, opsize, + hreg1 := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); + cg.a_load_ref_reg(current_asmdata.CurrAsmList, opsize, opsize, left.location.reference, hreg1); end else begin hreg1 := left.location.register; end; - hreg2 := cg.getintregister(exprasmlist, OS_INT); - exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBIC, hreg2, hreg1, 1)); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBFE, hreg1, hreg2, hreg1)); + hreg2 := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_SUBIC, hreg2, hreg1, 1)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUBFE, hreg1, hreg2, hreg1)); end; LOC_FLAGS: begin - hreg1 := cg.getintregister(exprasmlist, OS_INT); + hreg1 := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); resflags := left.location.resflags; - cg.g_flags2reg(exprasmlist, location.size, resflags, hreg1); + cg.g_flags2reg(current_asmdata.CurrAsmList, location.size, resflags, hreg1); end; LOC_JUMP: begin - hreg1 := cg.getintregister(exprasmlist, OS_INT); - objectlibrary.getjumplabel(hlabel); - cg.a_label(exprasmlist, truelabel); - cg.a_load_const_reg(exprasmlist, OS_INT, 1, hreg1); - cg.a_jmp_always(exprasmlist, hlabel); - cg.a_label(exprasmlist, falselabel); - cg.a_load_const_reg(exprasmlist, OS_INT, 0, hreg1); - cg.a_label(exprasmlist, hlabel); + hreg1 := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); + current_asmdata.getjumplabel(hlabel); + cg.a_label(current_asmdata.CurrAsmList, current_procinfo.CurrTrueLabel); + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, 1, hreg1); + cg.a_jmp_always(current_asmdata.CurrAsmList, hlabel); + cg.a_label(current_asmdata.CurrAsmList, current_procinfo.CurrFalseLabel); + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, 0, hreg1); + cg.a_label(current_asmdata.CurrAsmList, hlabel); end; else internalerror(10062); end; location.register := hreg1; - truelabel := oldtruelabel; - falselabel := oldfalselabel; + current_procinfo.CurrTrueLabel := oldTrueLabel; + current_procinfo.CurrFalseLabel := oldFalseLabel; end; begin diff --git a/compiler/powerpc64/nppcinl.pas b/compiler/powerpc64/nppcinl.pas index 1f2809141b..10f1f86722 100644 --- a/compiler/powerpc64/nppcinl.pas +++ b/compiler/powerpc64/nppcinl.pas @@ -89,12 +89,12 @@ procedure tppcinlinenode.load_fpu_location; begin location_reset(location, LOC_FPUREGISTER, def_cgsize(resulttype.def)); secondpass(left); - location_force_fpureg(exprasmlist, left.location, true); + location_force_fpureg(current_asmdata.CurrAsmList, left.location, true); location_copy(location, left.location); if (location.loc = LOC_CFPUREGISTER) then begin location.loc := LOC_FPUREGISTER; - location.register := cg.getfpuregister(exprasmlist, OS_F64); + location.register := cg.getfpuregister(current_asmdata.CurrAsmList, OS_F64); end; end; @@ -102,7 +102,7 @@ procedure tppcinlinenode.second_abs_real; begin location.loc := LOC_FPUREGISTER; load_fpu_location; - exprasmlist.concat(taicpu.op_reg_reg(A_FABS, location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FABS, location.register, left.location.register)); end; @@ -110,7 +110,7 @@ procedure tppcinlinenode.second_sqr_real; begin location.loc := LOC_FPUREGISTER; load_fpu_location; - exprasmlist.concat(taicpu.op_reg_reg_reg(A_FMUL, location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_FMUL, location.register, left.location.register, left.location.register)); end; @@ -123,21 +123,21 @@ begin LOC_CREFERENCE, LOC_REFERENCE: begin - r := cg.getintregister(exprasmlist, OS_ADDR); + r := cg.getintregister(current_asmdata.CurrAsmList, OS_ADDR); if (left.location.reference.offset = 0) and not assigned(left.location.reference.symbol) then begin if (left.location.reference.index = NR_NO) then - exprasmlist.concat(taicpu.op_const_reg(A_DCBT, 0, + current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_DCBT, 0, left.location.reference.base)) else - exprasmlist.concat(taicpu.op_reg_reg(A_DCBT, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_DCBT, left.location.reference.base, left.location.reference.index)); end else begin - cg.a_loadaddr_ref_reg(exprasmlist, left.location.reference, r); - exprasmlist.concat(taicpu.op_const_reg(A_DCBT, 0, r)); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList, left.location.reference, r); + current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_DCBT, 0, r)); end; end; else diff --git a/compiler/powerpc64/nppcmat.pas b/compiler/powerpc64/nppcmat.pas index 0bcdfe858d..33e6d7b31c 100644 --- a/compiler/powerpc64/nppcmat.pas +++ b/compiler/powerpc64/nppcmat.pas @@ -99,32 +99,32 @@ var internalerror(2005061702); end else if (abs(tordconstnode(right).value) = 1) then begin { x mod +/-1 is always zero } - cg.a_load_const_reg(exprasmlist, OS_INT, 0, resultreg); + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, 0, resultreg); end else if (ispowerof2(tordconstnode(right).value, power)) then begin if (is_signed(right.resulttype.def)) then begin - tempreg := cg.getintregister(exprasmlist, OS_INT); - maskreg := cg.getintregister(exprasmlist, OS_INT); - modreg := cg.getintregister(exprasmlist, OS_INT); - - cg.a_load_const_reg(exprasmlist, OS_INT, abs(tordconstnode(right).value)-1, modreg); - cg.a_op_const_reg_reg(exprasmlist, OP_SAR, OS_INT, 63, numerator, maskreg); - cg.a_op_reg_reg_reg(exprasmlist, OP_AND, OS_INT, numerator, modreg, tempreg); - - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ANDC, maskreg, maskreg, modreg)); - exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC, modreg, tempreg, 0)); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBFE, modreg, modreg, modreg)); - cg.a_op_reg_reg_reg(exprasmlist, OP_AND, OS_INT, modreg, maskreg, maskreg); - cg.a_op_reg_reg_reg(exprasmlist, OP_OR, OS_INT, maskreg, tempreg, resultreg); + tempreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); + maskreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); + modreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); + + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, abs(tordconstnode(right).value)-1, modreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_SAR, OS_INT, 63, numerator, maskreg); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_AND, OS_INT, numerator, modreg, tempreg); + + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ANDC, maskreg, maskreg, modreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_SUBFIC, modreg, tempreg, 0)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUBFE, modreg, modreg, modreg)); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_AND, OS_INT, modreg, maskreg, maskreg); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_OR, OS_INT, maskreg, tempreg, resultreg); end else begin - cg.a_op_const_reg_reg(exprasmlist, OP_AND, OS_INT, tordconstnode(right).value-1, numerator, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_AND, OS_INT, tordconstnode(right).value-1, numerator, resultreg); end; end else begin - cg.a_op_const_reg_reg(exprasmlist, divCgOps[is_signed(right.resulttype.def)], OS_INT, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, divCgOps[is_signed(right.resulttype.def)], OS_INT, tordconstnode(right).value, numerator, resultreg); - cg.a_op_const_reg_reg(exprasmlist, OP_MUL, OS_INT, tordconstnode(right).value, resultreg, + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, OP_MUL, OS_INT, tordconstnode(right).value, resultreg, resultreg); - cg.a_op_reg_reg_reg(exprasmlist, OP_SUB, OS_INT, resultreg, numerator, resultreg); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, OP_SUB, OS_INT, resultreg, numerator, resultreg); end; end; @@ -136,24 +136,24 @@ begin { put numerator in register } size:=def_cgsize(left.resulttype.def); - location_force_reg(exprasmlist,left.location, + location_force_reg(current_asmdata.CurrAsmList,left.location, size,true); location_copy(location,left.location); numerator := location.register; resultreg := location.register; if (location.loc = LOC_CREGISTER) then begin location.loc := LOC_REGISTER; - location.register := cg.getintregister(exprasmlist,size); + location.register := cg.getintregister(current_asmdata.CurrAsmList,size); resultreg := location.register; end else if (nodetype = modn) or (right.nodetype = ordconstn) then begin { for a modulus op, and for const nodes we need the result register to be an extra register } - resultreg := cg.getintregister(exprasmlist,size); + resultreg := cg.getintregister(current_asmdata.CurrAsmList,size); end; done := false; if (cs_opt_level1 in aktoptimizerswitches) and (right.nodetype = ordconstn) then begin if (nodetype = divn) then - cg.a_op_const_reg_reg(exprasmlist, divCgOps[is_signed(right.resulttype.def)], + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, divCgOps[is_signed(right.resulttype.def)], size, tordconstnode(right).value, numerator, resultreg) else genOrdConstNodeMod; @@ -162,9 +162,9 @@ begin if (not done) then begin { load divider in a register if necessary } - location_force_reg(exprasmlist,right.location,def_cgsize(right.resulttype.def),true); + location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(right.resulttype.def),true); if (right.nodetype <> ordconstn) then - exprasmlist.concat(taicpu.op_reg_reg_const(A_CMPDI, NR_CR7, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_CMPDI, NR_CR7, right.location.register, 0)) else begin if (tordconstnode(right).value = 0) then @@ -175,14 +175,14 @@ begin { select the correct opcode according to the sign of the result, whether we need overflow checking } op := divops[is_signed(right.resulttype.def), cs_check_overflow in aktlocalswitches]; - exprasmlist.concat(taicpu.op_reg_reg_reg(op, resultreg, numerator, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op, resultreg, numerator, divider)); if (nodetype = modn) then begin { multiply with the divisor again, taking care of the correct size } - exprasmlist.concat(taicpu.op_reg_reg_reg(A_MULLD,resultreg, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_MULLD,resultreg, divider,resultreg)); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUB,location.register, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUB,location.register, numerator,resultreg)); resultreg := location.register; end; @@ -191,16 +191,16 @@ begin location.loc:=LOC_REGISTER; location.register:=resultreg; if right.nodetype <> ordconstn then begin - objectlibrary.getjumplabel(hl); - exprasmlist.concat(taicpu.op_cond_sym(A_BC,zerocond,hl)); - cg.a_call_name(exprasmlist,'FPC_DIVBYZERO'); - cg.a_label(exprasmlist,hl); + current_asmdata.getjumplabel(hl); + current_asmdata.CurrAsmList.concat(taicpu.op_cond_sym(A_BC,zerocond,hl)); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DIVBYZERO'); + cg.a_label(current_asmdata.CurrAsmList,hl); end; { unsigned division/module can only overflow in case of division by zero (but checking this overflow flag is more convoluted than performing a simple comparison with 0) } if is_signed(right.resulttype.def) then - cg.g_overflowcheck(exprasmlist,location,resulttype.def); + cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def); end; {***************************************************************************** @@ -221,14 +221,14 @@ begin secondpass(right); { load left operators in a register } - location_force_reg(exprasmlist, left.location, + location_force_reg(current_asmdata.CurrAsmList, left.location, def_cgsize(left.resulttype.def), true); location_copy(location, left.location); resultreg := location.register; hregister1 := location.register; if (location.loc = LOC_CREGISTER) then begin location.loc := LOC_REGISTER; - resultreg := cg.getintregister(exprasmlist, OS_INT); + resultreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); location.register := resultreg; end; @@ -243,14 +243,14 @@ begin // result types with size < 32 bits have their shift values masked // differently... :/ shiftval := tordconstnode(right).value and (tcgsize2size[def_cgsize(resulttype.def)] * 8 -1); - cg.a_op_const_reg_reg(exprasmlist, op, def_cgsize(resulttype.def), + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList, op, def_cgsize(resulttype.def), shiftval, hregister1, resultreg) end else begin { load shift count in a register if necessary } - location_force_reg(exprasmlist, right.location, + location_force_reg(current_asmdata.CurrAsmList, right.location, def_cgsize(right.resulttype.def), true); hregister2 := right.location.register; - cg.a_op_reg_reg_reg(exprasmlist, op, def_cgsize(resulttype.def), hregister2, + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList, op, def_cgsize(resulttype.def), hregister2, hregister1, resultreg); end; end; @@ -280,23 +280,23 @@ begin begin src1 := left.location.register; if left.location.loc = LOC_CREGISTER then - location.register := cg.getintregister(exprasmlist, OS_INT) + location.register := cg.getintregister(current_asmdata.CurrAsmList, OS_INT) else - location.register := cg.getfpuregister(exprasmlist, location.size); + location.register := cg.getfpuregister(current_asmdata.CurrAsmList, location.size); end; LOC_REFERENCE, LOC_CREFERENCE: begin if (left.resulttype.def.deftype = floatdef) then begin - src1 := cg.getfpuregister(exprasmlist, + src1 := cg.getfpuregister(current_asmdata.CurrAsmList, def_cgsize(left.resulttype.def)); location.register := src1; - cg.a_loadfpu_ref_reg(exprasmlist, + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList, def_cgsize(left.resulttype.def), left.location.reference, src1); end else begin - src1 := cg.getintregister(exprasmlist, OS_64); + src1 := cg.getintregister(current_asmdata.CurrAsmList, OS_64); location.register := src1; - cg.a_load_ref_reg(exprasmlist, OS_64, OS_64, + cg.a_load_ref_reg(current_asmdata.CurrAsmList, OS_64, OS_64, left.location.reference, src1); end; end; @@ -313,9 +313,9 @@ begin location.loc := LOC_FPUREGISTER; end; { emit operation } - exprasmlist.concat(taicpu.op_reg_reg(op, location.register, src1)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op, location.register, src1)); end; - cg.g_overflowcheck(exprasmlist, location, resulttype.def); + cg.g_overflowcheck(current_asmdata.CurrAsmList, location, resulttype.def); end; {***************************************************************************** @@ -335,14 +335,14 @@ begin } if left.expectloc = LOC_JUMP then begin - hl := truelabel; - truelabel := falselabel; - falselabel := hl; + hl := current_procinfo.CurrTrueLabel; + current_procinfo.CurrTrueLabel := current_procinfo.CurrFalseLabel; + current_procinfo.CurrFalseLabel := hl; secondpass(left); - maketojumpbool(exprasmlist, left, lr_load_regvars); - hl := truelabel; - truelabel := falselabel; - falselabel := hl; + maketojumpbool(current_asmdata.CurrAsmList, left, lr_load_regvars); + hl := current_procinfo.CurrTrueLabel; + current_procinfo.CurrTrueLabel := current_procinfo.CurrFalseLabel; + current_procinfo.CurrFalseLabel := hl; location.loc := LOC_JUMP; end else @@ -356,9 +356,9 @@ begin end; LOC_REGISTER, LOC_CREGISTER, LOC_REFERENCE, LOC_CREFERENCE: begin - location_force_reg(exprasmlist, left.location, + location_force_reg(current_asmdata.CurrAsmList, left.location, def_cgsize(left.resulttype.def), true); - exprasmlist.concat(taicpu.op_reg_const(A_CMPDI, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const(A_CMPDI, left.location.register, 0)); location_reset(location, LOC_FLAGS, OS_NO); location.resflags.cr := RS_CR0; @@ -372,13 +372,13 @@ begin else begin secondpass(left); - location_force_reg(exprasmlist, left.location, + location_force_reg(current_asmdata.CurrAsmList, left.location, def_cgsize(left.resulttype.def), true); location_copy(location, left.location); location.loc := LOC_REGISTER; - location.register := cg.getintregister(exprasmlist, OS_INT); + location.register := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); { perform the NOT operation } - cg.a_op_reg_reg(exprasmlist, OP_NOT, def_cgsize(resulttype.def), + cg.a_op_reg_reg(current_asmdata.CurrAsmList, OP_NOT, def_cgsize(resulttype.def), left.location.register, location.register); end; diff --git a/compiler/powerpc64/nppcset.pas b/compiler/powerpc64/nppcset.pas index cb943afaef..1d1212137b 100644 --- a/compiler/powerpc64/nppcset.pas +++ b/compiler/powerpc64/nppcset.pas @@ -73,7 +73,7 @@ var indexreg : tregister; href : treference; - procedure genitem(list:taasmoutput;t : pcaselabel); + procedure genitem(list:TAsmList;t : pcaselabel); var i : aint; begin @@ -104,24 +104,24 @@ begin one or more 64 bit integer adresses which is slow } if not(jumptable_no_range) then begin { case expr less than min_ => goto elselabel } - cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,aint(min_),hregister,elselabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_lt,aint(min_),hregister,elselabel); { case expr greater than max_ => goto elselabel } - cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_gt,aint(max_),hregister,elselabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_gt,aint(max_),hregister,elselabel); end; - objectlibrary.getjumplabel(table); + current_asmdata.getjumplabel(table); { allocate base and index registers register } - indexreg:= cg.makeregsize(exprasmlist, hregister, OS_INT); + indexreg:= cg.makeregsize(current_asmdata.CurrAsmList, hregister, OS_INT); { indexreg := hregister; } - cg.a_load_reg_reg(exprasmlist, opsize, OS_INT, hregister, indexreg); + cg.a_load_reg_reg(current_asmdata.CurrAsmList, opsize, OS_INT, hregister, indexreg); { create reference, indexreg := indexreg * sizeof(OS_ADDR) } - cg.a_op_const_reg(exprasmlist, OP_MUL, OS_INT, tcgsize2size[OS_ADDR], indexreg); + cg.a_op_const_reg(current_asmdata.CurrAsmList, OP_MUL, OS_INT, tcgsize2size[OS_ADDR], indexreg); reference_reset_symbol(href, table, (-aint(min_)) * tcgsize2size[OS_ADDR]); href.index := indexreg; - cg.a_load_ref_reg(exprasmlist, OS_INT, OS_INT, href, indexreg); + cg.a_load_ref_reg(current_asmdata.CurrAsmList, OS_INT, OS_INT, href, indexreg); - exprasmlist.concat(taicpu.op_reg(A_MTCTR, indexreg)); - exprasmlist.concat(taicpu.op_none(A_BCTR)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_MTCTR, indexreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_BCTR)); { generate jump table } new_section(current_procinfo.aktlocaldata,sec_data,current_procinfo.procdef.mangledname,sizeof(aint)); @@ -144,13 +144,13 @@ var value := -value; if (value >= low(smallint)) and (value <= high(smallint)) then - exprasmlist.concat(taicpu.op_reg_reg_const(A_ADDIC_, hregister, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_const(A_ADDIC_, hregister, hregister, value)) else begin - tmpreg := cg.getintregister(exprasmlist, OS_INT); - cg.a_load_const_reg(exprasmlist, OS_INT, value, tmpreg); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_ADD_, hregister, + tmpreg := cg.getintregister(current_asmdata.CurrAsmList, OS_INT); + cg.a_load_const_reg(current_asmdata.CurrAsmList, OS_INT, value, tmpreg); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ADD_, hregister, hregister, tmpreg)); end; end; @@ -160,16 +160,16 @@ var genitem(t^.less); { need we to test the first value } if first and (t^._low > get_min_value(left.resulttype.def)) then begin - cg.a_cmp_const_reg_label(exprasmlist, OS_INT, jmp_lt, aword(t^._low), + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, OS_INT, jmp_lt, aword(t^._low), hregister, elselabel); end; if t^._low = t^._high then begin if t^._low - last = 0 then - cg.a_cmp_const_reg_label(exprasmlist, opsize, OC_EQ, 0, hregister, + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList, opsize, OC_EQ, 0, hregister, blocklabel(t^.blockid)) else gensub(aint(t^._low - last)); - tcgppc(cg).a_jmp_cond(exprasmlist, OC_EQ, blocklabel(t^.blockid)); + tcgppc(cg).a_jmp_cond(current_asmdata.CurrAsmList, OC_EQ, blocklabel(t^.blockid)); last := t^._low; lastrange := false; end else begin @@ -186,10 +186,10 @@ var { immediately. else check the range in between: } gensub(aint(t^._low - last)); if ((t^._low - last) <> 1) or (not lastrange) then - tcgppc(cg).a_jmp_cond(exprasmlist, jmp_lt, elselabel); + tcgppc(cg).a_jmp_cond(current_asmdata.CurrAsmList, jmp_lt, elselabel); end; gensub(aint(t^._high - t^._low)); - tcgppc(cg).a_jmp_cond(exprasmlist, jmp_le, blocklabel(t^.blockid)); + tcgppc(cg).a_jmp_cond(current_asmdata.CurrAsmList, jmp_le, blocklabel(t^.blockid)); last := t^._high; lastrange := true; end; @@ -207,7 +207,7 @@ begin lastrange := false; first := true; genitem(hp); - cg.a_jmp_always(exprasmlist, elselabel); + cg.a_jmp_always(current_asmdata.CurrAsmList, elselabel); end; end; diff --git a/compiler/procinfo.pas b/compiler/procinfo.pas index 886fd50ed1..c5cc7139e6 100644 --- a/compiler/procinfo.pas +++ b/compiler/procinfo.pas @@ -78,20 +78,26 @@ unit procinfo; { register containing currently the got } got : tregister; - gotlabel : tasmlabel; + CurrGOTLabel : tasmlabel; { Holds the reference used to store all saved registers. } save_regs_ref : treference; + { Labels for TRUE/FALSE condition, BREAK and CONTINUE } + CurrBreakLabel, + CurrContinueLabel, + CurrTrueLabel, + CurrFalseLabel : tasmlabel; + { label to leave the sub routine } - aktexitlabel : tasmlabel; + CurrExitLabel : tasmlabel; {# The code for the routine itself, excluding entry and exit code. This is a linked list of tai classes. } - aktproccode : taasmoutput; + aktproccode : TAsmList; { Data (like jump tables) that belongs to this routine } - aktlocaldata : taasmoutput; + aktlocaldata : TAsmList; { max. of space need for parameters } maxpushedparasize : aint; @@ -140,12 +146,16 @@ implementation framepointer:=NR_FRAME_POINTER_REG; maxpushedparasize:=0; { asmlists } - aktproccode:=Taasmoutput.Create; - aktlocaldata:=Taasmoutput.Create; + aktproccode:=TAsmList.Create; + aktlocaldata:=TAsmList.Create; reference_reset(save_regs_ref); { labels } - objectlibrary.getjumplabel(aktexitlabel); - objectlibrary.getjumplabel(gotlabel); + current_asmdata.getjumplabel(CurrExitLabel); + current_asmdata.getjumplabel(CurrGOTLabel); + CurrBreakLabel:=nil; + CurrContinueLabel:=nil; + CurrTrueLabel:=nil; + CurrFalseLabel:=nil; maxpushedparasize:=0; end; diff --git a/compiler/pstatmnt.pas b/compiler/pstatmnt.pas index 66793f0b13..3ca562f5f2 100644 --- a/compiler/pstatmnt.pas +++ b/compiler/pstatmnt.pas @@ -853,7 +853,7 @@ implementation if assigned(asmmodeinfos[aktasmmode]) then begin asmreader:=asmmodeinfos[aktasmmode]^.casmreader.create; - asmstat:=casmnode.create(asmreader.assemble as taasmoutput); + asmstat:=casmnode.create(asmreader.assemble as TAsmList); asmreader.free; end else @@ -898,9 +898,9 @@ implementation this is needed for the optimizer } If Assigned(AsmStat.p_asm) Then Begin - Marker := Tai_Marker.Create(AsmBlockStart); + Marker := Tai_Marker.Create(mark_AsmBlockStart); AsmStat.p_asm.Insert(Marker); - Marker := Tai_Marker.Create(AsmBlockEnd); + Marker := Tai_Marker.Create(mark_AsmBlockEnd); AsmStat.p_asm.Concat(Marker); End; Inside_asm_statement:=false; diff --git a/compiler/psub.pas b/compiler/psub.pas index 6090903d3d..c469b48c16 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -615,7 +615,7 @@ implementation begin cg.translate_register(tabstractnormalvarsym(p).localloc.register); if cs_asm_source in aktglobalswitches then - taasmoutput(list).concat(Tai_comment.Create(strpnew('Var '+tabstractnormalvarsym(p).realname+' located in register '+ + TAsmList(list).concat(Tai_comment.Create(strpnew('Var '+tabstractnormalvarsym(p).realname+' located in register '+ std_regname(tabstractnormalvarsym(p).localloc.register)))) end; end; @@ -667,7 +667,7 @@ implementation oldprocinfo : tprocinfo; oldaktmaxfpuregisters : longint; oldfilepos : tfileposinfo; - templist : Taasmoutput; + templist : TAsmList; headertai : tai; begin { the initialization procedure can be empty, then we @@ -695,10 +695,7 @@ implementation current_procinfo:=self; aktfilepos:=entrypos; - { get new labels } - aktbreaklabel:=nil; - aktcontinuelabel:=nil; - templist:=Taasmoutput.create; + templist:=TAsmList.create; { add parast/localst to symtablestack } add_to_symtablestack; @@ -807,7 +804,7 @@ implementation { generate code for the node tree } do_secondpass(code); - aktproccode.concatlist(exprasmlist); + aktproccode.concatlist(current_asmdata.CurrAsmList); {$ifdef i386} procdef.fpu_used:=code.registersfpu; {$endif i386} @@ -843,7 +840,7 @@ implementation else aktproccode.concatlist(templist); { insert exit label at the correct position } - cg.a_label(templist,aktexitlabel); + cg.a_label(templist,CurrExitLabel); if assigned(exitlabel_asmnode.currenttai) then aktproccode.insertlistafter(exitlabel_asmnode.currenttai,templist) else @@ -983,13 +980,13 @@ implementation debuginfo.insertlineinfo(aktproccode); { add the procedure to the al_procedures } - maybe_new_object_file(asmlist[al_procedures]); - new_section(asmlist[al_procedures],sec_code,lower(procdef.mangledname),getprocalign); - asmlist[al_procedures].concatlist(aktproccode); + maybe_new_object_file(current_asmdata.asmlists[al_procedures]); + new_section(current_asmdata.asmlists[al_procedures],sec_code,lower(procdef.mangledname),getprocalign); + current_asmdata.asmlists[al_procedures].concatlist(aktproccode); { save local data (casetable) also in the same file } if assigned(aktlocaldata) and (not aktlocaldata.empty) then - asmlist[al_procedures].concatlist(aktlocaldata); + current_asmdata.asmlists[al_procedures].concatlist(aktlocaldata); { only now we can remove the temps } tg.resettempgen; @@ -1511,7 +1508,7 @@ implementation begin s:=proc_get_importname(pd); if s<>'' then - gen_external_stub(asmlist[al_procedures],pd,{$IFDEF POWERPC64}'.'+{$ENDIF}s); + gen_external_stub(current_asmdata.asmlists[al_procedures],pd,{$IFDEF POWERPC64}'.'+{$ENDIF}s); end; { Import DLL specified? } @@ -1546,9 +1543,9 @@ implementation begin if (po_global in pd.procoptions) or (cs_profile in aktmoduleswitches) then - objectlibrary.newasmsymbol(pd.mangledname,AB_GLOBAL,AT_FUNCTION) + current_asmdata.newasmsymbol(pd.mangledname,AB_GLOBAL,AT_FUNCTION) else - objectlibrary.newasmsymbol(pd.mangledname,AB_LOCAL,AT_FUNCTION); + current_asmdata.newasmsymbol(pd.mangledname,AB_LOCAL,AT_FUNCTION); end; current_procinfo:=old_current_procinfo; diff --git a/compiler/ptconst.pas b/compiler/ptconst.pas index c8642bdd06..07e3fd45fe 100644 --- a/compiler/ptconst.pas +++ b/compiler/ptconst.pas @@ -84,7 +84,7 @@ implementation old_block_type : tblock_type; storefilepos : tfileposinfo; cursectype : TAsmSectiontype; - cural : tasmlist; + cural : tasmlisttype; procedure check_range(def:torddef); begin @@ -122,17 +122,17 @@ implementation { insert cut for smartlinking or alignment } l:=sym.getsize; - maybe_new_object_file(asmlist[cural]); - new_section(asmlist[cural],cursectype,lower(sym.mangledname),const_align(size_2_align(l))); + maybe_new_object_file(current_asmdata.asmlists[cural]); + new_section(current_asmdata.asmlists[cural],cursectype,lower(sym.mangledname),const_align(size_2_align(l))); if (sym.owner.symtabletype=globalsymtable) or maybe_smartlink_symbol or (assigned(current_procinfo) and (po_inline in current_procinfo.procdef.procoptions)) or DLLSource then - asmlist[cural].concat(Tai_symbol.Createname_global(sym.mangledname,AT_DATA,l)) + current_asmdata.asmlists[cural].concat(Tai_symbol.Createname_global(sym.mangledname,AT_DATA,l)) else - asmlist[cural].concat(Tai_symbol.Createname(sym.mangledname,AT_DATA,l)); + current_asmdata.asmlists[cural].concat(Tai_symbol.Createname(sym.mangledname,AT_DATA,l)); aktfilepos:=storefilepos; end; @@ -144,28 +144,28 @@ implementation bool8bit : begin if is_constboolnode(p) then - asmlist[cural].concat(Tai_const.Create_8bit(byte(tordconstnode(p).value))) + current_asmdata.asmlists[cural].concat(Tai_const.Create_8bit(byte(tordconstnode(p).value))) else Message(parser_e_illegal_expression); end; bool16bit : begin if is_constboolnode(p) then - asmlist[cural].concat(Tai_const.Create_16bit(word(tordconstnode(p).value))) + current_asmdata.asmlists[cural].concat(Tai_const.Create_16bit(word(tordconstnode(p).value))) else Message(parser_e_illegal_expression); end; bool32bit : begin if is_constboolnode(p) then - asmlist[cural].concat(Tai_const.Create_32bit(longint(tordconstnode(p).value))) + current_asmdata.asmlists[cural].concat(Tai_const.Create_32bit(longint(tordconstnode(p).value))) else Message(parser_e_illegal_expression); end; uchar : begin if is_constcharnode(p) then - asmlist[cural].concat(Tai_const.Create_8bit(byte(tordconstnode(p).value))) + current_asmdata.asmlists[cural].concat(Tai_const.Create_8bit(byte(tordconstnode(p).value))) else Message(parser_e_illegal_expression); end; @@ -174,7 +174,7 @@ implementation if is_constcharnode(p) then inserttypeconv(p,cwidechartype); if is_constwidecharnode(p) then - asmlist[cural].concat(Tai_const.Create_16bit(word(tordconstnode(p).value))) + current_asmdata.asmlists[cural].concat(Tai_const.Create_16bit(word(tordconstnode(p).value))) else Message(parser_e_illegal_expression); end; @@ -183,7 +183,7 @@ implementation begin if is_constintnode(p) then begin - asmlist[cural].concat(Tai_const.Create_8bit(byte(tordconstnode(p).value))); + current_asmdata.asmlists[cural].concat(Tai_const.Create_8bit(byte(tordconstnode(p).value))); check_range(torddef(t.def)); end else @@ -194,7 +194,7 @@ implementation begin if is_constintnode(p) then begin - asmlist[cural].concat(Tai_const.Create_16bit(word(tordconstnode(p).value))); + current_asmdata.asmlists[cural].concat(Tai_const.Create_16bit(word(tordconstnode(p).value))); check_range(torddef(t.def)); end else @@ -205,7 +205,7 @@ implementation begin if is_constintnode(p) then begin - asmlist[cural].concat(Tai_const.Create_32bit(longint(tordconstnode(p).value))); + current_asmdata.asmlists[cural].concat(Tai_const.Create_32bit(longint(tordconstnode(p).value))); if torddef(t.def).typ<>u32bit then check_range(torddef(t.def)); end @@ -230,7 +230,7 @@ implementation intvalue:=0; Message(parser_e_illegal_expression); end; - asmlist[cural].concat(Tai_const.Create_64bit(intvalue)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_64bit(intvalue)); end; else internalerror(3799); @@ -249,24 +249,24 @@ implementation case tfloatdef(t.def).typ of s32real : - asmlist[cural].concat(Tai_real_32bit.Create(ts32real(value))); + current_asmdata.asmlists[cural].concat(Tai_real_32bit.Create(ts32real(value))); s64real : {$ifdef ARM} if aktfputype in [fpu_fpa,fpu_fpa10,fpu_fpa11] then - asmlist[cural].concat(Tai_real_64bit.Create_hiloswapped(ts64real(value))) + current_asmdata.asmlists[cural].concat(Tai_real_64bit.Create_hiloswapped(ts64real(value))) else {$endif ARM} - asmlist[cural].concat(Tai_real_64bit.Create(ts64real(value))); + current_asmdata.asmlists[cural].concat(Tai_real_64bit.Create(ts64real(value))); s80real : - asmlist[cural].concat(Tai_real_80bit.Create(value)); + current_asmdata.asmlists[cural].concat(Tai_real_80bit.Create(value)); { the round is necessary for native compilers where comp isn't a float } s64comp : - asmlist[cural].concat(Tai_comp_64bit.Create(round(value))); + current_asmdata.asmlists[cural].concat(Tai_comp_64bit.Create(round(value))); s64currency: - asmlist[cural].concat(Tai_comp_64bit.Create(round(value*10000))); + current_asmdata.asmlists[cural].concat(Tai_comp_64bit.Create(round(value*10000))); s128real: - asmlist[cural].concat(Tai_real_128bit.Create(value)); + current_asmdata.asmlists[cural].concat(Tai_real_128bit.Create(value)); else internalerror(18); end; @@ -281,11 +281,11 @@ implementation begin if not Tobjectdef(pointertype.def).is_related(Tobjectdef(pointertype.def)) then message(parser_e_illegal_expression); - asmlist[cural].concat(Tai_const.Create_sym(objectlibrary.newasmsymbol( + current_asmdata.asmlists[cural].concat(Tai_const.Create_sym(current_asmdata.newasmsymbol( Tobjectdef(pointertype.def).vmt_mangledname,AB_EXTERNAL,AT_DATA))); end; niln: - asmlist[cural].concat(Tai_const.Create_sym(nil)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_sym(nil)); else Message(parser_e_illegal_expression); end; p.free; @@ -316,30 +316,30 @@ implementation if (p.nodetype = pointerconstn) then begin if sizeof(TConstPtrUInt)=8 then - asmlist[cural].concat(Tai_const.Create_64bit(TConstPtrUInt(tpointerconstnode(p).value))) + current_asmdata.asmlists[cural].concat(Tai_const.Create_64bit(TConstPtrUInt(tpointerconstnode(p).value))) else if sizeof(TConstPtrUInt)=4 then - asmlist[cural].concat(Tai_const.Create_32bit(TConstPtrUInt(tpointerconstnode(p).value))) + current_asmdata.asmlists[cural].concat(Tai_const.Create_32bit(TConstPtrUInt(tpointerconstnode(p).value))) else internalerror(200404122); end { nil pointer ? } else if p.nodetype=niln then - asmlist[cural].concat(Tai_const.Create_sym(nil)) + current_asmdata.asmlists[cural].concat(Tai_const.Create_sym(nil)) { maybe pchar ? } else if is_char(tpointerdef(t.def).pointertype.def) and (p.nodetype<>addrn) then begin - objectlibrary.getdatalabel(ll); - asmlist[cural].concat(Tai_const.Create_sym(ll)); + current_asmdata.getdatalabel(ll); + current_asmdata.asmlists[cural].concat(Tai_const.Create_sym(ll)); if p.nodetype=stringconstn then varalign:=size_2_align(tstringconstnode(p).len) else varalign:=0; varalign:=const_align(varalign); - asmlist[al_const].concat(Tai_align.Create(varalign)); - asmlist[al_const].concat(Tai_label.Create(ll)); + current_asmdata.asmlists[al_const].concat(Tai_align.Create(varalign)); + current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll)); if p.nodetype=stringconstn then begin len:=tstringconstnode(p).len; @@ -349,11 +349,11 @@ implementation len:=255; getmem(ca,len+2); move(tstringconstnode(p).value_str^,ca^,len+1); - asmlist[al_const].concat(Tai_string.Create_pchar(ca,len+1)); + current_asmdata.asmlists[al_const].concat(Tai_string.Create_pchar(ca,len+1)); end else if is_constcharnode(p) then - asmlist[al_const].concat(Tai_string.Create(char(byte(tordconstnode(p).value))+#0)) + current_asmdata.asmlists[al_const].concat(Tai_string.Create(char(byte(tordconstnode(p).value))+#0)) else message(parser_e_illegal_expression); end @@ -362,10 +362,10 @@ implementation if is_widechar(tpointerdef(t.def).pointertype.def) and (p.nodetype<>addrn) then begin - objectlibrary.getdatalabel(ll); - asmlist[cural].concat(Tai_const.Create_sym(ll)); - asmlist[al_typedconsts].concat(tai_align.create(const_align(sizeof(aint)))); - asmlist[al_typedconsts].concat(Tai_label.Create(ll)); + current_asmdata.getdatalabel(ll); + current_asmdata.asmlists[cural].concat(Tai_const.Create_sym(ll)); + current_asmdata.asmlists[al_typedconsts].concat(tai_align.create(const_align(sizeof(aint)))); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(ll)); if (p.nodetype in [stringconstn,ordconstn]) then begin { convert to widestring stringconstn } @@ -375,9 +375,9 @@ implementation begin pw:=pcompilerwidestring(tstringconstnode(p).value_str); for i:=0 to tstringconstnode(p).len-1 do - asmlist[al_typedconsts].concat(Tai_const.Create_16bit(pw^.data[i])); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(pw^.data[i])); { ending #0 } - asmlist[al_typedconsts].concat(Tai_const.Create_16bit(0)) + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(0)) end; end else @@ -445,17 +445,17 @@ implementation if po_abstractmethod in tprocsym(srsym).first_procdef.procoptions then Message(type_e_cant_take_address_of_abstract_method) else - asmlist[cural].concat(Tai_const.Createname(tprocsym(srsym).first_procdef.mangledname,AT_FUNCTION,offset)); + current_asmdata.asmlists[cural].concat(Tai_const.Createname(tprocsym(srsym).first_procdef.mangledname,AT_FUNCTION,offset)); end; globalvarsym : - asmlist[cural].concat(Tai_const.Createname(tglobalvarsym(srsym).mangledname,AT_DATA,offset)); + current_asmdata.asmlists[cural].concat(Tai_const.Createname(tglobalvarsym(srsym).mangledname,AT_DATA,offset)); typedconstsym : - asmlist[cural].concat(Tai_const.Createname(ttypedconstsym(srsym).mangledname,AT_DATA,offset)); + current_asmdata.asmlists[cural].concat(Tai_const.Createname(ttypedconstsym(srsym).mangledname,AT_DATA,offset)); labelsym : - asmlist[cural].concat(Tai_const.Createname(tlabelsym(srsym).mangledname,AT_LABEL,offset)); + current_asmdata.asmlists[cural].concat(Tai_const.Createname(tlabelsym(srsym).mangledname,AT_LABEL,offset)); constsym : if tconstsym(srsym).consttyp=constresourcestring then - asmlist[cural].concat(Tai_const.Createname(make_mangledname('RESOURCESTRINGLIST',tconstsym(srsym).owner,''),AT_DATA,tconstsym(srsym).resstrindex*(4+sizeof(aint)*3)+4+sizeof(aint))) + current_asmdata.asmlists[cural].concat(Tai_const.Createname(make_mangledname('RESOURCESTRINGLIST',tconstsym(srsym).owner,''),AT_DATA,tconstsym(srsym).resstrindex*(4+sizeof(aint)*3)+4+sizeof(aint))) else Message(type_e_variable_id_expected); else @@ -472,7 +472,7 @@ implementation begin if (tinlinenode(p).left.nodetype=typen) then begin - asmlist[cural].concat(Tai_const.createname( + current_asmdata.asmlists[cural].concat(Tai_const.createname( tobjectdef(tinlinenode(p).left.resulttype.def).vmt_mangledname,AT_DATA,0)); end else @@ -502,7 +502,7 @@ implementation if source_info.endian = target_info.endian then begin for l:=0 to p.resulttype.def.size-1 do - asmlist[cural].concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[l])); + current_asmdata.asmlists[cural].concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[l])); end else begin @@ -510,10 +510,10 @@ implementation j:=0; for l:=0 to ((p.resulttype.def.size-1) div 4) do begin - asmlist[cural].concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+3])); - asmlist[cural].concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+2])); - asmlist[cural].concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+1])); - asmlist[cural].concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j])); + current_asmdata.asmlists[cural].concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+3])); + current_asmdata.asmlists[cural].concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+2])); + current_asmdata.asmlists[cural].concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j+1])); + current_asmdata.asmlists[cural].concat(tai_const.create_8bit(Psetbytes(tsetconstnode(p).value_set)^[j])); Inc(j,4); end; end; @@ -532,9 +532,9 @@ implementation is_subequal(p.resulttype.def,t.def) then begin case longint(p.resulttype.def.size) of - 1 : asmlist[cural].concat(Tai_const.Create_8bit(Byte(tordconstnode(p).value))); - 2 : asmlist[cural].concat(Tai_const.Create_16bit(Word(tordconstnode(p).value))); - 4 : asmlist[cural].concat(Tai_const.Create_32bit(Longint(tordconstnode(p).value))); + 1 : current_asmdata.asmlists[cural].concat(Tai_const.Create_8bit(Byte(tordconstnode(p).value))); + 2 : current_asmdata.asmlists[cural].concat(Tai_const.Create_16bit(Word(tordconstnode(p).value))); + 4 : current_asmdata.asmlists[cural].concat(Tai_const.Create_32bit(Longint(tordconstnode(p).value))); end; end else @@ -584,12 +584,12 @@ implementation message2(parser_w_string_too_long,strpas(strval),tostr(t.def.size-1)); strlength:=t.def.size-1; end; - asmlist[cural].concat(Tai_const.Create_8bit(strlength)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_8bit(strlength)); { this can also handle longer strings } getmem(ca,strlength+1); move(strval^,ca^,strlength); ca[strlength]:=#0; - asmlist[cural].concat(Tai_string.Create_pchar(ca,strlength)); + current_asmdata.asmlists[cural].concat(Tai_string.Create_pchar(ca,strlength)); { fillup with spaces if size is shorter } if t.def.size>strlength then begin @@ -599,46 +599,46 @@ implementation fillchar(ca[0],t.def.size-strlength-1,' '); ca[t.def.size-strlength-1]:=#0; { this can also handle longer strings } - asmlist[cural].concat(Tai_string.Create_pchar(ca,t.def.size-strlength-1)); + current_asmdata.asmlists[cural].concat(Tai_string.Create_pchar(ca,t.def.size-strlength-1)); end; end; st_ansistring: begin { an empty ansi string is nil! } if (strlength=0) then - asmlist[cural].concat(Tai_const.Create_sym(nil)) + current_asmdata.asmlists[cural].concat(Tai_const.Create_sym(nil)) else begin - objectlibrary.getdatalabel(ll); - asmlist[cural].concat(Tai_const.Create_sym(ll)); - asmlist[al_const].concat(tai_align.create(const_align(sizeof(aint)))); - asmlist[al_const].concat(Tai_const.Create_aint(-1)); - asmlist[al_const].concat(Tai_const.Create_aint(strlength)); - asmlist[al_const].concat(Tai_label.Create(ll)); + current_asmdata.getdatalabel(ll); + current_asmdata.asmlists[cural].concat(Tai_const.Create_sym(ll)); + current_asmdata.asmlists[al_const].concat(tai_align.create(const_align(sizeof(aint)))); + current_asmdata.asmlists[al_const].concat(Tai_const.Create_aint(-1)); + current_asmdata.asmlists[al_const].concat(Tai_const.Create_aint(strlength)); + current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll)); getmem(ca,strlength+1); move(strval^,ca^,strlength); { The terminating #0 to be stored in the .data section (JM) } ca[strlength]:=#0; - asmlist[al_const].concat(Tai_string.Create_pchar(ca,strlength+1)); + current_asmdata.asmlists[al_const].concat(Tai_string.Create_pchar(ca,strlength+1)); end; end; st_widestring: begin { an empty ansi string is nil! } if (strlength=0) then - asmlist[cural].concat(Tai_const.Create_sym(nil)) + current_asmdata.asmlists[cural].concat(Tai_const.Create_sym(nil)) else begin - objectlibrary.getdatalabel(ll); - asmlist[cural].concat(Tai_const.Create_sym(ll)); - asmlist[al_const].concat(tai_align.create(const_align(sizeof(aint)))); - asmlist[al_const].concat(Tai_const.Create_aint(-1)); - asmlist[al_const].concat(Tai_const.Create_aint(strlength*cwidechartype.def.size)); - asmlist[al_const].concat(Tai_label.Create(ll)); + current_asmdata.getdatalabel(ll); + current_asmdata.asmlists[cural].concat(Tai_const.Create_sym(ll)); + current_asmdata.asmlists[al_const].concat(tai_align.create(const_align(sizeof(aint)))); + current_asmdata.asmlists[al_const].concat(Tai_const.Create_aint(-1)); + current_asmdata.asmlists[al_const].concat(Tai_const.Create_aint(strlength*cwidechartype.def.size)); + current_asmdata.asmlists[al_const].concat(Tai_label.Create(ll)); for i:=0 to strlength-1 do - asmlist[al_const].concat(Tai_const.Create_16bit(pcompilerwidestring(strval)^.data[i])); + current_asmdata.asmlists[al_const].concat(Tai_const.Create_16bit(pcompilerwidestring(strval)^.data[i])); { ending #0 } - asmlist[al_const].concat(Tai_const.Create_16bit(0)) + current_asmdata.asmlists[al_const].concat(Tai_const.Create_16bit(0)) end; end; st_longstring: @@ -656,7 +656,7 @@ implementation begin { Only allow nil initialization } consume(_NIL); - asmlist[cural].concat(Tai_const.Create_sym(nil)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_sym(nil)); end else if try_to_consume(_LKLAMMER) then @@ -701,12 +701,12 @@ implementation begin if i+1-tarraydef(t.def).lowrange<=len then begin - asmlist[cural].concat(Tai_const.Create_8bit(byte(ca^))); + current_asmdata.asmlists[cural].concat(Tai_const.Create_8bit(byte(ca^))); inc(ca); end else {Fill the remaining positions with #0.} - asmlist[cural].concat(Tai_const.Create_8bit(0)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_8bit(0)); end; p.free; end @@ -722,9 +722,9 @@ implementation { under tp: =nil or =var under fpc: =nil or =@var } if token=_NIL then begin - asmlist[cural].concat(Tai_const.Create_sym(nil)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_sym(nil)); if (po_methodpointer in tprocvardef(t.def).procoptions) then - asmlist[cural].concat(Tai_const.Create_sym(nil)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_sym(nil)); consume(_NIL); goto myexit; end; @@ -771,7 +771,7 @@ implementation if (p.nodetype=loadn) and (tloadnode(p).symtableentry.typ=procsym) then begin - asmlist[cural].concat(Tai_const.createname( + current_asmdata.asmlists[cural].concat(Tai_const.createname( tprocsym(tloadnode(p).symtableentry).first_procdef.mangledname,AT_FUNCTION,0)); end else @@ -793,11 +793,11 @@ implementation p.free; if string2guid(s,tmpguid) then begin - asmlist[cural].concat(Tai_const.Create_32bit(longint(tmpguid.D1))); - asmlist[cural].concat(Tai_const.Create_16bit(tmpguid.D2)); - asmlist[cural].concat(Tai_const.Create_16bit(tmpguid.D3)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_32bit(longint(tmpguid.D1))); + current_asmdata.asmlists[cural].concat(Tai_const.Create_16bit(tmpguid.D2)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_16bit(tmpguid.D3)); for i:=Low(tmpguid.D4) to High(tmpguid.D4) do - asmlist[cural].concat(Tai_const.Create_8bit(tmpguid.D4[i])); + current_asmdata.asmlists[cural].concat(Tai_const.Create_8bit(tmpguid.D4[i])); end else Message(parser_e_improper_guid_syntax); @@ -875,7 +875,7 @@ implementation { if needed fill (alignment) } if tfieldvarsym(srsym).fieldoffset>aktpos then for i:=1 to tfieldvarsym(srsym).fieldoffset-aktpos do - asmlist[cural].concat(Tai_const.Create_8bit(0)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_8bit(0)); { new position } aktpos:=tfieldvarsym(srsym).fieldoffset+tfieldvarsym(srsym).vartype.def.size; @@ -904,7 +904,7 @@ implementation Message1(parser_w_skipped_fields_after,sorg); for i:=1 to t.def.size-aktpos do - asmlist[cural].concat(Tai_const.Create_8bit(0)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_8bit(0)); consume(_RKLAMMER); end; @@ -922,7 +922,7 @@ implementation end else begin - asmlist[cural].concat(Tai_const.Create_sym(nil)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_sym(nil)); end; p.free; end @@ -973,8 +973,8 @@ implementation (vmt_offset<fieldoffset) then begin for i:=1 to vmt_offset-aktpos do - asmlist[cural].concat(tai_const.create_8bit(0)); - asmlist[cural].concat(tai_const.createname(vmt_mangledname,AT_DATA,0)); + current_asmdata.asmlists[cural].concat(tai_const.create_8bit(0)); + current_asmdata.asmlists[cural].concat(tai_const.createname(vmt_mangledname,AT_DATA,0)); { this is more general } aktpos:=vmt_offset + sizeof(aint); end; @@ -982,7 +982,7 @@ implementation { if needed fill } if fieldoffset>aktpos then for i:=1 to fieldoffset-aktpos do - asmlist[cural].concat(Tai_const.Create_8bit(0)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_8bit(0)); { new position } aktpos:=fieldoffset+vartype.def.size; @@ -1000,13 +1000,13 @@ implementation (tobjectdef(t.def).vmt_offset>=aktpos) then begin for i:=1 to tobjectdef(t.def).vmt_offset-aktpos do - asmlist[cural].concat(tai_const.create_8bit(0)); - asmlist[cural].concat(tai_const.createname(tobjectdef(t.def).vmt_mangledname,AT_DATA,0)); + current_asmdata.asmlists[cural].concat(tai_const.create_8bit(0)); + current_asmdata.asmlists[cural].concat(tai_const.createname(tobjectdef(t.def).vmt_mangledname,AT_DATA,0)); { this is more general } aktpos:=tobjectdef(t.def).vmt_offset + sizeof(aint); end; for i:=1 to t.def.size-aktpos do - asmlist[cural].concat(Tai_const.Create_8bit(0)); + current_asmdata.asmlists[cural].concat(Tai_const.Create_8bit(0)); consume(_RKLAMMER); end; end; @@ -1028,7 +1028,7 @@ implementation storefilepos:=aktfilepos; aktfilepos:=sym.fileinfo; - asmlist[cural].concat(tai_symbol_end.Createname(sym.mangledname)); + current_asmdata.asmlists[cural].concat(tai_symbol_end.Createname(sym.mangledname)); aktfilepos:=storefilepos; end; end; diff --git a/compiler/raatt.pas b/compiler/raatt.pas index ef9850ad41..663b864db0 100644 --- a/compiler/raatt.pas +++ b/compiler/raatt.pas @@ -959,7 +959,7 @@ unit raatt; SetupTables; _asmsorted:=TRUE; end; - curlist:=TAAsmoutput.Create; + curlist:=TAsmList.Create; lasTSec:=sec_code; { setup label linked list } LocalLabelList:=TLocalLabelList.Create; @@ -1522,7 +1522,7 @@ unit raatt; begin oper.opr.typ:=OPR_SYMBOL; oper.opr.symofs:=l; - oper.opr.symbol:=objectlibrary.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp); + oper.opr.symbol:=current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp); end else begin diff --git a/compiler/rabase.pas b/compiler/rabase.pas index ba00ddc272..0c7d8de2c9 100644 --- a/compiler/rabase.pas +++ b/compiler/rabase.pas @@ -32,7 +32,7 @@ unit rabase; type tbaseasmreader = class constructor create;virtual; - { the real return type is taasmoutput, but this would introduce too much unit circles } + { the real return type is TAsmList, but this would introduce too much unit circles } function Assemble: tlinkedlist;virtual;abstract; end; tcbaseasmreader = class of tbaseasmreader; diff --git a/compiler/rasm.pas b/compiler/rasm.pas index fa515e41c5..adf0b22d54 100644 --- a/compiler/rasm.pas +++ b/compiler/rasm.pas @@ -37,7 +37,7 @@ unit rasm; tasmreader = class(tbaseasmreader) firsttoken : boolean; _asmsorted : boolean; - curlist : TAAsmoutput; + curlist : TAsmList; c : char; actasmpattern : string; actopcode : tasmop; diff --git a/compiler/rautils.pas b/compiler/rautils.pas index bac54c2d88..24b3c06267 100644 --- a/compiler/rautils.pas +++ b/compiler/rautils.pas @@ -118,7 +118,7 @@ type destructor destroy;override; { converts the instruction to an instruction how it's used by the assembler writer and concats it to the passed list, the newly created item is returned } - function ConcatInstruction(p:TAAsmoutput) : tai;virtual; + function ConcatInstruction(p:TAsmList) : tai;virtual; Procedure Swapoperands; end; @@ -197,15 +197,15 @@ Function SearchIConstant(const s:string; var l:aint): boolean; Instruction generation routines ---------------------------------------------------------------------} - Procedure ConcatPasString(p : TAAsmoutput;s:string); - Procedure ConcatLabel(p: TAAsmoutput;var l : tasmlabel); - Procedure ConcatConstant(p : TAAsmoutput;value: aint; constsize:byte); - Procedure ConcatConstSymbol(p : TAAsmoutput;const sym:string;symtyp:tasmsymtype;l:aint); - Procedure ConcatRealConstant(p : TAAsmoutput;value: bestreal; real_typ : tfloattype); - Procedure ConcatString(p : TAAsmoutput;s:string); - procedure ConcatAlign(p:TAAsmoutput;l:aint); - Procedure ConcatPublic(p:TAAsmoutput;const s : string); - Procedure ConcatLocal(p:TAAsmoutput;const s : string); + Procedure ConcatPasString(p : TAsmList;s:string); + Procedure ConcatLabel(p: TAsmList;var l : tasmlabel); + Procedure ConcatConstant(p : TAsmList;value: aint; constsize:byte); + Procedure ConcatConstSymbol(p : TAsmList;const sym:string;symtyp:tasmsymtype;l:aint); + Procedure ConcatRealConstant(p : TAsmList;value: bestreal; real_typ : tfloattype); + Procedure ConcatString(p : TAsmList;s:string); + procedure ConcatAlign(p:TAsmList;l:aint); + Procedure ConcatPublic(p:TAsmList;const s : string); + Procedure ConcatLocal(p:TAsmList;const s : string); Implementation @@ -810,7 +810,7 @@ Begin staticsymtable : begin initref; - opr.ref.symbol:=objectlibrary.newasmsymbol(tglobalvarsym(sym).mangledname,AB_EXTERNAL,AT_DATA); + opr.ref.symbol:=current_asmdata.newasmsymbol(tglobalvarsym(sym).mangledname,AB_EXTERNAL,AT_DATA); end; parasymtable, localsymtable : @@ -872,7 +872,7 @@ Begin typedconstsym : begin initref; - opr.ref.symbol:=objectlibrary.newasmsymbol(ttypedconstsym(sym).mangledname,AB_EXTERNAL,AT_DATA); + opr.ref.symbol:=current_asmdata.newasmsymbol(ttypedconstsym(sym).mangledname,AB_EXTERNAL,AT_DATA); case ttypedconstsym(sym).typedconsttype.def.deftype of orddef, enumdef, @@ -920,7 +920,7 @@ Begin Message(asmr_w_calling_overload_func); l:=opr.ref.offset; opr.typ:=OPR_SYMBOL; - opr.symbol:=objectlibrary.newasmsymbol(tprocsym(sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION); + opr.symbol:=current_asmdata.newasmsymbol(tprocsym(sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION); opr.symofs:=l; hasvar:=true; SetupVar:=TRUE; @@ -1040,7 +1040,7 @@ end; end; - function TInstruction.ConcatInstruction(p:TAAsmoutput) : tai; + function TInstruction.ConcatInstruction(p:TAsmList) : tai; var ai : taicpu; i : longint; @@ -1099,7 +1099,7 @@ function TLocalLabel.Gettasmlabel:tasmlabel; begin if not assigned(lab) then begin - objectlibrary.getjumplabel(lab); + current_asmdata.getjumplabel(lab); { this label is forced to be used so it's always written } lab.increfs; end; @@ -1392,7 +1392,7 @@ Begin labelsym : begin if not(assigned(tlabelsym(sym).asmblocklabel)) then - objectlibrary.getjumplabel(tlabelsym(sym).asmblocklabel); + current_asmdata.getjumplabel(tlabelsym(sym).asmblocklabel); hl:=tlabelsym(sym).asmblocklabel; if emit then tlabelsym(sym).defined:=true @@ -1409,7 +1409,7 @@ end; {*************************************************************************} - Procedure ConcatString(p : TAAsmoutput;s:string); + Procedure ConcatString(p : TAsmList;s:string); {*********************************************************************} { PROCEDURE ConcatString(s:string); } { Description: This routine adds the character chain pointed to in } @@ -1422,7 +1422,7 @@ end; p.concat(Tai_string.Create_pchar(strpcopy(pc,s),length(s))); end; - Procedure ConcatPasString(p : TAAsmoutput;s:string); + Procedure ConcatPasString(p : TAsmList;s:string); {*********************************************************************} { PROCEDURE ConcatPasString(s:string); } { Description: This routine adds the character chain pointed to in } @@ -1434,7 +1434,7 @@ end; end; -Procedure ConcatConstant(p: TAAsmoutput; value: aint; constsize:byte); +Procedure ConcatConstant(p: TAsmList; value: aint; constsize:byte); {*********************************************************************} { PROCEDURE ConcatConstant(value: aint; maxvalue: aint); } { Description: This routine adds the value constant to the current } @@ -1482,13 +1482,13 @@ Begin end; - Procedure ConcatConstSymbol(p : TAAsmoutput;const sym:string;symtyp:tasmsymtype;l:aint); + Procedure ConcatConstSymbol(p : TAsmList;const sym:string;symtyp:tasmsymtype;l:aint); begin p.concat(Tai_const.Createname(sym,symtyp,l)); end; - Procedure ConcatRealConstant(p : TAAsmoutput;value: bestreal; real_typ : tfloattype); + Procedure ConcatRealConstant(p : TAsmList;value: bestreal; real_typ : tfloattype); {***********************************************************************} { PROCEDURE ConcatRealConstant(value: bestreal; real_typ : tfloattype); } { Description: This routine adds the value constant to the current } @@ -1515,7 +1515,7 @@ end; end; end; - Procedure ConcatLabel(p: TAAsmoutput;var l : tasmlabel); + Procedure ConcatLabel(p: TAsmList;var l : tasmlabel); {*********************************************************************} { PROCEDURE ConcatLabel } { Description: This routine either emits a label or a labeled } @@ -1525,7 +1525,7 @@ end; p.concat(Tai_label.Create(l)); end; - procedure ConcatAlign(p:TAAsmoutput;l:aint); + procedure ConcatAlign(p:TAsmList;l:aint); {*********************************************************************} { PROCEDURE ConcatPublic } { Description: This routine emits an global definition to the } @@ -1535,7 +1535,7 @@ end; p.concat(Tai_align.Create(l)); end; - procedure ConcatPublic(p:TAAsmoutput;const s : string); + procedure ConcatPublic(p:TAsmList;const s : string); {*********************************************************************} { PROCEDURE ConcatPublic } { Description: This routine emits an global definition to the } @@ -1545,7 +1545,7 @@ end; p.concat(Tai_symbol.Createname_global(s,AT_LABEL,0)); end; - procedure ConcatLocal(p:TAAsmoutput;const s : string); + procedure ConcatLocal(p:TAsmList;const s : string); {*********************************************************************} { PROCEDURE ConcatLocal } { Description: This routine emits an local definition to the } diff --git a/compiler/regvars.pas b/compiler/regvars.pas index b0109f5a82..1d3d34adad 100644 --- a/compiler/regvars.pas +++ b/compiler/regvars.pas @@ -33,21 +33,21 @@ interface {$ifdef OLDREGVARS} procedure assign_regvars(p: tnode); - procedure load_regvars(asml: TAAsmoutput; p: tnode); - procedure cleanup_regvars(asml: TAAsmoutput); - procedure store_regvar(asml: TAAsmoutput; reg: tregister); - procedure load_regvar(asml: TAAsmoutput; vsym: tvarsym); - procedure load_regvar_reg(asml: TAAsmoutput; reg: tregister); - procedure load_all_regvars(asml: TAAsmoutput); - procedure free_regvars(list: taasmoutput); -{ procedure translate_regvars(list: taasmoutput); } + procedure load_regvars(asml: TAsmList; p: tnode); + procedure cleanup_regvars(asml: TAsmList); + procedure store_regvar(asml: TAsmList; reg: tregister); + procedure load_regvar(asml: TAsmList; vsym: tvarsym); + procedure load_regvar_reg(asml: TAsmList; reg: tregister); + procedure load_all_regvars(asml: TAsmList); + procedure free_regvars(list: TAsmList); +{ procedure translate_regvars(list: TAsmList); } {$endif OLDREGVARS} {$ifdef i386} (* - procedure sync_regvars_other(list1, list2: taasmoutput; const regvarsloaded1, + procedure sync_regvars_other(list1, list2: TAsmList; const regvarsloaded1, regvarsloaded2: regvarother_booleanarray); - procedure sync_regvars_int(list1, list2: taasmoutput; const regvarsloaded1, + procedure sync_regvars_int(list1, list2: TAsmList; const regvarsloaded1, regvarsloaded2: Tsuperregisterset); *) {$endif i386} @@ -198,7 +198,7 @@ implementation siz:=OS_32; { allocate a register for this regvar } - tvarsym(regvarinfo^.regvars[i]).localloc.register:=cg.getintregister(exprasmlist,siz); + tvarsym(regvarinfo^.regvars[i]).localloc.register:=cg.getintregister(current_asmdata.CurrAsmList,siz); tvarsym(regvarinfo^.regvars[i]).localloc.loc:=LOC_REGISTER; { and make sure it can't be freed } { rg.makeregvarint(getsupreg(regvarinfo^.regvars[i].localloc.register));} @@ -263,7 +263,7 @@ implementation {$ifdef x86_64} {$endif x86_64} begin - tvarsym(regvarinfo^.fpuregvars[i]).localloc.register:=cg.getfpuregister(exprasmlist,OS_F64); + tvarsym(regvarinfo^.fpuregvars[i]).localloc.register:=cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64); tvarsym(regvarinfo^.fpuregvars[i]).localloc.loc:=LOC_FPUREGISTER; { rg.makeregvarother(regvarinfo^.fpuregvars[i].localloc.register);} end; @@ -276,7 +276,7 @@ implementation - procedure store_regvar(asml: TAAsmoutput; reg: tregister); + procedure store_regvar(asml: TAsmList; reg: tregister); var i: longint; cgsize : tcgsize; @@ -352,7 +352,7 @@ implementation {$endif i386} end; - procedure load_regvar(asml: TAAsmoutput; vsym: tvarsym); + procedure load_regvar(asml: TAsmList; vsym: tvarsym); var hr: treference; opsize: tcgsize; @@ -402,7 +402,7 @@ implementation *) end; - procedure load_regvar_reg(asml: TAAsmoutput; reg: tregister); + procedure load_regvar_reg(asml: TAsmList; reg: tregister); var i: longint; regvarinfo: pregvarinfo; @@ -432,7 +432,7 @@ implementation } end; - procedure load_all_regvars(asml: TAAsmoutput); + procedure load_all_regvars(asml: TAsmList); { var i: longint; @@ -450,7 +450,7 @@ implementation end; - procedure load_regvars(asml: TAAsmoutput; p: tnode); + procedure load_regvars(asml: TAsmList; p: tnode); var i: longint; regvarinfo: pregvarinfo; @@ -505,7 +505,7 @@ implementation {$ifdef i386} (* - procedure sync_regvars_other(list1, list2: taasmoutput; const regvarsloaded1, + procedure sync_regvars_other(list1, list2: TAsmList; const regvarsloaded1, regvarsloaded2: regvarother_booleanarray); var counter: tregisterindex; @@ -523,7 +523,7 @@ implementation end; - procedure sync_regvars_int(list1, list2: taasmoutput; const regvarsloaded1, + procedure sync_regvars_int(list1, list2: TAsmList; const regvarsloaded1, regvarsloaded2: Tsuperregisterset); var i : longint; @@ -545,7 +545,7 @@ implementation {$endif i386} - procedure cleanup_regvars(asml: TAAsmoutput); + procedure cleanup_regvars(asml: TAsmList); var i: longint; reg : tregister; @@ -596,7 +596,7 @@ implementation stabs generation. It could still be useful to generate the "var X is assigned to register Y with weight ZZZ" messages though - procedure translate_regvars(list: taasmoutput); + procedure translate_regvars(list: TAsmList); var i: longint; r: tregister; @@ -633,7 +633,7 @@ implementation end; } - procedure free_regvars(list: taasmoutput); + procedure free_regvars(list: TAsmList); var i: longint; reg: tregister; diff --git a/compiler/rgobj.pas b/compiler/rgobj.pas index 94b68cf4e5..ccdc249f6f 100644 --- a/compiler/rgobj.pas +++ b/compiler/rgobj.pas @@ -111,6 +111,8 @@ unit rgobj; end; tspillregsinfo = array[0..2] of tspillreginfo; + Tspill_temp_list=array[tsuperregister] of Treference; + {#------------------------------------------------------------------ This class implements the default register allocator. It is used by the @@ -134,19 +136,19 @@ unit rgobj; {# Allocate a register. An internalerror will be generated if there is no more free registers which can be allocated.} - function getregister(list:Taasmoutput;subreg:Tsubregister):Tregister;virtual; + function getregister(list:TAsmList;subreg:Tsubregister):Tregister;virtual; {# Get the register specified.} - procedure getcpuregister(list:Taasmoutput;r:Tregister);virtual; - procedure ungetcpuregister(list:Taasmoutput;r:Tregister);virtual; + procedure getcpuregister(list:TAsmList;r:Tregister);virtual; + procedure ungetcpuregister(list:TAsmList;r:Tregister);virtual; {# Get multiple registers specified.} - procedure alloccpuregisters(list:Taasmoutput;const r:Tcpuregisterset);virtual; + procedure alloccpuregisters(list:TAsmList;const r:Tcpuregisterset);virtual; {# Free multiple registers specified.} - procedure dealloccpuregisters(list:Taasmoutput;const r:Tcpuregisterset);virtual; + procedure dealloccpuregisters(list:TAsmList;const r:Tcpuregisterset);virtual; function uses_registers:boolean;virtual; procedure add_reg_instruction(instr:Tai;r:tregister); procedure add_move_instruction(instr:Taicpu); {# Do the register allocation.} - procedure do_register_allocation(list:Taasmoutput;headertai:tai);virtual; + procedure do_register_allocation(list:TAsmList;headertai:tai);virtual; { Adds an interference edge. don't move this to the protected section, the arm cg requires to access this (FK) } procedure add_edge(u,v:Tsuperregister); @@ -160,14 +162,14 @@ unit rgobj; { can be overriden to add cpu specific interferences } procedure add_cpu_interferences(p : tai);virtual; procedure add_constraints(reg:Tregister);virtual; - function getregisterinline(list:Taasmoutput;subreg:Tsubregister):Tregister; - procedure ungetregisterinline(list:Taasmoutput;r:Tregister); + function getregisterinline(list:TAsmList;subreg:Tsubregister):Tregister; + procedure ungetregisterinline(list:TAsmList;r:Tregister); function get_spill_subreg(r : tregister) : tsubregister;virtual; - function do_spill_replace(list:Taasmoutput;instr:taicpu;orgreg:tsuperregister;const spilltemp:treference):boolean;virtual; - procedure do_spill_read(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister);virtual; - procedure do_spill_written(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister);virtual; + function do_spill_replace(list:TAsmList;instr:taicpu;orgreg:tsuperregister;const spilltemp:treference):boolean;virtual; + procedure do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);virtual; + procedure do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);virtual; - function instr_spill_register(list:Taasmoutput; + function instr_spill_register(list:TAsmList; instr:taicpu; const r:Tsuperregisterset; const spilltemplist:Tspill_temp_list): boolean;virtual; @@ -208,12 +210,12 @@ unit rgobj; procedure epilogue_colouring; {# Colour the registers; that is do the register allocation.} procedure colour_registers; - procedure insert_regalloc_info(list:Taasmoutput;u:tsuperregister); - procedure insert_regalloc_info_all(list:Taasmoutput); - procedure generate_interference_graph(list:Taasmoutput;headertai:tai); + procedure insert_regalloc_info(list:TAsmList;u:tsuperregister); + procedure insert_regalloc_info_all(list:TAsmList); + procedure generate_interference_graph(list:TAsmList;headertai:tai); { translates the registers in the given assembler list } - procedure translate_registers(list:Taasmoutput); - function spill_registers(list:Taasmoutput;headertai:tai):boolean;virtual; + procedure translate_registers(list:TAsmList); + function spill_registers(list:TAsmList;headertai:tai):boolean;virtual; function getnewreg(subreg:tsubregister):tsuperregister; procedure add_edges_used(u:Tsuperregister); procedure add_to_movelist(u:Tsuperregister;data:Tlinkedlistitem); @@ -462,7 +464,7 @@ unit rgobj; end; - function trgobj.getregister(list:Taasmoutput;subreg:Tsubregister):Tregister; + function trgobj.getregister(list:TAsmList;subreg:Tsubregister):Tregister; begin {$ifdef EXTDEBUG} if reginfo=nil then @@ -481,7 +483,7 @@ unit rgobj; end; - procedure trgobj.ungetcpuregister(list:Taasmoutput;r:Tregister); + procedure trgobj.ungetcpuregister(list:TAsmList;r:Tregister); begin if (getsupreg(r)>=first_imaginary) then InternalError(2004020901); @@ -489,7 +491,7 @@ unit rgobj; end; - procedure trgobj.getcpuregister(list:Taasmoutput;r:Tregister); + procedure trgobj.getcpuregister(list:TAsmList;r:Tregister); var supreg:Tsuperregister; begin @@ -501,7 +503,7 @@ unit rgobj; end; - procedure trgobj.alloccpuregisters(list:Taasmoutput;const r:Tcpuregisterset); + procedure trgobj.alloccpuregisters(list:TAsmList;const r:Tcpuregisterset); var i:Tsuperregister; @@ -512,7 +514,7 @@ unit rgobj; end; - procedure trgobj.dealloccpuregisters(list:Taasmoutput;const r:Tcpuregisterset); + procedure trgobj.dealloccpuregisters(list:TAsmList;const r:Tcpuregisterset); var i:Tsuperregister; @@ -523,7 +525,7 @@ unit rgobj; end; - procedure trgobj.do_register_allocation(list:Taasmoutput;headertai:tai); + procedure trgobj.do_register_allocation(list:TAsmList;headertai:tai); var spillingcounter:byte; endspill:boolean; @@ -1424,7 +1426,7 @@ unit rgobj; end; - function trgobj.getregisterinline(list:Taasmoutput;subreg:Tsubregister):Tregister; + function trgobj.getregisterinline(list:TAsmList;subreg:Tsubregister):Tregister; var p : Tsuperregister; begin @@ -1436,7 +1438,7 @@ unit rgobj; end; - procedure trgobj.ungetregisterinline(list:Taasmoutput;r:Tregister); + procedure trgobj.ungetregisterinline(list:TAsmList;r:Tregister); var supreg:Tsuperregister; begin @@ -1446,7 +1448,7 @@ unit rgobj; end; - procedure trgobj.insert_regalloc_info(list:Taasmoutput;u:tsuperregister); + procedure trgobj.insert_regalloc_info(list:TAsmList;u:tsuperregister); var p : tai; r : tregister; @@ -1499,7 +1501,7 @@ unit rgobj; end; - procedure trgobj.insert_regalloc_info_all(list:Taasmoutput); + procedure trgobj.insert_regalloc_info_all(list:TAsmList); var supreg : tsuperregister; begin @@ -1514,7 +1516,7 @@ unit rgobj; end; - procedure trgobj.generate_interference_graph(list:Taasmoutput;headertai:tai); + procedure trgobj.generate_interference_graph(list:TAsmList;headertai:tai); var p : tai; {$ifdef EXTDEBUG} @@ -1579,7 +1581,7 @@ unit rgobj; end; - procedure Trgobj.translate_registers(list:taasmoutput); + procedure Trgobj.translate_registers(list:TAsmList); var hp,p,q:Tai; i:shortint; @@ -1692,7 +1694,7 @@ unit rgobj; end; - function trgobj.spill_registers(list:Taasmoutput;headertai:tai):boolean; + function trgobj.spill_registers(list:TAsmList;headertai:tai):boolean; { Returns true if any help registers have been used } var i : word; @@ -1701,7 +1703,7 @@ unit rgobj; regs_to_spill_set:Tsuperregisterset; spill_temps : ^Tspill_temp_list; supreg : tsuperregister; - templist : taasmoutput; + templist : TAsmList; begin spill_registers:=false; live_registers.clear; @@ -1710,7 +1712,7 @@ unit rgobj; spill_temps:=allocmem(sizeof(treference)*maxreg); supregset_reset(regs_to_spill_set,false,$ffff); { Allocate temps and insert in front of the list } - templist:=taasmoutput.create; + templist:=TAsmList.create; {Safe: this procedure is only called if there are spilled nodes.} with spillednodes do for i:=0 to length-1 do @@ -1781,19 +1783,19 @@ unit rgobj; end; - function trgobj.do_spill_replace(list:Taasmoutput;instr:taicpu;orgreg:tsuperregister;const spilltemp:treference):boolean; + function trgobj.do_spill_replace(list:TAsmList;instr:taicpu;orgreg:tsuperregister;const spilltemp:treference):boolean; begin result:=false; end; - procedure Trgobj.do_spill_read(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister); + procedure Trgobj.do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister); begin list.insertafter(spilling_create_load(spilltemp,tempreg),pos); end; - procedure Trgobj.do_spill_written(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister); + procedure Trgobj.do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister); begin list.insertafter(spilling_create_store(tempreg,spilltemp),pos); end; @@ -1805,7 +1807,7 @@ unit rgobj; end; - function trgobj.instr_spill_register(list:Taasmoutput; + function trgobj.instr_spill_register(list:TAsmList; instr:taicpu; const r:Tsuperregisterset; const spilltemplist:Tspill_temp_list): boolean; diff --git a/compiler/sparc/cgcpu.pas b/compiler/sparc/cgcpu.pas index 593f936d66..8614daf2c7 100644 --- a/compiler/sparc/cgcpu.pas +++ b/compiler/sparc/cgcpu.pas @@ -40,70 +40,70 @@ interface public procedure init_register_allocators;override; procedure done_register_allocators;override; - function getfpuregister(list:Taasmoutput;size:Tcgsize):Tregister;override; + function getfpuregister(list:TAsmList;size:Tcgsize):Tregister;override; { sparc special, needed by cg64 } - procedure make_simple_ref(list:taasmoutput;var ref: treference); - procedure handle_load_store(list:taasmoutput;isstore:boolean;op: tasmop;reg:tregister;ref: treference); - procedure handle_reg_const_reg(list:taasmoutput;op:Tasmop;src:tregister;a:aint;dst:tregister); + procedure make_simple_ref(list:TAsmList;var ref: treference); + procedure handle_load_store(list:TAsmList;isstore:boolean;op: tasmop;reg:tregister;ref: treference); + procedure handle_reg_const_reg(list:TAsmList;op:Tasmop;src:tregister;a:aint;dst:tregister); { parameter } - procedure a_param_const(list:TAasmOutput;size:tcgsize;a:aint;const paraloc:TCGPara);override; - procedure a_param_ref(list:TAasmOutput;sz:tcgsize;const r:TReference;const paraloc:TCGPara);override; - procedure a_paramaddr_ref(list:TAasmOutput;const r:TReference;const paraloc:TCGPara);override; - procedure a_paramfpu_reg(list : taasmoutput;size : tcgsize;const r : tregister;const paraloc : TCGPara);override; - procedure a_paramfpu_ref(list : taasmoutput;size : tcgsize;const ref : treference;const paraloc : TCGPara);override; - procedure a_call_name(list:TAasmOutput;const s:string);override; - procedure a_call_reg(list:TAasmOutput;Reg:TRegister);override; + procedure a_param_const(list:TAsmList;size:tcgsize;a:aint;const paraloc:TCGPara);override; + procedure a_param_ref(list:TAsmList;sz:tcgsize;const r:TReference;const paraloc:TCGPara);override; + procedure a_paramaddr_ref(list:TAsmList;const r:TReference;const paraloc:TCGPara);override; + procedure a_paramfpu_reg(list : TAsmList;size : tcgsize;const r : tregister;const paraloc : TCGPara);override; + procedure a_paramfpu_ref(list : TAsmList;size : tcgsize;const ref : treference;const paraloc : TCGPara);override; + procedure a_call_name(list:TAsmList;const s:string);override; + procedure a_call_reg(list:TAsmList;Reg:TRegister);override; { General purpose instructions } - procedure a_op_const_reg(list:TAasmOutput;Op:TOpCG;size:tcgsize;a:aint;reg:TRegister);override; - procedure a_op_reg_reg(list:TAasmOutput;Op:TOpCG;size:TCGSize;src, dst:TRegister);override; - procedure a_op_const_reg_reg(list:TAasmOutput;op:TOpCg;size:tcgsize;a:aint;src, dst:tregister);override; - procedure a_op_reg_reg_reg(list:TAasmOutput;op:TOpCg;size:tcgsize;src1, src2, dst:tregister);override; - procedure a_op_const_reg_reg_checkoverflow(list: taasmoutput; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation);override; - procedure a_op_reg_reg_reg_checkoverflow(list: taasmoutput; op: TOpCg; size: tcgsize; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation);override; + procedure a_op_const_reg(list:TAsmList;Op:TOpCG;size:tcgsize;a:aint;reg:TRegister);override; + procedure a_op_reg_reg(list:TAsmList;Op:TOpCG;size:TCGSize;src, dst:TRegister);override; + procedure a_op_const_reg_reg(list:TAsmList;op:TOpCg;size:tcgsize;a:aint;src, dst:tregister);override; + procedure a_op_reg_reg_reg(list:TAsmList;op:TOpCg;size:tcgsize;src1, src2, dst:tregister);override; + procedure a_op_const_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation);override; + procedure a_op_reg_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation);override; { move instructions } - procedure a_load_const_reg(list:TAasmOutput;size:tcgsize;a:aint;reg:tregister);override; - procedure a_load_const_ref(list:TAasmOutput;size:tcgsize;a:aint;const ref:TReference);override; - procedure a_load_reg_ref(list:TAasmOutput;FromSize,ToSize:TCgSize;reg:TRegister;const ref:TReference);override; - procedure a_load_ref_reg(list:TAasmOutput;FromSize,ToSize:TCgSize;const ref:TReference;reg:tregister);override; - procedure a_load_reg_reg(list:TAasmOutput;FromSize,ToSize:TCgSize;reg1,reg2:tregister);override; - procedure a_loadaddr_ref_reg(list:TAasmOutput;const ref:TReference;r:tregister);override; + procedure a_load_const_reg(list:TAsmList;size:tcgsize;a:aint;reg:tregister);override; + procedure a_load_const_ref(list:TAsmList;size:tcgsize;a:aint;const ref:TReference);override; + procedure a_load_reg_ref(list:TAsmList;FromSize,ToSize:TCgSize;reg:TRegister;const ref:TReference);override; + procedure a_load_ref_reg(list:TAsmList;FromSize,ToSize:TCgSize;const ref:TReference;reg:tregister);override; + procedure a_load_reg_reg(list:TAsmList;FromSize,ToSize:TCgSize;reg1,reg2:tregister);override; + procedure a_loadaddr_ref_reg(list:TAsmList;const ref:TReference;r:tregister);override; { fpu move instructions } - procedure a_loadfpu_reg_reg(list:TAasmOutput;size:tcgsize;reg1, reg2:tregister);override; - procedure a_loadfpu_ref_reg(list:TAasmOutput;size:tcgsize;const ref:TReference;reg:tregister);override; - procedure a_loadfpu_reg_ref(list:TAasmOutput;size:tcgsize;reg:tregister;const ref:TReference);override; + procedure a_loadfpu_reg_reg(list:TAsmList;size:tcgsize;reg1, reg2:tregister);override; + procedure a_loadfpu_ref_reg(list:TAsmList;size:tcgsize;const ref:TReference;reg:tregister);override; + procedure a_loadfpu_reg_ref(list:TAsmList;size:tcgsize;reg:tregister;const ref:TReference);override; { comparison operations } - procedure a_cmp_const_reg_label(list:TAasmOutput;size:tcgsize;cmp_op:topcmp;a:aint;reg:tregister;l:tasmlabel);override; - procedure a_cmp_reg_reg_label(list:TAasmOutput;size:tcgsize;cmp_op:topcmp;reg1,reg2:tregister;l:tasmlabel);override; - procedure a_jmp_always(List:TAasmOutput;l:TAsmLabel);override; - procedure a_jmp_name(list : taasmoutput;const s : string);override; - procedure a_jmp_cond(list:TAasmOutput;cond:TOpCmp;l:tasmlabel);{ override;} - procedure a_jmp_flags(list:TAasmOutput;const f:TResFlags;l:tasmlabel);override; - procedure g_flags2reg(list:TAasmOutput;Size:TCgSize;const f:tresflags;reg:TRegister);override; - procedure g_overflowCheck(List:TAasmOutput;const Loc:TLocation;def:TDef);override; - procedure g_overflowCheck_loc(List:TAasmOutput;const Loc:TLocation;def:TDef;ovloc : tlocation);override; - procedure g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean);override; - procedure g_proc_exit(list : taasmoutput;parasize:longint;nostackframe:boolean);override; - procedure g_restore_standard_registers(list:taasmoutput);override; - procedure g_save_standard_registers(list : taasmoutput);override; - procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint);override; - procedure g_concatcopy_unaligned(list : taasmoutput;const source,dest : treference;len : aint);override; - procedure g_concatcopy_move(list : taasmoutput;const source,dest : treference;len : aint); - procedure g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint);override; + procedure a_cmp_const_reg_label(list:TAsmList;size:tcgsize;cmp_op:topcmp;a:aint;reg:tregister;l:tasmlabel);override; + procedure a_cmp_reg_reg_label(list:TAsmList;size:tcgsize;cmp_op:topcmp;reg1,reg2:tregister;l:tasmlabel);override; + procedure a_jmp_always(List:TAsmList;l:TAsmLabel);override; + procedure a_jmp_name(list : TAsmList;const s : string);override; + procedure a_jmp_cond(list:TAsmList;cond:TOpCmp;l:tasmlabel);{ override;} + procedure a_jmp_flags(list:TAsmList;const f:TResFlags;l:tasmlabel);override; + procedure g_flags2reg(list:TAsmList;Size:TCgSize;const f:tresflags;reg:TRegister);override; + procedure g_overflowCheck(List:TAsmList;const Loc:TLocation;def:TDef);override; + procedure g_overflowCheck_loc(List:TAsmList;const Loc:TLocation;def:TDef;ovloc : tlocation);override; + procedure g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean);override; + procedure g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean);override; + procedure g_restore_standard_registers(list:TAsmList);override; + procedure g_save_standard_registers(list : TAsmList);override; + procedure g_concatcopy(list : TAsmList;const source,dest : treference;len : aint);override; + procedure g_concatcopy_unaligned(list : TAsmList;const source,dest : treference;len : aint);override; + procedure g_concatcopy_move(list : TAsmList;const source,dest : treference;len : aint); + procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);override; end; TCg64Sparc=class(tcg64f32) private procedure get_64bit_ops(op:TOpCG;var op1,op2:TAsmOp;checkoverflow : boolean); public - procedure a_load64_reg_ref(list : taasmoutput;reg : tregister64;const ref : treference);override; - procedure a_load64_ref_reg(list : taasmoutput;const ref : treference;reg : tregister64);override; - procedure a_param64_ref(list : taasmoutput;const r : treference;const paraloc : tcgpara);override; - procedure a_op64_reg_reg(list:TAasmOutput;op:TOpCG;size : tcgsize;regsrc,regdst:TRegister64);override; - procedure a_op64_const_reg(list:TAasmOutput;op:TOpCG;size : tcgsize;value:int64;regdst:TRegister64);override; - procedure a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64);override; - procedure a_op64_reg_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64);override; - procedure a_op64_const_reg_reg_checkoverflow(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation);override; - procedure a_op64_reg_reg_reg_checkoverflow(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation);override; + procedure a_load64_reg_ref(list : TAsmList;reg : tregister64;const ref : treference);override; + procedure a_load64_ref_reg(list : TAsmList;const ref : treference;reg : tregister64);override; + procedure a_param64_ref(list : TAsmList;const r : treference;const paraloc : tcgpara);override; + procedure a_op64_reg_reg(list:TAsmList;op:TOpCG;size : tcgsize;regsrc,regdst:TRegister64);override; + procedure a_op64_const_reg(list:TAsmList;op:TOpCG;size : tcgsize;value:int64;regdst:TRegister64);override; + procedure a_op64_const_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64);override; + procedure a_op64_reg_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64);override; + procedure a_op64_const_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation);override; + procedure a_op64_reg_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation);override; end; const @@ -140,7 +140,7 @@ implementation end; - procedure tcgsparc.make_simple_ref(list:taasmoutput;var ref: treference); + procedure tcgsparc.make_simple_ref(list:TAsmList;var ref: treference); var tmpreg : tregister; tmpref : treference; @@ -230,7 +230,7 @@ implementation end; - procedure tcgsparc.handle_load_store(list:taasmoutput;isstore:boolean;op: tasmop;reg:tregister;ref: treference); + procedure tcgsparc.handle_load_store(list:TAsmList;isstore:boolean;op: tasmop;reg:tregister;ref: treference); begin make_simple_ref(list,ref); if isstore then @@ -240,7 +240,7 @@ implementation end; - procedure tcgsparc.handle_reg_const_reg(list:taasmoutput;op:Tasmop;src:tregister;a:aint;dst:tregister); + procedure tcgsparc.handle_reg_const_reg(list:TAsmList;op:Tasmop;src:tregister;a:aint;dst:tregister); var tmpreg : tregister; begin @@ -296,7 +296,7 @@ implementation end; - function tcgsparc.getfpuregister(list:Taasmoutput;size:Tcgsize):Tregister; + function tcgsparc.getfpuregister(list:TAsmList;size:Tcgsize):Tregister; begin if size=OS_F64 then result:=rg[R_FPUREGISTER].getregister(list,R_SUBFD) @@ -305,7 +305,7 @@ implementation end; - procedure TCgSparc.a_param_const(list:TAasmOutput;size:tcgsize;a:aint;const paraloc:TCGPara); + procedure TCgSparc.a_param_const(list:TAsmList;size:tcgsize;a:aint;const paraloc:TCGPara); var Ref:TReference; begin @@ -330,7 +330,7 @@ implementation end; - procedure TCgSparc.a_param_ref(list:TAasmOutput;sz:TCgSize;const r:TReference;const paraloc:TCGPara); + procedure TCgSparc.a_param_ref(list:TAsmList;sz:TCgSize;const r:TReference;const paraloc:TCGPara); var ref: treference; tmpreg:TRegister; @@ -361,7 +361,7 @@ implementation end; - procedure TCgSparc.a_paramaddr_ref(list:TAasmOutput;const r:TReference;const paraloc:TCGPara); + procedure TCgSparc.a_paramaddr_ref(list:TAsmList;const r:TReference;const paraloc:TCGPara); var Ref:TReference; TmpReg:TRegister; @@ -388,7 +388,7 @@ implementation end; - procedure tcgsparc.a_paramfpu_ref(list : taasmoutput;size : tcgsize;const ref : treference;const paraloc : TCGPara); + procedure tcgsparc.a_paramfpu_ref(list : TAsmList;size : tcgsize;const ref : treference;const paraloc : TCGPara); var href,href2 : treference; hloc : pcgparalocation; @@ -414,7 +414,7 @@ implementation end; - procedure tcgsparc.a_paramfpu_reg(list : taasmoutput;size : tcgsize;const r : tregister;const paraloc : TCGPara); + procedure tcgsparc.a_paramfpu_reg(list : TAsmList;size : tcgsize;const r : tregister;const paraloc : TCGPara); var href : treference; begin @@ -425,15 +425,15 @@ implementation end; - procedure TCgSparc.a_call_name(list:TAasmOutput;const s:string); + procedure TCgSparc.a_call_name(list:TAsmList;const s:string); begin - list.concat(taicpu.op_sym(A_CALL,objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); + list.concat(taicpu.op_sym(A_CALL,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); { Delay slot } list.concat(taicpu.op_none(A_NOP)); end; - procedure TCgSparc.a_call_reg(list:TAasmOutput;Reg:TRegister); + procedure TCgSparc.a_call_reg(list:TAsmList;Reg:TRegister); begin list.concat(taicpu.op_reg(A_CALL,reg)); { Delay slot } @@ -443,7 +443,7 @@ implementation {********************** load instructions ********************} - procedure TCgSparc.a_load_const_reg(list : TAasmOutput;size : TCGSize;a : aint;reg : TRegister); + procedure TCgSparc.a_load_const_reg(list : TAsmList;size : TCGSize;a : aint;reg : TRegister); begin { we don't use the set instruction here because it could be evalutated to two instructions which would cause problems with the delay slot (FK) } @@ -462,7 +462,7 @@ implementation end; - procedure TCgSparc.a_load_const_ref(list : TAasmOutput;size : tcgsize;a : aint;const ref : TReference); + procedure TCgSparc.a_load_const_ref(list : TAsmList;size : tcgsize;a : aint;const ref : TReference); begin if a=0 then a_load_reg_ref(list,size,size,NR_G0,ref) @@ -471,7 +471,7 @@ implementation end; - procedure TCgSparc.a_load_reg_ref(list:TAasmOutput;FromSize,ToSize:TCGSize;reg:tregister;const Ref:TReference); + procedure TCgSparc.a_load_reg_ref(list:TAsmList;FromSize,ToSize:TCGSize;reg:tregister;const Ref:TReference); var op : tasmop; begin @@ -495,7 +495,7 @@ implementation end; - procedure TCgSparc.a_load_ref_reg(list:TAasmOutput;FromSize,ToSize:TCgSize;const ref:TReference;reg:tregister); + procedure TCgSparc.a_load_ref_reg(list:TAsmList;FromSize,ToSize:TCgSize;const ref:TReference;reg:tregister); var op : tasmop; begin @@ -523,7 +523,7 @@ implementation end; - procedure TCgSparc.a_load_reg_reg(list:TAasmOutput;fromsize,tosize:tcgsize;reg1,reg2:tregister); + procedure TCgSparc.a_load_reg_reg(list:TAsmList;fromsize,tosize:tcgsize;reg1,reg2:tregister); var instr : taicpu; begin @@ -577,7 +577,7 @@ implementation end; - procedure TCgSparc.a_loadaddr_ref_reg(list : TAasmOutput;const ref : TReference;r : tregister); + procedure TCgSparc.a_loadaddr_ref_reg(list : TAsmList;const ref : TReference;r : tregister); var tmpref,href : treference; hreg,tmpreg : tregister; @@ -674,7 +674,7 @@ implementation end; - procedure TCgSparc.a_loadfpu_reg_reg(list:TAasmOutput;size:tcgsize;reg1, reg2:tregister); + procedure TCgSparc.a_loadfpu_reg_reg(list:TAsmList;size:tcgsize;reg1, reg2:tregister); const FpuMovInstr : Array[OS_F32..OS_F64] of TAsmOp = (A_FMOVS,A_FMOVD); @@ -692,7 +692,7 @@ implementation end; - procedure TCgSparc.a_loadfpu_ref_reg(list:TAasmOutput;size:tcgsize;const ref:TReference;reg:tregister); + procedure TCgSparc.a_loadfpu_ref_reg(list:TAsmList;size:tcgsize;const ref:TReference;reg:tregister); const FpuLoadInstr : Array[OS_F32..OS_F64] of TAsmOp = (A_LDF,A_LDDF); @@ -701,7 +701,7 @@ implementation end; - procedure TCgSparc.a_loadfpu_reg_ref(list:TAasmOutput;size:tcgsize;reg:tregister;const ref:TReference); + procedure TCgSparc.a_loadfpu_reg_ref(list:TAsmList;size:tcgsize;reg:tregister;const ref:TReference); const FpuLoadInstr : Array[OS_F32..OS_F64] of TAsmOp = (A_STF,A_STDF); @@ -710,7 +710,7 @@ implementation end; - procedure TCgSparc.a_op_const_reg(list:TAasmOutput;Op:TOpCG;size:tcgsize;a:aint;reg:TRegister); + procedure TCgSparc.a_op_const_reg(list:TAsmList;Op:TOpCG;size:tcgsize;a:aint;reg:TRegister); begin if Op in [OP_NEG,OP_NOT] then internalerror(200306011); @@ -721,7 +721,7 @@ implementation end; - procedure TCgSparc.a_op_reg_reg(list:TAasmOutput;Op:TOpCG;size:TCGSize;src, dst:TRegister); + procedure TCgSparc.a_op_reg_reg(list:TAsmList;Op:TOpCG;size:TCGSize;src, dst:TRegister); var a : aint; begin @@ -746,7 +746,7 @@ implementation end; - procedure TCgSparc.a_op_const_reg_reg(list:TAasmOutput;op:TOpCg;size:tcgsize;a:aint;src, dst:tregister); + procedure TCgSparc.a_op_const_reg_reg(list:TAsmList;op:TOpCg;size:tcgsize;a:aint;src, dst:tregister); var power : longInt; begin @@ -775,13 +775,13 @@ implementation end; - procedure TCgSparc.a_op_reg_reg_reg(list:TAasmOutput;op:TOpCg;size:tcgsize;src1, src2, dst:tregister); + procedure TCgSparc.a_op_reg_reg_reg(list:TAsmList;op:TOpCg;size:tcgsize;src1, src2, dst:tregister); begin list.concat(taicpu.op_reg_reg_reg(TOpCG2AsmOp[op],src2,src1,dst)); end; - procedure tcgsparc.a_op_const_reg_reg_checkoverflow(list: taasmoutput; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation); + procedure tcgsparc.a_op_const_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister;setflags : boolean;var ovloc : tlocation); var power : longInt; tmpreg1,tmpreg2 : tregister; @@ -827,7 +827,7 @@ implementation end; - procedure tcgsparc.a_op_reg_reg_reg_checkoverflow(list: taasmoutput; op: TOpCg; size: tcgsize; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation); + procedure tcgsparc.a_op_reg_reg_reg_checkoverflow(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister;setflags : boolean;var ovloc : tlocation); var tmpreg1,tmpreg2 : tregister; begin @@ -864,7 +864,7 @@ implementation {*************** compare instructructions ****************} - procedure TCgSparc.a_cmp_const_reg_label(list:TAasmOutput;size:tcgsize;cmp_op:topcmp;a:aint;reg:tregister;l:tasmlabel); + procedure TCgSparc.a_cmp_const_reg_label(list:TAsmList;size:tcgsize;cmp_op:topcmp;a:aint;reg:tregister;l:tasmlabel); begin if (a=0) then list.concat(taicpu.op_reg_reg_reg(A_SUBcc,reg,NR_G0,NR_G0)) @@ -874,30 +874,30 @@ implementation end; - procedure TCgSparc.a_cmp_reg_reg_label(list:TAasmOutput;size:tcgsize;cmp_op:topcmp;reg1,reg2:tregister;l:tasmlabel); + procedure TCgSparc.a_cmp_reg_reg_label(list:TAsmList;size:tcgsize;cmp_op:topcmp;reg1,reg2:tregister;l:tasmlabel); begin list.concat(taicpu.op_reg_reg_reg(A_SUBcc,reg2,reg1,NR_G0)); a_jmp_cond(list,cmp_op,l); end; - procedure TCgSparc.a_jmp_always(List:TAasmOutput;l:TAsmLabel); + procedure TCgSparc.a_jmp_always(List:TAsmList;l:TAsmLabel); begin - List.Concat(TAiCpu.op_sym(A_BA,objectlibrary.newasmsymbol(l.name,AB_EXTERNAL,AT_FUNCTION))); + List.Concat(TAiCpu.op_sym(A_BA,current_asmdata.newasmsymbol(l.name,AB_EXTERNAL,AT_FUNCTION))); { Delay slot } list.Concat(TAiCpu.Op_none(A_NOP)); end; - procedure tcgsparc.a_jmp_name(list : taasmoutput;const s : string); + procedure tcgsparc.a_jmp_name(list : TAsmList;const s : string); begin - List.Concat(TAiCpu.op_sym(A_BA,objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); + List.Concat(TAiCpu.op_sym(A_BA,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); { Delay slot } list.Concat(TAiCpu.Op_none(A_NOP)); end; - procedure TCgSparc.a_jmp_cond(list:TAasmOutput;cond:TOpCmp;l:TAsmLabel); + procedure TCgSparc.a_jmp_cond(list:TAsmList;cond:TOpCmp;l:TAsmLabel); var ai:TAiCpu; begin @@ -909,7 +909,7 @@ implementation end; - procedure TCgSparc.a_jmp_flags(list:TAasmOutput;const f:TResFlags;l:tasmlabel); + procedure TCgSparc.a_jmp_flags(list:TAsmList;const f:TResFlags;l:tasmlabel); var ai : taicpu; op : tasmop; @@ -926,11 +926,11 @@ implementation end; - procedure TCgSparc.g_flags2reg(list:TAasmOutput;Size:TCgSize;const f:tresflags;reg:TRegister); + procedure TCgSparc.g_flags2reg(list:TAsmList;Size:TCgSize;const f:tresflags;reg:TRegister); var hl : tasmlabel; begin - objectlibrary.getjumplabel(hl); + current_asmdata.getjumplabel(hl); a_load_const_reg(list,size,1,reg); a_jmp_flags(list,f,hl); a_load_const_reg(list,size,0,reg); @@ -938,7 +938,7 @@ implementation end; - procedure tcgsparc.g_overflowCheck(List:TAasmOutput;const Loc:TLocation;def:TDef); + procedure tcgsparc.g_overflowCheck(List:TAsmList;const Loc:TLocation;def:TDef); var l : tlocation; begin @@ -947,7 +947,7 @@ implementation end; - procedure TCgSparc.g_overflowCheck_loc(List:TAasmOutput;const Loc:TLocation;def:TDef;ovloc : tlocation); + procedure TCgSparc.g_overflowCheck_loc(List:TAsmList;const Loc:TLocation;def:TDef;ovloc : tlocation); var hl : tasmlabel; ai:TAiCpu; @@ -955,7 +955,7 @@ implementation begin if not(cs_check_overflow in aktlocalswitches) then exit; - objectlibrary.getjumplabel(hl); + current_asmdata.getjumplabel(hl); case ovloc.loc of LOC_VOID: begin @@ -988,7 +988,7 @@ implementation { *********** entry/exit code and address loading ************ } - procedure TCgSparc.g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean); + procedure TCgSparc.g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean); begin if nostackframe then exit; @@ -1016,13 +1016,13 @@ implementation end; - procedure TCgSparc.g_restore_standard_registers(list:taasmoutput); + procedure TCgSparc.g_restore_standard_registers(list:TAsmList); begin { The sparc port uses the sparc standard calling convetions so this function has no used } end; - procedure TCgSparc.g_proc_exit(list : taasmoutput;parasize:longint;nostackframe:boolean); + procedure TCgSparc.g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean); var hr : treference; begin @@ -1065,7 +1065,7 @@ implementation end; - procedure TCgSparc.g_save_standard_registers(list : taasmoutput); + procedure TCgSparc.g_save_standard_registers(list : TAsmList); begin { The sparc port uses the sparc standard calling convetions so this function has no used } end; @@ -1073,7 +1073,7 @@ implementation { ************* concatcopy ************ } - procedure tcgsparc.g_concatcopy_move(list : taasmoutput;const source,dest : treference;len : aint); + procedure tcgsparc.g_concatcopy_move(list : TAsmList;const source,dest : treference;len : aint); var paraloc1,paraloc2,paraloc3 : TCGPara; begin @@ -1103,7 +1103,7 @@ implementation end; - procedure TCgSparc.g_concatcopy(list:taasmoutput;const source,dest:treference;len:aint); + procedure TCgSparc.g_concatcopy(list:TAsmList;const source,dest:treference;len:aint); var tmpreg1, hreg, @@ -1140,7 +1140,7 @@ implementation a_load_const_reg(list,OS_INT,count,countreg); { explicitely allocate R_O0 since it can be used safely here } { (for holding date that's being copied) } - objectlibrary.getjumplabel(lab); + current_asmdata.getjumplabel(lab); a_label(list, lab); list.concat(taicpu.op_ref_reg(A_LD,src,tmpreg1)); list.concat(taicpu.op_reg_ref(A_ST,tmpreg1,dst)); @@ -1196,7 +1196,7 @@ implementation end; - procedure tcgsparc.g_concatcopy_unaligned(list : taasmoutput;const source,dest : treference;len : aint); + procedure tcgsparc.g_concatcopy_unaligned(list : TAsmList;const source,dest : treference;len : aint); var src, dst: TReference; tmpreg1, @@ -1228,7 +1228,7 @@ implementation a_load_const_reg(list,OS_INT,len,countreg); { explicitely allocate R_O0 since it can be used safely here } { (for holding date that's being copied) } - objectlibrary.getjumplabel(lab); + current_asmdata.getjumplabel(lab); a_label(list, lab); list.concat(taicpu.op_ref_reg(A_LDUB,src,tmpreg1)); list.concat(taicpu.op_reg_ref(A_STB,tmpreg1,dst)); @@ -1258,7 +1258,7 @@ implementation end; - procedure tcgsparc.g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint); + procedure tcgsparc.g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint); var make_global : boolean; href : treference; @@ -1298,7 +1298,7 @@ implementation list.concat(taicpu.op_reg(A_JMP,NR_L1)); end else - list.concat(taicpu.op_sym(A_BA,objectlibrary.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); + list.concat(taicpu.op_sym(A_BA,current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); { Delay slot } list.Concat(TAiCpu.Op_none(A_NOP)); @@ -1310,7 +1310,7 @@ implementation ****************************************************************************} - procedure tcg64sparc.a_load64_reg_ref(list : taasmoutput;reg : tregister64;const ref : treference); + procedure tcg64sparc.a_load64_reg_ref(list : TAsmList;reg : tregister64;const ref : treference); var tmpref: treference; begin @@ -1322,7 +1322,7 @@ implementation end; - procedure tcg64sparc.a_load64_ref_reg(list : taasmoutput;const ref : treference;reg : tregister64); + procedure tcg64sparc.a_load64_ref_reg(list : TAsmList;const ref : treference;reg : tregister64); var tmpref: treference; begin @@ -1334,7 +1334,7 @@ implementation end; - procedure tcg64sparc.a_param64_ref(list : taasmoutput;const r : treference;const paraloc : tcgpara); + procedure tcg64sparc.a_param64_ref(list : TAsmList;const r : treference;const paraloc : tcgpara); var hreg64 : tregister64; begin @@ -1387,7 +1387,7 @@ implementation end; - procedure TCg64Sparc.a_op64_reg_reg(list:TAasmOutput;op:TOpCG;size : tcgsize;regsrc,regdst:TRegister64); + procedure TCg64Sparc.a_op64_reg_reg(list:TAsmList;op:TOpCG;size : tcgsize;regsrc,regdst:TRegister64); var op1,op2 : TAsmOp; begin @@ -1412,7 +1412,7 @@ implementation end; - procedure TCg64Sparc.a_op64_const_reg(list:TAasmOutput;op:TOpCG;size : tcgsize;value:int64;regdst:TRegister64); + procedure TCg64Sparc.a_op64_const_reg(list:TAsmList;op:TOpCG;size : tcgsize;value:int64;regdst:TRegister64); var op1,op2:TAsmOp; begin @@ -1427,7 +1427,7 @@ implementation end; - procedure tcg64sparc.a_op64_const_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64; regsrc,regdst : tregister64); + procedure tcg64sparc.a_op64_const_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;value : int64; regsrc,regdst : tregister64); var l : tlocation; begin @@ -1435,7 +1435,7 @@ implementation end; - procedure tcg64sparc.a_op64_reg_reg_reg(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64); + procedure tcg64sparc.a_op64_reg_reg_reg(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64); var l : tlocation; begin @@ -1443,7 +1443,7 @@ implementation end; - procedure tcg64sparc.a_op64_const_reg_reg_checkoverflow(list: taasmoutput;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation); + procedure tcg64sparc.a_op64_const_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation); var op1,op2:TAsmOp; begin @@ -1458,7 +1458,7 @@ implementation end; - procedure tcg64sparc.a_op64_reg_reg_reg_checkoverflow(list: taasmoutput;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation); + procedure tcg64sparc.a_op64_reg_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation); var op1,op2:TAsmOp; begin diff --git a/compiler/sparc/ncpuadd.pas b/compiler/sparc/ncpuadd.pas index 413880988f..4dcdb6c1e5 100644 --- a/compiler/sparc/ncpuadd.pas +++ b/compiler/sparc/ncpuadd.pas @@ -47,7 +47,7 @@ interface uses systems, cutils,verbose, - paramgr, + paramgr,procinfo, aasmtai,aasmcpu,defutil, cgbase,cgcpu,cgutils, cpupara, @@ -166,8 +166,8 @@ interface { force fpureg as location, left right doesn't matter as both will be in a fpureg } - location_force_fpureg(exprasmlist,left.location,true); - location_force_fpureg(exprasmlist,right.location,(left.location.loc<>LOC_CFPUREGISTER)); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,right.location,(left.location.loc<>LOC_CFPUREGISTER)); location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def)); if left.location.loc<>LOC_CFPUREGISTER then @@ -208,7 +208,7 @@ interface internalerror(200306014); end; - exprasmlist.concat(taicpu.op_reg_reg_reg(op, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op, left.location.register,right.location.register,location.register)); end; @@ -223,8 +223,8 @@ interface { force fpureg as location, left right doesn't matter as both will be in a fpureg } - location_force_fpureg(exprasmlist,left.location,true); - location_force_fpureg(exprasmlist,right.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,right.location,true); location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=getfpuresflags; @@ -233,10 +233,10 @@ interface op:=A_FCMPd else op:=A_FCMPs; - exprasmlist.concat(taicpu.op_reg_reg(op, + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op, left.location.register,right.location.register)); { Delay slot (can only contain integer operation) } - exprasmlist.concat(taicpu.op_none(A_NOP)); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_NOP)); end; @@ -246,9 +246,9 @@ interface force_reg_left_right(true,true); if right.location.loc = LOC_CONSTANT then - tcgsparc(cg).handle_reg_const_reg(exprasmlist,A_SUBcc,left.location.register,right.location.value,NR_G0) + tcgsparc(cg).handle_reg_const_reg(current_asmdata.CurrAsmList,A_SUBcc,left.location.register,right.location.value,NR_G0) else - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBcc,left.location.register,right.location.register,NR_G0)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUBcc,left.location.register,right.location.register,NR_G0)); location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=getresflags(true); @@ -261,9 +261,9 @@ interface force_reg_left_right(true,true); if right.location.loc = LOC_CONSTANT then - tcgsparc(cg).handle_reg_const_reg(exprasmlist,A_SUBcc,left.location.register,right.location.value,NR_G0) + tcgsparc(cg).handle_reg_const_reg(current_asmdata.CurrAsmList,A_SUBcc,left.location.register,right.location.value,NR_G0) else - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBcc,left.location.register,right.location.register,NR_G0)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUBcc,left.location.register,right.location.register,NR_G0)); location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=getresflags(true); @@ -282,10 +282,10 @@ interface case nodetype of ltn,gtn: begin - cg.a_jmp_flags(exprasmlist,getresflags(unsigned),truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrTrueLabel); { cheat a little bit for the negative test } toggleflag(nf_swaped); - cg.a_jmp_flags(exprasmlist,getresflags(unsigned),falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrFalseLabel); toggleflag(nf_swaped); end; lten,gten: @@ -295,19 +295,19 @@ interface nodetype:=ltn else nodetype:=gtn; - cg.a_jmp_flags(exprasmlist,getresflags(unsigned),truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrTrueLabel); { cheat for the negative test } if nodetype=ltn then nodetype:=gtn else nodetype:=ltn; - cg.a_jmp_flags(exprasmlist,getresflags(unsigned),falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrFalseLabel); nodetype:=oldnodetype; end; equaln: - cg.a_jmp_flags(exprasmlist,F_NE,falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NE,current_procinfo.CurrFalseLabel); unequaln: - cg.a_jmp_flags(exprasmlist,F_NE,truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NE,current_procinfo.CurrTrueLabel); end; end; @@ -320,18 +320,18 @@ interface begin { the comparisaion of the low dword have to be } { always unsigned! } - cg.a_jmp_flags(exprasmlist,getresflags(true),truelabel); - cg.a_jmp_always(exprasmlist,falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(true),current_procinfo.CurrTrueLabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); end; equaln: begin - cg.a_jmp_flags(exprasmlist,F_NE,falselabel); - cg.a_jmp_always(exprasmlist,truelabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NE,current_procinfo.CurrFalseLabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); end; unequaln: begin - cg.a_jmp_flags(exprasmlist,F_NE,truelabel); - cg.a_jmp_always(exprasmlist,falselabel); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NE,current_procinfo.CurrTrueLabel); + cg.a_jmp_always(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); end; end; end; @@ -345,9 +345,9 @@ interface location_reset(location,LOC_JUMP,OS_NO); - exprasmlist.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reghi,right.location.register64.reghi)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reghi,right.location.register64.reghi)); firstjmp64bitcmp; - exprasmlist.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reglo,right.location.register64.reglo)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_CMP,left.location.register64.reglo,right.location.register64.reglo)); secondjmp64bitcmp; end; @@ -363,9 +363,9 @@ interface not(is_signed(right.resulttype.def)); if right.location.loc = LOC_CONSTANT then - tcgsparc(cg).handle_reg_const_reg(exprasmlist,A_SUBcc,left.location.register,right.location.value,NR_G0) + tcgsparc(cg).handle_reg_const_reg(current_asmdata.CurrAsmList,A_SUBcc,left.location.register,right.location.value,NR_G0) else - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBcc,left.location.register,right.location.register,NR_G0)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUBcc,left.location.register,right.location.register,NR_G0)); location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=getresflags(unsigned); diff --git a/compiler/sparc/ncpucall.pas b/compiler/sparc/ncpucall.pas index 343957ced8..ff56aa25af 100644 --- a/compiler/sparc/ncpucall.pas +++ b/compiler/sparc/ncpucall.pas @@ -47,7 +47,7 @@ implementation procedure tsparccallnode.extra_post_call_code; begin if paramanager.ret_in_param(procdefinition.rettype.def,procdefinition.proccalloption) then - exprasmlist.concat(taicpu.op_const(A_UNIMP,procdefinition.rettype.def.size and $fff)); + current_asmdata.CurrAsmList.concat(taicpu.op_const(A_UNIMP,procdefinition.rettype.def.size and $fff)); end; diff --git a/compiler/sparc/ncpucnv.pas b/compiler/sparc/ncpucnv.pas index 26df287315..7ff8064d98 100644 --- a/compiler/sparc/ncpucnv.pas +++ b/compiler/sparc/ncpucnv.pas @@ -59,7 +59,7 @@ implementation symconst,symdef,aasmbase,aasmtai, defutil, cgbase,cgutils,pass_1,pass_2, - ncon,ncal, + ncon,ncal,procinfo, ncgutil, cpubase,aasmcpu, tgobj,cgobj; @@ -115,18 +115,18 @@ implementation procedure loadsigned; begin - location_force_mem(exprasmlist,left.location); + location_force_mem(current_asmdata.CurrAsmList,left.location); { Load memory in fpu register } - cg.a_loadfpu_ref_reg(exprasmlist,OS_F32,left.location.reference,location.register); - tg.ungetiftemp(exprasmlist,left.location.reference); + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,OS_F32,left.location.reference,location.register); + tg.ungetiftemp(current_asmdata.CurrAsmList,left.location.reference); { Convert value in fpu register from integer to float } case tfloatdef(resulttype.def).typ of s32real: - exprasmlist.concat(taicpu.op_reg_reg(A_FiTOs,location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FiTOs,location.register,location.register)); s64real: - exprasmlist.concat(taicpu.op_reg_reg(A_FiTOd,location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FiTOd,location.register,location.register)); s128real: - exprasmlist.concat(taicpu.op_reg_reg(A_FiTOq,location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FiTOq,location.register,location.register)); else internalerror(200408011); end; @@ -141,50 +141,50 @@ implementation location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def)); if is_signed(left.resulttype.def) then begin - location.register:=cg.getfpuregister(exprasmlist,location.size); + location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); loadsigned; end else begin - objectlibrary.getdatalabel(l1); - objectlibrary.getjumplabel(l2); + current_asmdata.getdatalabel(l1); + current_asmdata.getjumplabel(l2); reference_reset_symbol(href,l1,0); - hregister:=cg.getintregister(exprasmlist,OS_32); - cg.a_load_loc_reg(exprasmlist,OS_32,left.location,hregister); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_32,left.location,hregister); { here we need always an 64 bit register } - location.register:=cg.getfpuregister(exprasmlist,OS_F64); - location_force_mem(exprasmlist,left.location); + location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64); + location_force_mem(current_asmdata.CurrAsmList,left.location); { Load memory in fpu register } - cg.a_loadfpu_ref_reg(exprasmlist,OS_F32,left.location.reference,location.register); - tg.ungetiftemp(exprasmlist,left.location.reference); - exprasmlist.concat(taicpu.op_reg_reg(A_FiTOd,location.register,location.register)); + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,OS_F32,left.location.reference,location.register); + tg.ungetiftemp(current_asmdata.CurrAsmList,left.location.reference); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FiTOd,location.register,location.register)); - exprasmList.concat(Taicpu.op_reg_reg(A_CMP,hregister,NR_G0)); - cg.a_jmp_flags(exprasmlist,F_GE,l2); + current_asmdata.CurrAsmList.concat(Taicpu.op_reg_reg(A_CMP,hregister,NR_G0)); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_GE,l2); case tfloatdef(resulttype.def).typ of { converting dword to s64real first and cut off at the end avoids precision loss } s32real, s64real: begin - hregister:=cg.getfpuregister(exprasmlist,OS_F64); - asmlist[al_typedconsts].concat(tai_align.create(const_align(8))); - asmlist[al_typedconsts].concat(Tai_label.Create(l1)); + hregister:=cg.getfpuregister(current_asmdata.CurrAsmList,OS_F64); + current_asmdata.asmlists[al_typedconsts].concat(tai_align.create(const_align(8))); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(l1)); { I got this constant from a test program (FK) } - asmlist[al_typedconsts].concat(Tai_const.Create_32bit($41f00000)); - asmlist[al_typedconsts].concat(Tai_const.Create_32bit(0)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit($41f00000)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit(0)); - cg.a_loadfpu_ref_reg(exprasmlist,OS_F64,href,hregister); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_FADDD,location.register,hregister,location.register)); - cg.a_label(exprasmlist,l2); + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,OS_F64,href,hregister); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_FADDD,location.register,hregister,location.register)); + cg.a_label(current_asmdata.CurrAsmList,l2); { cut off if we should convert to single } if tfloatdef(resulttype.def).typ=s32real then begin hregister:=location.register; - location.register:=cg.getfpuregister(exprasmlist,location.size); - exprasmlist.concat(taicpu.op_reg_reg(A_FDTOS,hregister,location.register)); + location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FDTOS,hregister,location.register)); end; end; else @@ -209,13 +209,13 @@ implementation op : tasmop; begin location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def)); - location_force_fpureg(exprasmlist,left.location,false); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,false); { Convert value in fpu register from integer to float } op:=conv_op[tfloatdef(resulttype.def).typ,tfloatdef(left.resulttype.def).typ]; if op=A_NONE then internalerror(200401121); - location.register:=cg.getfpuregister(exprasmlist,location.size); - exprasmlist.concat(taicpu.op_reg_reg(op,left.location.register,location.register)); + location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,left.location.register,location.register)); end; @@ -224,12 +224,12 @@ implementation hreg1,hreg2 : tregister; resflags : tresflags; opsize : tcgsize; - hlabel,oldtruelabel,oldfalselabel : tasmlabel; + hlabel,oldTrueLabel,oldFalseLabel : tasmlabel; begin - oldtruelabel:=truelabel; - oldfalselabel:=falselabel; - objectlibrary.getjumplabel(truelabel); - objectlibrary.getjumplabel(falselabel); + oldTrueLabel:=current_procinfo.CurrTrueLabel; + oldFalseLabel:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); secondpass(left); if codegenerror then exit; @@ -241,8 +241,8 @@ implementation (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then begin location_copy(location,left.location); - truelabel:=oldtruelabel; - falselabel:=oldfalselabel; + current_procinfo.CurrTrueLabel:=oldTrueLabel; + current_procinfo.CurrFalseLabel:=oldFalseLabel; exit; end; location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def)); @@ -252,40 +252,40 @@ implementation begin if left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE] then begin - hreg2:=cg.getintregister(exprasmlist,opsize); - cg.a_load_ref_reg(exprasmlist,opsize,opsize,left.location.reference,hreg2); + hreg2:=cg.getintregister(current_asmdata.CurrAsmList,opsize); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,opsize,opsize,left.location.reference,hreg2); end else hreg2:=left.location.register; {$ifndef cpu64bit} if left.location.size in [OS_64,OS_S64] then begin - hreg1:=cg.getintregister(exprasmlist,OS_32); - cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,hreg2,tregister(succ(longint(hreg2))),hreg1); + hreg1:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,hreg2,tregister(succ(longint(hreg2))),hreg1); hreg2:=hreg1; opsize:=OS_32; end; {$endif cpu64bit} - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBCC,NR_G0,hreg2,NR_G0)); - hreg1:=cg.getintregister(exprasmlist,opsize); - exprasmlist.concat(taicpu.op_reg_const_reg(A_ADDX,NR_G0,0,hreg1)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUBCC,NR_G0,hreg2,NR_G0)); + hreg1:=cg.getintregister(current_asmdata.CurrAsmList,opsize); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const_reg(A_ADDX,NR_G0,0,hreg1)); end; LOC_FLAGS : begin - hreg1:=cg.GetIntRegister(exprasmlist,location.size); + hreg1:=cg.GetIntRegister(current_asmdata.CurrAsmList,location.size); resflags:=left.location.resflags; - cg.g_flags2reg(exprasmlist,location.size,resflags,hreg1); + cg.g_flags2reg(current_asmdata.CurrAsmList,location.size,resflags,hreg1); end; LOC_JUMP : begin - hreg1:=cg.getintregister(exprasmlist,OS_INT); - objectlibrary.getjumplabel(hlabel); - cg.a_label(exprasmlist,truelabel); - cg.a_load_const_reg(exprasmlist,OS_INT,1,hreg1); - cg.a_jmp_always(exprasmlist,hlabel); - cg.a_label(exprasmlist,falselabel); - cg.a_load_const_reg(exprasmlist,OS_INT,0,hreg1); - cg.a_label(exprasmlist,hlabel); + hreg1:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + current_asmdata.getjumplabel(hlabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT,1,hreg1); + cg.a_jmp_always(current_asmdata.CurrAsmList,hlabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT,0,hreg1); + cg.a_label(current_asmdata.CurrAsmList,hlabel); end; else internalerror(10062); @@ -295,8 +295,8 @@ implementation if location.size in [OS_64, OS_S64] then internalerror(200408241); - truelabel:=oldtruelabel; - falselabel:=oldfalselabel; + current_procinfo.CurrTrueLabel:=oldTrueLabel; + current_procinfo.CurrFalseLabel:=oldFalseLabel; end; diff --git a/compiler/sparc/ncpuinln.pas b/compiler/sparc/ncpuinln.pas index 4e3dfb7fdc..cd77c9b505 100644 --- a/compiler/sparc/ncpuinln.pas +++ b/compiler/sparc/ncpuinln.pas @@ -60,11 +60,11 @@ implementation procedure tsparcinlinenode.load_fpu_location; begin secondpass(left); - location_force_fpureg(exprasmlist,left.location,true); + location_force_fpureg(current_asmdata.CurrAsmList,left.location,true); location_copy(location,left.location); if left.location.loc=LOC_CFPUREGISTER then begin - location.register:=cg.getfpuregister(exprasmlist,location.size); + location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size); location.loc := LOC_FPUREGISTER; end; end; @@ -102,11 +102,11 @@ implementation load_fpu_location; case tfloatdef(left.resulttype.def).typ of s32real: - exprasmlist.concat(taicpu.op_reg_reg(A_FABSs,left.location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FABSs,left.location.register,location.register)); s64real: - exprasmlist.concat(taicpu.op_reg_reg(A_FABSd,left.location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FABSd,left.location.register,location.register)); s128real: - exprasmlist.concat(taicpu.op_reg_reg(A_FABSq,left.location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FABSq,left.location.register,location.register)); else internalerror(200410031); end; @@ -118,11 +118,11 @@ implementation load_fpu_location; case tfloatdef(left.resulttype.def).typ of s32real: - exprasmlist.concat(taicpu.op_reg_reg_reg(A_FMULs,left.location.register,left.location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_FMULs,left.location.register,left.location.register,location.register)); s64real: - exprasmlist.concat(taicpu.op_reg_reg_reg(A_FMULd,left.location.register,left.location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_FMULd,left.location.register,left.location.register,location.register)); s128real: - exprasmlist.concat(taicpu.op_reg_reg_reg(A_FMULq,left.location.register,left.location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_FMULq,left.location.register,left.location.register,location.register)); else internalerror(200410032); end; @@ -134,11 +134,11 @@ implementation load_fpu_location; case tfloatdef(left.resulttype.def).typ of s32real: - exprasmlist.concat(taicpu.op_reg_reg(A_FSQRTs,left.location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FSQRTs,left.location.register,location.register)); s64real: - exprasmlist.concat(taicpu.op_reg_reg(A_FSQRTd,left.location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FSQRTd,left.location.register,location.register)); s128real: - exprasmlist.concat(taicpu.op_reg_reg(A_FSQRTq,left.location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FSQRTq,left.location.register,location.register)); else internalerror(200410033); end; diff --git a/compiler/sparc/ncpumat.pas b/compiler/sparc/ncpumat.pas index d981ba803a..1bcca11052 100644 --- a/compiler/sparc/ncpumat.pas +++ b/compiler/sparc/ncpumat.pas @@ -51,7 +51,7 @@ implementation symconst, aasmbase,aasmcpu,aasmtai, defutil, - cgbase,cgobj,pass_2, + cgbase,cgobj,pass_2,procinfo, ncon, cpubase, ncgutil,cgcpu,cgutils; @@ -80,18 +80,18 @@ implementation location_copy(location,left.location); { put numerator in register } - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),true); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true); location_copy(location,left.location); numerator := location.register; if (nodetype = modn) then - resultreg := cg.GetIntRegister(exprasmlist,OS_INT) + resultreg := cg.GetIntRegister(current_asmdata.CurrAsmList,OS_INT) else begin if (location.loc = LOC_CREGISTER) then begin location.loc := LOC_REGISTER; - location.register := cg.GetIntRegister(exprasmlist,OS_INT); + location.register := cg.GetIntRegister(current_asmdata.CurrAsmList,OS_INT); end; resultreg := location.register; end; @@ -102,21 +102,21 @@ implementation begin if is_signed(left.resulttype.def) Then begin - tmpreg:=cg.GetIntRegister(exprasmlist,OS_INT); - cg.a_op_const_reg_reg(exprasmlist,OP_SAR,OS_INT,31,numerator,tmpreg); + tmpreg:=cg.GetIntRegister(current_asmdata.CurrAsmList,OS_INT); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SAR,OS_INT,31,numerator,tmpreg); { if signed, tmpreg=right value-1, otherwise 0 } - cg.a_op_const_reg(exprasmlist,OP_AND,OS_INT,tordconstnode(right).value-1,tmpreg); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_AND,OS_INT,tordconstnode(right).value-1,tmpreg); { add to the left value } - cg.a_op_reg_reg(exprasmlist,OP_ADD,OS_INT,tmpreg,numerator); - cg.a_op_const_reg_reg(exprasmlist,OP_SAR,OS_INT,aword(power),numerator,resultreg); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_ADD,OS_INT,tmpreg,numerator); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SAR,OS_INT,aword(power),numerator,resultreg); end else - cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_INT,aword(power),numerator,resultreg); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHR,OS_INT,aword(power),numerator,resultreg); end else begin { load divider in a register if necessary } - location_force_reg(exprasmlist,right.location, + location_force_reg(current_asmdata.CurrAsmList,right.location, def_cgsize(right.resulttype.def),true); divider := right.location.register; @@ -127,37 +127,37 @@ implementation { Fill %y with the -1 or 0 depending on the highest bit } if is_signed(left.resulttype.def) then begin - tmpreg:=cg.GetIntRegister(exprasmlist,OS_INT); - exprasmlist.concat(taicpu.op_reg_const_reg(A_SRA,numerator,31,tmpreg)); - exprasmlist.concat(taicpu.op_reg_reg(A_MOV,tmpreg,NR_Y)); + tmpreg:=cg.GetIntRegister(current_asmdata.CurrAsmList,OS_INT); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const_reg(A_SRA,numerator,31,tmpreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_MOV,tmpreg,NR_Y)); end else - exprasmlist.concat(taicpu.op_reg_reg(A_MOV,NR_G0,NR_Y)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_MOV,NR_G0,NR_Y)); { wait 3 instructions slots before we can read %y } - exprasmlist.concat(taicpu.op_none(A_NOP)); - exprasmlist.concat(taicpu.op_none(A_NOP)); - exprasmlist.concat(taicpu.op_none(A_NOP)); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_NOP)); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_NOP)); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_NOP)); op := divops[is_signed(right.resulttype.def), cs_check_overflow in aktlocalswitches]; - exprasmlist.concat(taicpu.op_reg_reg_reg(op,numerator,divider,resultreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op,numerator,divider,resultreg)); if (nodetype = modn) then begin - objectlibrary.getjumplabel(overflowlabel); + current_asmdata.getjumplabel(overflowlabel); ai:=taicpu.op_cond_sym(A_Bxx,C_O,overflowlabel); ai.delayslot_annulled:=true; - exprasmlist.concat(ai); - exprasmlist.concat(taicpu.op_reg(A_NOT,resultreg)); - cg.a_label(exprasmlist,overflowlabel); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SMUL,resultreg,divider,resultreg)); - exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUB,numerator,resultreg,resultreg)); + current_asmdata.CurrAsmList.concat(ai); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_NOT,resultreg)); + cg.a_label(current_asmdata.CurrAsmList,overflowlabel); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SMUL,resultreg,divider,resultreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_SUB,numerator,resultreg,resultreg)); end; end; { set result location } location.loc:=LOC_REGISTER; location.register:=resultreg; - cg.g_overflowcheck(exprasmlist,Location,ResultType.Def); + cg.g_overflowcheck(current_asmdata.CurrAsmList,Location,ResultType.Def); end; @@ -199,7 +199,7 @@ implementation location_reset(location,LOC_REGISTER,OS_64); { load left operator in a register } - location_force_reg(exprasmlist,left.location,OS_64,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,OS_64,false); hreg64hi:=left.location.register64.reghi; hreg64lo:=left.location.register64.reglo; @@ -208,35 +208,35 @@ implementation begin if nodetype = shln then begin - cg.a_load_const_reg(exprasmlist,OS_32,0,hreg64hi); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_32,0,hreg64hi); if (shiftval and 31) <> 0 then - cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,shiftval and 31,hreg64lo,hreg64lo); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_32,shiftval and 31,hreg64lo,hreg64lo); end else begin - cg.a_load_const_reg(exprasmlist,OS_32,0,hreg64lo); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_32,0,hreg64lo); if (shiftval and 31) <> 0 then - cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,shiftval and 31,hreg64hi,hreg64hi); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHR,OS_32,shiftval and 31,hreg64hi,hreg64hi); end; location.register64.reglo:=hreg64hi; location.register64.reghi:=hreg64lo; end else begin - hregister:=cg.getintregister(exprasmlist,OS_32); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); if nodetype = shln then begin - cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,32-shiftval,hreg64lo,hregister); - cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,shiftval,hreg64hi,hreg64hi); - cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,hregister,hreg64hi,hreg64hi); - cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,shiftval,hreg64lo,hreg64lo); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHR,OS_32,32-shiftval,hreg64lo,hregister); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_32,shiftval,hreg64hi,hreg64hi); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,hregister,hreg64hi,hreg64hi); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_32,shiftval,hreg64lo,hreg64lo); end else begin - cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,32-shiftval,hreg64hi,hregister); - cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,shiftval,hreg64lo,hreg64lo); - cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,hregister,hreg64lo,hreg64lo); - cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,shiftval,hreg64hi,hreg64hi); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_32,32-shiftval,hreg64hi,hregister); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHR,OS_32,shiftval,hreg64lo,hreg64lo); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,hregister,hreg64lo,hreg64lo); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHR,OS_32,shiftval,hreg64hi,hreg64hi); end; location.register64.reghi:=hreg64hi; location.register64.reglo:=hreg64lo; @@ -245,14 +245,14 @@ implementation else begin { load left operators in a register } - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),true); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true); location_copy(location,left.location); resultreg := location.register; hregister1 := location.register; if (location.loc = LOC_CREGISTER) then begin location.loc := LOC_REGISTER; - resultreg := cg.GetIntRegister(exprasmlist,OS_INT); + resultreg := cg.GetIntRegister(current_asmdata.CurrAsmList,OS_INT); location.register := resultreg; end; { determine operator } @@ -264,13 +264,13 @@ implementation if (right.nodetype=ordconstn) then begin if tordconstnode(right).value and 31<>0 then - cg.a_op_const_reg_reg(exprasmlist,op,OS_32,tordconstnode(right).value and 31,hregister1,resultreg) + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,op,OS_32,tordconstnode(right).value and 31,hregister1,resultreg) end else begin { load shift count in a register if necessary } - location_force_reg(exprasmlist,right.location,def_cgsize(right.resulttype.def),true); - cg.a_op_reg_reg_reg(exprasmlist,op,OS_32,right.location.register,hregister1,resultreg); + location_force_reg(current_asmdata.CurrAsmList,right.location,def_cgsize(right.resulttype.def),true); + cg.a_op_reg_reg_reg(current_asmdata.CurrAsmList,op,OS_32,right.location.register,hregister1,resultreg); end; end; end; @@ -289,14 +289,14 @@ implementation } if left.expectloc=LOC_JUMP then begin - hl:=truelabel; - truelabel:=falselabel; - falselabel:=hl; + hl:=current_procinfo.CurrTrueLabel; + current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel; + current_procinfo.CurrFalseLabel:=hl; secondpass(left); - maketojumpbool(exprasmlist,left,lr_load_regvars); - hl:=truelabel; - truelabel:=falselabel; - falselabel:=hl; + maketojumpbool(current_asmdata.CurrAsmList,left,lr_load_regvars); + hl:=current_procinfo.CurrTrueLabel; + current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel; + current_procinfo.CurrFalseLabel:=hl; location.loc:=LOC_JUMP; end else @@ -310,8 +310,8 @@ implementation end; LOC_REGISTER, LOC_CREGISTER, LOC_REFERENCE, LOC_CREFERENCE : begin - location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),true); - exprasmlist.concat(taicpu.op_reg_const_reg(A_SUBcc,left.location.register,0,NR_G0)); + location_force_reg(current_asmdata.CurrAsmList,left.location,def_cgsize(left.resulttype.def),true); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_const_reg(A_SUBcc,left.location.register,0,NR_G0)); location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=F_E; end; diff --git a/compiler/sparc/ncpuset.pas b/compiler/sparc/ncpuset.pas index 6f0b955859..421c4db2b1 100644 --- a/compiler/sparc/ncpuset.pas +++ b/compiler/sparc/ncpuset.pas @@ -69,7 +69,7 @@ unit ncpuset; indexreg,jmpreg,basereg : tregister; href : treference; - procedure genitem(list:taasmoutput;t : pcaselabel); + procedure genitem(list:TAsmList;t : pcaselabel); var i : aint; begin @@ -89,29 +89,29 @@ unit ncpuset; if not(jumptable_no_range) then begin { case expr less than min_ => goto elselabel } - cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_lt,aint(min_),hregister,elselabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_lt,aint(min_),hregister,elselabel); { case expr greater than max_ => goto elselabel } - cg.a_cmp_const_reg_label(exprasmlist,opsize,jmp_gt,aint(max_),hregister,elselabel); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,jmp_gt,aint(max_),hregister,elselabel); end; - objectlibrary.getjumplabel(table); - indexreg:=cg.getaddressregister(exprasmlist); - cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_ADDR,2,hregister,indexreg); + current_asmdata.getjumplabel(table); + indexreg:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_op_const_reg_reg(current_asmdata.CurrAsmList,OP_SHL,OS_ADDR,2,hregister,indexreg); { create reference } reference_reset_symbol(href,table,0); href.offset:=(-aint(min_))*4; - basereg:=cg.getaddressregister(exprasmlist); - cg.a_loadaddr_ref_reg(exprasmlist,href,basereg); + basereg:=cg.getaddressregister(current_asmdata.CurrAsmList); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,basereg); - jmpreg:=cg.getaddressregister(exprasmlist); + jmpreg:=cg.getaddressregister(current_asmdata.CurrAsmList); reference_reset(href); href.index:=indexreg; href.base:=basereg; - cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,jmpreg); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,href,jmpreg); - exprasmlist.concat(taicpu.op_reg(A_JMP,jmpreg)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_JMP,jmpreg)); { Delay slot } - exprasmlist.concat(taicpu.op_none(A_NOP)); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_NOP)); { generate jump table } new_section(current_procinfo.aktlocaldata,sec_data,current_procinfo.procdef.mangledname,sizeof(aint)); current_procinfo.aktlocaldata.concat(Tai_label.Create(table)); diff --git a/compiler/sparc/racpu.pas b/compiler/sparc/racpu.pas index 92b4bbce3a..9643158843 100644 --- a/compiler/sparc/racpu.pas +++ b/compiler/sparc/racpu.pas @@ -36,12 +36,12 @@ interface TSparcInstruction=class(TInstruction) delayslot_annulled : boolean; { opcode adding } - function ConcatInstruction(p : taasmoutput) : tai;override; + function ConcatInstruction(p : TAsmList) : tai;override; end; implementation - function TSparcInstruction.ConcatInstruction(p : taasmoutput) : tai; + function TSparcInstruction.ConcatInstruction(p : TAsmList) : tai; begin result:=inherited ConcatInstruction(p); { delay slot annulled support } diff --git a/compiler/sparc/racpugas.pas b/compiler/sparc/racpugas.pas index 818c36b9a7..4ffd1bfa43 100644 --- a/compiler/sparc/racpugas.pas +++ b/compiler/sparc/racpugas.pas @@ -343,7 +343,7 @@ Interface Consume(AS_LPAREN); BuildConstSymbolExpression(false, true,false,l,tempstr,tempsymtyp); if not assigned(oper.opr.ref.symbol) then - oper.opr.ref.symbol:=objectlibrary.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp) + oper.opr.ref.symbol:=current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp) else Message(asmr_e_cant_have_multiple_relocatable_symbols); case oper.opr.typ of diff --git a/compiler/sparc/rgcpu.pas b/compiler/sparc/rgcpu.pas index 943158fffb..96f9d8645b 100644 --- a/compiler/sparc/rgcpu.pas +++ b/compiler/sparc/rgcpu.pas @@ -35,8 +35,8 @@ unit rgcpu; trgcpu=class(trgobj) procedure add_constraints(reg:tregister);override; function get_spill_subreg(r : tregister) : tsubregister;override; - procedure do_spill_read(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister);override; - procedure do_spill_written(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister);override; + procedure do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);override; + procedure do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);override; end; @@ -86,16 +86,16 @@ implementation end; - procedure trgcpu.do_spill_read(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister); + procedure trgcpu.do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister); var helpins : tai; tmpref : treference; - helplist : taasmoutput; + helplist : TAsmList; hreg : tregister; begin if abs(spilltemp.offset)>4095 then begin - helplist:=taasmoutput.create; + helplist:=TAsmList.create; if getregtype(tempreg)=R_INTREGISTER then hreg:=tempreg @@ -122,16 +122,16 @@ implementation end; - procedure trgcpu.do_spill_written(list:Taasmoutput;pos:tai;const spilltemp:treference;tempreg:tregister); + procedure trgcpu.do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister); var helpins : tai; tmpref : treference; - helplist : taasmoutput; + helplist : TAsmList; hreg : tregister; begin if abs(spilltemp.offset)>4095 then begin - helplist:=taasmoutput.create; + helplist:=TAsmList.create; if getregtype(tempreg)=R_INTREGISTER then hreg:=getregisterinline(helplist,R_SUBWHOLE) diff --git a/compiler/symdef.pas b/compiler/symdef.pas index 8baa662688..e651b5ab01 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -1090,16 +1090,16 @@ implementation if assigned(typesym) then begin str:=ttypesym(typesym).realname; - asmlist[al_rtti].concat(Tai_string.Create(chr(length(str))+str)); + current_asmdata.asmlists[al_rtti].concat(Tai_string.Create(chr(length(str))+str)); end else - asmlist[al_rtti].concat(Tai_string.Create(#0)) + current_asmdata.asmlists[al_rtti].concat(Tai_string.Create(#0)) end; procedure tstoreddef.write_rtti_data(rt:trttitype); begin - asmlist[al_rtti].concat(tai_const.create_8bit(tkUnknown)); + current_asmdata.asmlists[al_rtti].concat(tai_const.create_8bit(tkUnknown)); write_rtti_name; end; @@ -1121,13 +1121,13 @@ implementation begin if not assigned(localrttilab[rt]) then begin - objectlibrary.getdatalabel(localrttilab[rt]); + current_asmdata.getdatalabel(localrttilab[rt]); write_child_rtti_data(rt); - maybe_new_object_file(asmlist[al_rtti]); - new_section(asmlist[al_rtti],sec_rodata,localrttilab[rt].name,const_align(sizeof(aint))); - asmlist[al_rtti].concat(Tai_symbol.Create_global(localrttilab[rt],0)); + maybe_new_object_file(current_asmdata.asmlists[al_rtti]); + new_section(current_asmdata.asmlists[al_rtti],sec_rodata,localrttilab[rt].name,const_align(sizeof(aint))); + current_asmdata.asmlists[al_rtti].concat(Tai_symbol.Create_global(localrttilab[rt],0)); write_rtti_data(rt); - asmlist[al_rtti].concat(Tai_symbol_end.Create(localrttilab[rt])); + current_asmdata.asmlists[al_rtti].concat(Tai_symbol_end.Create(localrttilab[rt])); end; get_rtti_label:=localrttilab[rt]; end; @@ -1342,26 +1342,26 @@ implementation case string_typ of st_ansistring: begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkAString)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkAString)); write_rtti_name; end; st_widestring: begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkWString)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkWString)); write_rtti_name; end; st_longstring: begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkLString)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkLString)); write_rtti_name; end; st_shortstring: begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkSString)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkSString)); write_rtti_name; - asmlist[al_rtti].concat(Tai_const.Create_8bit(len)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(len)); {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} end; end; @@ -1535,36 +1535,36 @@ implementation var hp : tenumsym; begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkEnumeration)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkEnumeration)); write_rtti_name; {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} case longint(savesize) of 1: - asmlist[al_rtti].concat(Tai_const.Create_8bit(otUByte)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(otUByte)); 2: - asmlist[al_rtti].concat(Tai_const.Create_8bit(otUWord)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(otUWord)); 4: - asmlist[al_rtti].concat(Tai_const.Create_8bit(otULong)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(otULong)); end; {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(4)); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(4)); {$endif cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_const.Create_32bit(min)); - asmlist[al_rtti].concat(Tai_const.Create_32bit(max)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(min)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(max)); if assigned(basedef) then - asmlist[al_rtti].concat(Tai_const.Create_sym(basedef.get_rtti_label(rt))) + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(basedef.get_rtti_label(rt))) else - asmlist[al_rtti].concat(Tai_const.create_sym(nil)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.create_sym(nil)); hp:=tenumsym(firstenum); while assigned(hp) do begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(length(hp.realname))); - asmlist[al_rtti].concat(Tai_string.Create(hp.realname)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(length(hp.realname))); + current_asmdata.asmlists[al_rtti].concat(Tai_string.Create(hp.realname)); hp:=hp.nextenum; end; - asmlist[al_rtti].concat(Tai_const.Create_8bit(0)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(0)); end; @@ -1690,60 +1690,60 @@ implementation begin write_rtti_name; {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_const.Create_8bit(byte(trans[typ]))); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(byte(trans[typ]))); {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(4)); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(4)); {$endif cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_const.Create_32bit(longint(low))); - asmlist[al_rtti].concat(Tai_const.Create_32bit(longint(high))); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(longint(low))); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(longint(high))); end; begin case typ of s64bit : begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkInt64)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkInt64)); write_rtti_name; {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} { low } - asmlist[al_rtti].concat(Tai_const.Create_64bit(int64($80000000) shl 32)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_64bit(int64($80000000) shl 32)); { high } - asmlist[al_rtti].concat(Tai_const.Create_64bit((int64($7fffffff) shl 32) or int64($ffffffff))); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_64bit((int64($7fffffff) shl 32) or int64($ffffffff))); end; u64bit : begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkQWord)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkQWord)); write_rtti_name; {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} { low } - asmlist[al_rtti].concat(Tai_const.Create_64bit(0)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_64bit(0)); { high } - asmlist[al_rtti].concat(Tai_const.Create_64bit(int64((int64($ffffffff) shl 32) or int64($ffffffff)))); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_64bit(int64((int64($ffffffff) shl 32) or int64($ffffffff)))); end; bool8bit: begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkBool)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkBool)); dointeger; end; uchar: begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkChar)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkChar)); dointeger; end; uwidechar: begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkWChar)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkWChar)); dointeger; end; else begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkInteger)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkInteger)); dointeger; end; end; @@ -1858,12 +1858,12 @@ implementation translate : array[tfloattype] of byte = (ftSingle,ftDouble,ftExtended,ftComp,ftCurr,ftFloat128); begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkFloat)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkFloat)); write_rtti_name; {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_const.Create_8bit(translate[typ])); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(translate[typ])); end; @@ -2073,7 +2073,7 @@ implementation procedure tvariantdef.write_rtti_data(rt:trttitype); begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkVariant)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkVariant)); end; @@ -2324,16 +2324,16 @@ implementation procedure tsetdef.write_rtti_data(rt:trttitype); begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkSet)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkSet)); write_rtti_name; {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_const.Create_8bit(otULong)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(otULong)); {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_const.Create_sym(tstoreddef(elementtype.def).get_rtti_label(rt))); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(tstoreddef(elementtype.def).get_rtti_label(rt))); end; @@ -2566,21 +2566,21 @@ implementation procedure tarraydef.write_rtti_data(rt:trttitype); begin if IsDynamicArray then - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkdynarray)) + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkdynarray)) else - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkarray)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkarray)); write_rtti_name; {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} { size of elements } - asmlist[al_rtti].concat(Tai_const.Create_aint(elesize)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_aint(elesize)); if not(IsDynamicArray) then - asmlist[al_rtti].concat(Tai_const.Create_aint(elecount)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_aint(elecount)); { element type } - asmlist[al_rtti].concat(Tai_const.Create_sym(tstoreddef(elementtype.def).get_rtti_label(rt))); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(tstoreddef(elementtype.def).get_rtti_label(rt))); { variant type } - asmlist[al_rtti].concat(Tai_const.Create_32bit(tstoreddef(elementtype.def).getvartype)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(tstoreddef(elementtype.def).getvartype)); end; @@ -2662,8 +2662,8 @@ implementation ((tsym(sym).typ=fieldvarsym) and tfieldvarsym(sym).vartype.def.needs_inittable) then begin - asmlist[al_rtti].concat(Tai_const.Create_sym(tstoreddef(tfieldvarsym(sym).vartype.def).get_rtti_label(FRTTIType))); - asmlist[al_rtti].concat(Tai_const.Create_32bit(tfieldvarsym(sym).fieldoffset)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(tstoreddef(tfieldvarsym(sym).vartype.def).get_rtti_label(FRTTIType))); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(tfieldvarsym(sym).fieldoffset)); end; end; @@ -2805,16 +2805,16 @@ implementation procedure trecorddef.write_rtti_data(rt:trttitype); begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkrecord)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkrecord)); write_rtti_name; {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_const.Create_32bit(size)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(size)); Count:=0; FRTTIType:=rt; symtable.foreach(@count_field_rtti,nil); - asmlist[al_rtti].concat(Tai_const.Create_32bit(Count)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(Count)); symtable.foreach(@write_field_rtti,nil); end; @@ -4079,10 +4079,10 @@ implementation vs_out : paraspec := pfOut; end; { write flags for current parameter } - asmlist[al_rtti].concat(Tai_const.Create_8bit(paraspec)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(paraspec)); { write name of current parameter } - asmlist[al_rtti].concat(Tai_const.Create_8bit(length(parasym.realname))); - asmlist[al_rtti].concat(Tai_string.Create(parasym.realname)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(length(parasym.realname))); + current_asmdata.asmlists[al_rtti].concat(Tai_string.Create(parasym.realname)); { write name of type of current parameter } tstoreddef(parasym.vartype.def).write_rtti_name; @@ -4096,21 +4096,21 @@ implementation if po_methodpointer in procoptions then begin { write method id and name } - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkmethod)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkmethod)); write_rtti_name; {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} { write kind of method (can only be function or procedure)} if rettype.def = voidtype.def then methodkind := mkProcedure else methodkind := mkFunction; - asmlist[al_rtti].concat(Tai_const.Create_8bit(methodkind)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(methodkind)); { get # of parameters } - asmlist[al_rtti].concat(Tai_const.Create_8bit(maxparacount)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(maxparacount)); { write parameter info. The parameters must be written in reverse order if this method uses right to left parameter pushing! } @@ -4130,7 +4130,7 @@ implementation end else begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkprocvar)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkprocvar)); write_rtti_name; end; end; @@ -4702,7 +4702,7 @@ implementation begin if not(assigned(proc) and assigned(proc.firstsym)) then begin - asmlist[al_rtti].concat(Tai_const.create(aitconst_ptr,1)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.create(aitconst_ptr,1)); typvalue:=3; end else if proc.firstsym^.sym.typ=fieldvarsym then @@ -4735,7 +4735,7 @@ implementation end; hp:=hp^.next; end; - asmlist[al_rtti].concat(Tai_const.create(aitconst_ptr,address)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.create(aitconst_ptr,address)); typvalue:=0; end else @@ -4745,13 +4745,13 @@ implementation exit; if not(po_virtualmethod in tprocdef(proc.procdef).procoptions) then begin - asmlist[al_rtti].concat(Tai_const.createname(tprocdef(proc.procdef).mangledname,AT_FUNCTION,0)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.createname(tprocdef(proc.procdef).mangledname,AT_FUNCTION,0)); typvalue:=1; end else begin { virtual method, write vmt offset } - asmlist[al_rtti].concat(Tai_const.create(aitconst_ptr, + current_asmdata.asmlists[al_rtti].concat(Tai_const.create(aitconst_ptr, tprocdef(proc.procdef)._class.vmtmethodoffset(tprocdef(proc.procdef).extnumber))); typvalue:=2; end; @@ -4767,28 +4767,28 @@ implementation proctypesinfo:=$40 else proctypesinfo:=0; - asmlist[al_rtti].concat(Tai_const.Create_sym(tstoreddef(tpropertysym(sym).proptype.def).get_rtti_label(fullrtti))); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(tstoreddef(tpropertysym(sym).proptype.def).get_rtti_label(fullrtti))); writeproc(tpropertysym(sym).readaccess,0); writeproc(tpropertysym(sym).writeaccess,2); { isn't it stored ? } if not(ppo_stored in tpropertysym(sym).propoptions) then begin - asmlist[al_rtti].concat(Tai_const.create_sym(nil)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.create_sym(nil)); proctypesinfo:=proctypesinfo or (3 shl 4); end else writeproc(tpropertysym(sym).storedaccess,4); - asmlist[al_rtti].concat(Tai_const.Create_32bit(tpropertysym(sym).index)); - asmlist[al_rtti].concat(Tai_const.Create_32bit(tpropertysym(sym).default)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(tpropertysym(sym).index)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(tpropertysym(sym).default)); propnameitem:=searchpropnamelist(tpropertysym(sym).name); if not assigned(propnameitem) then internalerror(200512201); - asmlist[al_rtti].concat(Tai_const.Create_16bit(propnameitem.index)); - asmlist[al_rtti].concat(Tai_const.Create_8bit(proctypesinfo)); - asmlist[al_rtti].concat(Tai_const.Create_8bit(length(tpropertysym(sym).realname))); - asmlist[al_rtti].concat(Tai_string.Create(tpropertysym(sym).realname)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_16bit(propnameitem.index)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(proctypesinfo)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(length(tpropertysym(sym).realname))); + current_asmdata.asmlists[al_rtti].concat(Tai_string.Create(tpropertysym(sym).realname)); {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} end; end; @@ -4854,15 +4854,15 @@ implementation (tsym(sym).typ=fieldvarsym) then begin {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(AInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(AInt))); {$endif cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_const.Create_aint(tfieldvarsym(sym).fieldoffset)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_aint(tfieldvarsym(sym).fieldoffset)); hp:=searchproptablelist(tobjectdef(tfieldvarsym(sym).vartype.def)); if not(assigned(hp)) then internalerror(0206002); - asmlist[al_rtti].concat(Tai_const.Create_16bit(hp.index)); - asmlist[al_rtti].concat(Tai_const.Create_8bit(length(tfieldvarsym(sym).realname))); - asmlist[al_rtti].concat(Tai_string.Create(tfieldvarsym(sym).realname)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_16bit(hp.index)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(length(tfieldvarsym(sym).realname))); + current_asmdata.asmlists[al_rtti].concat(Tai_string.Create(tfieldvarsym(sym).realname)); end; end; @@ -4875,32 +4875,32 @@ implementation fieldcount : longint; begin proptablelist:=TLinkedList.Create; - objectlibrary.getdatalabel(fieldtable); - objectlibrary.getdatalabel(classtable); - maybe_new_object_file(asmlist[al_rtti]); - new_section(asmlist[al_rtti],sec_rodata,classtable.name,const_align(sizeof(aint))); + current_asmdata.getdatalabel(fieldtable); + current_asmdata.getdatalabel(classtable); + maybe_new_object_file(current_asmdata.asmlists[al_rtti]); + new_section(current_asmdata.asmlists[al_rtti],sec_rodata,classtable.name,const_align(sizeof(aint))); { fields } fieldcount:=0; symtable.foreach(@count_published_fields,@fieldcount); - asmlist[al_rtti].concat(Tai_label.Create(fieldtable)); - asmlist[al_rtti].concat(Tai_const.Create_16bit(fieldcount)); + current_asmdata.asmlists[al_rtti].concat(Tai_label.Create(fieldtable)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_16bit(fieldcount)); {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_const.Create_sym(classtable)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(classtable)); symtable.foreach(@writefields,nil); { generate the class table } - asmlist[al_rtti].concat(tai_align.create(const_align(sizeof(aint)))); - asmlist[al_rtti].concat(Tai_label.Create(classtable)); - asmlist[al_rtti].concat(Tai_const.Create_16bit(proptablelist.count)); + current_asmdata.asmlists[al_rtti].concat(tai_align.create(const_align(sizeof(aint)))); + current_asmdata.asmlists[al_rtti].concat(Tai_label.Create(classtable)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_16bit(proptablelist.count)); {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} hp:=tproptablelistitem(proptablelist.first); while assigned(hp) do begin - asmlist[al_rtti].concat(Tai_const.Createname(tobjectdef(hp.def).vmt_mangledname,AT_DATA,0)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Createname(tobjectdef(hp.def).vmt_mangledname,AT_DATA,0)); hp:=tproptablelistitem(hp.next); end; @@ -4925,33 +4925,33 @@ implementation begin case objecttype of odt_class: - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkclass)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkclass)); odt_object: - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkobject)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkobject)); odt_interfacecom: - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkinterface)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkinterface)); odt_interfacecorba: - asmlist[al_rtti].concat(Tai_const.Create_8bit(tkinterfaceCorba)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(tkinterfaceCorba)); else exit; end; { generate the name } - asmlist[al_rtti].concat(Tai_const.Create_8bit(length(objrealname^))); - asmlist[al_rtti].concat(Tai_string.Create(objrealname^)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(length(objrealname^))); + current_asmdata.asmlists[al_rtti].concat(Tai_string.Create(objrealname^)); {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} case rt of initrtti : begin - asmlist[al_rtti].concat(Tai_const.Create_32bit(size)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(size)); if objecttype in [odt_class,odt_object] then begin count:=0; FRTTIType:=rt; symtable.foreach(@count_field_rtti,nil); - asmlist[al_rtti].concat(Tai_const.Create_32bit(count)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(count)); symtable.foreach(@write_field_rtti,nil); end; end; @@ -4964,27 +4964,27 @@ implementation if not(objecttype in [odt_interfacecom,odt_interfacecorba]) then begin if (oo_has_vmt in objectoptions) then - asmlist[al_rtti].concat(Tai_const.Createname(vmt_mangledname,AT_DATA,0)) + current_asmdata.asmlists[al_rtti].concat(Tai_const.Createname(vmt_mangledname,AT_DATA,0)) else - asmlist[al_rtti].concat(Tai_const.create_sym(nil)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.create_sym(nil)); end; { write parent typeinfo } if assigned(childof) and ((oo_can_have_published in childof.objectoptions) or (objecttype in [odt_interfacecom,odt_interfacecorba])) then - asmlist[al_rtti].concat(Tai_const.Create_sym(childof.get_rtti_label(fullrtti))) + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(childof.get_rtti_label(fullrtti))) else - asmlist[al_rtti].concat(Tai_const.create_sym(nil)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.create_sym(nil)); if objecttype in [odt_object,odt_class] then begin { total number of unique properties } - asmlist[al_rtti].concat(Tai_const.Create_16bit(propnamelist.count)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_16bit(propnamelist.count)); end else { interface: write flags, iid and iidstr } begin - asmlist[al_rtti].concat(Tai_const.Create_32bit( + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit( { ugly, but working } longint([ TCompilerIntfFlag(ord(ifHasGuid)*ord(assigned(iidguid))), @@ -4995,21 +4995,21 @@ implementation ifDispatch, } )); {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_const.Create_32bit(longint(iidguid^.D1))); - asmlist[al_rtti].concat(Tai_const.Create_16bit(iidguid^.D2)); - asmlist[al_rtti].concat(Tai_const.Create_16bit(iidguid^.D3)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(longint(iidguid^.D1))); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_16bit(iidguid^.D2)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_16bit(iidguid^.D3)); for i:=Low(iidguid^.D4) to High(iidguid^.D4) do - asmlist[al_rtti].concat(Tai_const.Create_8bit(iidguid^.D4[i])); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(iidguid^.D4[i])); end; { write unit name } - asmlist[al_rtti].concat(Tai_const.Create_8bit(length(current_module.realmodulename^))); - asmlist[al_rtti].concat(Tai_string.Create(current_module.realmodulename^)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(length(current_module.realmodulename^))); + current_asmdata.asmlists[al_rtti].concat(Tai_string.Create(current_module.realmodulename^)); {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} { write iidstr } @@ -5017,13 +5017,13 @@ implementation begin if assigned(iidstr) then begin - asmlist[al_rtti].concat(Tai_const.Create_8bit(length(iidstr^))); - asmlist[al_rtti].concat(Tai_string.Create(iidstr^)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(length(iidstr^))); + current_asmdata.asmlists[al_rtti].concat(Tai_string.Create(iidstr^)); end else - asmlist[al_rtti].concat(Tai_const.Create_8bit(0)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(0)); {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} end; @@ -5032,9 +5032,9 @@ implementation begin propcount:=0; symtable.foreach(@count_published_properties,@propcount); - asmlist[al_rtti].concat(Tai_const.Create_16bit(propcount)); + current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_16bit(propcount)); {$ifdef cpurequiresproperalignment} - asmlist[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); + current_asmdata.asmlists[al_rtti].concat(Tai_align.Create(sizeof(TConstPtrUInt))); {$endif cpurequiresproperalignment} end; symtable.foreach(@write_property_info,nil); diff --git a/compiler/symsym.pas b/compiler/symsym.pas index f45da0e81a..8f0dc32d26 100644 --- a/compiler/symsym.pas +++ b/compiler/symsym.pas @@ -367,6 +367,7 @@ implementation { tree } node, { aasm } + aasmtai, { codegen } paramgr, procinfo @@ -2325,7 +2326,7 @@ implementation begin { the label is always a global label } if not assigned(lab) then - lab:=objectlibrary.newasmsymbol(mangledname,AB_EXTERNAL,AT_DATA); + lab:=current_asmdata.newasmsymbol(mangledname,AB_EXTERNAL,AT_DATA); get_label:=lab; end; diff --git a/compiler/systems/t_beos.pas b/compiler/systems/t_beos.pas index 3db531626b..121af6c488 100644 --- a/compiler/systems/t_beos.pas +++ b/compiler/systems/t_beos.pas @@ -165,10 +165,10 @@ begin begin {$ifdef i386} { place jump in al_procedures } - asmlist[al_procedures].concat(Tai_align.Create_op(4,$90)); - asmlist[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); - asmlist[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); - asmlist[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); + current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90)); + current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); + current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); + current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); {$endif i386} end; end diff --git a/compiler/systems/t_bsd.pas b/compiler/systems/t_bsd.pas index b04230fc97..86a2996c92 100644 --- a/compiler/systems/t_bsd.pas +++ b/compiler/systems/t_bsd.pas @@ -90,8 +90,8 @@ implementation procedure timportlibdarwin.preparelib(const s : string); begin - if asmlist[al_imports]=nil then - asmlist[al_imports]:=TAAsmoutput.create; + if current_asmdata.asmlists[al_imports]=nil then + current_asmdata.asmlists[al_imports]:=TAsmList.create; end; @@ -212,7 +212,7 @@ var sym : tasmsymbol; r : treference; begin - new_section(asmlist[al_procedures],sec_code,'',0); + new_section(current_asmdata.asmlists[al_procedures],sec_code,'',0); hp2:=texported_item(current_module._exports.first); while assigned(hp2) do begin @@ -224,25 +224,25 @@ begin if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then begin { place jump in al_procedures } - asmlist[al_procedures].concat(tai_align.create(target_info.alignment.procalign)); - asmlist[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); + current_asmdata.asmlists[al_procedures].concat(tai_align.create(target_info.alignment.procalign)); + current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); if (cs_create_pic in aktmoduleswitches) and { other targets need to be checked how it works } (target_info.system in [system_i386_freebsd]) then begin {$ifdef x86} - sym:=objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION); + sym:=current_asmdata.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION); reference_reset_symbol(r,sym,0); if cs_create_pic in aktmoduleswitches then r.refaddr:=addr_pic else r.refaddr:=addr_full; - asmlist[al_procedures].concat(taicpu.op_ref(A_JMP,S_NO,r)); + current_asmdata.asmlists[al_procedures].concat(taicpu.op_ref(A_JMP,S_NO,r)); {$endif x86} end else - cg.a_jmp_name(asmlist[al_procedures],tprocsym(hp2.sym).first_procdef.mangledname); - asmlist[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); + cg.a_jmp_name(current_asmdata.asmlists[al_procedures],tprocsym(hp2.sym).first_procdef.mangledname); + current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); end; end else diff --git a/compiler/systems/t_linux.pas b/compiler/systems/t_linux.pas index d16df12e4e..189604283f 100644 --- a/compiler/systems/t_linux.pas +++ b/compiler/systems/t_linux.pas @@ -160,7 +160,7 @@ var sym : tasmsymbol; r : treference; begin - new_section(asmlist[al_procedures],sec_code,'',0); + new_section(current_asmdata.asmlists[al_procedures],sec_code,'',0); hp2:=texported_item(current_module._exports.first); while assigned(hp2) do begin @@ -172,25 +172,25 @@ begin if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then begin { place jump in al_procedures } - asmlist[al_procedures].concat(tai_align.create(target_info.alignment.procalign)); - asmlist[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); + current_asmdata.asmlists[al_procedures].concat(tai_align.create(target_info.alignment.procalign)); + current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); if (cs_create_pic in aktmoduleswitches) and { other targets need to be checked how it works } (target_info.system in [system_x86_64_linux,system_i386_linux]) then begin {$ifdef x86} - sym:=objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION); + sym:=current_asmdata.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION); reference_reset_symbol(r,sym,0); if cs_create_pic in aktmoduleswitches then r.refaddr:=addr_pic else r.refaddr:=addr_full; - asmlist[al_procedures].concat(taicpu.op_ref(A_JMP,S_NO,r)); + current_asmdata.asmlists[al_procedures].concat(taicpu.op_ref(A_JMP,S_NO,r)); {$endif x86} end else - cg.a_jmp_name(asmlist[al_procedures],tprocsym(hp2.sym).first_procdef.mangledname); - asmlist[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); + cg.a_jmp_name(current_asmdata.asmlists[al_procedures],tprocsym(hp2.sym).first_procdef.mangledname); + current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); end; end else diff --git a/compiler/systems/t_nwl.pas b/compiler/systems/t_nwl.pas index e87a960f2c..42a9a82589 100644 --- a/compiler/systems/t_nwl.pas +++ b/compiler/systems/t_nwl.pas @@ -242,10 +242,10 @@ begin begin {$ifdef i386} { place jump in al_procedures } - asmlist[al_procedures].concat(Tai_align.Create_op(4,$90)); - asmlist[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); - asmlist[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); - asmlist[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); + current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90)); + current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); + current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); + current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); {$endif i386} end; end diff --git a/compiler/systems/t_nwm.pas b/compiler/systems/t_nwm.pas index e5be4591fa..605c9e123e 100644 --- a/compiler/systems/t_nwm.pas +++ b/compiler/systems/t_nwm.pas @@ -234,10 +234,10 @@ begin begin {$ifdef i386} { place jump in al_procedures } - asmlist[al_procedures].concat(Tai_align.Create_op(4,$90)); - asmlist[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); - asmlist[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); - asmlist[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); + current_asmdata.asmlists[al_procedures].concat(Tai_align.Create_op(4,$90)); + current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); + current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_sym(A_JMP,S_NO,current_asmdata.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); + current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); {$endif i386} end; end diff --git a/compiler/systems/t_sunos.pas b/compiler/systems/t_sunos.pas index 1b34ae3db3..f35b84981d 100644 --- a/compiler/systems/t_sunos.pas +++ b/compiler/systems/t_sunos.pas @@ -169,7 +169,7 @@ procedure texportlibsolaris.generatelib; var hp2 : texported_item; begin - new_section(asmlist[al_procedures],sec_code,'',0); + new_section(current_asmdata.asmlists[al_procedures],sec_code,'',0); hp2:=texported_item(current_module._exports.first); while assigned(hp2) do begin @@ -181,10 +181,10 @@ begin if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then begin { place jump in al_procedures } - asmlist[al_procedures].concat(tai_align.create(target_info.alignment.procalign)); - asmlist[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); - cg.a_jmp_name(asmlist[al_procedures],tprocsym(hp2.sym).first_procdef.mangledname); - asmlist[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); + current_asmdata.asmlists[al_procedures].concat(tai_align.create(target_info.alignment.procalign)); + current_asmdata.asmlists[al_procedures].concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); + cg.a_jmp_name(current_asmdata.asmlists[al_procedures],tprocsym(hp2.sym).first_procdef.mangledname); + current_asmdata.asmlists[al_procedures].concat(Tai_symbol_end.Createname(hp2.name^)); end; end else diff --git a/compiler/systems/t_win.pas b/compiler/systems/t_win.pas index 9876192ec8..eaf3ccd8d3 100644 --- a/compiler/systems/t_win.pas +++ b/compiler/systems/t_win.pas @@ -120,8 +120,8 @@ implementation procedure timportlibwin32.preparelib(const s : string); begin - if asmlist[al_imports]=nil then - asmlist[al_imports]:=TAAsmoutput.create; + if current_asmdata.asmlists[al_imports]=nil then + current_asmdata.asmlists[al_imports]:=TAsmList.create; end; @@ -248,15 +248,15 @@ implementation hp1 : timportList; hp2 : twin32imported_item; begin - new_section(asmlist[al_imports],sec_code,'',0); + new_section(current_asmdata.asmlists[al_imports],sec_code,'',0); hp1:=timportlist(current_module.imports.first); while assigned(hp1) do begin hp2:=twin32imported_item(hp1.imported_items.first); while assigned(hp2) do begin - asmlist[al_imports].concat(tai_directive.create(asd_extern,hp2.func^)); - asmlist[al_imports].concat(tai_directive.create(asd_nasm_import,hp2.func^+' '+hp1.dllname^+' '+hp2.name^)); + current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_extern,hp2.func^)); + current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_nasm_import,hp2.func^+' '+hp1.dllname^+' '+hp2.name^)); hp2:=twin32imported_item(hp2.next); end; hp1:=timportlist(hp1.next); @@ -284,131 +284,131 @@ implementation while assigned(hp1) do begin { Get labels for the sections } - objectlibrary.getdatalabel(lhead); - objectlibrary.getdatalabel(lname); - objectlibrary.getaddrlabel(lidata4); - objectlibrary.getaddrlabel(lidata5); + current_asmdata.getdatalabel(lhead); + current_asmdata.getdatalabel(lname); + current_asmdata.getaddrlabel(lidata4); + current_asmdata.getaddrlabel(lidata5); { create header for this importmodule } - asmlist[al_imports].concat(Tai_cutobject.Create_begin); - new_section(asmlist[al_imports],sec_idata2,'',0); - asmlist[al_imports].concat(Tai_label.Create(lhead)); + current_asmdata.asmlists[al_imports].concat(Tai_cutobject.Create_begin); + new_section(current_asmdata.asmlists[al_imports],sec_idata2,'',0); + current_asmdata.asmlists[al_imports].concat(Tai_label.Create(lhead)); { pointer to procedure names } - asmlist[al_imports].concat(Tai_const.Create_rva_sym(lidata4)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(lidata4)); { two empty entries follow } - asmlist[al_imports].concat(Tai_const.Create_32bit(0)); - asmlist[al_imports].concat(Tai_const.Create_32bit(0)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0)); { pointer to dll name } - asmlist[al_imports].concat(Tai_const.Create_rva_sym(lname)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(lname)); { pointer to fixups } - asmlist[al_imports].concat(Tai_const.Create_rva_sym(lidata5)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(lidata5)); { first write the name references } - new_section(asmlist[al_imports],sec_idata4,'',0); - asmlist[al_imports].concat(Tai_const.Create_32bit(0)); - asmlist[al_imports].concat(Tai_label.Create(lidata4)); + new_section(current_asmdata.asmlists[al_imports],sec_idata4,'',0); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0)); + current_asmdata.asmlists[al_imports].concat(Tai_label.Create(lidata4)); { then the addresses and create also the indirect jump } - new_section(asmlist[al_imports],sec_idata5,'',0); - asmlist[al_imports].concat(Tai_const.Create_32bit(0)); - asmlist[al_imports].concat(Tai_label.Create(lidata5)); + new_section(current_asmdata.asmlists[al_imports],sec_idata5,'',0); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0)); + current_asmdata.asmlists[al_imports].concat(Tai_label.Create(lidata5)); { create procedures } hp2:=twin32imported_item(hp1.imported_items.first); while assigned(hp2) do begin { insert cuts } - asmlist[al_imports].concat(Tai_cutobject.Create); + current_asmdata.asmlists[al_imports].concat(Tai_cutobject.Create); { create indirect jump } if not hp2.is_var then begin - objectlibrary.getjumplabel(lcode); + current_asmdata.getjumplabel(lcode); {$ifdef ARM} - objectlibrary.getjumplabel(lpcode); + current_asmdata.getjumplabel(lpcode); {$endif ARM} { place jump in al_procedures, insert a code section in the al_imports to reduce the amount of .s files (PFV) } - new_section(asmlist[al_imports],sec_code,'',0); + new_section(current_asmdata.asmlists[al_imports],sec_code,'',0); if assigned(hp2.procdef) then mangledstring:=hp2.procdef.mangledname else mangledstring:=hp2.func^; - asmlist[al_imports].concat(Tai_symbol.Createname_global(mangledstring,AT_FUNCTION,0)); - asmlist[al_imports].concat(Tai_function_name.Create('')); + current_asmdata.asmlists[al_imports].concat(Tai_symbol.Createname_global(mangledstring,AT_FUNCTION,0)); + current_asmdata.asmlists[al_imports].concat(Tai_function_name.Create('')); {$ifdef ARM} reference_reset_symbol(href,lpcode,0); - asmlist[al_imports].concat(Taicpu.op_reg_ref(A_LDR,NR_R12,href)); + current_asmdata.asmlists[al_imports].concat(Taicpu.op_reg_ref(A_LDR,NR_R12,href)); reference_reset_base(href,NR_R12,0); - asmlist[al_imports].concat(Taicpu.op_reg_ref(A_LDR,NR_R15,href)); - asmlist[al_imports].concat(Tai_label.Create(lpcode)); + current_asmdata.asmlists[al_imports].concat(Taicpu.op_reg_ref(A_LDR,NR_R15,href)); + current_asmdata.asmlists[al_imports].concat(Tai_label.Create(lpcode)); reference_reset_symbol(href,lcode,0); - asmlist[al_imports].concat(tai_const.create_sym_offset(href.symbol,href.offset)); + current_asmdata.asmlists[al_imports].concat(tai_const.create_sym_offset(href.symbol,href.offset)); {$else ARM} reference_reset_symbol(href,lcode,0); - asmlist[al_imports].concat(Taicpu.Op_ref(A_JMP,S_NO,href)); - asmlist[al_imports].concat(Tai_align.Create_op(4,$90)); + current_asmdata.asmlists[al_imports].concat(Taicpu.Op_ref(A_JMP,S_NO,href)); + current_asmdata.asmlists[al_imports].concat(Tai_align.Create_op(4,$90)); {$endif ARM} end; { create head link } - new_section(asmlist[al_imports],sec_idata7,'',0); - asmlist[al_imports].concat(Tai_const.Create_rva_sym(lhead)); + new_section(current_asmdata.asmlists[al_imports],sec_idata7,'',0); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(lhead)); { fixup } - objectlibrary.getjumplabel(tasmlabel(hp2.lab)); - new_section(asmlist[al_imports],sec_idata4,'',0); - asmlist[al_imports].concat(Tai_const.Create_rva_sym(hp2.lab)); + current_asmdata.getjumplabel(tasmlabel(hp2.lab)); + new_section(current_asmdata.asmlists[al_imports],sec_idata4,'',0); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(hp2.lab)); { add jump field to al_imports } - new_section(asmlist[al_imports],sec_idata5,'',0); + new_section(current_asmdata.asmlists[al_imports],sec_idata5,'',0); if hp2.is_var then - asmlist[al_imports].concat(Tai_symbol.Createname_global(hp2.func^,AT_FUNCTION,0)) + current_asmdata.asmlists[al_imports].concat(Tai_symbol.Createname_global(hp2.func^,AT_FUNCTION,0)) else - asmlist[al_imports].concat(Tai_label.Create(lcode)); + current_asmdata.asmlists[al_imports].concat(Tai_label.Create(lcode)); if (cs_debuginfo in aktmoduleswitches) then begin if assigned(hp2.name) then begin importname:='__imp_'+hp2.name^; suffix:=0; - while assigned(objectlibrary.getasmsymbol(importname)) do + while assigned(current_asmdata.getasmsymbol(importname)) do begin inc(suffix); importname:='__imp_'+hp2.name^+'_'+tostr(suffix); end; - asmlist[al_imports].concat(tai_symbol.createname(importname,AT_FUNCTION,4)); + current_asmdata.asmlists[al_imports].concat(tai_symbol.createname(importname,AT_FUNCTION,4)); end else begin importname:='__imp_by_ordinal'+tostr(hp2.ordnr); suffix:=0; - while assigned(objectlibrary.getasmsymbol(importname)) do + while assigned(current_asmdata.getasmsymbol(importname)) do begin inc(suffix); importname:='__imp_by_ordinal'+tostr(hp2.ordnr)+'_'+tostr(suffix); end; - asmlist[al_imports].concat(tai_symbol.createname(importname,AT_FUNCTION,4)); + current_asmdata.asmlists[al_imports].concat(tai_symbol.createname(importname,AT_FUNCTION,4)); end; end; if hp2.name^<>'' then - asmlist[al_imports].concat(Tai_const.Create_rva_sym(hp2.lab)) + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(hp2.lab)) else - asmlist[al_imports].concat(Tai_const.Create_32bit(longint($80000000) or longint(hp2.ordnr))); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(longint($80000000) or longint(hp2.ordnr))); { finally the import information } - new_section(asmlist[al_imports],sec_idata6,'',0); - asmlist[al_imports].concat(Tai_label.Create(hp2.lab)); - asmlist[al_imports].concat(Tai_const.Create_16bit(hp2.ordnr)); - asmlist[al_imports].concat(Tai_string.Create(hp2.name^+#0)); - asmlist[al_imports].concat(Tai_align.Create_op(2,0)); + new_section(current_asmdata.asmlists[al_imports],sec_idata6,'',0); + current_asmdata.asmlists[al_imports].concat(Tai_label.Create(hp2.lab)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_16bit(hp2.ordnr)); + current_asmdata.asmlists[al_imports].concat(Tai_string.Create(hp2.name^+#0)); + current_asmdata.asmlists[al_imports].concat(Tai_align.Create_op(2,0)); hp2:=twin32imported_item(hp2.next); end; { write final section } - asmlist[al_imports].concat(Tai_cutobject.Create_end); + current_asmdata.asmlists[al_imports].concat(Tai_cutobject.Create_end); { end of name references } - new_section(asmlist[al_imports],sec_idata4,'',0); - asmlist[al_imports].concat(Tai_const.Create_32bit(0)); + new_section(current_asmdata.asmlists[al_imports],sec_idata4,'',0); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0)); { end if addresses } - new_section(asmlist[al_imports],sec_idata5,'',0); - asmlist[al_imports].concat(Tai_const.Create_32bit(0)); + new_section(current_asmdata.asmlists[al_imports],sec_idata5,'',0); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0)); { dllname } - new_section(asmlist[al_imports],sec_idata7,'',0); - asmlist[al_imports].concat(Tai_label.Create(lname)); - asmlist[al_imports].concat(Tai_string.Create(hp1.dllname^+#0)); + new_section(current_asmdata.asmlists[al_imports],sec_idata7,'',0); + current_asmdata.asmlists[al_imports].concat(Tai_label.Create(lname)); + current_asmdata.asmlists[al_imports].concat(Tai_string.Create(hp1.dllname^+#0)); hp1:=timportlist(hp1.next); end; @@ -434,131 +434,131 @@ implementation while assigned(hp1) do begin { align al_procedures for the jumps } - new_section(asmlist[al_imports],sec_code,'',sizeof(aint)); + new_section(current_asmdata.asmlists[al_imports],sec_code,'',sizeof(aint)); { Get labels for the sections } - objectlibrary.getjumplabel(l1); - objectlibrary.getjumplabel(l2); - objectlibrary.getjumplabel(l3); - new_section(asmlist[al_imports],sec_idata2,'',0); + current_asmdata.getjumplabel(l1); + current_asmdata.getjumplabel(l2); + current_asmdata.getjumplabel(l3); + new_section(current_asmdata.asmlists[al_imports],sec_idata2,'',0); { pointer to procedure names } - asmlist[al_imports].concat(Tai_const.Create_rva_sym(l2)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(l2)); { two empty entries follow } - asmlist[al_imports].concat(Tai_const.Create_32bit(0)); - asmlist[al_imports].concat(Tai_const.Create_32bit(0)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0)); { pointer to dll name } - asmlist[al_imports].concat(Tai_const.Create_rva_sym(l1)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(l1)); { pointer to fixups } - asmlist[al_imports].concat(Tai_const.Create_rva_sym(l3)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(l3)); { only create one section for each else it will create a lot of idata* } { first write the name references } - new_section(asmlist[al_imports],sec_idata4,'',0); - asmlist[al_imports].concat(Tai_label.Create(l2)); + new_section(current_asmdata.asmlists[al_imports],sec_idata4,'',0); + current_asmdata.asmlists[al_imports].concat(Tai_label.Create(l2)); hp2:=twin32imported_item(hp1.imported_items.first); while assigned(hp2) do begin - objectlibrary.getjumplabel(tasmlabel(hp2.lab)); + current_asmdata.getjumplabel(tasmlabel(hp2.lab)); if hp2.name^<>'' then - asmlist[al_imports].concat(Tai_const.Create_rva_sym(hp2.lab)) + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(hp2.lab)) else - asmlist[al_imports].concat(Tai_const.Create_32bit(longint($80000000) or hp2.ordnr)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(longint($80000000) or hp2.ordnr)); hp2:=twin32imported_item(hp2.next); end; { finalize the names ... } - asmlist[al_imports].concat(Tai_const.Create_32bit(0)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0)); { then the addresses and create also the indirect jump } - new_section(asmlist[al_imports],sec_idata5,'',0); - asmlist[al_imports].concat(Tai_label.Create(l3)); + new_section(current_asmdata.asmlists[al_imports],sec_idata5,'',0); + current_asmdata.asmlists[al_imports].concat(Tai_label.Create(l3)); hp2:=twin32imported_item(hp1.imported_items.first); while assigned(hp2) do begin if not hp2.is_var then begin - objectlibrary.getjumplabel(l4); + current_asmdata.getjumplabel(l4); {$ifdef ARM} - objectlibrary.getjumplabel(l5); + current_asmdata.getjumplabel(l5); {$endif ARM} { create indirect jump and } { place jump in al_procedures } - new_section(asmlist[al_imports],sec_code,'',0); + new_section(current_asmdata.asmlists[al_imports],sec_code,'',0); if assigned(hp2.procdef) then mangledstring:=hp2.procdef.mangledname else mangledstring:=hp2.func^; - asmlist[al_imports].concat(Tai_symbol.Createname_global(mangledstring,AT_FUNCTION,0)); - asmlist[al_imports].concat(tai_function_name.create('')); + current_asmdata.asmlists[al_imports].concat(Tai_symbol.Createname_global(mangledstring,AT_FUNCTION,0)); + current_asmdata.asmlists[al_imports].concat(tai_function_name.create('')); {$ifdef ARM} reference_reset_symbol(href,l5,0); - asmlist[al_imports].concat(Taicpu.op_reg_ref(A_LDR,NR_R12,href)); + current_asmdata.asmlists[al_imports].concat(Taicpu.op_reg_ref(A_LDR,NR_R12,href)); reference_reset_base(href,NR_R12,0); - asmlist[al_imports].concat(Taicpu.op_reg_ref(A_LDR,NR_R15,href)); - asmlist[al_imports].concat(Tai_label.Create(l5)); + current_asmdata.asmlists[al_imports].concat(Taicpu.op_reg_ref(A_LDR,NR_R15,href)); + current_asmdata.asmlists[al_imports].concat(Tai_label.Create(l5)); reference_reset_symbol(href,l4,0); - asmlist[al_imports].concat(tai_const.create_sym_offset(href.symbol,href.offset)); + current_asmdata.asmlists[al_imports].concat(tai_const.create_sym_offset(href.symbol,href.offset)); {$else ARM} reference_reset_symbol(href,l4,0); - asmlist[al_imports].concat(Taicpu.Op_ref(A_JMP,S_NO,href)); - asmlist[al_imports].concat(Tai_align.Create_op(4,$90)); + current_asmdata.asmlists[al_imports].concat(Taicpu.Op_ref(A_JMP,S_NO,href)); + current_asmdata.asmlists[al_imports].concat(Tai_align.Create_op(4,$90)); {$endif ARM} { add jump field to al_imports } - new_section(asmlist[al_imports],sec_idata5,'',0); + new_section(current_asmdata.asmlists[al_imports],sec_idata5,'',0); if (cs_debuginfo in aktmoduleswitches) then begin if assigned(hp2.name) then begin importname:='__imp_'+hp2.name^; suffix:=0; - while assigned(objectlibrary.getasmsymbol(importname)) do + while assigned(current_asmdata.getasmsymbol(importname)) do begin inc(suffix); importname:='__imp_'+hp2.name^+'_'+tostr(suffix); end; - asmlist[al_imports].concat(tai_symbol.createname(importname,AT_FUNCTION,4)); + current_asmdata.asmlists[al_imports].concat(tai_symbol.createname(importname,AT_FUNCTION,4)); end else begin importname:='__imp_by_ordinal'+tostr(hp2.ordnr); suffix:=0; - while assigned(objectlibrary.getasmsymbol(importname)) do + while assigned(current_asmdata.getasmsymbol(importname)) do begin inc(suffix); importname:='__imp_by_ordinal'+tostr(hp2.ordnr)+'_'+tostr(suffix); end; - asmlist[al_imports].concat(tai_symbol.createname(importname,AT_FUNCTION,4)); + current_asmdata.asmlists[al_imports].concat(tai_symbol.createname(importname,AT_FUNCTION,4)); end; end; - asmlist[al_imports].concat(Tai_label.Create(l4)); + current_asmdata.asmlists[al_imports].concat(Tai_label.Create(l4)); end else begin - asmlist[al_imports].concat(Tai_symbol.Createname_global(hp2.func^,AT_DATA,0)); + current_asmdata.asmlists[al_imports].concat(Tai_symbol.Createname_global(hp2.func^,AT_DATA,0)); end; - asmlist[al_imports].concat(Tai_const.Create_rva_sym(hp2.lab)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_rva_sym(hp2.lab)); hp2:=twin32imported_item(hp2.next); end; { finalize the addresses } - asmlist[al_imports].concat(Tai_const.Create_32bit(0)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_32bit(0)); { finally the import information } - new_section(asmlist[al_imports],sec_idata6,'',0); + new_section(current_asmdata.asmlists[al_imports],sec_idata6,'',0); hp2:=twin32imported_item(hp1.imported_items.first); while assigned(hp2) do begin - asmlist[al_imports].concat(Tai_label.Create(hp2.lab)); + current_asmdata.asmlists[al_imports].concat(Tai_label.Create(hp2.lab)); { the ordinal number } - asmlist[al_imports].concat(Tai_const.Create_16bit(hp2.ordnr)); - asmlist[al_imports].concat(Tai_string.Create(hp2.name^+#0)); - asmlist[al_imports].concat(Tai_align.Create_op(2,0)); + current_asmdata.asmlists[al_imports].concat(Tai_const.Create_16bit(hp2.ordnr)); + current_asmdata.asmlists[al_imports].concat(Tai_string.Create(hp2.name^+#0)); + current_asmdata.asmlists[al_imports].concat(Tai_align.Create_op(2,0)); hp2:=twin32imported_item(hp2.next); end; { create import dll name } - new_section(asmlist[al_imports],sec_idata7,'',0); - asmlist[al_imports].concat(Tai_label.Create(l1)); - asmlist[al_imports].concat(Tai_string.Create(hp1.dllname^+#0)); + new_section(current_asmdata.asmlists[al_imports],sec_idata7,'',0); + current_asmdata.asmlists[al_imports].concat(Tai_label.Create(l1)); + current_asmdata.asmlists[al_imports].concat(Tai_string.Create(hp1.dllname^+#0)); hp1:=timportlist(hp1.next); end; @@ -571,11 +571,11 @@ implementation procedure texportlibwin32.preparelib(const s:string); begin - if asmlist[al_exports]=nil then - asmlist[al_exports]:=TAAsmoutput.create; + if current_asmdata.asmlists[al_exports]=nil then + current_asmdata.asmlists[al_exports]:=TAsmList.create; EList_indexed:=tFPList.Create; EList_nonindexed:=tFPList.Create; - objectlibrary.getdatalabel(edatalabel); + current_asmdata.getdatalabel(edatalabel); end; @@ -653,7 +653,7 @@ implementation hp,hp2 : texported_item; temtexport : TLinkedList; address_table,name_table_pointers, - name_table,ordinal_table : TAAsmoutput; + name_table,ordinal_table : TAsmList; i,autoindex,ni_high : longint; hole : boolean; @@ -711,10 +711,10 @@ implementation ordinal_min:=$7FFFFFFF; entries:=0; named_entries:=0; - objectlibrary.getjumplabel(dll_name_label); - objectlibrary.getjumplabel(export_address_table); - objectlibrary.getjumplabel(export_name_table_pointers); - objectlibrary.getjumplabel(export_ordinal_table); + current_asmdata.getjumplabel(dll_name_label); + current_asmdata.getjumplabel(export_address_table); + current_asmdata.getjumplabel(export_name_table_pointers); + current_asmdata.getjumplabel(export_ordinal_table); { count entries } while assigned(hp) do @@ -735,50 +735,50 @@ implementation { we must also count the holes !! } entries:=ordinal_max-ordinal_base+1; - new_section(asmlist[al_exports],sec_edata,'',0); + new_section(current_asmdata.asmlists[al_exports],sec_edata,'',0); { create label to reference from main so smartlink will include the .edata section } - asmlist[al_exports].concat(Tai_symbol.Create_global(edatalabel,0)); + current_asmdata.asmlists[al_exports].concat(Tai_symbol.Create_global(edatalabel,0)); { export flags } - asmlist[al_exports].concat(Tai_const.Create_32bit(0)); + current_asmdata.asmlists[al_exports].concat(Tai_const.Create_32bit(0)); { date/time stamp } - asmlist[al_exports].concat(Tai_const.Create_32bit(0)); + current_asmdata.asmlists[al_exports].concat(Tai_const.Create_32bit(0)); { major version } - asmlist[al_exports].concat(Tai_const.Create_16bit(0)); + current_asmdata.asmlists[al_exports].concat(Tai_const.Create_16bit(0)); { minor version } - asmlist[al_exports].concat(Tai_const.Create_16bit(0)); + current_asmdata.asmlists[al_exports].concat(Tai_const.Create_16bit(0)); { pointer to dll name } - asmlist[al_exports].concat(Tai_const.Create_rva_sym(dll_name_label)); + current_asmdata.asmlists[al_exports].concat(Tai_const.Create_rva_sym(dll_name_label)); { ordinal base normally set to 1 } - asmlist[al_exports].concat(Tai_const.Create_32bit(ordinal_base)); + current_asmdata.asmlists[al_exports].concat(Tai_const.Create_32bit(ordinal_base)); { number of entries } - asmlist[al_exports].concat(Tai_const.Create_32bit(entries)); + current_asmdata.asmlists[al_exports].concat(Tai_const.Create_32bit(entries)); { number of named entries } - asmlist[al_exports].concat(Tai_const.Create_32bit(named_entries)); + current_asmdata.asmlists[al_exports].concat(Tai_const.Create_32bit(named_entries)); { address of export address table } - asmlist[al_exports].concat(Tai_const.Create_rva_sym(export_address_table)); + current_asmdata.asmlists[al_exports].concat(Tai_const.Create_rva_sym(export_address_table)); { address of name pointer pointers } - asmlist[al_exports].concat(Tai_const.Create_rva_sym(export_name_table_pointers)); + current_asmdata.asmlists[al_exports].concat(Tai_const.Create_rva_sym(export_name_table_pointers)); { address of ordinal number pointers } - asmlist[al_exports].concat(Tai_const.Create_rva_sym(export_ordinal_table)); + current_asmdata.asmlists[al_exports].concat(Tai_const.Create_rva_sym(export_ordinal_table)); { the name } - asmlist[al_exports].concat(Tai_label.Create(dll_name_label)); + current_asmdata.asmlists[al_exports].concat(Tai_label.Create(dll_name_label)); if st='' then - asmlist[al_exports].concat(Tai_string.Create(current_module.modulename^+target_info.sharedlibext+#0)) + current_asmdata.asmlists[al_exports].concat(Tai_string.Create(current_module.modulename^+target_info.sharedlibext+#0)) else - asmlist[al_exports].concat(Tai_string.Create(st+target_info.sharedlibext+#0)); + current_asmdata.asmlists[al_exports].concat(Tai_string.Create(st+target_info.sharedlibext+#0)); { export address table } - address_table:=TAAsmoutput.create; + address_table:=TAsmList.create; address_table.concat(Tai_align.Create_op(4,0)); address_table.concat(Tai_label.Create(export_address_table)); - name_table_pointers:=TAAsmoutput.create; + name_table_pointers:=TAsmList.create; name_table_pointers.concat(Tai_align.Create_op(4,0)); name_table_pointers.concat(Tai_label.Create(export_name_table_pointers)); - ordinal_table:=TAAsmoutput.create; + ordinal_table:=TAsmList.create; ordinal_table.concat(Tai_align.Create_op(4,0)); ordinal_table.concat(Tai_label.Create(export_ordinal_table)); - name_table:=TAAsmoutput.Create; + name_table:=TAsmList.Create; name_table.concat(Tai_align.Create_op(4,0)); { write each address } hp:=texported_item(current_module._exports.first); @@ -786,7 +786,7 @@ implementation begin if (hp.options and eo_name)<>0 then begin - objectlibrary.getjumplabel(name_label); + current_asmdata.getjumplabel(name_label); name_table_pointers.concat(Tai_const.Create_rva_sym(name_label)); ordinal_table.concat(Tai_const.Create_16bit(hp.index-ordinal_base)); name_table.concat(Tai_align.Create_op(2,0)); @@ -835,10 +835,10 @@ implementation hp:=texported_item(hp.next); end; - asmlist[al_exports].concatlist(address_table); - asmlist[al_exports].concatlist(name_table_pointers); - asmlist[al_exports].concatlist(ordinal_table); - asmlist[al_exports].concatlist(name_table); + current_asmdata.asmlists[al_exports].concatlist(address_table); + current_asmdata.asmlists[al_exports].concatlist(name_table_pointers); + current_asmdata.asmlists[al_exports].concatlist(ordinal_table); + current_asmdata.asmlists[al_exports].concatlist(name_table); address_table.Free; name_table_pointers.free; ordinal_table.free; @@ -852,7 +852,7 @@ implementation p : pchar; s : string; begin - new_section(asmlist[al_exports],sec_code,'',0); + new_section(current_asmdata.asmlists[al_exports],sec_code,'',0); hp:=texported_item(current_module._exports.first); while assigned(hp) do begin @@ -867,7 +867,7 @@ implementation s:=''; end; p:=strpnew(#9+'export '+s+' '+hp.name^+' '+tostr(hp.index)); - {asmlist[al_exports].concat(tai_direct.create(p));} + {current_asmdata.asmlists[al_exports].concat(tai_direct.create(p));} hp:=texported_item(hp.next); end; end; diff --git a/compiler/tgobj.pas b/compiler/tgobj.pas index 6412f3e99e..9cd7cad202 100644 --- a/compiler/tgobj.pas +++ b/compiler/tgobj.pas @@ -59,8 +59,8 @@ unit tgobj; private { contains all free temps using nextfree links } tempfreelist : ptemprecord; - function alloctemp(list: taasmoutput; size,alignment : longint; temptype : ttemptype; def:tdef) : longint; - procedure freetemp(list: taasmoutput; pos:longint;temptypes:ttemptypeset); + function alloctemp(list: TAsmList; size,alignment : longint; temptype : ttemptype; def:tdef) : longint; + procedure freetemp(list: TAsmList; pos:longint;temptypes:ttemptypeset); public { contains all temps } templist : ptemprecord; @@ -80,12 +80,12 @@ unit tgobj; } procedure setfirsttemp(l : longint); - procedure gettemp(list: taasmoutput; size : longint;temptype:ttemptype;var ref : treference); - procedure gettemptyped(list: taasmoutput; def:tdef;temptype:ttemptype;var ref : treference); - procedure ungettemp(list: taasmoutput; const ref : treference); + procedure gettemp(list: TAsmList; size : longint;temptype:ttemptype;var ref : treference); + procedure gettemptyped(list: TAsmList; def:tdef;temptype:ttemptype;var ref : treference); + procedure ungettemp(list: TAsmList; const ref : treference); - function sizeoftemp(list: taasmoutput; const ref: treference): longint; - function changetemptype(list: taasmoutput; const ref:treference;temptype:ttemptype):boolean; + function sizeoftemp(list: TAsmList; const ref: treference): longint; + function changetemptype(list: TAsmList; const ref:treference;temptype:ttemptype):boolean; {# Returns TRUE if the reference ref is allocated in temporary volatile memory space, otherwise returns FALSE. @@ -97,17 +97,17 @@ unit tgobj; The freed space can later be reallocated and reused. If this reference is not in the temporary memory, it is simply not freed. } - procedure ungetiftemp(list: taasmoutput; const ref : treference); + procedure ungetiftemp(list: TAsmList; const ref : treference); { Allocate space for a local } - procedure getlocal(list: taasmoutput; size : longint;def:tdef;var ref : treference); - procedure UnGetLocal(list: taasmoutput; const ref : treference); + procedure getlocal(list: TAsmList; size : longint;def:tdef;var ref : treference); + procedure UnGetLocal(list: TAsmList; const ref : treference); end; var tg: ttgobj; - procedure location_freetemp(list:taasmoutput; const l : tlocation); + procedure location_freetemp(list:TAsmList; const l : tlocation); implementation @@ -141,7 +141,7 @@ implementation Helpers *****************************************************************************} - procedure location_freetemp(list:taasmoutput; const l : tlocation); + procedure location_freetemp(list:TAsmList; const l : tlocation); begin if (l.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then tg.ungetiftemp(list,l.reference); @@ -234,7 +234,7 @@ implementation end; - function ttgobj.AllocTemp(list: taasmoutput; size,alignment : longint; temptype : ttemptype;def : tdef) : longint; + function ttgobj.AllocTemp(list: TAsmList; size,alignment : longint; temptype : ttemptype;def : tdef) : longint; var tl,htl, bestslot,bestprev, @@ -393,7 +393,7 @@ implementation end; - procedure ttgobj.FreeTemp(list: taasmoutput; pos:longint;temptypes:ttemptypeset); + procedure ttgobj.FreeTemp(list: TAsmList; pos:longint;temptypes:ttemptypeset); var hp,hnext,hprev,hprevfree : ptemprecord; begin @@ -478,7 +478,7 @@ implementation end; - procedure ttgobj.gettemp(list: taasmoutput; size : longint;temptype:ttemptype;var ref : treference); + procedure ttgobj.gettemp(list: TAsmList; size : longint;temptype:ttemptype;var ref : treference); var varalign : longint; begin @@ -492,7 +492,7 @@ implementation end; - procedure ttgobj.gettemptyped(list: taasmoutput; def:tdef;temptype:ttemptype;var ref : treference); + procedure ttgobj.gettemptyped(list: TAsmList; def:tdef;temptype:ttemptype;var ref : treference); var varalign : longint; begin @@ -526,7 +526,7 @@ implementation end; - function ttgobj.sizeoftemp(list: taasmoutput; const ref: treference): longint; + function ttgobj.sizeoftemp(list: TAsmList; const ref: treference): longint; var hp : ptemprecord; begin @@ -548,7 +548,7 @@ implementation end; - function ttgobj.ChangeTempType(list: taasmoutput; const ref:treference;temptype:ttemptype):boolean; + function ttgobj.ChangeTempType(list: TAsmList; const ref:treference;temptype:ttemptype):boolean; var hp : ptemprecord; begin @@ -589,20 +589,20 @@ implementation end; - procedure ttgobj.UnGetTemp(list: taasmoutput; const ref : treference); + procedure ttgobj.UnGetTemp(list: TAsmList; const ref : treference); begin FreeTemp(list,ref.offset,[tt_normal,tt_noreuse,tt_persistent]); end; - procedure ttgobj.UnGetIfTemp(list: taasmoutput; const ref : treference); + procedure ttgobj.UnGetIfTemp(list: TAsmList; const ref : treference); begin if istemp(ref) then FreeTemp(list,ref.offset,[tt_normal]); end; - procedure ttgobj.getlocal(list: taasmoutput; size : longint;def:tdef;var ref : treference); + procedure ttgobj.getlocal(list: TAsmList; size : longint;def:tdef;var ref : treference); var varalign : longint; begin @@ -616,7 +616,7 @@ implementation end; - procedure ttgobj.UnGetLocal(list: taasmoutput; const ref : treference); + procedure ttgobj.UnGetLocal(list: TAsmList; const ref : treference); begin FreeTemp(list,ref.offset,[tt_persistent]); end; diff --git a/compiler/x86/agx86int.pas b/compiler/x86/agx86int.pas index 05e5ca9e3b..3eb5f38e3e 100644 --- a/compiler/x86/agx86int.pas +++ b/compiler/x86/agx86int.pas @@ -39,7 +39,7 @@ interface procedure WriteOper(const o:toper;s : topsize; opcode: tasmop;dest : boolean); procedure WriteOper_jmp(const o:toper;s : topsize); public - procedure WriteTree(p:TAAsmoutput);override; + procedure WriteTree(p:TAsmList);override; procedure WriteAsmList;override; Function DoAssemble:boolean;override; procedure WriteExternals; @@ -378,7 +378,7 @@ implementation PadTabs:=s+#9; end; - procedure tx86IntelAssembler.WriteTree(p:TAAsmoutput); + procedure tx86IntelAssembler.WriteTree(p:TAsmList); const regallocstr : array[tregalloctype] of string[10]=(' allocated',' released',' sync',' resized'); tempallocstr : array[boolean] of string[10]=(' released',' allocated'); @@ -401,7 +401,7 @@ implementation { lineinfo is only needed for al_procedures (PFV) } do_line:=((cs_asm_source in aktglobalswitches) or (cs_lineinfo in aktmoduleswitches)) - and (p=asmlist[al_procedures]); + and (p=current_asmdata.asmlists[al_procedures]); InlineLevel:=0; DoNotSplitLine:=false; hp:=tai(p.first); @@ -797,9 +797,9 @@ implementation end; ait_marker : begin - if tai_marker(hp).kind=InlineStart then + if tai_marker(hp).kind=mark_InlineStart then inc(InlineLevel) - else if tai_marker(hp).kind=InlineEnd then + else if tai_marker(hp).kind=mark_InlineEnd then dec(InlineLevel); end; @@ -848,7 +848,7 @@ implementation procedure tx86IntelAssembler.WriteExternals; begin currentasmlist:=self; - objectlibrary.symbolsearch.foreach_static(@writeexternal,nil); + current_asmdata.AsmSymbolDict.foreach_static(@writeexternal,nil); end; @@ -876,7 +876,7 @@ implementation procedure tx86IntelAssembler.WriteAsmList; var - hal : tasmlist; + hal : tasmlisttype; begin {$ifdef EXTDEBUG} if assigned(current_module.mainsource) then @@ -898,11 +898,11 @@ implementation WriteExternals; - for hal:=low(Tasmlist) to high(Tasmlist) do + for hal:=low(TasmlistType) to high(TasmlistType) do begin - AsmWriteLn(target_asm.comment+'Begin asmlist '+TasmlistStr[hal]); - writetree(asmlist[hal]); - AsmWriteLn(target_asm.comment+'End asmlist '+TasmlistStr[hal]); + AsmWriteLn(target_asm.comment+'Begin asmlist '+AsmListTypeStr[hal]); + writetree(current_asmdata.asmlists[hal]); + AsmWriteLn(target_asm.comment+'End asmlist '+AsmListTypeStr[hal]); end; AsmWriteLn(#9'END'); diff --git a/compiler/x86/cga.pas b/compiler/x86/cga.pas index 364e313609..6012a3cc18 100644 --- a/compiler/x86/cga.pas +++ b/compiler/x86/cga.pas @@ -63,41 +63,41 @@ implementation procedure emit_none(i : tasmop;s : topsize); begin - exprasmList.concat(Taicpu.Op_none(i,s)); + current_asmdata.CurrAsmList.concat(Taicpu.Op_none(i,s)); end; procedure emit_reg(i : tasmop;s : topsize;reg : tregister); begin - exprasmList.concat(Taicpu.Op_reg(i,s,reg)); + current_asmdata.CurrAsmList.concat(Taicpu.Op_reg(i,s,reg)); end; procedure emit_ref(i : tasmop;s : topsize;ref : treference); begin - tcgx86(cg).make_simple_ref(exprasmlist,ref); - exprasmList.concat(Taicpu.Op_ref(i,s,ref)); + tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,ref); + current_asmdata.CurrAsmList.concat(Taicpu.Op_ref(i,s,ref)); end; procedure emit_const_reg(i : tasmop;s : topsize;c : aint;reg : tregister); begin - exprasmList.concat(Taicpu.Op_const_reg(i,s,c,reg)); + current_asmdata.CurrAsmList.concat(Taicpu.Op_const_reg(i,s,c,reg)); end; procedure emit_const_ref(i : tasmop;s : topsize;c : aint;ref : treference); begin - tcgx86(cg).make_simple_ref(exprasmlist,ref); - exprasmList.concat(Taicpu.Op_const_ref(i,s,c,ref)); + tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,ref); + current_asmdata.CurrAsmList.concat(Taicpu.Op_const_ref(i,s,c,ref)); end; procedure emit_ref_reg(i : tasmop;s : topsize;ref : treference;reg : tregister); begin - tcgx86(cg).make_simple_ref(exprasmlist,ref); - exprasmList.concat(Taicpu.Op_ref_reg(i,s,ref,reg)); + tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,ref); + current_asmdata.CurrAsmList.concat(Taicpu.Op_ref_reg(i,s,ref,reg)); end; procedure emit_reg_ref(i : tasmop;s : topsize;reg : tregister;ref : treference); begin - tcgx86(cg).make_simple_ref(exprasmlist,ref); - exprasmList.concat(Taicpu.Op_reg_ref(i,s,reg,ref)); + tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,ref); + current_asmdata.CurrAsmList.concat(Taicpu.Op_reg_ref(i,s,reg,ref)); end; procedure emit_reg_reg(i : tasmop;s : topsize;reg1,reg2 : tregister); @@ -108,7 +108,7 @@ implementation if not ((reg1=reg2) and (i=A_MOV)) then begin instr:=Taicpu.op_reg_reg(i,s,reg1,reg2); - exprasmlist.concat(instr); + current_asmdata.CurrAsmList.concat(instr); if i=A_MOV then cg.add_move_instruction(instr); end; @@ -116,17 +116,17 @@ implementation procedure emit_const_reg_reg(i : tasmop;s : topsize;c : longint;reg1,reg2 : tregister); begin - exprasmList.concat(Taicpu.Op_const_reg_reg(i,s,c,reg1,reg2)); + current_asmdata.CurrAsmList.concat(Taicpu.Op_const_reg_reg(i,s,c,reg1,reg2)); end; procedure emit_reg_reg_reg(i : tasmop;s : topsize;reg1,reg2,reg3 : tregister); begin - exprasmList.concat(Taicpu.Op_reg_reg_reg(i,s,reg1,reg2,reg3)); + current_asmdata.CurrAsmList.concat(Taicpu.Op_reg_reg_reg(i,s,reg1,reg2,reg3)); end; procedure emit_sym(i : tasmop;s : topsize;op : tasmsymbol); begin - exprasmList.concat(Taicpu.Op_sym(i,s,op)); + current_asmdata.CurrAsmList.concat(Taicpu.Op_sym(i,s,op)); end; end. diff --git a/compiler/x86/cgx86.pas b/compiler/x86/cgx86.pas index 10448e4088..6e862d6bc2 100644 --- a/compiler/x86/cgx86.pas +++ b/compiler/x86/cgx86.pas @@ -39,92 +39,92 @@ unit cgx86; rgfpu : Trgx86fpu; procedure done_register_allocators;override; - function getfpuregister(list:Taasmoutput;size:Tcgsize):Tregister;override; - function getmmxregister(list:Taasmoutput):Tregister; - function getmmregister(list:Taasmoutput;size:Tcgsize):Tregister;override; - - procedure getcpuregister(list:Taasmoutput;r:Tregister);override; - procedure ungetcpuregister(list:Taasmoutput;r:Tregister);override; - procedure alloccpuregisters(list:Taasmoutput;rt:Tregistertype;const r:Tcpuregisterset);override; - procedure dealloccpuregisters(list:Taasmoutput;rt:Tregistertype;const r:Tcpuregisterset);override; + function getfpuregister(list:TAsmList;size:Tcgsize):Tregister;override; + function getmmxregister(list:TAsmList):Tregister; + function getmmregister(list:TAsmList;size:Tcgsize):Tregister;override; + + procedure getcpuregister(list:TAsmList;r:Tregister);override; + procedure ungetcpuregister(list:TAsmList;r:Tregister);override; + procedure alloccpuregisters(list:TAsmList;rt:Tregistertype;const r:Tcpuregisterset);override; + procedure dealloccpuregisters(list:TAsmList;rt:Tregistertype;const r:Tcpuregisterset);override; function uses_registers(rt:Tregistertype):boolean;override; procedure add_reg_instruction(instr:Tai;r:tregister);override; procedure dec_fpu_stack; procedure inc_fpu_stack; - procedure a_call_name(list : taasmoutput;const s : string);override; - procedure a_call_reg(list : taasmoutput;reg : tregister);override; - procedure a_call_ref(list : taasmoutput;ref : treference);override; - procedure a_call_name_static(list : taasmoutput;const s : string);override; + procedure a_call_name(list : TAsmList;const s : string);override; + procedure a_call_reg(list : TAsmList;reg : tregister);override; + procedure a_call_ref(list : TAsmList;ref : treference);override; + procedure a_call_name_static(list : TAsmList;const s : string);override; - procedure a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); override; - procedure a_op_const_ref(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; const ref: TReference); override; - procedure a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; src, dst: TRegister); override; - procedure a_op_ref_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; const ref: TReference; reg: TRegister); override; - procedure a_op_reg_ref(list : taasmoutput; Op: TOpCG; size: TCGSize;reg: TRegister; const ref: TReference); override; + procedure a_op_const_reg(list : TAsmList; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); override; + procedure a_op_const_ref(list : TAsmList; Op: TOpCG; size: TCGSize; a: aint; const ref: TReference); override; + procedure a_op_reg_reg(list : TAsmList; Op: TOpCG; size: TCGSize; src, dst: TRegister); override; + procedure a_op_ref_reg(list : TAsmList; Op: TOpCG; size: TCGSize; const ref: TReference; reg: TRegister); override; + procedure a_op_reg_ref(list : TAsmList; Op: TOpCG; size: TCGSize;reg: TRegister; const ref: TReference); override; - procedure a_op_const_reg_reg(list: taasmoutput; op: TOpCg; + procedure a_op_const_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister); override; - procedure a_op_reg_reg_reg(list: taasmoutput; op: TOpCg; + procedure a_op_reg_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; src1, src2, dst: tregister); override; { move instructions } - procedure a_load_const_reg(list : taasmoutput; tosize: tcgsize; a : aint;reg : tregister);override; - procedure a_load_const_ref(list : taasmoutput; tosize: tcgsize; a : aint;const ref : treference);override; - procedure a_load_reg_ref(list : taasmoutput;fromsize,tosize: tcgsize; reg : tregister;const ref : treference);override; - procedure a_load_ref_reg(list : taasmoutput;fromsize,tosize: tcgsize;const ref : treference;reg : tregister);override; - procedure a_load_reg_reg(list : taasmoutput;fromsize,tosize: tcgsize;reg1,reg2 : tregister);override; - procedure a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister);override; + procedure a_load_const_reg(list : TAsmList; tosize: tcgsize; a : aint;reg : tregister);override; + procedure a_load_const_ref(list : TAsmList; tosize: tcgsize; a : aint;const ref : treference);override; + procedure a_load_reg_ref(list : TAsmList;fromsize,tosize: tcgsize; reg : tregister;const ref : treference);override; + procedure a_load_ref_reg(list : TAsmList;fromsize,tosize: tcgsize;const ref : treference;reg : tregister);override; + procedure a_load_reg_reg(list : TAsmList;fromsize,tosize: tcgsize;reg1,reg2 : tregister);override; + procedure a_loadaddr_ref_reg(list : TAsmList;const ref : treference;r : tregister);override; { fpu move instructions } - procedure a_loadfpu_reg_reg(list: taasmoutput; size: tcgsize; reg1, reg2: tregister); override; - procedure a_loadfpu_ref_reg(list: taasmoutput; size: tcgsize; const ref: treference; reg: tregister); override; - procedure a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: tregister; const ref: treference); override; + procedure a_loadfpu_reg_reg(list: TAsmList; size: tcgsize; reg1, reg2: tregister); override; + procedure a_loadfpu_ref_reg(list: TAsmList; size: tcgsize; const ref: treference; reg: tregister); override; + procedure a_loadfpu_reg_ref(list: TAsmList; size: tcgsize; reg: tregister; const ref: treference); override; { vector register move instructions } - procedure a_loadmm_reg_reg(list: taasmoutput; fromsize, tosize : tcgsize;reg1, reg2: tregister;shuffle : pmmshuffle); override; - procedure a_loadmm_ref_reg(list: taasmoutput; fromsize, tosize : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); override; - procedure a_loadmm_reg_ref(list: taasmoutput; fromsize, tosize : tcgsize;reg: tregister; const ref: treference;shuffle : pmmshuffle); override; - procedure a_opmm_ref_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); override; - procedure a_opmm_reg_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;src,dst: tregister;shuffle : pmmshuffle);override; + procedure a_loadmm_reg_reg(list: TAsmList; fromsize, tosize : tcgsize;reg1, reg2: tregister;shuffle : pmmshuffle); override; + procedure a_loadmm_ref_reg(list: TAsmList; fromsize, tosize : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); override; + procedure a_loadmm_reg_ref(list: TAsmList; fromsize, tosize : tcgsize;reg: tregister; const ref: treference;shuffle : pmmshuffle); override; + procedure a_opmm_ref_reg(list: TAsmList; Op: TOpCG; size : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); override; + procedure a_opmm_reg_reg(list: TAsmList; Op: TOpCG; size : tcgsize;src,dst: tregister;shuffle : pmmshuffle);override; { comparison operations } - procedure a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; + procedure a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; l : tasmlabel);override; - procedure a_cmp_const_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;const ref : treference; + procedure a_cmp_const_ref_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;const ref : treference; l : tasmlabel);override; - procedure a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override; - procedure a_cmp_ref_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;const ref: treference; reg : tregister; l : tasmlabel); override; - procedure a_cmp_reg_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg : tregister; const ref: treference; l : tasmlabel); override; + procedure a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg1,reg2 : tregister;l : tasmlabel); override; + procedure a_cmp_ref_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;const ref: treference; reg : tregister; l : tasmlabel); override; + procedure a_cmp_reg_ref_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg : tregister; const ref: treference; l : tasmlabel); override; - procedure a_jmp_name(list : taasmoutput;const s : string);override; - procedure a_jmp_always(list : taasmoutput;l: tasmlabel); override; - procedure a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); override; + procedure a_jmp_name(list : TAsmList;const s : string);override; + procedure a_jmp_always(list : TAsmList;l: tasmlabel); override; + procedure a_jmp_flags(list : TAsmList;const f : TResFlags;l: tasmlabel); override; - procedure g_flags2reg(list: taasmoutput; size: TCgSize; const f: tresflags; reg: TRegister); override; - procedure g_flags2ref(list: taasmoutput; size: TCgSize; const f: tresflags; const ref: TReference); override; + procedure g_flags2reg(list: TAsmList; size: TCgSize; const f: tresflags; reg: TRegister); override; + procedure g_flags2ref(list: TAsmList; size: TCgSize; const f: tresflags; const ref: TReference); override; - procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aint);override; + procedure g_concatcopy(list : TAsmList;const source,dest : treference;len : aint);override; { entry/exit code helpers } - procedure g_releasevaluepara_openarray(list : taasmoutput;const l:tlocation);override; - procedure g_profilecode(list : taasmoutput);override; - procedure g_stackpointer_alloc(list : taasmoutput;localsize : longint);override; - procedure g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean);override; + procedure g_releasevaluepara_openarray(list : TAsmList;const l:tlocation);override; + procedure g_profilecode(list : TAsmList);override; + procedure g_stackpointer_alloc(list : TAsmList;localsize : longint);override; + procedure g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean);override; - procedure g_overflowcheck(list: taasmoutput; const l:tlocation;def:tdef);override; + procedure g_overflowcheck(list: TAsmList; const l:tlocation;def:tdef);override; - procedure make_simple_ref(list:taasmoutput;var ref: treference); + procedure make_simple_ref(list:TAsmList;var ref: treference); protected - procedure a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel); + procedure a_jmp_cond(list : TAsmList;cond : TOpCmp;l: tasmlabel); procedure check_register_size(size:tcgsize;reg:tregister); - procedure opmm_loc_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;loc : tlocation;dst: tregister; shuffle : pmmshuffle); + procedure opmm_loc_reg(list: TAsmList; Op: TOpCG; size : tcgsize;loc : tlocation;dst: tregister; shuffle : pmmshuffle); private procedure sizes2load(s1,s2 : tcgsize;var op: tasmop; var s3: topsize); - procedure floatload(list: taasmoutput; t : tcgsize;const ref : treference); - procedure floatstore(list: taasmoutput; t : tcgsize;const ref : treference); + procedure floatload(list: TAsmList; t : tcgsize;const ref : treference); + procedure floatstore(list: TAsmList; t : tcgsize;const ref : treference); procedure floatloadops(t : tcgsize;var op : tasmop;var s : topsize); procedure floatstoreops(t : tcgsize;var op : tasmop;var s : topsize); @@ -177,13 +177,13 @@ unit cgx86; end; - function Tcgx86.getfpuregister(list:Taasmoutput;size:Tcgsize):Tregister; + function Tcgx86.getfpuregister(list:TAsmList;size:Tcgsize):Tregister; begin result:=rgfpu.getregisterfpu(list); end; - function Tcgx86.getmmxregister(list:Taasmoutput):Tregister; + function Tcgx86.getmmxregister(list:TAsmList):Tregister; begin if not assigned(rg[R_MMXREGISTER]) then internalerror(2003121214); @@ -191,7 +191,7 @@ unit cgx86; end; - function Tcgx86.getmmregister(list:Taasmoutput;size:Tcgsize):Tregister; + function Tcgx86.getmmregister(list:TAsmList;size:Tcgsize):Tregister; begin if not assigned(rg[R_MMREGISTER]) then internalerror(2003121234); @@ -206,7 +206,7 @@ unit cgx86; end; - procedure Tcgx86.getcpuregister(list:Taasmoutput;r:Tregister); + procedure Tcgx86.getcpuregister(list:TAsmList;r:Tregister); begin if getregtype(r)=R_FPUREGISTER then internalerror(2003121210) @@ -215,7 +215,7 @@ unit cgx86; end; - procedure tcgx86.ungetcpuregister(list:Taasmoutput;r:Tregister); + procedure tcgx86.ungetcpuregister(list:TAsmList;r:Tregister); begin if getregtype(r)=R_FPUREGISTER then rgfpu.ungetregisterfpu(list,r) @@ -224,14 +224,14 @@ unit cgx86; end; - procedure Tcgx86.alloccpuregisters(list:Taasmoutput;rt:Tregistertype;const r:Tcpuregisterset); + procedure Tcgx86.alloccpuregisters(list:TAsmList;rt:Tregistertype;const r:Tcpuregisterset); begin if rt<>R_FPUREGISTER then inherited alloccpuregisters(list,rt,r); end; - procedure Tcgx86.dealloccpuregisters(list:Taasmoutput;rt:Tregistertype;const r:Tcpuregisterset); + procedure Tcgx86.dealloccpuregisters(list:TAsmList;rt:Tregistertype;const r:Tcpuregisterset); begin if rt<>R_FPUREGISTER then inherited dealloccpuregisters(list,rt,r); @@ -337,7 +337,7 @@ unit cgx86; end; - procedure tcgx86.make_simple_ref(list:taasmoutput;var ref: treference); + procedure tcgx86.make_simple_ref(list:TAsmList;var ref: treference); var hreg : tregister; href : treference; @@ -455,7 +455,7 @@ unit cgx86; end; - procedure tcgx86.floatload(list: taasmoutput; t : tcgsize;const ref : treference); + procedure tcgx86.floatload(list: TAsmList; t : tcgsize;const ref : treference); var op : tasmop; @@ -500,7 +500,7 @@ unit cgx86; end; - procedure tcgx86.floatstore(list: taasmoutput; t : tcgsize;const ref : treference); + procedure tcgx86.floatstore(list: TAsmList; t : tcgsize;const ref : treference); var op : tasmop; @@ -529,13 +529,13 @@ unit cgx86; Assembler code ****************************************************************************} - procedure tcgx86.a_jmp_name(list : taasmoutput;const s : string); + procedure tcgx86.a_jmp_name(list : TAsmList;const s : string); begin - list.concat(taicpu.op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); + list.concat(taicpu.op_sym(A_JMP,S_NO,current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION))); end; - procedure tcgx86.a_jmp_always(list : taasmoutput;l: tasmlabel); + procedure tcgx86.a_jmp_always(list : TAsmList;l: tasmlabel); begin a_jmp_cond(list, OC_NONE, l); end; @@ -548,26 +548,26 @@ unit cgx86; l1: tasmsymbol; begin stubname := 'L'+s+'$stub'; - result := objectlibrary.getasmsymbol(stubname); + result := current_asmdata.getasmsymbol(stubname); if assigned(result) then exit; - if asmlist[al_imports]=nil then - asmlist[al_imports]:=TAAsmoutput.create; - - asmlist[al_imports].concat(Tai_section.create(sec_stub,'',0)); - result := objectlibrary.newasmsymbol(stubname,AB_EXTERNAL,AT_FUNCTION); - asmlist[al_imports].concat(Tai_symbol.Create(result,0)); - asmlist[al_imports].concat(tai_directive.create(asd_indirect_symbol,s)); - asmlist[al_imports].concat(taicpu.op_none(A_HLT)); - asmlist[al_imports].concat(taicpu.op_none(A_HLT)); - asmlist[al_imports].concat(taicpu.op_none(A_HLT)); - asmlist[al_imports].concat(taicpu.op_none(A_HLT)); - asmlist[al_imports].concat(taicpu.op_none(A_HLT)); + if current_asmdata.asmlists[al_imports]=nil then + current_asmdata.asmlists[al_imports]:=TAsmList.create; + + current_asmdata.asmlists[al_imports].concat(Tai_section.create(sec_stub,'',0)); + result := current_asmdata.newasmsymbol(stubname,AB_EXTERNAL,AT_FUNCTION); + current_asmdata.asmlists[al_imports].concat(Tai_symbol.Create(result,0)); + current_asmdata.asmlists[al_imports].concat(tai_directive.create(asd_indirect_symbol,s)); + current_asmdata.asmlists[al_imports].concat(taicpu.op_none(A_HLT)); + current_asmdata.asmlists[al_imports].concat(taicpu.op_none(A_HLT)); + current_asmdata.asmlists[al_imports].concat(taicpu.op_none(A_HLT)); + current_asmdata.asmlists[al_imports].concat(taicpu.op_none(A_HLT)); + current_asmdata.asmlists[al_imports].concat(taicpu.op_none(A_HLT)); end; - procedure tcgx86.a_call_name(list : taasmoutput;const s : string); + procedure tcgx86.a_call_name(list : TAsmList;const s : string); var sym : tasmsymbol; r : treference; @@ -575,7 +575,7 @@ unit cgx86; if (target_info.system <> system_i386_darwin) then begin - sym:=objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION); + sym:=current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION); reference_reset_symbol(r,sym,0); if cs_create_pic in aktmoduleswitches then begin @@ -596,25 +596,25 @@ unit cgx86; end; - procedure tcgx86.a_call_name_static(list : taasmoutput;const s : string); + procedure tcgx86.a_call_name_static(list : TAsmList;const s : string); var sym : tasmsymbol; r : treference; begin - sym:=objectlibrary.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION); + sym:=current_asmdata.newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION); reference_reset_symbol(r,sym,0); r.refaddr:=addr_full; list.concat(taicpu.op_ref(A_CALL,S_NO,r)); end; - procedure tcgx86.a_call_reg(list : taasmoutput;reg : tregister); + procedure tcgx86.a_call_reg(list : TAsmList;reg : tregister); begin list.concat(taicpu.op_reg(A_CALL,S_NO,reg)); end; - procedure tcgx86.a_call_ref(list : taasmoutput;ref : treference); + procedure tcgx86.a_call_ref(list : TAsmList;ref : treference); begin list.concat(taicpu.op_ref(A_CALL,S_NO,ref)); end; @@ -622,7 +622,7 @@ unit cgx86; {********************** load instructions ********************} - procedure tcgx86.a_load_const_reg(list : taasmoutput; tosize: TCGSize; a : aint; reg : TRegister); + procedure tcgx86.a_load_const_reg(list : TAsmList; tosize: TCGSize; a : aint; reg : TRegister); begin check_register_size(tosize,reg); @@ -632,7 +632,7 @@ unit cgx86; end; - procedure tcgx86.a_load_const_ref(list : taasmoutput; tosize: tcgsize; a : aint;const ref : treference); + procedure tcgx86.a_load_const_ref(list : TAsmList; tosize: tcgsize; a : aint;const ref : treference); var tmpref : treference; begin @@ -653,7 +653,7 @@ unit cgx86; end; - procedure tcgx86.a_load_reg_ref(list : taasmoutput; fromsize,tosize: TCGSize; reg : tregister;const ref : treference); + procedure tcgx86.a_load_reg_ref(list : TAsmList; fromsize,tosize: TCGSize; reg : tregister;const ref : treference); var op: tasmop; s: topsize; @@ -693,7 +693,7 @@ unit cgx86; end; - procedure tcgx86.a_load_ref_reg(list : taasmoutput;fromsize,tosize : tcgsize;const ref: treference;reg : tregister); + procedure tcgx86.a_load_ref_reg(list : TAsmList;fromsize,tosize : tcgsize;const ref: treference;reg : tregister); var op: tasmop; s: topsize; @@ -714,7 +714,7 @@ unit cgx86; end; - procedure tcgx86.a_load_reg_reg(list : taasmoutput;fromsize,tosize : tcgsize;reg1,reg2 : tregister); + procedure tcgx86.a_load_reg_reg(list : TAsmList;fromsize,tosize : tcgsize;reg1,reg2 : tregister); var op: tasmop; s: topsize; @@ -755,7 +755,7 @@ unit cgx86; end; - procedure tcgx86.a_loadaddr_ref_reg(list : taasmoutput;const ref : treference;r : tregister); + procedure tcgx86.a_loadaddr_ref_reg(list : TAsmList;const ref : treference;r : tregister); var tmpref : treference; begin @@ -814,7 +814,7 @@ unit cgx86; system_i386_linux: if segment=NR_GS then begin - reference_reset_symbol(tmpref,objectlibrary.newasmsymbol( + reference_reset_symbol(tmpref,current_asmdata.newasmsymbol( '___fpc_threadvar_offset',AB_EXTERNAL,AT_DATA),0); tmpref.segment:=NR_GS; list.concat(Taicpu.op_ref_reg(A_ADD,tcgsize2opsize[OS_ADDR],tmpref,r)); @@ -845,7 +845,7 @@ unit cgx86; { all fpu load routines expect that R_ST[0-7] means an fpu regvar and } { R_ST means "the current value at the top of the fpu stack" (JM) } - procedure tcgx86.a_loadfpu_reg_reg(list: taasmoutput; size: tcgsize; reg1, reg2: tregister); + procedure tcgx86.a_loadfpu_reg_reg(list: TAsmList; size: tcgsize; reg1, reg2: tregister); begin if (reg1<>NR_ST) then @@ -861,7 +861,7 @@ unit cgx86; end; - procedure tcgx86.a_loadfpu_ref_reg(list: taasmoutput; size: tcgsize; const ref: treference; reg: tregister); + procedure tcgx86.a_loadfpu_ref_reg(list: TAsmList; size: tcgsize; const ref: treference; reg: tregister); begin floatload(list,size,ref); if (reg<>NR_ST) then @@ -869,7 +869,7 @@ unit cgx86; end; - procedure tcgx86.a_loadfpu_reg_ref(list: taasmoutput; size: tcgsize; reg: tregister; const ref: treference); + procedure tcgx86.a_loadfpu_reg_ref(list: TAsmList; size: tcgsize; reg: tregister; const ref: treference); begin if reg<>NR_ST then a_loadfpu_reg_reg(list,size,reg,NR_ST); @@ -892,7 +892,7 @@ unit cgx86; end; - procedure tcgx86.a_loadmm_reg_reg(list: taasmoutput; fromsize, tosize : tcgsize;reg1, reg2: tregister;shuffle : pmmshuffle); + procedure tcgx86.a_loadmm_reg_reg(list: TAsmList; fromsize, tosize : tcgsize;reg1, reg2: tregister;shuffle : pmmshuffle); var instr : taicpu; begin @@ -917,7 +917,7 @@ unit cgx86; end; - procedure tcgx86.a_loadmm_ref_reg(list: taasmoutput; fromsize, tosize : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); + procedure tcgx86.a_loadmm_ref_reg(list: TAsmList; fromsize, tosize : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); var tmpref : treference; begin @@ -932,7 +932,7 @@ unit cgx86; end; - procedure tcgx86.a_loadmm_reg_ref(list: taasmoutput; fromsize, tosize : tcgsize;reg: tregister; const ref: treference;shuffle : pmmshuffle); + procedure tcgx86.a_loadmm_reg_ref(list: TAsmList; fromsize, tosize : tcgsize;reg: tregister; const ref: treference;shuffle : pmmshuffle); var hreg : tregister; tmpref : treference; @@ -957,7 +957,7 @@ unit cgx86; end; - procedure tcgx86.a_opmm_ref_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); + procedure tcgx86.a_opmm_ref_reg(list: TAsmList; Op: TOpCG; size : tcgsize;const ref: treference; reg: tregister;shuffle : pmmshuffle); var l : tlocation; begin @@ -968,7 +968,7 @@ unit cgx86; end; - procedure tcgx86.a_opmm_reg_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;src,dst: tregister;shuffle : pmmshuffle); + procedure tcgx86.a_opmm_reg_reg(list: TAsmList; Op: TOpCG; size : tcgsize;src,dst: tregister;shuffle : pmmshuffle); var l : tlocation; begin @@ -979,7 +979,7 @@ unit cgx86; end; - procedure tcgx86.opmm_loc_reg(list: taasmoutput; Op: TOpCG; size : tcgsize;loc : tlocation;dst: tregister; shuffle : pmmshuffle); + procedure tcgx86.opmm_loc_reg(list: TAsmList; Op: TOpCG; size : tcgsize;loc : tlocation;dst: tregister; shuffle : pmmshuffle); const opmm2asmop : array[0..1,OS_F32..OS_F64,topcg] of tasmop = ( ( { scalar } @@ -1037,7 +1037,7 @@ unit cgx86; case loc.loc of LOC_CREFERENCE,LOC_REFERENCE: begin - make_simple_ref(exprasmlist,loc.reference); + make_simple_ref(current_asmdata.CurrAsmList,loc.reference); list.concat(taicpu.op_ref_reg(asmop,S_NO,loc.reference,resultreg)); end; LOC_CMMREGISTER,LOC_MMREGISTER: @@ -1053,7 +1053,7 @@ unit cgx86; end; - procedure tcgx86.a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); + procedure tcgx86.a_op_const_reg(list : TAsmList; Op: TOpCG; size: TCGSize; a: aint; reg: TRegister); var opcode : tasmop; @@ -1146,7 +1146,7 @@ unit cgx86; end; - procedure tcgx86.a_op_const_ref(list : taasmoutput; Op: TOpCG; size: TCGSize; a: aint; const ref: TReference); + procedure tcgx86.a_op_const_ref(list : TAsmList; Op: TOpCG; size: TCGSize; a: aint; const ref: TReference); var opcode: tasmop; power: longint; @@ -1245,7 +1245,7 @@ unit cgx86; end; - procedure tcgx86.a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; src, dst: TRegister); + procedure tcgx86.a_op_reg_reg(list : TAsmList; Op: TOpCG; size: TCGSize; src, dst: TRegister); var dstsize: topsize; instr:Taicpu; @@ -1282,7 +1282,7 @@ unit cgx86; end; - procedure tcgx86.a_op_ref_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; const ref: TReference; reg: TRegister); + procedure tcgx86.a_op_ref_reg(list : TAsmList; Op: TOpCG; size: TCGSize; const ref: TReference; reg: TRegister); var tmpref : treference; begin @@ -1307,7 +1307,7 @@ unit cgx86; end; - procedure tcgx86.a_op_reg_ref(list : taasmoutput; Op: TOpCG; size: TCGSize;reg: TRegister; const ref: TReference); + procedure tcgx86.a_op_reg_ref(list : TAsmList; Op: TOpCG; size: TCGSize;reg: TRegister; const ref: TReference); var tmpref : treference; begin @@ -1338,7 +1338,7 @@ unit cgx86; end; - procedure tcgx86.a_op_const_reg_reg(list: taasmoutput; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister); + procedure tcgx86.a_op_const_reg_reg(list: TAsmList; op: TOpCg; size: tcgsize; a: aint; src, dst: tregister); var tmpref: treference; power: longint; @@ -1398,7 +1398,7 @@ unit cgx86; end; - procedure tcgx86.a_op_reg_reg_reg(list: taasmoutput; op: TOpCg;size: tcgsize; src1, src2, dst: tregister); + procedure tcgx86.a_op_reg_reg_reg(list: TAsmList; op: TOpCg;size: tcgsize; src1, src2, dst: tregister); var tmpref: treference; begin @@ -1432,7 +1432,7 @@ unit cgx86; {*************** compare instructructions ****************} - procedure tcgx86.a_cmp_const_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; + procedure tcgx86.a_cmp_const_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;reg : tregister; l : tasmlabel); {$ifdef x86_64} @@ -1459,7 +1459,7 @@ unit cgx86; end; - procedure tcgx86.a_cmp_const_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;a : aint;const ref : treference; + procedure tcgx86.a_cmp_const_ref_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;a : aint;const ref : treference; l : tasmlabel); var @@ -1486,7 +1486,7 @@ unit cgx86; end; - procedure tcgx86.a_cmp_reg_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp; + procedure tcgx86.a_cmp_reg_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp; reg1,reg2 : tregister;l : tasmlabel); begin @@ -1497,7 +1497,7 @@ unit cgx86; end; - procedure tcgx86.a_cmp_ref_reg_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;const ref: treference; reg : tregister;l : tasmlabel); + procedure tcgx86.a_cmp_ref_reg_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;const ref: treference; reg : tregister;l : tasmlabel); var tmpref : treference; begin @@ -1509,7 +1509,7 @@ unit cgx86; end; - procedure tcgx86.a_cmp_reg_ref_label(list : taasmoutput;size : tcgsize;cmp_op : topcmp;reg : tregister;const ref: treference; l : tasmlabel); + procedure tcgx86.a_cmp_reg_ref_label(list : TAsmList;size : tcgsize;cmp_op : topcmp;reg : tregister;const ref: treference; l : tasmlabel); var tmpref : treference; begin @@ -1521,7 +1521,7 @@ unit cgx86; end; - procedure tcgx86.a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel); + procedure tcgx86.a_jmp_cond(list : TAsmList;cond : TOpCmp;l: tasmlabel); var ai : taicpu; begin @@ -1537,7 +1537,7 @@ unit cgx86; end; - procedure tcgx86.a_jmp_flags(list : taasmoutput;const f : TResFlags;l: tasmlabel); + procedure tcgx86.a_jmp_flags(list : TAsmList;const f : TResFlags;l: tasmlabel); var ai : taicpu; begin @@ -1548,7 +1548,7 @@ unit cgx86; end; - procedure tcgx86.g_flags2reg(list: taasmoutput; size: TCgSize; const f: tresflags; reg: TRegister); + procedure tcgx86.g_flags2reg(list: TAsmList; size: TCgSize; const f: tresflags; reg: TRegister); var ai : taicpu; hreg : tregister; @@ -1562,7 +1562,7 @@ unit cgx86; end; - procedure tcgx86.g_flags2ref(list: taasmoutput; size: TCgSize; const f: tresflags; const ref: TReference); + procedure tcgx86.g_flags2ref(list: TAsmList; size: TCgSize; const f: tresflags; const ref: TReference); var ai : taicpu; tmpref : treference; @@ -1579,7 +1579,7 @@ unit cgx86; { ************* concatcopy ************ } - procedure Tcgx86.g_concatcopy(list:Taasmoutput;const source,dest:Treference;len:aint); + procedure Tcgx86.g_concatcopy(list:TAsmList;const source,dest:Treference;len:aint); const {$ifdef cpu64bit} @@ -1747,7 +1747,7 @@ unit cgx86; Entry/Exit Code Helpers ****************************************************************************} - procedure tcgx86.g_releasevaluepara_openarray(list : taasmoutput;const l:tlocation); + procedure tcgx86.g_releasevaluepara_openarray(list : TAsmList;const l:tlocation); begin if (use_fixed_stack) then begin @@ -1758,7 +1758,7 @@ unit cgx86; end; - procedure tcgx86.g_profilecode(list : taasmoutput); + procedure tcgx86.g_profilecode(list : TAsmList); var pl : tasmlabel; @@ -1781,7 +1781,7 @@ unit cgx86; else mcountPrefix:=''; end; - objectlibrary.getaddrlabel(pl); + current_asmdata.getaddrlabel(pl); new_section(list,sec_data,lower(current_procinfo.procdef.mangledname),sizeof(aint)); list.concat(Tai_label.Create(pl)); list.concat(Tai_const.Create_32bit(0)); @@ -1807,7 +1807,7 @@ unit cgx86; end; - procedure tcgx86.g_stackpointer_alloc(list : taasmoutput;localsize : longint); + procedure tcgx86.g_stackpointer_alloc(list : TAsmList;localsize : longint); {$ifdef i386} {$ifndef NOTARGETWIN} var @@ -1838,7 +1838,7 @@ unit cgx86; end else begin - objectlibrary.getjumplabel(again); + current_asmdata.getjumplabel(again); getcpuregister(list,NR_EDI); list.concat(Taicpu.op_reg(A_PUSH,S_L,NR_EDI)); list.concat(Taicpu.op_const_reg(A_MOV,S_L,localsize div winstackpagesize,NR_EDI)); @@ -1861,7 +1861,7 @@ unit cgx86; end; - procedure tcgx86.g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean); + procedure tcgx86.g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean); var stackmisalignment: longint; begin @@ -1925,7 +1925,7 @@ unit cgx86; { produces if necessary overflowcode } - procedure tcgx86.g_overflowcheck(list: taasmoutput; const l:tlocation;def:tdef); + procedure tcgx86.g_overflowcheck(list: TAsmList; const l:tlocation;def:tdef); var hl : tasmlabel; ai : taicpu; @@ -1933,7 +1933,7 @@ unit cgx86; begin if not(cs_check_overflow in aktlocalswitches) then exit; - objectlibrary.getjumplabel(hl); + current_asmdata.getjumplabel(hl); if not ((def.deftype=pointerdef) or ((def.deftype=orddef) and (torddef(def).typ in [u64bit,u16bit,u32bit,u8bit,uchar, diff --git a/compiler/x86/nx86add.pas b/compiler/x86/nx86add.pas index 11a25cca98..1ddb5e7e9e 100644 --- a/compiler/x86/nx86add.pas +++ b/compiler/x86/nx86add.pas @@ -111,11 +111,11 @@ unit nx86add; if (nodetype=subn) and (nf_swaped in flags) then begin if extra_not then - cg.a_op_reg_reg(exprasmlist,OP_NOT,opsize,left.location.register,left.location.register); - r:=cg.getintregister(exprasmlist,opsize); - cg.a_load_loc_reg(exprasmlist,opsize,right.location,r); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_NOT,opsize,left.location.register,left.location.register); + r:=cg.getintregister(current_asmdata.CurrAsmList,opsize); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,opsize,right.location,r); emit_reg_reg(op,TCGSize2Opsize[opsize],left.location.register,r); - cg.a_load_reg_reg(exprasmlist,opsize,opsize,r,left.location.register); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,opsize,opsize,r,left.location.register); end else begin @@ -155,8 +155,8 @@ unit nx86add; begin if extra_not then begin - r:=cg.getintregister(exprasmlist,opsize); - cg.a_load_loc_reg(exprasmlist,opsize,right.location,r); + r:=cg.getintregister(current_asmdata.CurrAsmList,opsize); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,opsize,right.location,r); emit_reg(A_NOT,TCGSize2Opsize[opsize],r); emit_reg_reg(A_AND,TCGSize2Opsize[opsize],r,left.location.register); end @@ -176,13 +176,13 @@ unit nx86add; begin if cs_check_overflow in aktlocalswitches then begin - objectlibrary.getjumplabel(hl4); + current_asmdata.getjumplabel(hl4); if unsigned then - cg.a_jmp_flags(exprasmlist,F_AE,hl4) + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_AE,hl4) else - cg.a_jmp_flags(exprasmlist,F_NO,hl4); - cg.a_call_name(exprasmlist,'FPC_OVERFLOW'); - cg.a_label(exprasmlist,hl4); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NO,hl4); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_OVERFLOW'); + cg.a_label(current_asmdata.CurrAsmList,hl4); end; end; end; @@ -205,7 +205,7 @@ unit nx86add; { maybe we can reuse a constant register when the operation is a comparison that doesn't change the value of the register } - location_force_reg(exprasmlist,left.location,opsize,(nodetype in [ltn,lten,gtn,gten,equaln,unequaln])); + location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,(nodetype in [ltn,lten,gtn,gten,equaln,unequaln])); end; end; end; @@ -215,14 +215,14 @@ unit nx86add; begin if (right.location.loc<>LOC_FPUREGISTER) then begin - cg.a_loadfpu_loc_reg(exprasmlist,right.location,NR_ST); + cg.a_loadfpu_loc_reg(current_asmdata.CurrAsmList,right.location,NR_ST); if (right.location.loc <> LOC_CFPUREGISTER) then - location_freetemp(exprasmlist,left.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); if (left.location.loc<>LOC_FPUREGISTER) then begin - cg.a_loadfpu_loc_reg(exprasmlist,left.location,NR_ST); + cg.a_loadfpu_loc_reg(current_asmdata.CurrAsmList,left.location,NR_ST); if (left.location.loc <> LOC_CFPUREGISTER) then - location_freetemp(exprasmlist,left.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); end else begin @@ -233,9 +233,9 @@ unit nx86add; { the nominator in st0 } else if (left.location.loc<>LOC_FPUREGISTER) then begin - cg.a_loadfpu_loc_reg(exprasmlist,left.location,NR_ST); + cg.a_loadfpu_loc_reg(current_asmdata.CurrAsmList,left.location,NR_ST); if (left.location.loc <> LOC_CFPUREGISTER) then - location_freetemp(exprasmlist,left.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); end else begin @@ -255,12 +255,12 @@ unit nx86add; case right.location.loc of LOC_REGISTER, LOC_CREGISTER : - exprasmlist.concat(taicpu.op_reg_reg(op,TCGSize2Opsize[opsize],right.location.register,left.location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,TCGSize2Opsize[opsize],right.location.register,left.location.register)); LOC_REFERENCE, LOC_CREFERENCE : begin - tcgx86(cg).make_simple_ref(exprasmlist,right.location.reference); - exprasmlist.concat(taicpu.op_ref_reg(op,TCGSize2Opsize[opsize],right.location.reference,left.location.register)); + tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,right.location.reference); + current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(op,TCGSize2Opsize[opsize],right.location.reference,left.location.register)); end; LOC_CONSTANT : begin @@ -269,13 +269,13 @@ unit nx86add; if (opsize in [OS_S64,OS_64]) and ((right.location.value<low(longint)) or (right.location.value>high(longint))) then begin - tmpreg:=cg.getintregister(exprasmlist,opsize); - cg.a_load_const_reg(exprasmlist,opsize,right.location.value,tmpreg); - exprasmlist.concat(taicpu.op_reg_reg(op,TCGSize2Opsize[opsize],tmpreg,left.location.register)); + tmpreg:=cg.getintregister(current_asmdata.CurrAsmList,opsize); + cg.a_load_const_reg(current_asmdata.CurrAsmList,opsize,right.location.value,tmpreg); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,TCGSize2Opsize[opsize],tmpreg,left.location.register)); end else {$endif x86_64} - exprasmlist.concat(taicpu.op_const_reg(op,TCGSize2Opsize[opsize],right.location.value,left.location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(op,TCGSize2Opsize[opsize],right.location.value,left.location.register)); end; else internalerror(200203232); @@ -360,8 +360,8 @@ unit nx86add; if assigned(tsetelementnode(right).right) then internalerror(43244); { bts requires both elements to be registers } - location_force_reg(exprasmlist,left.location,opsize,false); - location_force_reg(exprasmlist,right.location,opsize,true); + location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,false); + location_force_reg(current_asmdata.CurrAsmList,right.location,opsize,true); op:=A_BTS; noswap:=true; end @@ -396,7 +396,7 @@ unit nx86add; { left must be a register } left_must_be_reg(opsize,noswap); emit_generic_code(op,opsize,true,extra_not,false); - location_freetemp(exprasmlist,right.location); + location_freetemp(current_asmdata.CurrAsmList,right.location); set_result_location_reg; end; @@ -418,7 +418,7 @@ unit nx86add; if (not(nf_swaped in flags) and (nodetype = lten)) or ((nf_swaped in flags) and (nodetype = gten)) then swapleftright; - location_force_reg(exprasmlist,left.location,opsize,true); + location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,true); emit_op_right_left(A_AND,opsize); op:=A_CMP; { warning: ugly hack, we need a JE so change the node to equaln } @@ -430,8 +430,8 @@ unit nx86add; { left must be a register } left_must_be_reg(opsize,false); emit_generic_code(op,opsize,true,false,false); - location_freetemp(exprasmlist,right.location); - location_freetemp(exprasmlist,left.location); + location_freetemp(current_asmdata.CurrAsmList,right.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=getresflags(true); @@ -544,7 +544,7 @@ unit nx86add; { register variable ? } if (left.location.loc=LOC_CMMXREGISTER) then begin - hregister:=tcgx86(cg).getmmxregister(exprasmlist); + hregister:=tcgx86(cg).getmmxregister(current_asmdata.CurrAsmList); emit_reg_reg(A_MOVQ,S_NO,left.location.register,hregister); end else @@ -552,7 +552,7 @@ unit nx86add; if not(left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then internalerror(200203245); - hregister:=tcgx86(cg).getmmxregister(exprasmlist); + hregister:=tcgx86(cg).getmmxregister(current_asmdata.CurrAsmList); emit_ref_reg(A_MOVQ,S_NO,left.location.reference,hregister); end; @@ -566,7 +566,7 @@ unit nx86add; begin if (nodetype=subn) and (nf_swaped in flags) then begin - hreg:=tcgx86(cg).getmmxregister(exprasmlist); + hreg:=tcgx86(cg).getmmxregister(current_asmdata.CurrAsmList); if right.location.loc=LOC_CMMXREGISTER then begin emit_reg_reg(A_MOVQ,S_NO,right.location.register,hreg); @@ -610,9 +610,9 @@ unit nx86add; location.register:=left.location.register; end; - location_freetemp(exprasmlist,right.location); + location_freetemp(current_asmdata.CurrAsmList,right.location); if cmpop then - location_freetemp(exprasmlist,left.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); end; {$endif SUPPORT_MMX} @@ -644,8 +644,8 @@ unit nx86add; { if nf_swaped in flags then swapleftright;} { bts requires both elements to be registers } -{ location_force_reg(exprasmlist,left.location,opsize_2_cgsize[opsize],false); - location_force_reg(exprasmlist,right.location,opsize_2_cgsize[opsize],true); +{ location_force_reg(current_asmdata.CurrAsmList,left.location,opsize_2_cgsize[opsize],false); + location_force_reg(current_asmdata.CurrAsmList,right.location,opsize_2_cgsize[opsize],true); op:=A_BTS; noswap:=true;} end @@ -669,7 +669,7 @@ unit nx86add; if (not(nf_swaped in flags) and (nodetype = lten)) or ((nf_swaped in flags) and (nodetype = gten)) then swapleftright; - location_force_reg(exprasmlist,left.location,opsize,true); + location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,true); emit_op_right_left(A_AND,opsize); op:=A_PCMPEQD; cmpop:=true; @@ -688,9 +688,9 @@ unit nx86add; { left must be a register } left_must_be_reg(opsize,noswap); { emit_generic_code(op,opsize,true,extra_not,false);} - location_freetemp(exprasmlist,right.location); + location_freetemp(current_asmdata.CurrAsmList,right.location); if cmpop then - location_freetemp(exprasmlist,left.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); end; {$endif SUPPORT_MMX} @@ -732,12 +732,12 @@ unit nx86add; copy instruction } if left.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER] then - location_force_mem(exprasmlist,left.location); - cg.a_opmm_loc_reg(exprasmlist,op,location.size,left.location,location.register,mms_movescalar); + location_force_mem(current_asmdata.CurrAsmList,left.location); + cg.a_opmm_loc_reg(current_asmdata.CurrAsmList,op,location.size,left.location,location.register,mms_movescalar); end else begin - location_force_mmregscalar(exprasmlist,left.location,false); + location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,false); location.register:=left.location.register; { force floating point reg. location to be written to memory, we don't force it to mm register because writing to memory @@ -745,8 +745,8 @@ unit nx86add; copy instruction } if right.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER] then - location_force_mem(exprasmlist,right.location); - cg.a_opmm_loc_reg(exprasmlist,op,location.size,right.location,location.register,mms_movescalar); + location_force_mem(current_asmdata.CurrAsmList,right.location); + cg.a_opmm_loc_reg(current_asmdata.CurrAsmList,op,location.size,right.location,location.register,mms_movescalar); end; end; @@ -773,15 +773,15 @@ unit nx86add; copy instruction } if left.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER] then - location_force_mem(exprasmlist,left.location); + location_force_mem(current_asmdata.CurrAsmList,left.location); case left.location.loc of LOC_REFERENCE,LOC_CREFERENCE: begin - tcgx86(cg).make_simple_ref(exprasmlist,left.location.reference); - exprasmlist.concat(taicpu.op_ref_reg(op,S_NO,left.location.reference,right.location.register)); + tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,left.location.reference); + current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(op,S_NO,left.location.reference,right.location.register)); end; LOC_MMREGISTER,LOC_CMMREGISTER: - exprasmlist.concat(taicpu.op_reg_reg(op,S_NO,left.location.register,right.location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,S_NO,left.location.register,right.location.register)); else internalerror(200402221); end; @@ -792,22 +792,22 @@ unit nx86add; end else begin - location_force_mmregscalar(exprasmlist,left.location,false); + location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,false); { force floating point reg. location to be written to memory, we don't force it to mm register because writing to memory allows probably shorter code because there is no direct fpu->mm register copy instruction } if right.location.loc in [LOC_FPUREGISTER,LOC_CFPUREGISTER] then - location_force_mem(exprasmlist,right.location); + location_force_mem(current_asmdata.CurrAsmList,right.location); case right.location.loc of LOC_REFERENCE,LOC_CREFERENCE: begin - tcgx86(cg).make_simple_ref(exprasmlist,right.location.reference); - exprasmlist.concat(taicpu.op_ref_reg(op,S_NO,right.location.reference,left.location.register)); + tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,right.location.reference); + current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(op,S_NO,right.location.reference,left.location.register)); end; LOC_MMREGISTER,LOC_CMMREGISTER: - exprasmlist.concat(taicpu.op_reg_reg(op,S_NO,right.location.register,left.location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(op,S_NO,right.location.register,left.location.register)); else internalerror(200402223); end; @@ -881,10 +881,10 @@ unit nx86add; tcgx86(cg).dec_fpu_stack; { load fpu flags } - cg.getcpuregister(exprasmlist,NR_AX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_AX); emit_reg(A_FNSTSW,S_NO,NR_AX); emit_none(A_SAHF,S_NO); - cg.ungetcpuregister(exprasmlist,NR_AX); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_AX); if nf_swaped in flags then begin case nodetype of @@ -911,9 +911,9 @@ unit nx86add; else {$endif x86_64} begin - exprasmlist.concat(taicpu.op_reg_reg(A_FCOMIP,S_NO,NR_ST1,NR_ST0)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FCOMIP,S_NO,NR_ST1,NR_ST0)); { fcomip pops only one fpu register } - exprasmlist.concat(taicpu.op_reg(A_FSTP,S_NO,NR_ST0)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg(A_FSTP,S_NO,NR_ST0)); tcgx86(cg).dec_fpu_stack; tcgx86(cg).dec_fpu_stack; @@ -1034,7 +1034,7 @@ unit nx86add; left_must_be_reg(opsize,false); emit_generic_code(op,opsize,unsigned,extra_not,mboverflow); - location_freetemp(exprasmlist,right.location); + location_freetemp(current_asmdata.CurrAsmList,right.location); set_result_location_reg; end; @@ -1053,8 +1053,8 @@ unit nx86add; left_must_be_reg(opsize,false); emit_generic_code(A_CMP,opsize,unsigned,false,false); - location_freetemp(exprasmlist,right.location); - location_freetemp(exprasmlist,left.location); + location_freetemp(current_asmdata.CurrAsmList,right.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=getresflags(unsigned); diff --git a/compiler/x86/nx86cnv.pas b/compiler/x86/nx86cnv.pas index db89e390f5..3c0c70eb3c 100644 --- a/compiler/x86/nx86cnv.pas +++ b/compiler/x86/nx86cnv.pas @@ -61,7 +61,7 @@ implementation verbose,systems,globals,globtype, aasmbase,aasmtai,aasmcpu, symconst,symdef, - cgbase,cga,pass_2, + cgbase,cga,procinfo,pass_2, ncon,ncal,ncnv, cpubase, cgutils,cgobj,cgx86,ncgutil, @@ -98,12 +98,12 @@ implementation href : treference; {$endif cpu64bit} resflags : tresflags; - hlabel,oldtruelabel,oldfalselabel : tasmlabel; + hlabel,oldTrueLabel,oldFalseLabel : tasmlabel; begin - oldtruelabel:=truelabel; - oldfalselabel:=falselabel; - objectlibrary.getjumplabel(truelabel); - objectlibrary.getjumplabel(falselabel); + oldTrueLabel:=current_procinfo.CurrTrueLabel; + oldFalseLabel:=current_procinfo.CurrFalseLabel; + current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel); + current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel); secondpass(left); if codegenerror then exit; @@ -114,8 +114,8 @@ implementation (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then begin location_copy(location,left.location); - truelabel:=oldtruelabel; - falselabel:=oldfalselabel; + current_procinfo.CurrTrueLabel:=oldTrueLabel; + current_procinfo.CurrFalseLabel:=oldFalseLabel; exit; end; @@ -128,17 +128,17 @@ implementation {$ifndef cpu64bit} if left.location.size in [OS_64,OS_S64] then begin - hregister:=cg.getintregister(exprasmlist,OS_INT); - cg.a_load_ref_reg(exprasmlist,OS_32,OS_32,left.location.reference,hregister); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_32,OS_32,left.location.reference,hregister); href:=left.location.reference; inc(href.offset,4); - cg.a_op_ref_reg(exprasmlist,OP_OR,OS_32,href,hregister); + cg.a_op_ref_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,href,hregister); end else {$endif cpu64bit} begin - location_force_reg(exprasmlist,left.location,left.location.size,true); - cg.a_op_reg_reg(exprasmlist,OP_OR,left.location.size,left.location.register,left.location.register); + location_force_reg(current_asmdata.CurrAsmList,left.location,left.location.size,true); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_OR,left.location.size,left.location.register,left.location.register); end; end; LOC_FLAGS : @@ -150,35 +150,35 @@ implementation {$ifndef cpu64bit} if left.location.size in [OS_64,OS_S64] then begin - hregister:=cg.getintregister(exprasmlist,OS_32); - cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,left.location.register64.reglo,hregister); - cg.a_op_reg_reg(exprasmlist,OP_OR,OS_32,left.location.register64.reghi,hregister); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_32,OS_32,left.location.register64.reglo,hregister); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_32,left.location.register64.reghi,hregister); end else {$endif cpu64bit} - cg.a_op_reg_reg(exprasmlist,OP_OR,left.location.size,left.location.register,left.location.register); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_OR,left.location.size,left.location.register,left.location.register); end; LOC_JUMP : begin - hregister:=cg.getintregister(exprasmlist,OS_INT); - objectlibrary.getjumplabel(hlabel); - cg.a_label(exprasmlist,truelabel); - cg.a_load_const_reg(exprasmlist,OS_INT,1,hregister); - cg.a_jmp_always(exprasmlist,hlabel); - cg.a_label(exprasmlist,falselabel); - cg.a_load_const_reg(exprasmlist,OS_INT,0,hregister); - cg.a_label(exprasmlist,hlabel); - cg.a_op_reg_reg(exprasmlist,OP_OR,OS_INT,hregister,hregister); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + current_asmdata.getjumplabel(hlabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrTrueLabel); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT,1,hregister); + cg.a_jmp_always(current_asmdata.CurrAsmList,hlabel); + cg.a_label(current_asmdata.CurrAsmList,current_procinfo.CurrFalseLabel); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT,0,hregister); + cg.a_label(current_asmdata.CurrAsmList,hlabel); + cg.a_op_reg_reg(current_asmdata.CurrAsmList,OP_OR,OS_INT,hregister,hregister); end; else internalerror(10062); end; { load flags to register } location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def)); - location.register:=cg.getintregister(exprasmlist,location.size); - cg.g_flags2reg(exprasmlist,location.size,resflags,location.register); - truelabel:=oldtruelabel; - falselabel:=oldfalselabel; + location.register:=cg.getintregister(current_asmdata.CurrAsmList,location.size); + cg.g_flags2reg(current_asmdata.CurrAsmList,location.size,resflags,location.register); + current_procinfo.CurrTrueLabel:=oldTrueLabel; + current_procinfo.CurrFalseLabel:=oldFalseLabel; end; function tx86typeconvnode.first_int_to_real : tnode; @@ -212,7 +212,7 @@ implementation internalerror(200506061); location_reset(location,LOC_MMREGISTER,def_cgsize(resulttype.def)); - location.register:=cg.getmmregister(exprasmlist,def_cgsize(resulttype.def)); + location.register:=cg.getmmregister(current_asmdata.CurrAsmList,def_cgsize(resulttype.def)); if (left.location.loc=LOC_REGISTER) and (torddef(left.resulttype.def).typ=u64bit) then begin {$ifdef cpu64bit} @@ -232,8 +232,8 @@ implementation we load bits 0..62 and then check bit 63: if it is 1 then we add $80000000 000000000 as double } - objectlibrary.getdatalabel(l1); - objectlibrary.getjumplabel(l2); + current_asmdata.getdatalabel(l1); + current_asmdata.getjumplabel(l2); if not(signtested) then begin @@ -242,33 +242,33 @@ implementation dec(left.location.reference.offset,4); end; - exprasmlist.concat(taicpu.op_ref_reg(op,S_Q,left.location.reference,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(op,S_Q,left.location.reference,location.register)); - cg.a_jmp_flags(exprasmlist,F_NC,l2); - asmlist[al_typedconsts].concat(Tai_label.Create(l1)); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NC,l2); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(l1)); reference_reset_symbol(href,l1,0); { I got these constant from a test program (FK) } if is_double(resulttype.def) then begin { double (2^64) } - asmlist[al_typedconsts].concat(Tai_const.Create_32bit(0)); - asmlist[al_typedconsts].concat(Tai_const.Create_32bit($43f00000)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit(0)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit($43f00000)); { simplify for PIC } - tcgx86(cg).make_simple_ref(exprasmlist,href); - exprasmlist.concat(taicpu.op_ref_reg(A_ADDSD,S_NO,href,location.register)); + tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,href); + current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(A_ADDSD,S_NO,href,location.register)); end else if is_single(resulttype.def) then begin { single(2^64) } - asmlist[al_typedconsts].concat(Tai_const.Create_32bit($5f800000)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit($5f800000)); { simplify for PIC } - tcgx86(cg).make_simple_ref(exprasmlist,href); - exprasmlist.concat(taicpu.op_ref_reg(A_ADDSS,S_NO,href,location.register)); + tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,href); + current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(A_ADDSS,S_NO,href,location.register)); end else internalerror(200506071); - cg.a_label(exprasmlist,l2); + cg.a_label(current_asmdata.CurrAsmList,l2); end else begin @@ -277,10 +277,10 @@ implementation case left.location.loc of LOC_CREFERENCE, LOC_REFERENCE : - exprasmList.concat(Taicpu.op_ref_reg(op,S_L,left.location.reference,location.register)); + current_asmdata.CurrAsmList.concat(Taicpu.op_ref_reg(op,S_L,left.location.reference,location.register)); LOC_CREGISTER, LOC_REGISTER : - exprasmList.concat(Taicpu.op_reg_reg(op,S_L,left.location.register,location.register)); + current_asmdata.CurrAsmList.concat(Taicpu.op_reg_reg(op,S_L,left.location.register,location.register)); else internalerror(200506072); end; @@ -290,19 +290,19 @@ implementation case left.location.loc of LOC_CREFERENCE, LOC_REFERENCE : - exprasmList.concat(Taicpu.op_ref_reg(op,S_Q,left.location.reference,location.register)); + current_asmdata.CurrAsmList.concat(Taicpu.op_ref_reg(op,S_Q,left.location.reference,location.register)); LOC_CREGISTER, LOC_REGISTER : - exprasmList.concat(Taicpu.op_reg_reg(op,S_Q,left.location.register,location.register)); + current_asmdata.CurrAsmList.concat(Taicpu.op_reg_reg(op,S_Q,left.location.register,location.register)); else internalerror(200506073); end; end else begin - hreg:=cg.getintregister(exprasmlist,OS_64); - cg.a_load_loc_reg(exprasmlist,OS_64,left.location,hreg); - exprasmList.concat(Taicpu.Op_reg_reg(op,S_NO,hreg,location.register)); + hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_64); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_64,left.location,hreg); + current_asmdata.CurrAsmList.concat(Taicpu.Op_reg_reg(op,S_NO,hreg,location.register)); end end; end; @@ -324,17 +324,17 @@ implementation signtested:=false; { We need to load from a reference } - location_force_mem(exprasmlist,left.location); + location_force_mem(current_asmdata.CurrAsmList,left.location); { For u32bit we need to load it as comp and need to make it 64bits } if (torddef(left.resulttype.def).typ=u32bit) then begin - tg.GetTemp(exprasmlist,8,tt_normal,href); - location_freetemp(exprasmlist,left.location); - cg.a_load_ref_ref(exprasmlist,left.location.size,OS_32,left.location.reference,href); + tg.GetTemp(current_asmdata.CurrAsmList,8,tt_normal,href); + location_freetemp(current_asmdata.CurrAsmList,left.location); + cg.a_load_ref_ref(current_asmdata.CurrAsmList,left.location.size,OS_32,left.location.reference,href); inc(href.offset,4); - cg.a_load_const_ref(exprasmlist,OS_32,0,href); + cg.a_load_const_ref(current_asmdata.CurrAsmList,OS_32,0,href); dec(href.offset,4); left.location.reference:=href; end; @@ -344,15 +344,15 @@ implementation u32bit, scurrency, s64bit: - exprasmlist.concat(taicpu.op_ref(A_FILD,S_IQ,left.location.reference)); + current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_FILD,S_IQ,left.location.reference)); u64bit: begin { unsigned 64 bit ints are harder to handle: we load bits 0..62 and then check bit 63: if it is 1 then we add $80000000 000000000 as double } - objectlibrary.getdatalabel(l1); - objectlibrary.getjumplabel(l2); + current_asmdata.getdatalabel(l1); + current_asmdata.getjumplabel(l2); if not(signtested) then begin @@ -361,32 +361,32 @@ implementation dec(left.location.reference.offset,4); end; - exprasmlist.concat(taicpu.op_ref(A_FILD,S_IQ,left.location.reference)); - cg.a_jmp_flags(exprasmlist,F_NC,l2); - asmlist[al_typedconsts].concat(Tai_label.Create(l1)); + current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_FILD,S_IQ,left.location.reference)); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NC,l2); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(l1)); { I got this constant from a test program (FK) } - asmlist[al_typedconsts].concat(Tai_const.Create_32bit(0)); - asmlist[al_typedconsts].concat(Tai_const.Create_32bit(longint ($80000000))); - asmlist[al_typedconsts].concat(Tai_const.Create_32bit($0000403f)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit(0)); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit(longint ($80000000))); + current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit($0000403f)); reference_reset_symbol(href,l1,0); - tcgx86(cg).make_simple_ref(exprasmlist,href); - exprasmlist.concat(Taicpu.Op_ref(A_FLD,S_FX,href)); - exprasmlist.concat(Taicpu.Op_reg_reg(A_FADDP,S_NO,NR_ST,NR_ST1)); - cg.a_label(exprasmlist,l2); + tcgx86(cg).make_simple_ref(current_asmdata.CurrAsmList,href); + current_asmdata.CurrAsmList.concat(Taicpu.Op_ref(A_FLD,S_FX,href)); + current_asmdata.CurrAsmList.concat(Taicpu.Op_reg_reg(A_FADDP,S_NO,NR_ST,NR_ST1)); + cg.a_label(current_asmdata.CurrAsmList,l2); end else begin if left.resulttype.def.size<4 then begin - tg.GetTemp(exprasmlist,4,tt_normal,href); - location_freetemp(exprasmlist,left.location); - cg.a_load_ref_ref(exprasmlist,left.location.size,OS_32,left.location.reference,href); + tg.GetTemp(current_asmdata.CurrAsmList,4,tt_normal,href); + location_freetemp(current_asmdata.CurrAsmList,left.location); + cg.a_load_ref_ref(current_asmdata.CurrAsmList,left.location.size,OS_32,left.location.reference,href); left.location.reference:=href; end; - exprasmlist.concat(taicpu.op_ref(A_FILD,S_IL,left.location.reference)); + current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_FILD,S_IL,left.location.reference)); end; end; - location_freetemp(exprasmlist,left.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); tcgx86(cg).inc_fpu_stack; location.register:=NR_ST; end; diff --git a/compiler/x86/nx86inl.pas b/compiler/x86/nx86inl.pas index 2bc9568c15..f473a8ddf6 100644 --- a/compiler/x86/nx86inl.pas +++ b/compiler/x86/nx86inl.pas @@ -191,12 +191,12 @@ implementation ; LOC_CFPUREGISTER: begin - cg.a_loadfpu_reg_reg(exprasmlist,left.location.size, + cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,left.location.size, left.location.register,location.register); end; LOC_REFERENCE,LOC_CREFERENCE: begin - cg.a_loadfpu_ref_reg(exprasmlist, + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList, def_cgsize(left.resulttype.def), left.location.reference,location.register); end @@ -221,19 +221,19 @@ implementation if use_sse(resulttype.def) then begin secondpass(left); - location_force_mmregscalar(exprasmlist,left.location,false); + location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,false); location:=left.location; case tfloatdef(resulttype.def).typ of s32real: reference_reset_symbol(href, - objectlibrary.newasmsymbol('FPC_ABSMASK_SINGLE',AB_EXTERNAL,AT_DATA),0); + current_asmdata.newasmsymbol('FPC_ABSMASK_SINGLE',AB_EXTERNAL,AT_DATA),0); s64real: reference_reset_symbol(href, - objectlibrary.newasmsymbol('FPC_ABSMASK_DOUBLE',AB_EXTERNAL,AT_DATA),0); + current_asmdata.newasmsymbol('FPC_ABSMASK_DOUBLE',AB_EXTERNAL,AT_DATA),0); else internalerror(200506081); end; - exprasmlist.concat(taicpu.op_ref_reg(A_ANDPS,S_XMM,href,location.register)) + current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(A_ANDPS,S_XMM,href,location.register)) end else begin @@ -249,9 +249,9 @@ implementation if use_sse(resulttype.def) then begin secondpass(left); - location_force_mmregscalar(exprasmlist,left.location,false); + location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,false); location:=left.location; - cg.a_opmm_loc_reg(exprasmlist,OP_MUL,left.location.size,left.location,left.location.register,mms_movescalar); + cg.a_opmm_loc_reg(current_asmdata.CurrAsmList,OP_MUL,left.location.size,left.location,left.location.register,mms_movescalar); end else begin @@ -265,13 +265,13 @@ implementation if use_sse(resulttype.def) then begin secondpass(left); - location_force_mmregscalar(exprasmlist,left.location,false); + location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,false); location:=left.location; case tfloatdef(resulttype.def).typ of s32real: - exprasmlist.concat(taicpu.op_reg_reg(A_SQRTSS,S_XMM,location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_SQRTSS,S_XMM,location.register,location.register)); s64real: - exprasmlist.concat(taicpu.op_reg_reg(A_SQRTSD,S_XMM,location.register,location.register)); + current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_SQRTSD,S_XMM,location.register,location.register)); else internalerror(200510031); end; @@ -317,10 +317,10 @@ implementation LOC_CREFERENCE, LOC_REFERENCE: begin - r:=cg.getintregister(exprasmlist,OS_ADDR); - cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,r); + r:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR); + cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,left.location.reference,r); reference_reset_base(ref,r,0); - exprasmlist.concat(taicpu.op_ref(A_PREFETCHNTA,S_NO,ref)); + current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_PREFETCHNTA,S_NO,ref)); end; else internalerror(200402021); @@ -361,10 +361,10 @@ implementation begin inc(tcallparanode(left).left.location.reference.offset, (tordconstnode(tcallparanode(tcallparanode(left).right).left).value div bitsperop)*tcgsize2size[opsize]); - cg.a_op_const_ref(exprasmlist,cgop,opsize,l,tcallparanode(left).left.location.reference); + cg.a_op_const_ref(current_asmdata.CurrAsmList,cgop,opsize,l,tcallparanode(left).left.location.reference); end; LOC_CREGISTER : - cg.a_op_const_reg(exprasmlist,cgop,tcallparanode(left).left.location.size,l,tcallparanode(left).left.location.register); + cg.a_op_const_reg(current_asmdata.CurrAsmList,cgop,tcallparanode(left).left.location.size,l,tcallparanode(left).left.location.register); else internalerror(200405022); end; @@ -388,10 +388,10 @@ implementation { need a cmp and jmp, but this should be done by the } { type cast code which does range checking if necessary (FK) } - hregister:=cg.makeregsize(exprasmlist,Tcallparanode(Tcallparanode(left).right).left.location.register,opsize) + hregister:=cg.makeregsize(current_asmdata.CurrAsmList,Tcallparanode(Tcallparanode(left).right).left.location.register,opsize) else - hregister:=cg.getintregister(exprasmlist,opsize); - cg.a_load_loc_reg(exprasmlist,opsize,tcallparanode(tcallparanode(left).right).left.location,hregister); + hregister:=cg.getintregister(current_asmdata.CurrAsmList,opsize); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,opsize,tcallparanode(tcallparanode(left).right).left.location,hregister); if (tcallparanode(left).left.location.loc=LOC_REFERENCE) then emit_reg_ref(asmop,tcgsize2opsize[opsize],hregister,tcallparanode(left).left.location.reference) else diff --git a/compiler/x86/nx86mat.pas b/compiler/x86/nx86mat.pas index b547bbb3ed..a7186d41c3 100644 --- a/compiler/x86/nx86mat.pas +++ b/compiler/x86/nx86mat.pas @@ -54,7 +54,7 @@ interface aasmbase,aasmtai,defutil, cgbase,pass_1,pass_2, ncon, - cpubase, + cpubase,procinfo, cga,ncgutil,cgobj,cgx86,cgutils; @@ -110,7 +110,7 @@ interface begin secondpass(left); location_reset(location,LOC_MMXREGISTER,OS_NO); - hreg:=tcgx86(cg).getmmxregister(exprasmlist); + hreg:=tcgx86(cg).getmmxregister(current_asmdata.CurrAsmList); emit_reg_reg(A_PXOR,S_NO,hreg,hreg); case left.location.loc of LOC_MMXREGISTER: @@ -119,13 +119,13 @@ interface end; LOC_CMMXREGISTER: begin - location.register:=tcgx86(cg).getmmxregister(exprasmlist); + location.register:=tcgx86(cg).getmmxregister(current_asmdata.CurrAsmList); emit_reg_reg(A_MOVQ,S_NO,left.location.register,location.register); end; LOC_REFERENCE, LOC_CREFERENCE: begin - location.register:=tcgx86(cg).getmmxregister(exprasmlist); + location.register:=tcgx86(cg).getmmxregister(current_asmdata.CurrAsmList); emit_ref_reg(A_MOVQ,S_NO,left.location.reference,location.register); end; else @@ -167,33 +167,33 @@ interface if expectloc=LOC_MMREGISTER then begin - location_force_mmregscalar(exprasmlist,left.location,false); + location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,false); location_reset(location,LOC_MMREGISTER,def_cgsize(resulttype.def)); { make life of register allocator easier } - location.register:=cg.getmmregister(exprasmlist,def_cgsize(resulttype.def)); - cg.a_loadmm_reg_reg(exprasmlist,def_cgsize(resulttype.def),def_cgsize(resulttype.def),left.location.register,location.register,mms_movescalar); + location.register:=cg.getmmregister(current_asmdata.CurrAsmList,def_cgsize(resulttype.def)); + cg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,def_cgsize(resulttype.def),def_cgsize(resulttype.def),left.location.register,location.register,mms_movescalar); - reg:=cg.getmmregister(exprasmlist,def_cgsize(resulttype.def)); + reg:=cg.getmmregister(current_asmdata.CurrAsmList,def_cgsize(resulttype.def)); - objectlibrary.getdatalabel(l1); - asmlist[al_typedconsts].concat(Tai_label.Create(l1)); + current_asmdata.getdatalabel(l1); + current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(l1)); case def_cgsize(resulttype.def) of OS_F32: - asmlist[al_typedconsts].concat(tai_const.create_32bit(longint(1 shl 31))); + current_asmdata.asmlists[al_typedconsts].concat(tai_const.create_32bit(longint(1 shl 31))); OS_F64: begin - asmlist[al_typedconsts].concat(tai_const.create_32bit(0)); - asmlist[al_typedconsts].concat(tai_const.create_32bit(-(1 shl 31))); + current_asmdata.asmlists[al_typedconsts].concat(tai_const.create_32bit(0)); + current_asmdata.asmlists[al_typedconsts].concat(tai_const.create_32bit(-(1 shl 31))); end else internalerror(2004110215); end; reference_reset_symbol(href,l1,0); - cg.a_loadmm_ref_reg(exprasmlist,def_cgsize(resulttype.def),def_cgsize(resulttype.def),href,reg,mms_movescalar); + cg.a_loadmm_ref_reg(current_asmdata.CurrAsmList,def_cgsize(resulttype.def),def_cgsize(resulttype.def),href,reg,mms_movescalar); - cg.a_opmm_reg_reg(exprasmlist,OP_XOR,left.location.size,reg,location.register,nil); + cg.a_opmm_reg_reg(current_asmdata.CurrAsmList,OP_XOR,left.location.size,reg,location.register,nil); end else begin @@ -203,7 +203,7 @@ interface LOC_CREFERENCE: begin location.register:=NR_ST; - cg.a_loadfpu_ref_reg(exprasmlist, + cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList, def_cgsize(left.resulttype.def), left.location.reference,location.register); emit_none(A_FCHS,S_NO); @@ -212,7 +212,7 @@ interface LOC_CFPUREGISTER: begin { "load st,st" is ignored by the code generator } - cg.a_loadfpu_reg_reg(exprasmlist,left.location.size,left.location.register,NR_ST); + cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmList,left.location.size,left.location.register,NR_ST); location.register:=NR_ST; emit_none(A_FCHS,S_NO); end; @@ -237,14 +237,14 @@ interface if left.expectloc=LOC_JUMP then begin location_reset(location,LOC_JUMP,OS_NO); - hl:=truelabel; - truelabel:=falselabel; - falselabel:=hl; + hl:=current_procinfo.CurrTrueLabel; + current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel; + current_procinfo.CurrFalseLabel:=hl; secondpass(left); - maketojumpbool(exprasmlist,left,lr_load_regvars); - hl:=truelabel; - truelabel:=falselabel; - falselabel:=hl; + maketojumpbool(current_asmdata.CurrAsmList,left,lr_load_regvars); + hl:=current_procinfo.CurrTrueLabel; + current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel; + current_procinfo.CurrFalseLabel:=hl; end else begin @@ -265,7 +265,7 @@ interface LOC_REFERENCE, LOC_CREFERENCE : begin - location_force_reg(exprasmlist,left.location,opsize,true); + location_force_reg(current_asmdata.CurrAsmList,left.location,opsize,true); emit_reg_reg(A_TEST,TCGSize2Opsize[opsize],left.location.register,left.location.register); location_reset(location,LOC_FLAGS,OS_NO); location.resflags:=F_E; @@ -285,7 +285,7 @@ interface begin secondpass(left); location_reset(location,LOC_MMXREGISTER,OS_NO); - r:=cg.getintregister(exprasmlist,OS_INT); + r:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); emit_const_reg(A_MOV,S_L,longint($ffffffff),r); { load operand } case left.location.loc of @@ -293,18 +293,18 @@ interface location_copy(location,left.location); LOC_CMMXREGISTER: begin - location.register:=tcgx86(cg).getmmxregister(exprasmlist); + location.register:=tcgx86(cg).getmmxregister(current_asmdata.CurrAsmList); emit_reg_reg(A_MOVQ,S_NO,left.location.register,location.register); end; LOC_REFERENCE, LOC_CREFERENCE: begin - location.register:=tcgx86(cg).getmmxregister(exprasmlist); + location.register:=tcgx86(cg).getmmxregister(current_asmdata.CurrAsmList); emit_ref_reg(A_MOVQ,S_NO,left.location.reference,location.register); end; end; { load mask } - hreg:=tcgx86(cg).getmmxregister(exprasmlist); + hreg:=tcgx86(cg).getmmxregister(current_asmdata.CurrAsmList); emit_reg_reg(A_MOVD,S_NO,r,hreg); { lower 32 bit } emit_reg_reg(A_PXOR,S_NO,hreg,location.register); diff --git a/compiler/x86/nx86set.pas b/compiler/x86/nx86set.pas index 2518cfd006..6690394e2c 100644 --- a/compiler/x86/nx86set.pas +++ b/compiler/x86/nx86set.pas @@ -203,26 +203,26 @@ implementation { use the register as base in a reference (JM) } if ranges then begin - pleftreg:=cg.makeregsize(exprasmlist,left.location.register,OS_INT); - cg.a_load_reg_reg(exprasmlist,left.location.size,OS_INT,left.location.register,pleftreg); + pleftreg:=cg.makeregsize(current_asmdata.CurrAsmList,left.location.register,OS_INT); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,left.location.size,OS_INT,left.location.register,pleftreg); if opsize<>OS_INT then - cg.a_op_const_reg(exprasmlist,OP_AND,OS_INT,255,pleftreg); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_AND,OS_INT,255,pleftreg); opsize:=OS_INT; end else { otherwise simply use the lower 8 bits (no "and" } { necessary this way) (JM) } begin - pleftreg:=cg.makeregsize(exprasmlist,left.location.register,OS_8); + pleftreg:=cg.makeregsize(current_asmdata.CurrAsmList,left.location.register,OS_8); opsize := OS_8; end; end else begin { load the value in a register } - pleftreg:=cg.getintregister(exprasmlist,OS_32); + pleftreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); opsize:=OS_32; - cg.a_load_ref_reg(exprasmlist,OS_8,OS_32,left.location.reference,pleftreg); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_8,OS_32,left.location.reference,pleftreg); end; { Get a label to jump to the end } @@ -235,7 +235,7 @@ implementation else location.resflags:=F_E; - objectlibrary.getjumplabel(l); + current_asmdata.getjumplabel(l); { how much have we already substracted from the x in the } { "x in [y..z]" expression } @@ -253,12 +253,12 @@ implementation begin if (left.location.loc = LOC_CREGISTER) then begin - hreg:=cg.getintregister(exprasmlist,OS_INT); - cg.a_load_reg_reg(exprasmlist,opsize,OS_INT,pleftreg,hreg); + hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,opsize,OS_INT,pleftreg,hreg); pleftreg:=hreg; opsize:=OS_INT; end; - cg.a_op_const_reg(exprasmlist,OP_SUB,opsize,setparts[i].start-adjustment,pleftreg); + cg.a_op_const_reg(current_asmdata.CurrAsmList,OP_SUB,opsize,setparts[i].start-adjustment,pleftreg); end; { new total value substracted from x: } @@ -269,36 +269,36 @@ implementation { we need a carry in case the element is in the range } { (this will never overflow since we check at the } { beginning whether stop-start <> 255) } - cg.a_cmp_const_reg_label(exprasmlist,opsize,OC_B,setparts[i].stop-setparts[i].start+1,pleftreg,l); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,opsize,OC_B,setparts[i].stop-setparts[i].start+1,pleftreg,l); end else { if setparts[i].start = 0 and setparts[i].stop = 255, } { it's always true since "in" is only allowed for bytes } begin - exprasmlist.concat(taicpu.op_none(A_STC,S_NO)); - cg.a_jmp_always(exprasmlist,l); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_STC,S_NO)); + cg.a_jmp_always(current_asmdata.CurrAsmList,l); end; end else begin { Emit code to check if left is an element } - exprasmlist.concat(taicpu.op_const_reg(A_CMP,TCGSize2OpSize[opsize],setparts[i].stop-adjustment, + current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_CMP,TCGSize2OpSize[opsize],setparts[i].stop-adjustment, pleftreg)); { Result should be in carry flag when ranges are used } if ranges then - exprasmlist.concat(taicpu.op_none(A_STC,S_NO)); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_STC,S_NO)); { If found, jump to end } - cg.a_jmp_flags(exprasmlist,F_E,l); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_E,l); end; if ranges and { if the last one was a range, the carry flag is already } { set appropriately } not(setparts[numparts].range) then - exprasmlist.concat(taicpu.op_none(A_CLC,S_NO)); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_CLC,S_NO)); { To compensate for not doing a second pass } right.location.reference.symbol:=nil; { Now place the end label } - cg.a_label(exprasmlist,l); + cg.a_label(current_asmdata.CurrAsmList,l); end else begin @@ -334,16 +334,16 @@ implementation LOC_REGISTER, LOC_CREGISTER: begin - hreg:=cg.makeregsize(exprasmlist,left.location.register,OS_32); - cg.a_load_reg_reg(exprasmlist,left.location.size,OS_32,left.location.register,hreg); + hreg:=cg.makeregsize(current_asmdata.CurrAsmList,left.location.register,OS_32); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,left.location.size,OS_32,left.location.register,hreg); end; else begin { the set element isn't never samller than a byte and because it's a small set we need only 5 bits but 8 bits are easier to load } - hreg:=cg.getintregister(exprasmlist,OS_32); - cg.a_load_ref_reg(exprasmlist,OS_8,OS_32,left.location.reference,hreg); + hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_8,OS_32,left.location.reference,hreg); end; end; @@ -357,8 +357,8 @@ implementation begin { We have to load the value into a register because btl does not accept values only refs or regs (PFV) } - hreg2:=cg.getintregister(exprasmlist,OS_32); - cg.a_load_const_reg(exprasmlist,OS_32,right.location.value,hreg2); + hreg2:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_32,right.location.value,hreg2); emit_reg_reg(A_BT,S_L,hreg,hreg2); end; LOC_CREFERENCE, @@ -377,28 +377,28 @@ implementation if right.location.loc=LOC_CONSTANT then begin location.resflags:=F_C; - objectlibrary.getjumplabel(l); - objectlibrary.getjumplabel(l2); + current_asmdata.getjumplabel(l); + current_asmdata.getjumplabel(l2); { load constants to a register } if left.nodetype=ordconstn then - location_force_reg(exprasmlist,left.location,OS_INT,true); + location_force_reg(current_asmdata.CurrAsmList,left.location,OS_INT,true); case left.location.loc of LOC_REGISTER, LOC_CREGISTER: begin - hreg:=cg.makeregsize(exprasmlist,left.location.register,OS_32); - cg.a_load_reg_reg(exprasmlist,left.location.size,OS_32,left.location.register,hreg); - cg.a_cmp_const_reg_label(exprasmlist,OS_32,OC_BE,31,hreg,l); + hreg:=cg.makeregsize(current_asmdata.CurrAsmList,left.location.register,OS_32); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,left.location.size,OS_32,left.location.register,hreg); + cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_32,OC_BE,31,hreg,l); { reset carry flag } - exprasmlist.concat(taicpu.op_none(A_CLC,S_NO)); - cg.a_jmp_always(exprasmlist,l2); - cg.a_label(exprasmlist,l); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_CLC,S_NO)); + cg.a_jmp_always(current_asmdata.CurrAsmList,l2); + cg.a_label(current_asmdata.CurrAsmList,l); { We have to load the value into a register because btl does not accept values only refs or regs (PFV) } - hreg2:=cg.getintregister(exprasmlist,OS_32); - cg.a_load_const_reg(exprasmlist,OS_32,right.location.value,hreg2); + hreg2:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_32,right.location.value,hreg2); emit_reg_reg(A_BT,S_L,hreg,hreg2); end; else @@ -415,21 +415,21 @@ implementation begin emit_const_ref(A_CMP,S_B,31,left.location.reference); end; - cg.a_jmp_flags(exprasmlist,F_BE,l); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_BE,l); { reset carry flag } - exprasmlist.concat(taicpu.op_none(A_CLC,S_NO)); - cg.a_jmp_always(exprasmlist,l2); - cg.a_label(exprasmlist,l); - hreg:=cg.getintregister(exprasmlist,OS_32); - cg.a_load_ref_reg(exprasmlist,OS_32,OS_32,left.location.reference,hreg); + current_asmdata.CurrAsmList.concat(taicpu.op_none(A_CLC,S_NO)); + cg.a_jmp_always(current_asmdata.CurrAsmList,l2); + cg.a_label(current_asmdata.CurrAsmList,l); + hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_32,OS_32,left.location.reference,hreg); { We have to load the value into a register because btl does not accept values only refs or regs (PFV) } - hreg2:=cg.getintregister(exprasmlist,OS_32); - cg.a_load_const_reg(exprasmlist,OS_32,right.location.value,hreg2); + hreg2:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_32,right.location.value,hreg2); emit_reg_reg(A_BT,S_L,hreg,hreg2); end; end; - cg.a_label(exprasmlist,l2); + cg.a_label(current_asmdata.CurrAsmList,l2); end { of right.location.loc=LOC_CONSTANT } { do search in a normal set which could have >32 elementsm but also used if the left side contains higher values > 32 } @@ -442,19 +442,19 @@ implementation else begin if (left.location.loc=LOC_REGISTER) then - pleftreg:=cg.makeregsize(exprasmlist,left.location.register,OS_32) + pleftreg:=cg.makeregsize(current_asmdata.CurrAsmList,left.location.register,OS_32) else - pleftreg:=cg.getintregister(exprasmlist,OS_32); - cg.a_load_loc_reg(exprasmlist,OS_32,left.location,pleftreg); - location_freetemp(exprasmlist,left.location); + pleftreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_32); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_32,left.location,pleftreg); + location_freetemp(current_asmdata.CurrAsmList,left.location); emit_reg_ref(A_BT,S_L,pleftreg,right.location.reference); - { tg.ungetiftemp(exprasmlist,right.location.reference) happens below } + { tg.ungetiftemp(current_asmdata.CurrAsmList,right.location.reference) happens below } location.resflags:=F_C; end; end; end; if not genjumps then - location_freetemp(exprasmlist,right.location); + location_freetemp(current_asmdata.CurrAsmList,right.location); end; begin diff --git a/compiler/x86/rax86.pas b/compiler/x86/rax86.pas index a6d2b8aced..a5a264ad08 100644 --- a/compiler/x86/rax86.pas +++ b/compiler/x86/rax86.pas @@ -57,7 +57,7 @@ type procedure CheckNonCommutativeOpcodes; procedure SwapOperands; { opcode adding } - function ConcatInstruction(p : taasmoutput) : tai;override; + function ConcatInstruction(p : TAsmList) : tai;override; end; const @@ -475,7 +475,7 @@ end; opcode Adding *****************************************************************************} -function Tx86Instruction.ConcatInstruction(p : taasmoutput) : tai; +function Tx86Instruction.ConcatInstruction(p : TAsmList) : tai; var siz : topsize; i,asize : longint; diff --git a/compiler/x86/rgx86.pas b/compiler/x86/rgx86.pas index 9c6894f6bd..f18df43eb6 100644 --- a/compiler/x86/rgx86.pas +++ b/compiler/x86/rgx86.pas @@ -36,7 +36,7 @@ unit rgx86; type trgx86 = class(trgobj) function get_spill_subreg(r : tregister) : tsubregister;override; - function do_spill_replace(list:Taasmoutput;instr:taicpu;orgreg:tsuperregister;const spilltemp:treference):boolean;override; + function do_spill_replace(list:TAsmList;instr:taicpu;orgreg:tsuperregister;const spilltemp:treference):boolean;override; end; tpushedsavedloc = record @@ -73,14 +73,14 @@ unit rgx86; constructor create; - function getregisterfpu(list: taasmoutput) : tregister; - procedure ungetregisterfpu(list: taasmoutput; r : tregister); + function getregisterfpu(list: TAsmList) : tregister; + procedure ungetregisterfpu(list: TAsmList; r : tregister); { pushes and restores registers } - procedure saveusedfpuregisters(list:Taasmoutput; + procedure saveusedfpuregisters(list:TAsmList; var saved:Tpushedsavedfpu; const s:Tcpuregisterset); - procedure restoreusedfpuregisters(list:Taasmoutput; + procedure restoreusedfpuregisters(list:TAsmList; const saved:Tpushedsavedfpu); { corrects the fpu stack register by ofs } @@ -110,7 +110,7 @@ implementation end; - function trgx86.do_spill_replace(list:Taasmoutput;instr:taicpu;orgreg:tsuperregister;const spilltemp:treference):boolean; + function trgx86.do_spill_replace(list:TAsmList;instr:taicpu;orgreg:tsuperregister;const spilltemp:treference):boolean; var replaceoper : longint; begin @@ -232,7 +232,7 @@ implementation end; - function trgx86fpu.getregisterfpu(list: taasmoutput) : tregister; + function trgx86fpu.getregisterfpu(list: TAsmList) : tregister; begin { note: don't return R_ST0, see comments above implementation of } { a_loadfpu_* methods in cgcpu (JM) } @@ -240,7 +240,7 @@ implementation end; - procedure trgx86fpu.ungetregisterfpu(list : taasmoutput; r : tregister); + procedure trgx86fpu.ungetregisterfpu(list : TAsmList; r : tregister); begin { nothing to do, fpu stack management is handled by the load/ } { store operations in cgcpu (JM) } @@ -255,7 +255,7 @@ implementation end; - procedure trgx86fpu.saveusedfpuregisters(list: taasmoutput; + procedure trgx86fpu.saveusedfpuregisters(list: TAsmList; var saved : tpushedsavedfpu; const s: tcpuregisterset); var @@ -292,7 +292,7 @@ implementation end; - procedure trgx86fpu.restoreusedfpuregisters(list : taasmoutput; + procedure trgx86fpu.restoreusedfpuregisters(list : TAsmList; const saved : tpushedsavedfpu); var @@ -329,7 +329,7 @@ implementation end; (* - procedure Trgx86fpu.saveotherregvars(list: taasmoutput; const s: totherregisterset); + procedure Trgx86fpu.saveotherregvars(list: TAsmList; const s: totherregisterset); var r: Tregister; begin diff --git a/compiler/x86_64/cgcpu.pas b/compiler/x86_64/cgcpu.pas index 4a9afbfebd..21cbc43cc1 100644 --- a/compiler/x86_64/cgcpu.pas +++ b/compiler/x86_64/cgcpu.pas @@ -35,8 +35,8 @@ unit cgcpu; type tcgx86_64 = class(tcgx86) procedure init_register_allocators;override; - procedure g_proc_exit(list : taasmoutput;parasize:longint;nostackframe:boolean);override; - procedure g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint);override; + procedure g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean);override; + procedure g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint);override; end; @@ -59,7 +59,7 @@ unit cgcpu; end; - procedure tcgx86_64.g_proc_exit(list : taasmoutput;parasize:longint;nostackframe:boolean); + procedure tcgx86_64.g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean); var stacksize : longint; begin @@ -85,7 +85,7 @@ unit cgcpu; end; - procedure tcgx86_64.g_intf_wrapper(list: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint); + procedure tcgx86_64.g_intf_wrapper(list: TAsmList; procdef: tprocdef; const labelname: string; ioffset: longint); var make_global : boolean; href : treference; @@ -128,7 +128,7 @@ unit cgcpu; end else begin - sym:=objectlibrary.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION); + sym:=current_asmdata.newasmsymbol(procdef.mangledname,AB_EXTERNAL,AT_FUNCTION); reference_reset_symbol(r,sym,0); if cs_create_pic in aktmoduleswitches then r.refaddr:=addr_pic diff --git a/compiler/x86_64/nx64add.pas b/compiler/x86_64/nx64add.pas index aff2a4ad6a..e4f9a2a2b0 100644 --- a/compiler/x86_64/nx64add.pas +++ b/compiler/x86_64/nx64add.pas @@ -55,30 +55,30 @@ interface location_reset(location,LOC_REGISTER,OS_INT); { Get a temp register and load the left value into it and free the location. } - r:=cg.getintregister(exprasmlist,OS_INT); - cg.a_load_loc_reg(exprasmlist,OS_INT,left.location,r); + r:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_INT,left.location,r); { Allocate RAX. } - cg.getcpuregister(exprasmlist,NR_RAX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_RAX); { Load the right value. } - cg.a_load_loc_reg(exprasmlist,OS_INT,right.location,NR_RAX); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_INT,right.location,NR_RAX); { Also allocate RDX, since it is also modified by a mul (JM). } - cg.getcpuregister(exprasmlist,NR_RDX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_RDX); emit_reg(A_MUL,S_Q,r); if cs_check_overflow in aktlocalswitches then begin - objectlibrary.getjumplabel(hl4); - cg.a_jmp_flags(exprasmlist,F_AE,hl4); - cg.a_call_name(exprasmlist,'FPC_OVERFLOW'); - cg.a_label(exprasmlist,hl4); + current_asmdata.getjumplabel(hl4); + cg.a_jmp_flags(current_asmdata.CurrAsmList,F_AE,hl4); + cg.a_call_name(current_asmdata.CurrAsmList,'FPC_OVERFLOW'); + cg.a_label(current_asmdata.CurrAsmList,hl4); end; { Free RDX,RAX } - cg.ungetcpuregister(exprasmlist,NR_RDX); - cg.ungetcpuregister(exprasmlist,NR_RAX); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_RDX); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_RAX); { Allocate a new register and store the result in RAX in it. } - location.register:=cg.getintregister(exprasmlist,OS_INT); + location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); emit_reg_reg(A_MOV,S_Q,NR_RAX,location.register); - location_freetemp(exprasmlist,left.location); - location_freetemp(exprasmlist,right.location); + location_freetemp(current_asmdata.CurrAsmList,left.location); + location_freetemp(current_asmdata.CurrAsmList,right.location); end; diff --git a/compiler/x86_64/nx64cal.pas b/compiler/x86_64/nx64cal.pas index 7ba31e5740..e880271414 100644 --- a/compiler/x86_64/nx64cal.pas +++ b/compiler/x86_64/nx64cal.pas @@ -52,7 +52,7 @@ implementation mmregs:=varargsparas.mmregsused else mmregs:=0; - exprasmlist.concat(taicpu.op_const_reg(A_MOV,S_Q,mmregs,NR_RAX)) + current_asmdata.CurrAsmList.concat(taicpu.op_const_reg(A_MOV,S_Q,mmregs,NR_RAX)) end; end; diff --git a/compiler/x86_64/nx64mat.pas b/compiler/x86_64/nx64mat.pas index 4f0333fff8..6a22dc9148 100644 --- a/compiler/x86_64/nx64mat.pas +++ b/compiler/x86_64/nx64mat.pas @@ -74,7 +74,7 @@ implementation { put numerator in register } location_reset(location,LOC_REGISTER,OS_INT); - location_force_reg(exprasmlist,left.location,OS_INT,false); + location_force_reg(current_asmdata.CurrAsmList,left.location,OS_INT,false); hreg1:=left.location.register; if (nodetype=divn) and (right.nodetype=ordconstn) and @@ -88,7 +88,7 @@ implementation { use a sequence without jumps, saw this in comp.compilers (JM) } { no jumps, but more operations } - hreg2:=cg.getintregister(exprasmlist,OS_INT); + hreg2:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); emit_reg_reg(A_MOV,S_Q,hreg1,hreg2); {If the left value is signed, hreg2=$ffffffff, otherwise 0.} emit_const_reg(A_SAR,S_Q,63,hreg2); @@ -106,9 +106,9 @@ implementation else begin {Bring denominator to a register.} - cg.getcpuregister(exprasmlist,NR_RAX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_RAX); emit_reg_reg(A_MOV,S_Q,hreg1,NR_RAX); - cg.getcpuregister(exprasmlist,NR_RDX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_RDX); {Sign extension depends on the left type.} if torddef(left.resulttype.def).typ=u64bit then emit_reg_reg(A_XOR,S_Q,NR_RDX,NR_RDX) @@ -127,19 +127,19 @@ implementation emit_reg(op,S_Q,right.location.register) else begin - hreg1:=cg.getintregister(exprasmlist,right.location.size); - cg.a_load_loc_reg(exprasmlist,OS_64,right.location,hreg1); + hreg1:=cg.getintregister(current_asmdata.CurrAsmList,right.location.size); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_64,right.location,hreg1); emit_reg(op,S_Q,hreg1); end; { Copy the result into a new register. Release RAX & RDX.} - cg.ungetcpuregister(exprasmlist,NR_RDX); - cg.ungetcpuregister(exprasmlist,NR_RAX); - location.register:=cg.getintregister(exprasmlist,OS_INT); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_RDX); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_RAX); + location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_INT); if nodetype=divn then - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,NR_RAX,location.register) + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_RAX,location.register) else - cg.a_load_reg_reg(exprasmlist,OS_INT,OS_INT,NR_RDX,location.register); + cg.a_load_reg_reg(current_asmdata.CurrAsmList,OS_INT,OS_INT,NR_RDX,location.register); end; end; @@ -178,7 +178,7 @@ implementation { load left operators in a register } location_copy(location,left.location); - location_force_reg(exprasmlist,location,opsize,false); + location_force_reg(current_asmdata.CurrAsmList,location,opsize,false); { shifting by a constant directly coded: } if (right.nodetype=ordconstn) then @@ -186,11 +186,11 @@ implementation else begin { load right operators in a RCX } - cg.getcpuregister(exprasmlist,NR_RCX); - cg.a_load_loc_reg(exprasmlist,OS_INT,right.location,NR_RCX); + cg.getcpuregister(current_asmdata.CurrAsmList,NR_RCX); + cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_INT,right.location,NR_RCX); { right operand is in ECX } - cg.ungetcpuregister(exprasmlist,NR_RCX); + cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_RCX); emit_reg_reg(op,tcgsize2opsize[opsize],NR_CL,location.register); end; end; |
