Jelajahi Sumber

Merged revisions 2921-2922,2925 via svnmerge from
http://svn.freepascal.org/svn/fpc/branches/linker/compiler

........
r2921 | peter | 2006-03-15 08:35:00 +0100 (Wed, 15 Mar 2006) | 2 lines

* pass ObjectWriter to ObjectOuput

........
r2922 | peter | 2006-03-15 12:40:30 +0100 (Wed, 15 Mar 2006) | 2 lines

* refactor asmdata

........
r2925 | peter | 2006-03-15 16:09:39 +0100 (Wed, 15 Mar 2006) | 3 lines

* add cfi to asmdata
* move asmlist, asmcfi, asmdata to own unit

........

git-svn-id: trunk@2932 -

peter 19 tahun lalu
induk
melakukan
b7fe6797bf
100 mengubah file dengan 3595 tambahan dan 3441 penghapusan
  1. 2 1
      .gitattributes
  2. 2 1
      compiler/Makefile
  3. 3 1
      compiler/Makefile.fpc
  4. 25 178
      compiler/aasmbase.pas
  5. 421 0
      compiler/aasmdata.pas
  6. 90 224
      compiler/aasmtai.pas
  7. 11 11
      compiler/aggas.pas
  8. 1 1
      compiler/alpha/aasmcpu.pas
  9. 1 1
      compiler/alpha/agaxpgas.pas
  10. 28 28
      compiler/alpha/cgcpu.pas
  11. 3 3
      compiler/alpha/radirect.pas
  12. 1 1
      compiler/alpha/rasm.pas
  13. 5 5
      compiler/alpha/rgcpu.pas
  14. 12 12
      compiler/aopt.pas
  15. 9 9
      compiler/aoptbase.pas
  16. 2 2
      compiler/aoptcs.pas
  17. 1 1
      compiler/aoptda.pas
  18. 10 10
      compiler/aoptobj.pas
  19. 6 6
      compiler/arm/aasmcpu.pas
  20. 1 1
      compiler/arm/agarmgas.pas
  21. 101 101
      compiler/arm/cgcpu.pas
  22. 1 1
      compiler/arm/cpupara.pas
  23. 1 1
      compiler/arm/cpupi.pas
  24. 29 29
      compiler/arm/narmadd.pas
  25. 34 34
      compiler/arm/narmcnv.pas
  26. 6 6
      compiler/arm/narmcon.pas
  27. 10 10
      compiler/arm/narminl.pas
  28. 13 13
      compiler/arm/narmmat.pas
  29. 3 3
      compiler/arm/raarm.pas
  30. 1 1
      compiler/arm/raarmgas.pas
  31. 11 11
      compiler/arm/rgcpu.pas
  32. 54 43
      compiler/assemble.pas
  33. 1 1
      compiler/browcol.pas
  34. 69 87
      compiler/cfidwarf.pas
  35. 63 63
      compiler/cg64f32.pas
  36. 201 207
      compiler/cgobj.pas
  37. 30 30
      compiler/cresstr.pas
  38. 11 11
      compiler/dbgbase.pas
  39. 156 156
      compiler/dbgdwarf.pas
  40. 39 39
      compiler/dbgstabs.pas
  41. 5 2
      compiler/finput.pas
  42. 22 20
      compiler/fmodule.pas
  43. 1 0
      compiler/fppu.pas
  44. 12 12
      compiler/i386/ag386nsm.pas
  45. 8 8
      compiler/i386/aopt386.pas
  46. 36 36
      compiler/i386/cgcpu.pas
  47. 3 3
      compiler/i386/cpupara.pas
  48. 3 0
      compiler/i386/cputarg.pas
  49. 22 22
      compiler/i386/csopt386.pas
  50. 30 30
      compiler/i386/daopt386.pas
  51. 53 53
      compiler/i386/n386add.pas
  52. 9 9
      compiler/i386/n386cal.pas
  53. 44 44
      compiler/i386/n386mat.pas
  54. 8 8
      compiler/i386/n386mem.pas
  55. 16 16
      compiler/i386/n386set.pas
  56. 12 12
      compiler/i386/popt386.pas
  57. 4 4
      compiler/i386/ra386int.pas
  58. 1 1
      compiler/i386/rgcpu.pas
  59. 4 4
      compiler/i386/rropt386.pas
  60. 16 3
      compiler/link.pas
  61. 1 1
      compiler/m68k/aasmcpu.pas
  62. 1 1
      compiler/m68k/ag68kgas.pas
  63. 83 83
      compiler/m68k/cgcpu.pas
  64. 60 60
      compiler/m68k/n68kadd.pas
  65. 2 2
      compiler/m68k/n68kcal.pas
  66. 16 16
      compiler/m68k/n68kcnv.pas
  67. 78 78
      compiler/m68k/n68kmat.pas
  68. 5 5
      compiler/m68k/ra68k.pas
  69. 3 3
      compiler/m68k/ra68kmot.pas
  70. 1 1
      compiler/m68k/rgcpu.pas
  71. 1 1
      compiler/mips/aasmcpu.pas
  72. 6 6
      compiler/nbas.pas
  73. 75 75
      compiler/ncgadd.pas
  74. 29 29
      compiler/ncgbas.pas
  75. 114 114
      compiler/ncgcal.pas
  76. 69 69
      compiler/ncgcnv.pas
  77. 55 55
      compiler/ncgcon.pas
  78. 280 280
      compiler/ncgflw.pas
  79. 85 85
      compiler/ncginl.pas
  80. 118 118
      compiler/ncgld.pas
  81. 43 43
      compiler/ncgmat.pas
  82. 98 98
      compiler/ncgmem.pas
  83. 19 19
      compiler/ncgopt.pas
  84. 104 104
      compiler/ncgset.pas
  85. 130 130
      compiler/ncgutil.pas
  86. 1 1
      compiler/ncon.pas
  87. 95 95
      compiler/nobj.pas
  88. 1 1
      compiler/node.pas
  89. 2 1
      compiler/nset.pas
  90. 44 25
      compiler/ogbase.pas
  91. 74 43
      compiler/ogcoff.pas
  92. 6 5
      compiler/ogelf.pas
  93. 9 9
      compiler/paramgr.pas
  94. 23 68
      compiler/parser.pas
  95. 4 4
      compiler/pass_2.pas
  96. 1 1
      compiler/pdecl.pas
  97. 64 64
      compiler/pmodules.pas
  98. 4 4
      compiler/powerpc/aasmcpu.pas
  99. 1 1
      compiler/powerpc/agppcgas.pas
  100. 13 13
      compiler/powerpc/agppcmpw.pas

+ 2 - 1
.gitattributes

@@ -7,6 +7,7 @@ compiler/Makefile svneol=native#text/plain
 compiler/Makefile.fpc svneol=native#text/plain
 compiler/README -text
 compiler/aasmbase.pas svneol=native#text/plain
+compiler/aasmdata.pas svneol=native#text/plain
 compiler/aasmtai.pas svneol=native#text/plain
 compiler/aggas.pas svneol=native#text/plain
 compiler/alpha/aasmcpu.pas svneol=native#text/plain
@@ -75,6 +76,7 @@ compiler/browlog.pas svneol=native#text/plain
 compiler/bsdcompile -text
 compiler/catch.pas svneol=native#text/plain
 compiler/cclasses.pas svneol=native#text/plain
+compiler/cfidwarf.pas svneol=native#text/plain
 compiler/cg64f32.pas svneol=native#text/plain
 compiler/cgbase.pas svneol=native#text/plain
 compiler/cgobj.pas svneol=native#text/plain
@@ -96,7 +98,6 @@ compiler/dbgdwarf.pas svneol=native#text/plain
 compiler/dbgstabs.pas svneol=native#text/plain
 compiler/defcmp.pas svneol=native#text/plain
 compiler/defutil.pas svneol=native#text/plain
-compiler/dwarf.pas svneol=native#text/plain
 compiler/export.pas svneol=native#text/plain
 compiler/finput.pas svneol=native#text/plain
 compiler/fmodule.pas svneol=native#text/plain

+ 2 - 1
compiler/Makefile

@@ -2722,10 +2722,11 @@ INSTALLEXEFILE=$(PPCROSSNAME)
 else
 INSTALLEXEFILE=$(EXENAME)
 endif
-PPC_TARGETS=alpha i386 m68k powerpc sparc arm x86_64 powerpc64 vis ia64
+PPC_TARGETS=i386 m68k powerpc sparc arm x86_64 powerpc64 alpha vis ia64
 .PHONY: $(PPC_TARGETS)
 $(PPC_TARGETS):
 	$(MAKE) PPC_TARGET=$@ CPU_UNITDIR=$@ all
+alltargets: $(ALLTARGETS)
 .PHONY: all compiler echotime ppuclean execlean clean distclean
 all: compiler $(addsuffix _all,$(TARGET_DIRS))
 compiler: $(COMPILER_UNITTARGETDIR) $(COMPILER_TARGETDIR) $(EXENAME)

+ 3 - 1
compiler/Makefile.fpc

@@ -254,13 +254,15 @@ endif
 # CPU targets
 #####################################################################
 
-PPC_TARGETS=alpha i386 m68k powerpc sparc arm x86_64 powerpc64 vis ia64
+PPC_TARGETS=i386 m68k powerpc sparc arm x86_64 powerpc64 alpha vis ia64
 
 .PHONY: $(PPC_TARGETS)
 
 $(PPC_TARGETS):
         $(MAKE) PPC_TARGET=$@ CPU_UNITDIR=$@ all
 
+alltargets: $(ALLTARGETS)
+
 
 #####################################################################
 # Default makefile

+ 25 - 178
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,
@@ -69,7 +78,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;
@@ -86,11 +95,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;
@@ -100,48 +104,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
 
@@ -149,9 +117,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;
@@ -269,135 +247,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.

+ 421 - 0
compiler/aasmdata.pas

@@ -0,0 +1,421 @@
+{
+    Copyright (c) 1998-2006 by Florian Klaempfl
+
+    This unit implements an abstract asmoutput class for all processor types
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+{ @abstract(This unit implements an abstract asm output class for all processor types)
+  This unit implements an abstract assembler output class for all processors, these
+  are then overriden for each assembler writer to actually write the data in these
+  classes to an assembler file.
+}
+
+unit aasmdata;
+
+{$i fpcdefs.inc}
+
+interface
+
+    uses
+       cutils,cclasses,
+       globtype,globals,systems,
+       cpuinfo,cpubase,
+       cgbase,cgutils,
+       symtype,
+       aasmbase,ogbase;
+
+    type
+      { 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'
+      );
+
+    type
+      TAsmList = class(tlinkedlist)
+         constructor create;
+         function  empty : boolean;
+         function  getlasttaifilepos : pfileposinfo;
+      end;
+
+      TAsmCFI=class
+      public
+        constructor create;virtual;
+        destructor destroy;override;
+        procedure generate_code(list:TAsmList);virtual;
+        procedure start_frame(list:TAsmList);virtual;
+        procedure end_frame(list:TAsmList);virtual;
+        procedure cfa_offset(list:TAsmList;reg:tregister;ofs:longint);virtual;
+        procedure cfa_restore(list:TAsmList;reg:tregister);virtual;
+        procedure cfa_def_cfa_register(list:TAsmList;reg:tregister);virtual;
+        procedure cfa_def_cfa_offset(list:TAsmList;ofs:longint);virtual;
+      end;
+      TAsmCFIClass=class of TAsmCFI;
+
+      TAsmData = class
+      private
+        { Symbols }
+        FAsmSymbolDict : TDictionary;
+        FAltSymbolList : TFPObjectList;
+        FNextAltNr     : longint;
+        FNextLabelNr   : array[Tasmlabeltype] of longint;
+        { Call Frame Information for stack unwinding}
+        FAsmCFI        : TAsmCFI;
+      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;
+        property AsmCFI:TAsmCFI read FAsmCFI;
+      end;
+
+    var
+      CAsmCFI : TAsmCFIClass;
+      current_asmdata : TAsmData;
+
+
+implementation
+
+    uses
+      verbose,
+      aasmtai;
+
+
+{*****************************************************************************
+                                 TAsmCFI
+*****************************************************************************}
+
+    constructor TAsmCFI.create;
+      begin
+      end;
+
+
+    destructor TAsmCFI.destroy;
+      begin
+      end;
+
+
+    procedure TAsmCFI.generate_code(list:TAsmList);
+      begin
+      end;
+
+
+    procedure TAsmCFI.start_frame(list:TAsmList);
+      begin
+      end;
+
+
+    procedure TAsmCFI.end_frame(list:TAsmList);
+      begin
+      end;
+
+
+    procedure TAsmCFI.cfa_offset(list:TAsmList;reg:tregister;ofs:longint);
+      begin
+      end;
+
+
+    procedure TAsmCFI.cfa_restore(list:TAsmList;reg:tregister);
+      begin
+      end;
+
+
+    procedure TAsmCFI.cfa_def_cfa_register(list:TAsmList;reg:tregister);
+      begin
+      end;
+
+
+    procedure TAsmCFI.cfa_def_cfa_offset(list:TAsmList;ofs:longint);
+      begin
+      end;
+
+
+{*****************************************************************************
+                                 TAsmList
+*****************************************************************************}
+
+    constructor TAsmList.create;
+      begin
+        inherited create;
+        { make sure the optimizer won't remove the first tai of this list}
+        insert(tai_marker.create(mark_BlockStart));
+      end;
+
+
+    function TAsmList.empty : boolean;
+      begin
+        { there is always a mark_BlockStart available,
+          see TAsmList.create }
+        result:=(count<=1);
+      end;
+
+
+    function TAsmList.getlasttaifilepos : pfileposinfo;
+      var
+       hp : tlinkedlistitem;
+      begin
+         getlasttaifilepos := nil;
+         if assigned(last) then
+           begin
+              { find the last file information record }
+              if not (tai(last).typ in SkipLineInfo) then
+                getlasttaifilepos:=@tailineinfo(last).fileinfo
+              else
+               { go through list backwards to find the first entry
+                 with line information
+               }
+               begin
+                 hp:=tai(last);
+                 while assigned(hp) and (tai(hp).typ in SkipLineInfo) do
+                    hp:=hp.Previous;
+                 { found entry }
+                 if assigned(hp) then
+                   getlasttaifilepos:=@tailineinfo(hp).fileinfo
+               end;
+           end;
+      end;
+
+
+{****************************************************************************
+                                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,''));
+        { CFI }
+        FAsmCFI:=CAsmCFI.Create;
+      end;
+
+
+    destructor TAsmData.destroy;
+      var
+{$ifdef MEMDEBUG}
+        d : tmemdebug;
+{$endif}
+        hal : TAsmListType;
+      begin
+{$ifdef MEMDEBUG}
+         d:=tmemdebug.create(name+' - AsmSymbols');
+{$endif}
+        FAltSymbolList.free;
+        FAsmSymbolDict.free;
+{$ifdef MEMDEBUG}
+         d.free;
+{$endif}
+{$ifdef MEMDEBUG}
+         d:=tmemdebug.create(name+' - AsmCFI');
+{$endif}
+        FAsmCFI.free;
+{$ifdef MEMDEBUG}
+         d.free;
+{$endif}
+{$ifdef MEMDEBUG}
+         d:=tmemdebug.create(name+' - AsmLists');
+{$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
+  CAsmCFI:=TAsmCFI;
+end.

+ 90 - 224
compiler/aasmtai.pas

@@ -37,7 +37,7 @@ interface
        cpuinfo,cpubase,
        cgbase,cgutils,
        symtype,
-       aasmbase,ogbase;
+       aasmbase,aasmdata,ogbase;
 
     type
        { keep the number of elements in this enumeration less or equal than 32 as long
@@ -224,21 +224,35 @@ 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;
+    const
+      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 +319,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 +459,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 +489,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 +548,7 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
        end;
 
-       Taasmoutput=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;
 
         { Class template for assembler instructions
         }
@@ -598,6 +603,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 +621,22 @@ interface
         end;
         tai_align_class = class of tai_align_abstract;
 
-        taasmoutput = 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'
-      );
-
     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;
-
-      { hook to notify uses of registers }
-      add_reg_instruction_hook : tadd_reg_instruction_proc;
-
-      asmlist:array[Tasmlist] of Taasmoutput;
-
+      { target specific tais }
       cai_align : tai_align_class;
       cai_cpu   : tai_cpu_class;
 
-    function  use_smartlink_section:boolean;
-    function  maybe_smartlink_symbol:boolean;
+      { hook to notify uses of registers }
+      add_reg_instruction_hook : tadd_reg_instruction_proc;
 
-    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);
@@ -721,6 +656,41 @@ implementation
                                  Helpers
  ****************************************************************************}
 
+    procedure maybe_new_object_file(list:TAsmList);
+      begin
+        if (cs_create_smart in aktmoduleswitches) and
+           (not use_smartlink_section) then
+          list.concat(tai_cutobject.create);
+      end;
+
+
+    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:TAsmList;const Aname:string;Asymtyp:Tasmsymtype;
+                                   Aglobal:boolean;Asectype:TAsmSectiontype;Aalign:byte);
+      begin
+        maybe_new_object_file(list);
+        list.concat(tai_section.create(Asectype,Aname,Aalign));
+        list.concat(cai_align.create(Aalign));
+        if Aglobal or
+           maybe_smartlink_symbol then
+          list.concat(tai_symbol.createname_global(Aname,Asymtyp,0))
+        else
+          list.concat(tai_symbol.createname(Aname,Asymtyp,0));
+      end;
+
+
+    procedure section_symbol_end(list:TAsmList;const Aname:string);
+      begin
+        list.concat(tai_symbol_end.createname(Aname));
+      end;
+
+
     function ppuloadai(ppufile:tcompilerppufile):tai;
       var
         b : byte;
@@ -763,55 +733,6 @@ 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);
-      begin
-        if (cs_create_smart in aktmoduleswitches) and
-           (not use_smartlink_section) then
-          list.concat(tai_cutobject.create);
-      end;
-
-
-    procedure new_section(list:taasmoutput;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;
-                                   Aglobal:boolean;Asectype:TAsmSectiontype;Aalign:byte);
-      begin
-        maybe_new_object_file(list);
-        list.concat(tai_section.create(Asectype,Aname,Aalign));
-        list.concat(cai_align.create(Aalign));
-        if Aglobal or
-           maybe_smartlink_symbol then
-          list.concat(tai_symbol.createname_global(Aname,Asymtyp,0))
-        else
-          list.concat(tai_symbol.createname(Aname,Asymtyp,0));
-      end;
-
-
-    procedure section_symbol_end(list:taasmoutput;const Aname:string);
-      begin
-        list.concat(tai_symbol_end.createname(Aname));
-      end;
-
-
 {****************************************************************************
                              TAI
  ****************************************************************************}
@@ -935,7 +856,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 +869,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 +931,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 +941,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 +986,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 +1013,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 +1032,7 @@ implementation
       begin
         inherited ppuload(t,ppufile);
         name:=stringdup(ppufile.getstring);
-        directive:=tasmdirective(ppufile.getbyte);
+        directive:=TAsmDirective(ppufile.getbyte);
       end;
 
 
@@ -1315,7 +1236,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 +1249,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 +1613,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 +1621,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 +1708,7 @@ implementation
                              Tai_Marker
  ****************************************************************************}
 
-    constructor Tai_Marker.Create(_Kind: TMarker);
+    constructor Tai_Marker.Create(_Kind: TAsmMarker);
       begin
         Inherited Create;
         typ := ait_marker;
@@ -1798,7 +1719,7 @@ implementation
     constructor Tai_Marker.ppuload(t:taitype;ppufile:tcompilerppufile);
       begin
         inherited ppuload(t,ppufile);
-        kind:=TMarker(ppufile.getbyte);
+        kind:=TAsmMarker(ppufile.getbyte);
       end;
 
 
@@ -2452,61 +2373,6 @@ implementation
       end;
 
 
-{*****************************************************************************
-                                 TAAsmOutput
-*****************************************************************************}
-
-    constructor taasmoutput.create;
-      begin
-        inherited create;
-        { make sure the optimizer won't remove the first tai of this list}
-        insert(tai_marker.create(marker_blockstart));
-      end;
-
-
-    function taasmoutput.empty : boolean;
-      begin
-        { there is always a marker_blockstart available,
-          see taasmoutput.create }
-        result:=(count<=1);
-      end;
-
-
-    function taasmoutput.getlasttaifilepos : pfileposinfo;
-      var
-       hp : tlinkedlistitem;
-      begin
-         getlasttaifilepos := nil;
-         if assigned(last) then
-           begin
-              { find the last file information record }
-              if not (tai(last).typ in SkipLineInfo) then
-                getlasttaifilepos:=@tailineinfo(last).fileinfo
-              else
-               { go through list backwards to find the first entry
-                 with line information
-               }
-               begin
-                 hp:=tai(last);
-                 while assigned(hp) and (tai(hp).typ in SkipLineInfo) do
-                    hp:=hp.Previous;
-                 { found entry }
-                 if assigned(hp) then
-                   getlasttaifilepos:=@tailineinfo(hp).fileinfo
-               end;
-           end;
-      end;
-
-    procedure Taasmoutput.InsertAfter(Item,Loc : TLinkedListItem);
-
-      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);
-      end;
-
 begin
   cai_cpu:=tai_cpu_abstract;
   cai_align:=tai_align_abstract;

+ 11 - 11
compiler/aggas.pas

@@ -36,7 +36,7 @@ interface
 {$ENDIF USE_SYSUTILS}
       cclasses,
       globtype,globals,
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       assemble;
 
 
@@ -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
@@ -373,7 +373,7 @@ implementation
       end;
 
 
-    procedure TGNUAssembler.WriteTree(p:TAAsmoutput);
+    procedure TGNUAssembler.WriteTree(p:TAsmList);
 
     function needsObject(hp : tai_symbol) : boolean;
       begin
@@ -417,7 +417,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
@@ -974,9 +974,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 :
@@ -1011,7 +1011,7 @@ implementation
       p:dirstr;
       n:namestr;
       e:extstr;
-      hal : tasmlist;
+      hal : tasmlisttype;
     begin
 {$ifdef EXTDEBUG}
       if assigned(current_module.mainsource) then
@@ -1044,11 +1044,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;

+ 1 - 1
compiler/alpha/aasmcpu.pas

@@ -30,7 +30,7 @@ unit aasmcpu;
 
     uses
        aasmbase,globals,verbose,
-       cpubase,aasmtai;
+       cpubase,aasmtai,aasmdata;
 
     type
       tai_frame = class(tai)

+ 1 - 1
compiler/alpha/agaxpgas.pas

@@ -26,7 +26,7 @@ unit agaxpgas;
   interface
 
     uses
-       globals,systems,aasmbase,aasmtai,
+       globals,systems,aasmbase,aasmtai,aasmdata,
        aggas,cpubase;
 
     type

+ 28 - 28
compiler/alpha/cgcpu.pas

@@ -29,26 +29,26 @@ unit cgcpu;
 interface
 
 uses
-   cgbase,cgobj,aasmbase,aasmtai,aasmcpu,cginfo,cpubase,cpuinfo;
+   cgbase,cgobj,aasmbase,aasmtai,aasmdata,aasmcpu,cginfo,cpubase,cpuinfo;
 
 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;

+ 3 - 3
compiler/alpha/radirect.pas

@@ -42,7 +42,7 @@ interface
        globals,verbose,
        systems,
        { aasm }
-       aasmbase,aasmtai,aasmcpu,
+       aasmbase,aasmtai,aasmdata,aasmcpu,
        { symtable }
        symconst,symbase,symtype,symsym,symtable,defbase,
        { pass 1 }
@@ -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

+ 1 - 1
compiler/alpha/rasm.pas

@@ -47,7 +47,7 @@ Implementation
        globtype,globals,verbose,
        systems,
        { aasm }
-       cpubase,aasmbase,aasmtai,aasmcpu,
+       cpubase,aasmbase,aasmtai,aasmdata,aasmcpu,
        { symtable }
        symconst,symbase,symtype,symsym,symtable,
        { pass 1 }

+ 5 - 5
compiler/alpha/rgcpu.pas

@@ -28,14 +28,14 @@ unit rgcpu;
   interface
 
      uses
-       aasmbase,aasmtai,
+       aasmbase,aasmtai,aasmdata,
        cpubase,
        rgobj;
 
      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

+ 12 - 12
compiler/aopt.pas

@@ -28,14 +28,14 @@ Unit aopt;
   Interface
 
     Uses
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       aoptobj;
 
     Type
       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

+ 9 - 9
compiler/aoptbase.pas

@@ -27,7 +27,7 @@ unit aoptbase;
   interface
 
     uses
-      aasmbase,aasmcpu,aasmtai,
+      aasmbase,aasmcpu,aasmtai,aasmdata,
       cpubase,
       cgbase,
       cgutils;
@@ -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;

+ 2 - 2
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                                                             }

+ 1 - 1
compiler/aoptda.pas

@@ -29,7 +29,7 @@ Unit aoptda;
 
     uses
       cpubase,cgbase,
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       aoptcpub, aoptbase;
 
     Type

+ 10 - 10
compiler/aoptobj.pas

@@ -32,7 +32,7 @@ Unit AoptObj;
 
     uses
       globtype,
-      aasmbase,aasmcpu,aasmtai,
+      aasmbase,aasmcpu,aasmtai,aasmdata,
       cclasses,
       cgbase,cgutils,
       cpubase,
@@ -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;

+ 6 - 6
compiler/arm/aasmcpu.pas

@@ -27,7 +27,7 @@ interface
 
 uses
   cclasses,globtype,globals,verbose,
-  aasmbase,aasmtai,
+  aasmbase,aasmtai,aasmdata,
   ogbase,
   symtype,
   cpubase,cpuinfo,cgbase,cgutils;
@@ -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);

+ 1 - 1
compiler/arm/agarmgas.pas

@@ -29,7 +29,7 @@ unit agarmgas;
   interface
 
     uses
-       aasmtai,
+       aasmtai,aasmdata,
        aggas,
        cpubase;
 

+ 101 - 101
compiler/arm/cgcpu.pas

@@ -30,7 +30,7 @@ unit cgcpu;
     uses
        globtype,symtype,symdef,
        cgbase,cgutils,cgobj,
-       aasmbase,aasmcpu,aasmtai,
+       aasmbase,aasmcpu,aasmtai,aasmdata,
        parabase,
        cpubase,cpuinfo,node,cg64f32,rgcpu;
 
@@ -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

+ 1 - 1
compiler/arm/cpupara.pas

@@ -28,7 +28,7 @@ unit cpupara;
 
     uses
        globtype,globals,
-       aasmtai,
+       aasmtai,aasmdata,
        cpuinfo,cpubase,cgbase,
        symconst,symbase,symtype,symdef,parabase,paramgr;
 

+ 1 - 1
compiler/arm/cpupi.pas

@@ -46,7 +46,7 @@ unit cpupi;
     uses
        globals,systems,
        cpubase,
-       aasmtai,
+       aasmtai,aasmdata,
        tgobj,
        symconst,symsym,paramgr,
        cgbase,

+ 29 - 29
compiler/arm/narmadd.pas

@@ -46,9 +46,9 @@ interface
       globtype,systems,
       cutils,verbose,globals,
       symconst,symdef,paramgr,
-      aasmbase,aasmtai,aasmcpu,defutil,htypechk,
+      aasmbase,aasmtai,aasmdata,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);

+ 34 - 34
compiler/arm/narmcnv.pas

@@ -58,10 +58,10 @@ implementation
 
    uses
       verbose,globtype,globals,systems,
-      symconst,symdef,aasmbase,aasmtai,
+      symconst,symdef,aasmbase,aasmtai,aasmdata,
       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;
 
 

+ 6 - 6
compiler/arm/narmcon.pas

@@ -39,7 +39,7 @@ interface
       verbose,
       globtype,globals,
       cpuinfo,
-      aasmbase,aasmtai,
+      aasmbase,aasmtai,aasmdata,
       symconst,symdef,
       defutil,
       cgbase,cgutils,
@@ -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}

+ 10 - 10
compiler/arm/narminl.pas

@@ -59,7 +59,7 @@ implementation
       globtype,systems,
       cutils,verbose,globals,fmodule,
       symconst,symdef,
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       cgbase,cgutils,
       pass_1,pass_2,
       cpubase,paramgr,
@@ -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;
     }
 

+ 13 - 13
compiler/arm/narmmat.pas

@@ -45,10 +45,10 @@ implementation
       globtype,systems,
       cutils,verbose,globals,
       symconst,symdef,
-      aasmbase,aasmcpu,aasmtai,
+      aasmbase,aasmcpu,aasmtai,aasmdata,
       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;

+ 3 - 3
compiler/arm/raarm.pas

@@ -27,7 +27,7 @@ unit raarm;
 
     uses
       cpubase,
-      aasmtai,
+      aasmtai,aasmdata,
       rautils;
 
     type
@@ -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;

+ 1 - 1
compiler/arm/raarmgas.pas

@@ -53,7 +53,7 @@ Unit raarmgas;
       globtype,globals,verbose,
       systems,
       { aasm }
-      cpuinfo,aasmbase,aasmtai,aasmcpu,
+      cpuinfo,aasmbase,aasmtai,aasmdata,aasmcpu,
       { symtable }
       symconst,symbase,symtype,symsym,symtable,
       { parser }

+ 11 - 11
compiler/arm/rgcpu.pas

@@ -28,15 +28,15 @@ unit rgcpu;
   interface
 
      uses
-       aasmbase,aasmtai,aasmcpu,
+       aasmbase,aasmtai,aasmdata,aasmcpu,
        cgbase,cgutils,
        cpubase,
        rgobj;
 
      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;
 

+ 54 - 43
compiler/assemble.pas

@@ -38,7 +38,7 @@ interface
       strings,
       dos,
 {$ENDIF USE_SYSUTILS}
-      systems,globtype,globals,aasmbase,aasmtai,ogbase;
+      systems,globtype,globals,aasmbase,aasmtai,aasmdata,ogbase;
 
     const
        { maximum of aasmoutput lists there will be }
@@ -52,11 +52,11 @@ interface
       {filenames}
         path     : pathstr;
         name     : namestr;
-        asmfile,         { current .s and .o file }
-        objfile  : string;
-        ppufilename : string;
-        asmprefix : string;
-        SmartAsm : boolean;
+        AsmFileName,         { current .s and .o file }
+        ObjFileName,
+        ppufilename  : string;
+        asmprefix    : string;
+        SmartAsm     : boolean;
         SmartFilesCount,
         SmartHeaderCount : longint;
         Constructor Create(smart:boolean);virtual;
@@ -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;
@@ -183,7 +183,8 @@ Implementation
 {$ifdef m68k}
       cpuinfo,
 {$endif m68k}
-      aasmcpu
+      aasmcpu,
+      owbase,owar
       ;
 
     var
@@ -197,8 +198,8 @@ Implementation
     Constructor TAssembler.Create(smart:boolean);
       begin
       { load start values }
-        asmfile:=current_module.get_asmfilename;
-        objfile:=current_module.objfilename^;
+        AsmFileName:=current_module.get_AsmFilename;
+        ObjFileName:=current_module.ObjFileName^;
         name:=Lower(current_module.modulename^);
         path:=current_module.outputpath^;
         asmprefix := current_module.asmprefix^;
@@ -236,10 +237,10 @@ Implementation
           cut_end :
             s:=asmprefix+tostr(SmartHeaderCount)+'t';
         end;
-        AsmFile:=Path+FixFileName(s+tostr(SmartFilesCount)+target_info.asmext);
-        ObjFile:=Path+FixFileName(s+tostr(SmartFilesCount)+target_info.objext);
+        AsmFileName:=Path+FixFileName(s+tostr(SmartFilesCount)+target_info.asmext);
+        ObjFileName:=Path+FixFileName(s+tostr(SmartFilesCount)+target_info.objext);
         { insert in container so it can be cleared after the linking }
-        SmartLinkOFiles.Insert(Objfile);
+        SmartLinkOFiles.Insert(ObjFileName);
       end;
 
 
@@ -415,10 +416,10 @@ Implementation
         if cs_asm_leave in aktglobalswitches then
          exit;
         if cs_asm_extern in aktglobalswitches then
-         AsmRes.AddDeleteCommand(AsmFile)
+         AsmRes.AddDeleteCommand(AsmFileName)
         else
          begin
-           assign(g,AsmFile);
+           assign(g,AsmFileName);
            {$I-}
             erase(g);
            {$I+}
@@ -552,8 +553,8 @@ Implementation
 {$endif}
         if (cs_link_on_target in aktglobalswitches) then
          begin
-           Replace(result,'$ASM',maybequoted(ScriptFixFileName(AsmFile)));
-           Replace(result,'$OBJ',maybequoted(ScriptFixFileName(ObjFile)));
+           Replace(result,'$ASM',maybequoted(ScriptFixFileName(AsmFileName)));
+           Replace(result,'$OBJ',maybequoted(ScriptFixFileName(ObjFileName)));
          end
         else
          begin
@@ -562,8 +563,8 @@ Implementation
             Replace(result,'$ASM','')
           else
 {$endif}
-             Replace(result,'$ASM',maybequoted(AsmFile));
-           Replace(result,'$OBJ',maybequoted(ObjFile));
+             Replace(result,'$ASM',maybequoted(AsmFileName));
+           Replace(result,'$OBJ',maybequoted(ObjFileName));
          end;
       end;
 
@@ -575,20 +576,20 @@ Implementation
 {$ifdef hasunix}
         if DoPipe then
          begin
-           Message1(exec_i_assembling_pipe,asmfile);
+           Message1(exec_i_assembling_pipe,AsmFileName);
            POpen(outfile,FindAssembler+' '+MakeCmdLine,'W');
          end
         else
 {$endif}
          begin
-           Assign(outfile,asmfile);
+           Assign(outfile,AsmFileName);
            {$I-}
            Rewrite(outfile,1);
            {$I+}
            if ioresult<>0 then
              begin
                ioerror:=true;
-               Message1(exec_d_cant_create_asmfile,asmfile);
+               Message1(exec_d_cant_create_asmfile,AsmFileName);
              end;
          end;
         outcnt:=0;
@@ -640,7 +641,7 @@ Implementation
       end;
 
 
-    procedure TExternalAssembler.WriteTree(p:TAAsmoutput);
+    procedure TExternalAssembler.WriteTree(p:TAsmList);
       begin
       end;
 
@@ -1029,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);
@@ -1138,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);
@@ -1154,9 +1155,11 @@ Implementation
         doexit;
       var
         hp : Tai;
+        ObjWriter : TObjectWriter;
       begin
-        ObjOutput:=CObjOutput.Create(false);
-        ObjData:=ObjOutput.newObjData(Objfile);
+        ObjWriter:=TObjectwriter.create;
+        ObjOutput:=CObjOutput.Create(ObjWriter);
+        ObjData:=ObjOutput.newObjData(ObjFileName);
 
         { Pass 0 }
         ObjData.currpass:=0;
@@ -1218,7 +1221,7 @@ Implementation
         if errorcount=0 then
          begin
            { write objectfile }
-           ObjOutput.startobjectfile(ObjFile);
+           ObjOutput.startobjectfile(ObjFileName);
            ObjOutput.writeobjectfile(ObjData);
          end;
 
@@ -1226,6 +1229,7 @@ Implementation
         { Cleanup }
         ObjData.free;
         ObjData:=nil;
+        ObjWriter.free;
       end;
 
 
@@ -1234,9 +1238,15 @@ Implementation
         hp : Tai;
         startsectype : TAsmSectiontype;
         place: tcutplace;
+        ObjWriter : TObjectWriter;
       begin
+        if not(cs_asm_leave in aktglobalswitches) then
+          ObjWriter:=TARObjectWriter.create(current_module.staticlibfilename^)
+        else
+          ObjWriter:=TObjectwriter.create;
+
         NextSmartName(cut_normal);
-        ObjOutput:=CObjOutput.Create(true);
+        ObjOutput:=CObjOutput.Create(ObjWriter);
         startsectype:=sec_code;
 
         { start with list 1 }
@@ -1245,7 +1255,7 @@ Implementation
         hp:=Tai(currList.first);
         while assigned(hp) do
          begin
-           ObjData:=ObjOutput.newObjData(Objfile);
+           ObjData:=ObjOutput.newObjData(ObjFileName);
 
            { Pass 0 }
            ObjData.currpass:=0;
@@ -1272,7 +1282,7 @@ Implementation
 
            { Pass 2 }
            ObjData.currpass:=2;
-           ObjOutput.startobjectfile(Objfile);
+           ObjOutput.startobjectfile(ObjFileName);
            ObjData.resetsections;
            ObjData.beforewrite;
            ObjData.createsection(startsectype,'');
@@ -1320,34 +1330,35 @@ Implementation
          end;
         ObjData.free;
         ObjData:=nil;
+        ObjWriter.free;
       end;
 
 
     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
@@ -1362,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}

+ 1 - 1
compiler/browcol.pas

@@ -270,7 +270,7 @@ uses
   CUtils,
   globtype,globals,comphook,
   finput,fmodule,
-  cpuinfo,cgbase,aasmbase,aasmtai,paramgr,
+  cpuinfo,cgbase,aasmbase,aasmtai,aasmdata,paramgr,
   symsym,symdef,symtype,symbase,defutil;
 
 const

+ 69 - 87
compiler/dwarf.pas → compiler/cfidwarf.pas

@@ -19,7 +19,7 @@
 
  ****************************************************************************
 }
-unit dwarf;
+unit cfidwarf;
 
 {$i fpcdefs.inc}
 
@@ -29,7 +29,7 @@ interface
       cclasses,
       globtype,
       cgbase,cpubase,
-      aasmbase,aasmtai;
+      aasmbase,aasmtai,aasmdata;
 
     const
       maxdwarfops = 2;
@@ -51,50 +51,41 @@ interface
         op   : byte;
         ops  : byte;
         oper : array[0..maxdwarfops-1] of tdwarfoper;
-        constructor create(aop:longint);
-        constructor create_reg(aop:longint;enc1:tdwarfoperenc;reg:tregister);
-        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);
+        constructor create(aop:byte);
+        constructor create_reg(aop:byte;enc1:tdwarfoperenc;reg:tregister);
+        constructor create_const(aop:byte;enc1:tdwarfoperenc;val:int64);
+        constructor create_reloffset(aop:byte;enc1:tdwarfoperenc;beginlab,endlab:tasmsymbol);
+        constructor create_reg_const(aop:byte;enc1:tdwarfoperenc;reg:tregister;enc2:tdwarfoperenc;val:longint);
+        procedure generate_code(list:TAsmList);
       end;
 
-      tdwarf=class
-      private
-        Fal_dwarf : TLinkedList;
-      public
-        constructor create;
-        destructor destroy;override;
-        property al_dwarf:TlinkedList read Fal_dwarf;
-      end;
-
-      tdwarfcfi=class(tdwarf)
+      TDwarfAsmCFI=class(TAsmCFI)
       private
+        FDwarfList : TLinkedList;
         FFrameStartLabel,
         FFrameEndLabel,
         FLastloclabel : tasmlabel;
-        procedure cfa_advance_loc(list:taasmoutput);
+        procedure cfa_advance_loc(list:TAsmList);
+        procedure generate_initial_instructions(list:TAsmList);virtual;
       protected
         code_alignment_factor,
         data_alignment_factor : shortint;
+        property DwarfList:TlinkedList read FDwarfList;
       public
-        constructor create;
-        procedure generate_code(list:taasmoutput);
-        procedure generate_initial_instructions(list:taasmoutput);virtual;
+        constructor create;override;
+        destructor destroy;override;
+        procedure generate_code(list:TAsmList);override;
         { 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);override;
+        procedure end_frame(list:TAsmList);override;
+        procedure cfa_offset(list:TAsmList;reg:tregister;ofs:longint);override;
+        procedure cfa_restore(list:TAsmList;reg:tregister);override;
+        procedure cfa_def_cfa_register(list:TAsmList;reg:tregister);override;
+        procedure cfa_def_cfa_offset(list:TAsmList;ofs:longint);override;
       end;
 
 
-    var
-      dwarfcfi : tdwarfcfi;
-
-    function dwarf_reg(r:tregister):longint;
+    function dwarf_reg(r:tregister):byte;
 
 
 implementation
@@ -142,33 +133,17 @@ implementation
                                   Helpers
 ****************************************************************************}
 
-    function dwarf_reg(r:tregister):longint;
+    function dwarf_reg(r:tregister):byte;
       begin
         result:=regdwarf_table[findreg_by_number(r)];
       end;
 
 
-{****************************************************************************
-                                  TDWARF
-****************************************************************************}
-
-    constructor tdwarf.create;
-      begin
-        Fal_dwarf:=TLinkedList.Create;
-      end;
-
-
-    destructor tdwarf.destroy;
-      begin
-        Fal_dwarf.Free;
-      end;
-
-
 {****************************************************************************
                                 TDWARFITEM
 ****************************************************************************}
 
-    constructor tdwarfitem.create(aop:longint);
+    constructor tdwarfitem.create(aop:byte);
       begin
         inherited create;
         op:=aop;
@@ -176,7 +151,7 @@ implementation
       end;
 
 
-    constructor tdwarfitem.create_reg(aop:longint;enc1:tdwarfoperenc;reg:tregister);
+    constructor tdwarfitem.create_reg(aop:byte;enc1:tdwarfoperenc;reg:tregister);
       begin
         inherited create;
         op:=aop;
@@ -187,7 +162,7 @@ implementation
       end;
 
 
-    constructor tdwarfitem.create_const(aop:longint;enc1:tdwarfoperenc;val:int64);
+    constructor tdwarfitem.create_const(aop:byte;enc1:tdwarfoperenc;val:int64);
       begin
         inherited create;
         op:=aop;
@@ -198,7 +173,7 @@ implementation
       end;
 
 
-    constructor tdwarfitem.create_reloffset(aop:longint;enc1:tdwarfoperenc;beginlab,endlab:tasmsymbol);
+    constructor tdwarfitem.create_reloffset(aop:byte;enc1:tdwarfoperenc;beginlab,endlab:tasmsymbol);
       begin
         inherited create;
         op:=aop;
@@ -211,7 +186,7 @@ implementation
       end;
 
 
-    constructor tdwarfitem.create_reg_const(aop:longint;enc1:tdwarfoperenc;reg:tregister;enc2:tdwarfoperenc;val:longint);
+    constructor tdwarfitem.create_reg_const(aop:byte;enc1:tdwarfoperenc;reg:tregister;enc2:tdwarfoperenc;val:longint);
       begin
         inherited create;
         op:=aop;
@@ -225,7 +200,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,
@@ -258,10 +233,10 @@ implementation
 
 
 {****************************************************************************
-                                 TDWARFCFI
+                                 TDwarfAsmCFI
 ****************************************************************************}
 
-    constructor tdwarfcfi.create;
+    constructor TDwarfAsmCFI.create;
       begin
         inherited create;
         FFrameStartLabel:=nil;
@@ -269,11 +244,19 @@ implementation
         FLastLocLabel:=nil;
         code_alignment_factor:=1;
         data_alignment_factor:=-4;
+        FDwarfList:=TLinkedList.Create;
       end;
 
+
+    destructor TDwarfAsmCFI.destroy;
+      begin
+        FDwarfList.Free;
+      end;
+
+
 {$ifdef i386}
     { if more cpu dependend stuff is implemented, this needs more refactoring }
-    procedure tdwarfcfi.generate_initial_instructions(list:taasmoutput);
+    procedure TDwarfAsmCFI.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 +267,7 @@ implementation
       end;
 {$else i386}
     { if more cpu dependend stuff is implemented, this needs more refactoring }
-    procedure tdwarfcfi.generate_initial_instructions(list:taasmoutput);
+    procedure TDwarfAsmCFI.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 +278,7 @@ implementation
       end;
 {$endif i386}
 
-    procedure tdwarfcfi.generate_code(list:taasmoutput);
+    procedure TDwarfAsmCFI.generate_code(list:TAsmList);
       var
         hp : tdwarfitem;
         cielabel,
@@ -314,10 +297,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)));
@@ -337,7 +320,7 @@ implementation
         lenstartlabel:=nil;
         lenendlabel:=nil;
 
-        hp:=TDwarfItem(al_dwarf.first);
+        hp:=TDwarfItem(DwarfList.first);
         while assigned(hp) do
           begin
             case hp.op of
@@ -348,8 +331,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
@@ -380,28 +363,28 @@ implementation
         { Check for open frames }
         if assigned(lenstartlabel) then
           internalerror(2004041210);
-        { al_dwarf is processed, remove items }
-        al_dwarf.Clear;
+        { DwarfList is processed, remove items }
+        DwarfList.Clear;
       end;
 
 
-    procedure tdwarfcfi.start_frame(list:taasmoutput);
+    procedure TDwarfAsmCFI.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));
+        DwarfList.concat(tdwarfitem.create_reloffset(DW_CFA_start_frame,doe_32bit,FFrameStartLabel,FFrameEndLabel));
       end;
 
 
-    procedure tdwarfcfi.end_frame(list:taasmoutput);
+    procedure TDwarfAsmCFI.end_frame(list:TAsmList);
       begin
         if not assigned(FFrameStartLabel) then
           internalerror(2004041213);
-        al_dwarf.concat(tdwarfitem.create(DW_CFA_end_frame));
+        DwarfList.concat(tdwarfitem.create(DW_CFA_end_frame));
         list.concat(tai_label.create(FFrameEndLabel));
         FFrameStartLabel:=nil;
         FFrameEndLabel:=nil;
@@ -409,50 +392,49 @@ implementation
       end;
 
 
-    procedure tdwarfcfi.cfa_advance_loc(list:taasmoutput);
+    procedure TDwarfAsmCFI.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));
+        DwarfList.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 TDwarfAsmCFI.cfa_offset(list:TAsmList;reg:tregister;ofs:longint);
       begin
         cfa_advance_loc(list);
 {$warning TODO check if ref is a temp}
         { offset must be positive }
-        al_dwarf.concat(tdwarfitem.create_reg_const(DW_CFA_offset_extended,doe_uleb,reg,doe_uleb,ofs div data_alignment_factor));
+        DwarfList.concat(tdwarfitem.create_reg_const(DW_CFA_offset_extended,doe_uleb,reg,doe_uleb,ofs div data_alignment_factor));
       end;
 
 
-    procedure tdwarfcfi.cfa_restore(list:taasmoutput;reg:tregister);
+    procedure TDwarfAsmCFI.cfa_restore(list:TAsmList;reg:tregister);
       begin
         cfa_advance_loc(list);
-        al_dwarf.concat(tdwarfitem.create_reg(DW_CFA_restore_extended,doe_uleb,reg));
+        DwarfList.concat(tdwarfitem.create_reg(DW_CFA_restore_extended,doe_uleb,reg));
       end;
 
 
-    procedure tdwarfcfi.cfa_def_cfa_register(list:taasmoutput;reg:tregister);
+    procedure TDwarfAsmCFI.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));
+        DwarfList.concat(tdwarfitem.create_reg(DW_CFA_def_cfa_register,doe_uleb,reg));
       end;
 
 
-    procedure tdwarfcfi.cfa_def_cfa_offset(list:taasmoutput;ofs:longint);
+    procedure TDwarfAsmCFI.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));
+        DwarfList.concat(tdwarfitem.create_const(DW_CFA_def_cfa_offset,doe_uleb,ofs));
       end;
 
 
 begin
-{$warning TODO Maybe initialize per module}
-  dwarfcfi:=tdwarfcfi.create;
+  CAsmCFI:=TDwarfAsmCFI;
 end.

+ 63 - 63
compiler/cg64f32.pas

@@ -31,7 +31,7 @@ unit cg64f32;
   interface
 
     uses
-       aasmbase,aasmtai,aasmcpu,
+       aasmbase,aasmtai,aasmdata,aasmcpu,
        cpubase,cpupara,
        cgbase,cgobj,parabase,cgutils,
        symtype
@@ -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;

File diff ditekan karena terlalu besar
+ 201 - 207
compiler/cgobj.pas


+ 30 - 30
compiler/cresstr.pas

@@ -62,7 +62,7 @@ uses
    cutils,globtype,globals,
    symdef,
    verbose,fmodule,
-   aasmbase,aasmtai,
+   aasmbase,aasmtai,aasmdata,
    aasmcpu;
 
 
@@ -144,60 +144,60 @@ procedure Tresourcestrings.CreateResourceStringList;
     with p Do
      begin
        if (Value=nil) or (len=0) then
-         asmlist[al_resourcestrings].concat(tai_const.create_sym(nil))
+         current_asmdata.AsmLists[al_resourcestrings].concat(tai_const.create_sym(nil))
        else
          begin
-            objectlibrary.getdatalabel(l1);
-            asmlist[al_resourcestrings].concat(tai_const.create_sym(l1));
-            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(len));
-            asmlist[al_const].concat(tai_label.create(l1));
+            current_asmdata.getdatalabel(l1);
+            current_asmdata.AsmLists[al_resourcestrings].concat(tai_const.create_sym(l1));
+            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(len));
+            current_asmdata.AsmLists[al_const].concat(tai_label.create(l1));
             getmem(s,len+1);
             move(value^,s^,len);
             s[len]:=#0;
-            asmlist[al_const].concat(tai_string.create_pchar(s,len));
-            asmlist[al_const].concat(tai_const.create_8bit(0));
+            current_asmdata.AsmLists[al_const].concat(tai_string.create_pchar(s,len));
+            current_asmdata.AsmLists[al_const].concat(tai_const.create_8bit(0));
          end;
        { append Current value (nil) and hash...}
-       asmlist[al_resourcestrings].concat(tai_const.create_sym(nil));
-       asmlist[al_resourcestrings].concat(tai_const.create_32bit(longint(hash)));
+       current_asmdata.AsmLists[al_resourcestrings].concat(tai_const.create_sym(nil));
+       current_asmdata.AsmLists[al_resourcestrings].concat(tai_const.create_32bit(longint(hash)));
        { Append the name as a ansistring. }
-       objectlibrary.getdatalabel(l1);
+       current_asmdata.getdatalabel(l1);
        l:=length(name);
-       asmlist[al_resourcestrings].concat(tai_const.create_sym(l1));
-       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(l1));
+       current_asmdata.AsmLists[al_resourcestrings].concat(tai_const.create_sym(l1));
+       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(l1));
        getmem(s,l+1);
        move(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));
      end;
   end;
 
 Var
   R : tresourceStringItem;
 begin
-  if asmlist[al_resourcestrings]=nil then
-    asmlist[al_resourcestrings]:=taasmoutput.create;
-  maybe_new_object_file(asmlist[al_resourcestrings]);
-  new_section(asmlist[al_resourcestrings],sec_data,'',4);
-  asmlist[al_resourcestrings].concat(tai_align.create(const_align(sizeof(aint))));
-  asmlist[al_resourcestrings].concat(tai_symbol.createname_global(
+  if current_asmdata.AsmLists[al_resourcestrings]=nil then
+    current_asmdata.AsmLists[al_resourcestrings]:=tasmlist.create;
+  maybe_new_object_file(current_asmdata.AsmLists[al_resourcestrings]);
+  new_section(current_asmdata.AsmLists[al_resourcestrings],sec_data,'',4);
+  current_asmdata.AsmLists[al_resourcestrings].concat(tai_align.create(const_align(sizeof(aint))));
+  current_asmdata.AsmLists[al_resourcestrings].concat(tai_symbol.createname_global(
     make_mangledname('RESOURCESTRINGLIST',current_module.localsymtable,''),AT_DATA,0));
-  asmlist[al_resourcestrings].concat(tai_const.create_32bit(resstrcount));
+  current_asmdata.AsmLists[al_resourcestrings].concat(tai_const.create_32bit(resstrcount));
   R:=TResourceStringItem(List.First);
   while assigned(R) do
    begin
      AppendToAsmResList(R);
      R:=TResourceStringItem(R.Next);
    end;
-  asmlist[al_resourcestrings].concat(tai_symbol_end.createname(
+  current_asmdata.AsmLists[al_resourcestrings].concat(tai_symbol_end.createname(
     make_mangledname('RESOURCESTRINGLIST',current_module.localsymtable,'')));
 end;
 

+ 11 - 11
compiler/dbgbase.pas

@@ -30,7 +30,7 @@ interface
       systems,
       symconst,symbase,symdef,symtype,symsym,symtable,
       fmodule,
-      aasmtai;
+      aasmtai,aasmdata;
 
     type
       TDebugInfo=class
@@ -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

+ 156 - 156
compiler/dbgdwarf.pas

@@ -38,7 +38,7 @@ interface
 
     uses
       cclasses,
-      aasmbase,aasmtai,
+      aasmbase,aasmtai,aasmdata,
       symbase,symtype,symdef,
       DbgBase;
 
@@ -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;

+ 39 - 39
compiler/dbgstabs.pas

@@ -29,7 +29,7 @@ interface
       cclasses,
       dbgbase,
       symtype,symdef,symsym,symtable,symbase,
-      aasmtai;
+      aasmtai,aasmdata;
 
     type
       TDebugInfoStabs=class(TDebugInfo)
@@ -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

+ 5 - 2
compiler/finput.pas

@@ -636,6 +636,7 @@ uses
          stringdispose(exefilename);
          stringdispose(outputpath);
          stringdispose(path);
+         stringdispose(paramfn);
          { Create names }
          paramfn := stringdup(fn);
          paramallowoutput := allowoutput;
@@ -684,9 +685,9 @@ uses
           p:=path^;
          sharedlibfilename:=stringdup(p+prefix+n+suffix+extension);
          { don't use extension alone to check, it can be empty !! }
-         if (OutputFile<>'') or (OutputExtension<>'') then 
+         if (OutputFile<>'') or (OutputExtension<>'') then
            exefilename:=stringdup(p+n+OutputExtension)
-         else  
+         else
            exefilename:=stringdup(p+n+target_info.exeext);
          mapfilename:=stringdup(p+n+'.map');
       end;
@@ -705,6 +706,7 @@ uses
         exefilename:=nil;
         mapfilename:=nil;
         outputpath:=nil;
+        paramfn:=nil;
         path:=nil;
         { status }
         state:=ms_registered;
@@ -738,6 +740,7 @@ uses
         stringdispose(modulename);
         stringdispose(realmodulename);
         stringdispose(mainsource);
+        stringdispose(paramfn);
         inherited destroy;
       end;
 

+ 22 - 20
compiler/fmodule.pas

@@ -44,7 +44,7 @@ interface
     uses
        cutils,cclasses,
        globals,finput,
-       symbase,symsym,aasmbase;
+       symbase,symsym,aasmbase,aasmtai,aasmdata;
 
 
     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.

+ 1 - 0
compiler/fppu.pas

@@ -773,6 +773,7 @@ uses
       begin
         { Load unit map used for resolving }
         derefmapsize:=ppufile.getlongint;
+        derefmapcnt:=derefmapsize;
         getmem(derefmap,derefmapsize*sizeof(tderefmaprec));
         fillchar(derefmap^,derefmapsize*sizeof(tderefmaprec),0);
         for i:=0 to derefmapsize-1 do

+ 12 - 12
compiler/i386/ag386nsm.pas

@@ -28,7 +28,7 @@ interface
 
     uses
       cpubase,
-      aasmbase,aasmtai,aasmcpu,assemble,cgutils;
+      aasmbase,aasmtai,aasmdata,aasmcpu,assemble,cgutils;
 
     type
       T386NasmAssembler = class(texternalassembler)
@@ -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;
@@ -384,7 +384,7 @@ interface
         LasTSecType:=atype;
       end;
 
-    procedure T386NasmAssembler.WriteTree(p:taasmoutput);
+    procedure T386NasmAssembler.WriteTree(p:TAsmList);
     var
       s : string;
       hp       : tai;
@@ -404,7 +404,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
@@ -749,9 +749,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 :
@@ -789,13 +789,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
@@ -811,11 +811,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;

+ 8 - 8
compiler/i386/aopt386.pas

@@ -27,9 +27,9 @@ Unit aopt386;
 Interface
 
 Uses
-  aasmbase,aasmtai,aasmcpu;
+  aasmbase,aasmtai,aasmdata,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)

+ 36 - 36
compiler/i386/cgcpu.pas

@@ -28,7 +28,7 @@ unit cgcpu;
     uses
        globtype,
        cgbase,cgobj,cg64f32,cgx86,
-       aasmbase,aasmtai,aasmcpu,
+       aasmbase,aasmtai,aasmdata,aasmcpu,
        cpubase,parabase,cgutils,
        symconst,symdef
        ;
@@ -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;

+ 3 - 3
compiler/i386/cpupara.pas

@@ -27,7 +27,7 @@ unit cpupara;
 
     uses
        globtype,
-       aasmtai,cpubase,cgbase,
+       aasmtai,aasmdata,cpubase,cgbase,
        symconst,symtype,symsym,symdef,
        parabase,paramgr;
 
@@ -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);
@@ -614,7 +614,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

+ 3 - 0
compiler/i386/cputarg.pas

@@ -104,6 +104,9 @@ implementation
              Debuginfo
 **************************************}
 
+  {$ifndef NoCFIDwarf}
+      ,cfidwarf
+  {$endif NoCFIDwarf}
   {$ifndef NoDbgStabs}
       ,dbgstabs
   {$endif NoDbgStabs}

+ 22 - 22
compiler/i386/csopt386.pas

@@ -26,9 +26,9 @@ unit CSOpt386;
 
 interface
 
-uses aasmbase,aasmtai,aasmcpu, cpuinfo, cpubase, optbase, cgbase;
+uses aasmbase,aasmtai,aasmdata,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));

+ 30 - 30
compiler/i386/daopt386.pas

@@ -29,7 +29,7 @@ interface
 
 uses
   globtype,
-  cclasses,aasmbase,aasmtai,aasmcpu,cgbase,cgutils,
+  cclasses,aasmbase,aasmtai,aasmdata,aasmcpu,cgbase,cgutils,
   cpubase,optbase;
 
 {******************************* Constants *******************************}
@@ -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

+ 53 - 53
compiler/i386/n386add.pas

@@ -41,8 +41,8 @@ interface
       globtype,systems,
       cutils,verbose,globals,
       symconst,symdef,paramgr,
-      aasmbase,aasmtai,aasmcpu,
-      cgbase,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
+      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)
@@ -355,30 +355,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;
 
 

+ 9 - 9
compiler/i386/n386cal.pas

@@ -45,7 +45,7 @@ implementation
       cutils,verbose,globals,
       cgbase,cgutils,
       cpubase,paramgr,
-      aasmtai,aasmcpu,
+      aasmtai,aasmdata,aasmcpu,
       ncal,nbas,nmem,nld,ncnv,
       cga,cgobj,cpuinfo;
 
@@ -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;
 
 

+ 44 - 44
compiler/i386/n386mat.pas

@@ -50,7 +50,7 @@ implementation
     uses
       globtype,systems,
       cutils,verbose,globals,
-      symconst,symdef,aasmbase,aasmtai,defutil,
+      symconst,symdef,aasmbase,aasmtai,aasmdata,defutil,
       cgbase,pass_2,
       ncon,
       cpubase,cpuinfo,
@@ -94,7 +94,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
@@ -112,7 +112,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);
@@ -127,13 +127,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
@@ -170,9 +170,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
@@ -212,10 +212,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
@@ -223,7 +223,7 @@ implementation
                     if d>=$80000000 then
                       begin
                         emit_const_reg(A_CMP,S_L,aint(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
@@ -282,9 +282,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
@@ -304,19 +304,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)
@@ -335,19 +335,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;
 
@@ -371,7 +371,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;
 
@@ -415,8 +415,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 }
@@ -424,25 +424,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
@@ -451,14 +451,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;

+ 8 - 8
compiler/i386/n386mem.pas

@@ -50,7 +50,7 @@ implementation
       systems,
       cutils,verbose,
       symdef,paramgr,
-      aasmtai,
+      aasmtai,aasmdata,
       nld,ncon,nadd,
       cgutils,cgobj;
 
@@ -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;

+ 16 - 16
compiler/i386/n386set.pas

@@ -44,7 +44,7 @@ implementation
       systems,
       verbose,globals,
       symconst,symdef,defutil,
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       cgbase,pass_2,
       ncon,
       cpubase,cpuinfo,procinfo,
@@ -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;
 

+ 12 - 12
compiler/i386/popt386.pas

@@ -25,12 +25,12 @@ unit popt386;
 
 interface
 
-uses Aasmbase,aasmtai,aasmcpu,verbose;
+uses Aasmbase,aasmtai,aasmdata,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

+ 4 - 4
compiler/i386/ra386int.pas

@@ -82,7 +82,7 @@ Unit Ra386int;
        globals,verbose,
        systems,
        { aasm }
-       aasmtai,aasmcpu,
+       aasmtai,aasmdata,aasmcpu,
        { symtable }
        symconst,symbase,symtype,symsym,symdef,symtable,
        { parser }
@@ -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 }

+ 1 - 1
compiler/i386/rgcpu.pas

@@ -30,7 +30,7 @@ unit rgcpu;
     uses
       cpubase,
       cpuinfo,
-      aasmbase,aasmtai,
+      aasmbase,aasmtai,aasmdata,
       cclasses,globtype,cgbase,rgobj,rgx86;
 
     type

+ 4 - 4
compiler/i386/rropt386.pas

@@ -26,9 +26,9 @@ unit rropt386;
 
 interface
 
-uses aasmbase,aasmtai,aasmcpu;
+uses aasmbase,aasmtai,aasmdata,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

+ 16 - 3
compiler/link.pas

@@ -118,7 +118,7 @@ uses
 {$ENDIF USE_SYSUTILS}
   cutils,
   script,globals,verbose,comphook,ppu,
-  aasmbase,aasmtai,aasmcpu,
+  aasmbase,aasmtai,aasmdata,aasmcpu,
   ogmap;
 
 type
@@ -716,8 +716,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;
 
@@ -811,6 +819,7 @@ end;
               ExeOutput.Order_Stabs;
             hp:=tstringlistitem(hp.next);
           end;
+        exeoutput.Order_End;
       end;
 
 
@@ -924,6 +933,10 @@ end;
             exemap:=nil;
           end;
 
+        { close exe }
+        exeoutput.free;
+        exeoutput:=nil;
+
         MakeExecutable:=true;
       end;
 

+ 1 - 1
compiler/m68k/aasmcpu.pas

@@ -26,7 +26,7 @@ unit aasmcpu;
 interface
 
 uses
-  cclasses,aasmtai,
+  cclasses,aasmtai,aasmdata,
   aasmbase,globals,verbose,symtype,
   cpubase,cpuinfo,cgbase,cgutils;
 

+ 1 - 1
compiler/m68k/ag68kgas.pas

@@ -28,7 +28,7 @@ interface
     uses
       cclasses,cpubase,
       globals,
-      aasmbase,aasmtai,aasmcpu,assemble,aggas;
+      aasmbase,aasmtai,aasmdata,aasmcpu,assemble,aggas;
 
     type
       Tm68kGNUAssembler=class(TGNUassembler)

+ 83 - 83
compiler/m68k/cgcpu.pas

@@ -28,7 +28,7 @@ unit cgcpu;
 
     uses
        cgbase,cgobj,globtype,
-       aasmbase,aasmtai,aasmcpu,
+       aasmbase,aasmtai,aasmdata,aasmcpu,
        cpubase,cpuinfo,
        parabase,cpupara,
        node,symconst,symtype,symdef,
@@ -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;
@@ -545,7 +545,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
@@ -713,7 +713,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
@@ -747,7 +747,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;
@@ -780,14 +780,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
@@ -796,7 +796,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
@@ -806,7 +806,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;
@@ -860,7 +860,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;
@@ -950,9 +950,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);
@@ -970,9 +970,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);
@@ -992,16 +992,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;
@@ -1027,7 +1027,7 @@ unit cgcpu;
       end;
 
 
-{    procedure tcg68k.g_restore_frame_pointer(list : taasmoutput);
+{    procedure tcg68k.g_restore_frame_pointer(list : TAsmList);
       var
         r:Tregister;
       begin
@@ -1036,7 +1036,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;
@@ -1094,7 +1094,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;
@@ -1111,7 +1111,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;
@@ -1129,15 +1129,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 }
@@ -1173,7 +1173,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;
@@ -1191,7 +1191,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
@@ -1255,7 +1255,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;
@@ -1264,7 +1264,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;
@@ -1327,7 +1327,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;

+ 60 - 60
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;
 
 
@@ -49,9 +49,9 @@ implementation
       globtype,systems,
       cutils,verbose,globals,
       symconst,symdef,paramgr,
-      aasmbase,aasmtai,aasmcpu,defutil,htypechk,
+      aasmbase,aasmtai,aasmdata,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;

+ 2 - 2
compiler/m68k/n68kcal.pas

@@ -41,7 +41,7 @@ implementation
       cutils,verbose,globals,
       symconst,symbase,symsym,symtable,defutil,paramgr,parabase,
       cgbase,pass_2,
-      cpuinfo,cpubase,aasmbase,aasmtai,aasmcpu,
+      cpuinfo,cpubase,aasmbase,aasmtai,aasmdata,aasmcpu,
       nmem,nld,ncnv,
       ncgutil,cgutils,cgobj,tgobj,regvars,rgobj,rgcpu,
       cg64f32,cgcpu,cpupi,procinfo;
@@ -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);

+ 16 - 16
compiler/m68k/n68kcnv.pas

@@ -41,7 +41,7 @@ implementation
 
    uses
       verbose,globals,systems,
-      symconst,symdef,aasmbase,aasmtai,
+      symconst,symdef,aasmbase,aasmtai,aasmdata,
       defutil,
       cgbase,pass_1,pass_2,
       ncon,ncal,
@@ -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;
 

+ 78 - 78
compiler/m68k/n68kmat.pas

@@ -52,8 +52,8 @@ implementation
     uses
       globtype,systems,
       cutils,verbose,globals,
-      symconst,symdef,aasmbase,aasmtai,aasmcpu,
-      pass_1,pass_2,
+      symconst,symdef,aasmbase,aasmtai,aasmdata,aasmcpu,
+      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;

+ 5 - 5
compiler/m68k/ra68k.pas

@@ -26,7 +26,7 @@ unit ra68k;
   interface
 
     uses
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       cpubase,rautils,cclasses;
 
     type
@@ -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

+ 3 - 3
compiler/m68k/ra68kmot.pas

@@ -98,7 +98,7 @@ Implementation
        globals,verbose,
        systems,
        { aasm }
-       cpuinfo,aasmtai,aasmcpu,
+       cpuinfo,aasmtai,aasmdata,aasmcpu,
        cgbase,
        { symtable }
        symbase,symtype,symsym,symtable,
@@ -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;

+ 1 - 1
compiler/m68k/rgcpu.pas

@@ -27,7 +27,7 @@ unit rgcpu;
   interface
 
      uses
-       aasmbase,aasmtai,
+       aasmbase,aasmtai,aasmdata,
        cpubase,
        rgobj;
 

+ 1 - 1
compiler/mips/aasmcpu.pas

@@ -26,7 +26,7 @@ unit aasmcpu;
 interface
 
 uses
-  cclasses,aasmtai,
+  cclasses,aasmtai,aasmdata,
   aasmbase,globtype,globals,verbose,
   cpubase,cpuinfo,cgbase,cgutils;
 

+ 6 - 6
compiler/nbas.pas

@@ -28,7 +28,7 @@ interface
     uses
        globtype,
        cpuinfo,cpubase,cgbase,cgutils,
-       aasmbase,aasmtai,aasmcpu,
+       aasmbase,aasmtai,aasmdata,aasmcpu,
        node,
        symtype;
 
@@ -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;

+ 75 - 75
compiler/ncgadd.pas

@@ -71,8 +71,8 @@ interface
       globtype,systems,
       cutils,verbose,globals,
       symconst,symdef,paramgr,
-      aasmbase,aasmtai,defutil,
-      cgbase,pass_2,
+      aasmbase,aasmtai,aasmdata,defutil,
+      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;
@@ -495,10 +495,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:
@@ -510,20 +510,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;
@@ -536,11 +536,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;
@@ -553,13 +553,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)
@@ -567,8 +567,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);
@@ -581,7 +581,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;
 
 
@@ -679,11 +679,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
@@ -694,27 +694,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,
                 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;
 
 

+ 29 - 29
compiler/ncgbas.pas

@@ -68,7 +68,7 @@ interface
     uses
       globtype,globals,systems,
       cutils,verbose,
-      aasmbase,aasmtai,aasmcpu,symsym,symconst,
+      aasmbase,aasmtai,aasmdata,aasmcpu,symsym,symconst,
       defutil,
       nflw,pass_2,
       cgbase,cgobj,
@@ -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

+ 114 - 114
compiler/ncgcal.pas

@@ -78,7 +78,7 @@ implementation
       cutils,verbose,globals,
       symconst,symtable,defutil,paramgr,
       cgbase,pass_2,
-      aasmbase,aasmtai,
+      aasmbase,aasmtai,aasmdata,
       nbas,nmem,nld,ncnv,nutils,
 {$ifdef x86}
       cga,cgx86,
@@ -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 }

+ 69 - 69
compiler/ncgcnv.pas

@@ -58,10 +58,10 @@ interface
 
     uses
       cutils,verbose,globtype,globals,
-      aasmbase,aasmtai,aasmcpu,symconst,symdef,paramgr,
+      aasmbase,aasmtai,aasmdata,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);

+ 55 - 55
compiler/ncgcon.pas

@@ -64,7 +64,7 @@ implementation
     uses
       globtype,widestr,systems,
       verbose,globals,
-      symconst,symdef,aasmbase,aasmtai,aasmcpu,defutil,
+      symconst,symdef,aasmbase,aasmtai,aasmdata,aasmcpu,defutil,
       cpuinfo,cpubase,
       cgbase,cgobj,cgutils,
       ncgutil
@@ -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;
 

File diff ditekan karena terlalu besar
+ 280 - 280
compiler/ncgflw.pas


+ 85 - 85
compiler/ncginl.pas

@@ -56,7 +56,7 @@ implementation
       globtype,systems,
       cutils,verbose,globals,fmodule,
       symconst,symdef,defutil,symsym,
-      aasmbase,aasmtai,aasmcpu,parabase,
+      aasmbase,aasmtai,aasmdata,aasmcpu,parabase,
       cgbase,pass_1,pass_2,
       cpuinfo,cpubase,paramgr,procinfo,
       nbas,ncon,ncal,ncnv,nld,
@@ -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;
 

+ 118 - 118
compiler/ncgld.pas

@@ -56,7 +56,7 @@ implementation
       verbose,globtype,globals,
       symconst,symtype,symdef,symsym,defutil,paramgr,
       ncnv,ncon,nmem,nbas,
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       cgbase,pass_2,
       procinfo,
       cpubase,parabase,
@@ -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;
 
@@ -87,7 +87,7 @@ implementation
         norelocatelab : tasmlabel;
         paraloc1 : tcgpara;
       begin
-         
+
          { we don't know the size of all arrays }
          newsize:=def_cgsize(resulttype.def);
          location_reset(location,LOC_REFERENCE,newsize);
@@ -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('RESOURCESTRINGLIST',tconstsym(symtableentry).owner,''),AB_EXTERNAL,AT_DATA);
+                      location.reference.symbol:=current_asmdata.newasmsymbol(make_mangledname('RESOURCESTRINGLIST',tconstsym(symtableentry).owner,''),AB_EXTERNAL,AT_DATA);
                       location.reference.offset:=tconstsym(symtableentry).resstrindex*(4+sizeof(aint)*3)+4+sizeof(aint);
                    end
                  else
@@ -128,7 +128,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;
@@ -138,9 +138,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 }
@@ -157,37 +157,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 }
@@ -238,7 +238,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}
@@ -269,10 +269,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;
@@ -302,7 +302,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 }
@@ -318,12 +318,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);
@@ -332,7 +332,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
@@ -340,35 +340,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);
@@ -392,10 +392,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
@@ -422,9 +422,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;
@@ -437,8 +437,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;
@@ -454,8 +454,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;
@@ -469,9 +469,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
@@ -487,7 +487,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      }
@@ -510,7 +510,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
@@ -518,27 +518,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;
@@ -554,10 +554,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 :
@@ -568,15 +568,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);
@@ -590,13 +590,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,
@@ -610,9 +610,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,
@@ -624,9 +624,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,
@@ -634,11 +634,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 :
@@ -657,37 +657,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}
@@ -695,10 +695,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;
 
 
@@ -751,9 +751,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;
@@ -767,7 +767,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 }
@@ -871,16 +871,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
@@ -892,30 +892,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);

+ 43 - 43
compiler/ncgmat.pas

@@ -127,7 +127,7 @@ implementation
     uses
       globtype,systems,
       cutils,verbose,globals,
-      symconst,aasmbase,aasmtai,aasmcpu,defutil,
+      symconst,aasmbase,aasmtai,aasmdata,aasmcpu,defutil,
       parabase,
       pass_2,
       ncon,
@@ -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;
 
 

+ 98 - 98
compiler/ncgmem.pas

@@ -80,7 +80,7 @@ implementation
       systems,
       cutils,verbose,globals,
       symconst,symdef,symsym,defutil,paramgr,
-      aasmbase,aasmtai,
+      aasmbase,aasmtai,aasmdata,
       procinfo,pass_2,parabase,
       pass_1,nld,ncon,nadd,nutils,
       cgutils,cgobj,
@@ -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

+ 19 - 19
compiler/ncgopt.pas

@@ -40,7 +40,7 @@ uses
   globtype,globals,
   pass_1,defutil,htypechk,
   symdef,paramgr,
-  aasmbase,aasmtai,
+  aasmbase,aasmtai,aasmdata,
   ncnv, ncon, pass_2,
   cgbase, cpubase,
   tgobj, cgobj, cgutils,ncgutil;
@@ -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;
 

+ 104 - 104
compiler/ncgset.pas

@@ -27,7 +27,7 @@ interface
 
     uses
        globtype,globals,
-       node,nset,cpubase,cgbase,cgobj,aasmbase,aasmtai;
+       node,nset,cpubase,cgbase,cgobj,aasmbase,aasmtai,aasmdata;
 
     type
        tcgsetelementnode = class(tsetelementnode)
@@ -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

+ 130 - 130
compiler/ncgutil.pas

@@ -29,7 +29,7 @@ interface
       node,cpuinfo,
       globtype,
       cpubase,cgbase,parabase,cgutils,
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       symconst,symbase,symdef,symsym,symtype,symtable
 {$ifndef cpu64bit}
       ,cg64f32
@@ -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
 
@@ -157,7 +157,7 @@ implementation
     globals,systems,verbose,
     ppu,defutil,
     procinfo,paramgr,fmodule,
-    regvars,dwarf,dbgbase,
+    regvars,dbgbase,
     pass_1,pass_2,
     nbas,ncon,nld,nutils,
     tgobj,cgobj
@@ -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,13 +1809,13 @@ implementation
       end;
 
 
-    procedure gen_proc_entry_code(list:Taasmoutput);
+    procedure gen_proc_entry_code(list:TAsmList);
       var
         hitemp,
         lotemp : longint;
       begin
         { generate call frame marker for dwarf call frame info }
-        dwarfcfi.start_frame(list);
+        current_asmdata.asmcfi.start_frame(list);
 
         { All temps are know, write offsets used for information }
         if (cs_asm_source in aktglobalswitches) then
@@ -1839,7 +1839,7 @@ implementation
       end;
 
 
-    procedure gen_proc_exit_code(list:Taasmoutput);
+    procedure gen_proc_exit_code(list:TAsmList);
       var
         parasize : longint;
       begin
@@ -1862,11 +1862,11 @@ implementation
           location_free(list,current_procinfo.procdef.funcretloc[calleeside]);
 
         { end of frame marker for call frame info }
-        dwarfcfi.end_frame(list);
+        current_asmdata.asmcfi.end_frame(list);
       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

+ 1 - 1
compiler/ncon.pas

@@ -28,7 +28,7 @@ interface
     uses
       globtype,widestr,
       node,
-      aasmbase,aasmtai,cpuinfo,globals,
+      aasmbase,aasmtai,aasmdata,cpuinfo,globals,
       symconst,symtype,symdef,symsym;
 
     type

+ 95 - 95
compiler/nobj.pas

@@ -30,7 +30,7 @@ interface
        cutils,cclasses,
        globtype,
        symdef,symsym,
-       aasmbase,aasmtai
+       aasmbase,aasmtai,aasmdata
        ;
 
     type
@@ -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;
 
 

+ 1 - 1
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;

+ 2 - 1
compiler/nset.pas

@@ -28,7 +28,7 @@ interface
     uses
        cclasses,
        node,globtype,globals,
-       aasmbase,aasmtai,symtype;
+       aasmbase,aasmtai,aasmdata,symtype;
 
     type
        pcaselabel = ^tcaselabel;
@@ -506,6 +506,7 @@ implementation
              hp:=pcaseblock(blocks[i]);
              dispose(hp);
            end;
+         blocks.free;
          inherited destroy;
       end;
 

+ 44 - 25
compiler/ogbase.pas

@@ -31,7 +31,7 @@ interface
       { targets }
       systems,globtype,
       { outputwriters }
-      owbase,owar,
+      owbase,
       { assembler }
       aasmbase;
 
@@ -223,7 +223,7 @@ interface
         function  writedata(data:TObjData):boolean;virtual;abstract;
         property CObjData : TObjDataClass read FCObjData write FCObjData;
       public
-        constructor create(smart:boolean);virtual;
+        constructor create(AWriter:TObjectWriter);virtual;
         destructor  destroy;override;
         function  newObjData(const n:string):TObjData;
         function  startObjectfile(const fn:string):boolean;
@@ -300,7 +300,6 @@ interface
         { writer }
         FWriter : TObjectwriter;
         commonObjSection : TObjSection;
-        commonobjdata,
         internalobjdata : TObjData;
         EntrySym  : TObjSymbol;
         SectionDataAlign,
@@ -317,7 +316,9 @@ 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;
         procedure Order_Symbol(const aname:string);virtual;
         procedure Order_EndExeSection;virtual;
@@ -486,6 +487,7 @@ implementation
         relocations.free;
         ObjSymbolRefs.Free;
         ObjSymbolDefines.Free;
+        inherited destroy;
       end;
 
 
@@ -655,6 +657,7 @@ implementation
 {$ifdef MEMDEBUG}
         d.free;
 {$endif}
+        inherited destroy;
       end;
 
 
@@ -994,21 +997,16 @@ implementation
                                 TObjOutput
 ****************************************************************************}
 
-    constructor TObjOutput.create(smart:boolean);
+    constructor TObjOutput.create(AWriter:TObjectWriter);
       begin
-      { init writer }
-        if smart and
-           not(cs_asm_leave in aktglobalswitches) then
-          FWriter:=tarobjectwriter.create(current_module.staticlibfilename^)
-        else
-          FWriter:=TObjectwriter.create;
+        FWriter:=AWriter;
         CObjData:=TObjData;
       end;
 
 
     destructor TObjOutput.destroy;
       begin
-        FWriter.free;
+        inherited destroy;
       end;
 
 
@@ -1081,6 +1079,7 @@ implementation
     destructor tExeSection.destroy;
       begin
         ObjSectionList.Free;
+        inherited destroy;
       end;
 
 
@@ -1145,6 +1144,7 @@ implementation
         FExeSectionList.free;
         objdatalist.free;
         FWriter.free;
+        inherited destroy;
       end;
 
 
@@ -1185,15 +1185,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 +1210,12 @@ implementation
       end;
 
 
+    procedure TExeOutput.Order_End;
+      begin
+        internalobjdata.afterwrite;
+      end;
+
+
     procedure TExeOutput.Order_ExeSection(const aname:string);
       var
         sec : TExeSection;
@@ -1272,6 +1273,22 @@ implementation
       end;
 
 
+    procedure TExeOutput.Order_Align(const aname:string);
+      var
+        code     : integer;
+        alignval : longint;
+        objsec   : TObjSection;
+      begin
+        val(aname,alignval,code);
+        if alignval<=0 then
+          exit;
+        { Create an empty section with the required aligning }
+        inc(Fzeronr);
+        objsec:=internalobjdata.createsection('*align'+tostr(Fzeronr),alignval,CurrExeSec.SecOptions+[oso_data,oso_keep]);
+        CurrExeSec.AddObjSection(objsec);
+      end;
+
+
     procedure TExeOutput.Order_Zeros(const aname:string);
       var
         zeros : array[0..1023] of byte;
@@ -1288,7 +1305,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;
 
@@ -1553,10 +1569,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 }
@@ -1564,8 +1580,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
@@ -1776,6 +1790,8 @@ implementation
                 AddToObjSectionWorkList(refobjsec);
               end;
           end;
+        ObjSectionWorkList.Free;
+        ObjSectionWorkList:=nil;
 
         { Remove unused objsections from exesections }
         for i:=0 to ExeSections.Count-1 do
@@ -1807,6 +1823,8 @@ implementation
             objdata.fixuprelocs;
           end;
       end;
+
+
 {****************************************************************************
                                 TObjInput
 ****************************************************************************}
@@ -1821,6 +1839,7 @@ implementation
     destructor TObjInput.destroy;
       begin
         FReader.free;
+        inherited destroy;
       end;
 
 

+ 74 - 43
compiler/ogcoff.pas

@@ -33,7 +33,8 @@ interface
        { assembler }
        cpuinfo,cpubase,aasmbase,assemble,link,
        { output }
-       ogbase,ogmap;
+       ogbase,
+       owbase;
 
     type
        TCoffObjSection = class(TObjSection)
@@ -95,15 +96,47 @@ interface
        protected
          function writedata(data:TObjData):boolean;override;
        public
-         constructor createcoff(smart:boolean;awin32:boolean);
+         constructor createcoff(AWriter:TObjectWriter;awin32:boolean);
+         destructor destroy;
        end;
 
        TDJCoffObjOutput = class(TCoffObjOutput)
-         constructor create(smart:boolean);override;
+         constructor create(AWriter:TObjectWriter);override;
        end;
 
        TPECoffObjOutput = class(TCoffObjOutput)
-         constructor create(smart:boolean);override;
+         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)
@@ -162,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;
@@ -214,9 +217,9 @@ interface
 implementation
 
     uses
-       strings,
-       cutils,verbose,owbase,
-       globals,fmodule,aasmtai;
+       cutils,verbose,globals,
+       fmodule,aasmtai,aasmdata,
+       ogmap;
 
     const
 {$ifdef i386}
@@ -1015,13 +1018,23 @@ const win32stub : array[0..131] of byte=(
                                 TCoffObjOutput
 ****************************************************************************}
 
-    constructor TCoffObjOutput.createcoff(smart:boolean;awin32:boolean);
+    constructor TCoffObjOutput.createcoff(AWriter:TObjectWriter;awin32:boolean);
       begin
-        inherited create(smart);
+        inherited create(AWriter);
         win32:=awin32;
       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;
@@ -1298,16 +1311,16 @@ const win32stub : array[0..131] of byte=(
       end;
 
 
-    constructor TDJCoffObjOutput.create(smart:boolean);
+    constructor TDJCoffObjOutput.create(AWriter:TObjectWriter);
       begin
-        inherited createcoff(smart,false);
+        inherited createcoff(AWriter,false);
         cobjdata:=TDJCoffObjData;
       end;
 
 
-    constructor TPECoffObjOutput.create(smart:boolean);
+    constructor TPECoffObjOutput.create(AWriter:TObjectWriter);
       begin
-        inherited createcoff(smart,true);
+        inherited createcoff(AWriter,true);
         cobjdata:=TPECoffObjData;
       end;
 
@@ -1320,6 +1333,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;
 
 
@@ -1655,7 +1683,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;
 
@@ -2237,6 +2267,7 @@ const win32stub : array[0..131] of byte=(
         UnresolvedExeSymbols.Pack;
         if assigned(idata2objsection) then
           EndImport;
+        DLLReader.Free;
       end;
 
 

+ 6 - 5
compiler/ogelf.pas

@@ -31,9 +31,10 @@ interface
        { target }
        systems,
        { assembler }
-       cpuinfo,cpubase,aasmbase,aasmtai,assemble,
+       cpuinfo,cpubase,aasmbase,aasmtai,aasmdata,assemble,
        { output }
-       ogbase;
+       ogbase,
+       owbase;
 
     type
        TElfObjSection = class(TObjSection)
@@ -95,7 +96,7 @@ interface
        protected
          function writedata(data:TObjData):boolean;override;
        public
-         constructor Create(smart:boolean);override;
+         constructor Create(AWriter:TObjectWriter);override;
        end;
 
        TElfAssembler = class(tinternalassembler)
@@ -693,9 +694,9 @@ implementation
                             TElfObjectOutput
 ****************************************************************************}
 
-    constructor TElfObjectOutput.create(smart:boolean);
+    constructor TElfObjectOutput.create(AWriter:TObjectWriter);
       begin
-        inherited Create(smart);
+        inherited Create(AWriter);
         CObjData:=TElfObjData;
       end;
 

+ 9 - 9
compiler/paramgr.pas

@@ -31,7 +31,7 @@ unit paramgr;
        cclasses,globtype,
        cpubase,cgbase,
        parabase,
-       aasmtai,
+       aasmtai,aasmdata,
        symconst,symtype,symsym,symdef;
 
     type
@@ -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;

+ 23 - 68
compiler/parser.pas

@@ -42,7 +42,7 @@ implementation
       globtype,version,tokens,systems,globals,verbose,
       symbase,symtable,symsym,
       finput,fmodule,fppu,
-      aasmbase,aasmtai,
+      aasmbase,aasmtai,aasmdata,
       cgbase,
       script,gendef,
 {$ifdef BrowserCol}
@@ -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 }
@@ -248,52 +248,6 @@ implementation
 {$endif PREPROCWRITE}
 
 
-{*****************************************************************************
-                      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,''));
-
-         { Resource strings }
-         cresstr.resourcestrings:=Tresourcestrings.Create;
-
-         { 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}
-         { resource strings }
-         cresstr.resourcestrings.free;
-         objectlibrary:=nil;
-      end;
-
-
 {*****************************************************************************
                              Compile a source file
 *****************************************************************************}
@@ -316,10 +270,6 @@ implementation
           oldaktprocsym    : tprocsym;
         { cg }
           oldparse_only  : boolean;
-        { asmlists }
-          oldexprasmlist:Taasmoutput;
-          oldasmlist:array[Tasmlist] of Taasmoutput;
-          oldobjectlibrary : TObjLibraryData;
         { al_resourcestrings }
           Oldresourcestrings : tresourcestrings;
         { akt.. things }
@@ -371,10 +321,6 @@ implementation
             oldsourcecodepage:=aktsourcecodepage;
           { save cg }
             oldparse_only:=parse_only;
-          { save assembler lists }
-            oldasmlist:=asmlist;
-            oldexprasmlist:=exprasmlist;
-            oldobjectlibrary:=objectlibrary;
             Oldresourcestrings:=resourcestrings;
           { save akt... state }
           { handle the postponed case first }
@@ -453,6 +399,11 @@ implementation
          aktasmmode:=initasmmode;
          aktinterfacetype:=initinterfacetype;
 
+         resourcestrings:=Tresourcestrings.Create;
+
+         { 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;
@@ -466,9 +417,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
@@ -492,9 +440,6 @@ implementation
                end;
            end;
          finally
-           { restore old state }
-           done_module;
-
            if assigned(current_module) then
              begin
                { module is now compiled }
@@ -507,6 +452,16 @@ implementation
                    tppumodule(current_module).ppufile:=nil;
                  end;
 
+               resourcestrings.free;
+               resourcestrings:=nil;
+
+               { 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
@@ -541,12 +496,12 @@ implementation
                 block_type:=old_block_type;
                 { restore cg }
                 parse_only:=oldparse_only;
-                { restore asmlists }
-                exprasmlist:=oldexprasmlist;
-                asmlist:=oldasmlist;
-                { object data }
                 resourcestrings:=oldresourcestrings;
-                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)

+ 4 - 4
compiler/pass_2.pas

@@ -49,7 +49,7 @@ implementation
      globtype,systems,verbose,
      globals,
      paramgr,
-     aasmtai,
+     aasmtai,aasmdata,
      cgbase,
      nflw,cgobj;
 
@@ -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 }

+ 1 - 1
compiler/pdecl.pas

@@ -52,7 +52,7 @@ implementation
        globtype,tokens,verbose,widestr,
        systems,
        { aasm }
-       aasmbase,aasmtai,fmodule,
+       aasmbase,aasmtai,aasmdata,fmodule,
        { symtable }
        symconst,symbase,symtype,symdef,symtable,paramgr,defutil,
        { pass 1 }

+ 64 - 64
compiler/pmodules.pas

@@ -36,12 +36,12 @@ implementation
        cutils,cclasses,comphook,
        globals,verbose,fmodule,finput,fppu,
        symconst,symbase,symtype,symdef,symsym,symtable,
-       aasmtai,aasmcpu,aasmbase,
+       aasmtai,aasmdata,aasmcpu,aasmbase,
        cgbase,cgobj,
        nbas,ncgutil,
        link,assemble,import,export,gendef,ppu,comprsrc,dbgbase,
        cresstr,procinfo,
-       dwarf,pexports,
+       pexports,
        scanner,pbase,pexpr,psystem,psub,pdecsub;
 
 
@@ -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;
+            current_asmdata.asmcfi.generate_code(current_asmdata.asmlists[al_dwarf]);
           end;
       end;
 
@@ -152,10 +152,10 @@ implementation
     procedure InsertThreadvarTablesTable;
       var
         hp : tused_unit;
-        ltvTables : taasmoutput;
+        ltvTables : TAsmList;
         count : longint;
       begin
-        ltvTables:=TAAsmOutput.Create;
+        ltvTables:=TAsmList.Create;
         count:=0;
         hp:=tused_unit(usedunits.first);
         while assigned(hp) do
@@ -176,19 +176,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
@@ -203,9 +203,9 @@ implementation
     procedure InsertThreadvars;
       var
         s : string;
-        ltvTable : TAAsmoutput;
+        ltvTable : TAsmList;
       begin
-         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);
@@ -215,11 +215,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;
@@ -232,7 +232,7 @@ implementation
       hp           : tused_unit;
       found        : Boolean;
       I            : Integer;
-      ResourceInfo : taasmoutput;
+      ResourceInfo : TAsmList;
 
     begin
       if target_res.id=res_elf then
@@ -246,7 +246,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 }
@@ -267,8 +267,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;
@@ -276,10 +276,10 @@ implementation
     Procedure InsertResourceTablesTable;
       var
         hp : tused_unit;
-        ResourceStringTables : taasmoutput;
+        ResourceStringTables : tasmlist;
         count : longint;
       begin
-        ResourceStringTables:=TAAsmOutput.Create;
+        ResourceStringTables:=tasmlist.Create;
         count:=0;
         hp:=tused_unit(usedunits.first);
         while assigned(hp) do
@@ -300,11 +300,11 @@ implementation
         { Insert TableCount at start }
         ResourceStringTables.insert(Tai_const.Create_32bit(count));
         { Add to data segment }
-        maybe_new_object_file(asmlist[al_globals]);
-        new_section(asmlist[al_globals],sec_data,'FPC_RESOURCESTRINGTABLES',sizeof(aint));
-        asmlist[al_globals].concat(Tai_symbol.Createname_global('FPC_RESOURCESTRINGTABLES',AT_DATA,0));
-        asmlist[al_globals].concatlist(ResourceStringTables);
-        asmlist[al_globals].concat(Tai_symbol_end.Createname('FPC_RESOURCESTRINGTABLES'));
+        maybe_new_object_file(current_asmdata.AsmLists[al_globals]);
+        new_section(current_asmdata.AsmLists[al_globals],sec_data,'FPC_RESOURCESTRINGTABLES',sizeof(aint));
+        current_asmdata.AsmLists[al_globals].concat(Tai_symbol.Createname_global('FPC_RESOURCESTRINGTABLES',AT_DATA,0));
+        current_asmdata.AsmLists[al_globals].concatlist(ResourceStringTables);
+        current_asmdata.AsmLists[al_globals].concat(Tai_symbol_end.Createname('FPC_RESOURCESTRINGTABLES'));
         ResourceStringTables.free;
       end;
 
@@ -312,10 +312,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
@@ -352,11 +352,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;
 
@@ -368,10 +368,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
@@ -381,17 +381,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;
 
 
@@ -785,13 +785,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;
@@ -1094,11 +1094,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]);
 
          { generate a list of threadvars }
          if not(tf_section_threadvars in target_info.flags) then
@@ -1328,7 +1328,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));
 
          If resourcestrings.ResStrCount>0 then
           begin
@@ -1398,10 +1398,10 @@ implementation
            debuginfo.inserttypeinfo;
 
          { 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 a list of threadvars }
          if not(tf_section_threadvars in target_info.flags) then

+ 4 - 4
compiler/powerpc/aasmcpu.pas

@@ -27,7 +27,7 @@ interface
 
 uses
   globtype,verbose,
-  aasmbase,aasmtai,
+  aasmbase,aasmtai,aasmdata,
   cpubase,cgbase,cgutils;
 
     const
@@ -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);

+ 1 - 1
compiler/powerpc/agppcgas.pas

@@ -30,7 +30,7 @@ unit agppcgas;
 
     uses
        aasmbase,
-       aasmtai,
+       aasmtai,aasmdata,
        aggas,
        cpubase,
        globtype;

+ 13 - 13
compiler/powerpc/agppcmpw.pas

@@ -29,13 +29,13 @@ unit agppcmpw;
 interface
 
     uses
-       aasmtai,
+       aasmtai,aasmdata,
        globals,aasmbase,aasmcpu,assemble,
        cpubase;
 
     type
       TPPCMPWAssembler = class(TExternalAssembler)
-        procedure WriteTree(p:TAAsmoutput);override;
+        procedure WriteTree(p:TAsmList);override;
         procedure WriteAsmList;override;
         Function  DoAssemble:boolean;override;
         procedure WriteExternals;
@@ -74,7 +74,7 @@ interface
         'csect', {read only data}
         'csect', {bss} 'csect',
         'csect','csect','csect','csect',
-         '','','','','','','','','','','',''
+         '','','','','','','','','','','','','',''
       );
 
     type
@@ -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');

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini