Browse Source

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 years ago
parent
commit
b7fe6797bf
100 changed files with 3595 additions and 3441 deletions
  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/Makefile.fpc svneol=native#text/plain
 compiler/README -text
 compiler/README -text
 compiler/aasmbase.pas svneol=native#text/plain
 compiler/aasmbase.pas svneol=native#text/plain
+compiler/aasmdata.pas svneol=native#text/plain
 compiler/aasmtai.pas svneol=native#text/plain
 compiler/aasmtai.pas svneol=native#text/plain
 compiler/aggas.pas svneol=native#text/plain
 compiler/aggas.pas svneol=native#text/plain
 compiler/alpha/aasmcpu.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/bsdcompile -text
 compiler/catch.pas svneol=native#text/plain
 compiler/catch.pas svneol=native#text/plain
 compiler/cclasses.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/cg64f32.pas svneol=native#text/plain
 compiler/cgbase.pas svneol=native#text/plain
 compiler/cgbase.pas svneol=native#text/plain
 compiler/cgobj.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/dbgstabs.pas svneol=native#text/plain
 compiler/defcmp.pas svneol=native#text/plain
 compiler/defcmp.pas svneol=native#text/plain
 compiler/defutil.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/export.pas svneol=native#text/plain
 compiler/finput.pas svneol=native#text/plain
 compiler/finput.pas svneol=native#text/plain
 compiler/fmodule.pas svneol=native#text/plain
 compiler/fmodule.pas svneol=native#text/plain

+ 2 - 1
compiler/Makefile

@@ -2722,10 +2722,11 @@ INSTALLEXEFILE=$(PPCROSSNAME)
 else
 else
 INSTALLEXEFILE=$(EXENAME)
 INSTALLEXEFILE=$(EXENAME)
 endif
 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)
 .PHONY: $(PPC_TARGETS)
 $(PPC_TARGETS):
 $(PPC_TARGETS):
 	$(MAKE) PPC_TARGET=$@ CPU_UNITDIR=$@ all
 	$(MAKE) PPC_TARGET=$@ CPU_UNITDIR=$@ all
+alltargets: $(ALLTARGETS)
 .PHONY: all compiler echotime ppuclean execlean clean distclean
 .PHONY: all compiler echotime ppuclean execlean clean distclean
 all: compiler $(addsuffix _all,$(TARGET_DIRS))
 all: compiler $(addsuffix _all,$(TARGET_DIRS))
 compiler: $(COMPILER_UNITTARGETDIR) $(COMPILER_TARGETDIR) $(EXENAME)
 compiler: $(COMPILER_UNITTARGETDIR) $(COMPILER_TARGETDIR) $(EXENAME)

+ 3 - 1
compiler/Makefile.fpc

@@ -254,13 +254,15 @@ endif
 # CPU targets
 # 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)
 .PHONY: $(PPC_TARGETS)
 
 
 $(PPC_TARGETS):
 $(PPC_TARGETS):
         $(MAKE) PPC_TARGET=$@ CPU_UNITDIR=$@ all
         $(MAKE) PPC_TARGET=$@ CPU_UNITDIR=$@ all
 
 
+alltargets: $(ALLTARGETS)
+
 
 
 #####################################################################
 #####################################################################
 # Default makefile
 # Default makefile

+ 25 - 178
compiler/aasmbase.pas

@@ -41,6 +41,15 @@ interface
 
 
        TAsmsymtype=(AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION,AT_LABEL);
        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,
        TAsmSectiontype=(sec_none,
          sec_code,
          sec_code,
          sec_data,
          sec_data,
@@ -69,7 +78,7 @@ interface
        TAsmSymbol = class(TNamedIndexItem)
        TAsmSymbol = class(TNamedIndexItem)
        private
        private
          { this need to be incremented with every symbol loading into the
          { 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;
          refs       : longint;
        public
        public
          bind       : TAsmsymbind;
          bind       : TAsmsymbind;
@@ -86,11 +95,6 @@ interface
          function getrefs: longint;
          function getrefs: longint;
        end;
        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)
        TAsmLabel = class(TAsmSymbol)
          labelnr   : longint;
          labelnr   : longint;
          labeltype : TAsmLabelType;
          labeltype : TAsmLabelType;
@@ -100,48 +104,12 @@ interface
          function getname:string;override;
          function getname:string;override;
        end;
        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 LengthUleb128(a: aword) : byte;
     function LengthSleb128(a: aint) : 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
 implementation
 
 
@@ -149,9 +117,19 @@ implementation
       strings,
       strings,
       verbose;
       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;
     function LengthUleb128(a: aword) : byte;
@@ -269,135 +247,4 @@ implementation
         increfs;
         increfs;
       end;
       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.
 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,
        cpuinfo,cpubase,
        cgbase,cgutils,
        cgbase,cgutils,
        symtype,
        symtype,
-       aasmbase,ogbase;
+       aasmbase,aasmdata,ogbase;
 
 
     type
     type
        { keep the number of elements in this enumeration less or equal than 32 as long
        { keep the number of elements in this enumeration less or equal than 32 as long
@@ -224,21 +224,35 @@ interface
 
 
 
 
     type
     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 }
        { abstract assembler item }
        tai = class(TLinkedListItem)
        tai = class(TLinkedListItem)
 {$ifndef NOOPT}
 {$ifndef NOOPT}
@@ -305,13 +319,10 @@ interface
           procedure derefimpl;override;
           procedure derefimpl;override;
        end;
        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)
        tai_directive = class(tailineinfo)
           name : pstring;
           name : pstring;
-          directive : tasmdirective;
-          constructor Create(_directive:tasmdirective;const _name:string);
+          directive : TAsmDirective;
+          constructor Create(_directive:TAsmDirective;const _name:string);
           destructor Destroy;override;
           destructor Destroy;override;
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
@@ -448,13 +459,11 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
        end;
        end;
 
 
-       tstabtype = (stab_stabs,stab_stabn,stab_stabd);
-
        tai_stab = class(tai)
        tai_stab = class(tai)
           str : pchar;
           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;
           destructor Destroy;override;
        end;
        end;
 
 
@@ -480,8 +489,8 @@ interface
 
 
        { Insert a marker for assembler and inline blocks }
        { Insert a marker for assembler and inline blocks }
        tai_marker = class(tai)
        tai_marker = class(tai)
-          Kind: TMarker;
-          Constructor Create(_Kind: TMarker);
+          Kind: TAsmMarker;
+          Constructor Create(_Kind: TAsmMarker);
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
        end;
        end;
@@ -539,11 +548,7 @@ interface
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
        end;
        end;
 
 
-       Taasmoutput=class;
-
        tadd_reg_instruction_proc=procedure(instr:Tai;r:tregister) of object;
        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
         { Class template for assembler instructions
         }
         }
@@ -598,6 +603,9 @@ interface
         end;
         end;
         tai_cpu_class = class of tai_cpu_abstract;
         tai_cpu_class = class of tai_cpu_abstract;
 
 
+        { Buffer type used for alignment }
+        tfillbuffer = array[0..63] of char;
+
         { alignment for operator }
         { alignment for operator }
         tai_align_abstract = class(tai)
         tai_align_abstract = class(tai)
            aligntype : byte;   { 1 = no align, 2 = word align, 4 = dword align }
            aligntype : byte;   { 1 = no align, 2 = word align, 4 = dword align }
@@ -613,95 +621,22 @@ interface
         end;
         end;
         tai_align_class = class of tai_align_abstract;
         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
     var
       { array with all class types for tais }
       { array with all class types for tais }
       aiclass : taiclassarray;
       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_align : tai_align_class;
       cai_cpu   : tai_cpu_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);
                                    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;
     function ppuloadai(ppufile:tcompilerppufile):tai;
     procedure ppuwriteai(ppufile:tcompilerppufile;n:tai);
     procedure ppuwriteai(ppufile:tcompilerppufile;n:tai);
@@ -721,6 +656,41 @@ implementation
                                  Helpers
                                  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;
     function ppuloadai(ppufile:tcompilerppufile):tai;
       var
       var
         b : byte;
         b : byte;
@@ -763,55 +733,6 @@ implementation
       end;
       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
                              TAI
  ****************************************************************************}
  ****************************************************************************}
@@ -935,7 +856,7 @@ implementation
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_datablock;
          typ:=ait_datablock;
-         sym:=objectlibrary.newasmsymbol(_name,AB_LOCAL,AT_DATA);
+         sym:=current_asmdata.newasmsymbol(_name,AB_LOCAL,AT_DATA);
          { keep things aligned }
          { keep things aligned }
          if _size<=0 then
          if _size<=0 then
            _size:=4;
            _size:=4;
@@ -948,7 +869,7 @@ implementation
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_datablock;
          typ:=ait_datablock;
-         sym:=objectlibrary.newasmsymbol(_name,AB_GLOBAL,AT_DATA);
+         sym:=current_asmdata.newasmsymbol(_name,AB_GLOBAL,AT_DATA);
          { keep things aligned }
          { keep things aligned }
          if _size<=0 then
          if _size<=0 then
            _size:=4;
            _size:=4;
@@ -1010,7 +931,7 @@ implementation
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_symbol;
          typ:=ait_symbol;
-         sym:=objectlibrary.newasmsymbol(_name,AB_LOCAL,_symtyp);
+         sym:=current_asmdata.newasmsymbol(_name,AB_LOCAL,_symtyp);
          size:=siz;
          size:=siz;
          is_global:=false;
          is_global:=false;
       end;
       end;
@@ -1020,7 +941,7 @@ implementation
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_symbol;
          typ:=ait_symbol;
-         sym:=objectlibrary.newasmsymbol(_name,AB_GLOBAL,_symtyp);
+         sym:=current_asmdata.newasmsymbol(_name,AB_GLOBAL,_symtyp);
          size:=siz;
          size:=siz;
          is_global:=true;
          is_global:=true;
       end;
       end;
@@ -1065,7 +986,7 @@ implementation
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_symbol_end;
          typ:=ait_symbol_end;
-         sym:=objectlibrary.newasmsymbol(_name,AB_GLOBAL,AT_NONE);
+         sym:=current_asmdata.newasmsymbol(_name,AB_GLOBAL,AT_NONE);
       end;
       end;
 
 
 
 
@@ -1092,7 +1013,7 @@ implementation
                                TAI_SYMBOL_END
                                TAI_SYMBOL_END
  ****************************************************************************}
  ****************************************************************************}
 
 
-    constructor tai_directive.Create(_directive:tasmdirective;const _name:string);
+    constructor tai_directive.Create(_directive:TAsmDirective;const _name:string);
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_directive;
          typ:=ait_directive;
@@ -1111,7 +1032,7 @@ implementation
       begin
       begin
         inherited ppuload(t,ppufile);
         inherited ppuload(t,ppufile);
         name:=stringdup(ppufile.getstring);
         name:=stringdup(ppufile.getstring);
-        directive:=tasmdirective(ppufile.getbyte);
+        directive:=TAsmDirective(ppufile.getbyte);
       end;
       end;
 
 
 
 
@@ -1315,7 +1236,7 @@ implementation
          inherited Create;
          inherited Create;
          typ:=ait_const;
          typ:=ait_const;
          consttype:=aitconst_ptr;
          consttype:=aitconst_ptr;
-         sym:=objectlibrary.newasmsymbol(name,AB_EXTERNAL,_symtyp);
+         sym:=current_asmdata.newasmsymbol(name,AB_EXTERNAL,_symtyp);
          endsym:=nil;
          endsym:=nil;
          value:=ofs;
          value:=ofs;
          { update sym info }
          { update sym info }
@@ -1328,7 +1249,7 @@ implementation
          inherited Create;
          inherited Create;
          typ:=ait_const;
          typ:=ait_const;
          consttype:=aitconst_rva_symbol;
          consttype:=aitconst_rva_symbol;
-         sym:=objectlibrary.newasmsymbol(name,AB_EXTERNAL,AT_FUNCTION);
+         sym:=current_asmdata.newasmsymbol(name,AB_EXTERNAL,AT_FUNCTION);
          endsym:=nil;
          endsym:=nil;
          value:=0;
          value:=0;
          { update sym info }
          { update sym info }
@@ -1692,7 +1613,7 @@ implementation
                               TAI_STABS
                               TAI_STABS
  ****************************************************************************}
  ****************************************************************************}
 
 
-    constructor tai_stab.create(_stabtype:tstabtype;_str : pchar);
+    constructor tai_stab.create(_stabtype:TStabType;_str : pchar);
       begin
       begin
          inherited create;
          inherited create;
          typ:=ait_stab;
          typ:=ait_stab;
@@ -1700,7 +1621,7 @@ implementation
          stabtype:=_stabtype;
          stabtype:=_stabtype;
       end;
       end;
 
 
-    constructor tai_stab.create_str(_stabtype:tstabtype;const s:string);
+    constructor tai_stab.create_str(_stabtype:TStabType;const s:string);
       begin
       begin
          self.create(_stabtype,strpnew(s));
          self.create(_stabtype,strpnew(s));
       end;
       end;
@@ -1787,7 +1708,7 @@ implementation
                              Tai_Marker
                              Tai_Marker
  ****************************************************************************}
  ****************************************************************************}
 
 
-    constructor Tai_Marker.Create(_Kind: TMarker);
+    constructor Tai_Marker.Create(_Kind: TAsmMarker);
       begin
       begin
         Inherited Create;
         Inherited Create;
         typ := ait_marker;
         typ := ait_marker;
@@ -1798,7 +1719,7 @@ implementation
     constructor Tai_Marker.ppuload(t:taitype;ppufile:tcompilerppufile);
     constructor Tai_Marker.ppuload(t:taitype;ppufile:tcompilerppufile);
       begin
       begin
         inherited ppuload(t,ppufile);
         inherited ppuload(t,ppufile);
-        kind:=TMarker(ppufile.getbyte);
+        kind:=TAsmMarker(ppufile.getbyte);
       end;
       end;
 
 
 
 
@@ -2452,61 +2373,6 @@ implementation
       end;
       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
 begin
   cai_cpu:=tai_cpu_abstract;
   cai_cpu:=tai_cpu_abstract;
   cai_align:=tai_align_abstract;
   cai_align:=tai_align_abstract;

+ 11 - 11
compiler/aggas.pas

@@ -36,7 +36,7 @@ interface
 {$ENDIF USE_SYSUTILS}
 {$ENDIF USE_SYSUTILS}
       cclasses,
       cclasses,
       globtype,globals,
       globtype,globals,
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       assemble;
       assemble;
 
 
 
 
@@ -52,7 +52,7 @@ interface
         procedure WriteExtraHeader;virtual;
         procedure WriteExtraHeader;virtual;
         procedure WriteInstruction(hp: tai);
         procedure WriteInstruction(hp: tai);
        public
        public
-        procedure WriteTree(p:TAAsmoutput);override;
+        procedure WriteTree(p:TAsmList);override;
         procedure WriteAsmList;override;
         procedure WriteAsmList;override;
         destructor destroy; override;
         destructor destroy; override;
        private
        private
@@ -373,7 +373,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TGNUAssembler.WriteTree(p:TAAsmoutput);
+    procedure TGNUAssembler.WriteTree(p:TAsmList);
 
 
     function needsObject(hp : tai_symbol) : boolean;
     function needsObject(hp : tai_symbol) : boolean;
       begin
       begin
@@ -417,7 +417,7 @@ implementation
       { lineinfo is only needed for al_procedures (PFV) }
       { lineinfo is only needed for al_procedures (PFV) }
       do_line:=(cs_asm_source in aktglobalswitches) or
       do_line:=(cs_asm_source in aktglobalswitches) or
                ((cs_lineinfo in aktmoduleswitches)
                ((cs_lineinfo in aktmoduleswitches)
-                 and (p=asmlist[al_procedures]));
+                 and (p=current_asmdata.asmlists[al_procedures]));
       hp:=tai(p.first);
       hp:=tai(p.first);
       while assigned(hp) do
       while assigned(hp) do
        begin
        begin
@@ -974,9 +974,9 @@ implementation
              end;
              end;
 
 
            ait_marker :
            ait_marker :
-             if tai_marker(hp).kind=InlineStart then
+             if tai_marker(hp).kind=mark_InlineStart then
                inc(InlineLevel)
                inc(InlineLevel)
-             else if tai_marker(hp).kind=InlineEnd then
+             else if tai_marker(hp).kind=mark_InlineEnd then
                dec(InlineLevel);
                dec(InlineLevel);
 
 
            ait_directive :
            ait_directive :
@@ -1011,7 +1011,7 @@ implementation
       p:dirstr;
       p:dirstr;
       n:namestr;
       n:namestr;
       e:extstr;
       e:extstr;
-      hal : tasmlist;
+      hal : tasmlisttype;
     begin
     begin
 {$ifdef EXTDEBUG}
 {$ifdef EXTDEBUG}
       if assigned(current_module.mainsource) then
       if assigned(current_module.mainsource) then
@@ -1044,11 +1044,11 @@ implementation
       AsmStartSize:=AsmSize;
       AsmStartSize:=AsmSize;
       symendcount:=0;
       symendcount:=0;
 
 
-      for hal:=low(Tasmlist) to high(Tasmlist) do
+      for hal:=low(TasmlistType) to high(TasmlistType) do
         begin
         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;
         end;
 
 
       AsmLn;
       AsmLn;

+ 1 - 1
compiler/alpha/aasmcpu.pas

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

+ 1 - 1
compiler/alpha/agaxpgas.pas

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

+ 28 - 28
compiler/alpha/cgcpu.pas

@@ -29,26 +29,26 @@ unit cgcpu;
 interface
 interface
 
 
 uses
 uses
-   cgbase,cgobj,aasmbase,aasmtai,aasmcpu,cginfo,cpubase,cpuinfo;
+   cgbase,cgobj,aasmbase,aasmtai,aasmdata,aasmcpu,cginfo,cpubase,cpuinfo;
 
 
 type
 type
 pcgalpha = ^tcgalpha;
 pcgalpha = ^tcgalpha;
 tcgalpha = class(tcg)
 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;
     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);
     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;
 end;
 
 
 implementation
 implementation
@@ -56,7 +56,7 @@ implementation
 uses
 uses
    globtype,globals;
    globtype,globals;
 
 
-procedure tcgalpha.g_stackframe_entry(list : taasmoutput;localsize : longint);
+procedure tcgalpha.g_stackframe_entry(list : TAsmList;localsize : longint);
 
 
 begin
 begin
    list.concat(taicpu.op_reg_ref(A_LDGP,Global_pointer,new_reference(R_27,0)));
    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));
    list.concat(taicpu.op_reg_reg_reg(A_BIS,stack_pointer_reg,stack_pointer_reg,frame_pointer_reg));
 end;
 end;
 
 
-procedure g_exitcode(list : taasmoutput;parasize : longint; nostackframe,inlined : boolean);
+procedure g_exitcode(list : TAsmList;parasize : longint; nostackframe,inlined : boolean);
 
 
 begin
 begin
    { Restore stack pointer from frame pointer }
    { Restore stack pointer from frame pointer }
@@ -81,7 +81,7 @@ begin
     }
     }
 end;
 end;
 
 
-procedure tcgalpha.a_call_name(list : taasmoutput;const s : string);
+procedure tcgalpha.a_call_name(list : TAsmList;const s : string);
 
 
   begin
   begin
      { list^.concat(taicpu,op_sym(A_CALL,S_NO,newasmsymbol(s,AB_EXTERNAL,AT_FUNCTION)))); }
      { 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;
      abstract;
   end;
   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
 begin
 end;
 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
 begin
 end;
 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
 begin
 end;
 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
 begin
 end;
 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);
   l : tasmlabel);
 
 
 begin
 begin
 end;
 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
 begin
 end;
 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
 begin
 end;
 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);
   reg : tregister; l : tasmlabel);
 
 
 begin
 begin
 end;
 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
 begin
 end;
 end;
 
 
 
 
-procedure tcgalpha.g_maybe_loadself(list : taasmoutput);
+procedure tcgalpha.g_maybe_loadself(list : TAsmList);
 
 
 begin
 begin
 end;
 end;
 
 
 
 
-procedure tcgalpha.g_restore_frame_pointer(list : taasmoutput);
+procedure tcgalpha.g_restore_frame_pointer(list : TAsmList);
 
 
 begin
 begin
 end;
 end;

+ 3 - 3
compiler/alpha/radirect.pas

@@ -42,7 +42,7 @@ interface
        globals,verbose,
        globals,verbose,
        systems,
        systems,
        { aasm }
        { aasm }
-       aasmbase,aasmtai,aasmcpu,
+       aasmbase,aasmtai,aasmdata,aasmcpu,
        { symtable }
        { symtable }
        symconst,symbase,symtype,symsym,symtable,defbase,
        symconst,symbase,symtype,symsym,symtable,defbase,
        { pass 1 }
        { pass 1 }
@@ -64,7 +64,7 @@ interface
          ende : boolean;
          ende : boolean;
          srsym,sym : tsym;
          srsym,sym : tsym;
          srsymtable : tsymtable;
          srsymtable : tsymtable;
-         code : TAAsmoutput;
+         code : TAsmList;
          i,l : longint;
          i,l : longint;
 
 
        procedure writeasmline;
        procedure writeasmline;
@@ -98,7 +98,7 @@ interface
          retstr:='';
          retstr:='';
 
 
        c:=current_scanner.asmgetchar;
        c:=current_scanner.asmgetchar;
-       code:=TAAsmoutput.Create;
+       code:=TAsmList.Create;
        while not(ende) do
        while not(ende) do
          begin
          begin
             { wrong placement
             { wrong placement

+ 1 - 1
compiler/alpha/rasm.pas

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

+ 5 - 5
compiler/alpha/rgcpu.pas

@@ -28,14 +28,14 @@ unit rgcpu;
   interface
   interface
 
 
      uses
      uses
-       aasmbase,aasmtai,
+       aasmbase,aasmtai,aasmdata,
        cpubase,
        cpubase,
        rgobj;
        rgobj;
 
 
      type
      type
        trgcpu = class(trgobj)
        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;
        end;
 
 
   implementation
   implementation
@@ -43,7 +43,7 @@ unit rgcpu;
     uses
     uses
       cgobj;
       cgobj;
 
 
-    function trgcpu.getcpuregisterint(list: taasmoutput; reg: tregister): tregister;
+    function trgcpu.getcpuregisterint(list: TAsmList; reg: tregister): tregister;
 
 
       begin
       begin
         if reg = R_0 then
         if reg = R_0 then
@@ -55,7 +55,7 @@ unit rgcpu;
       end;
       end;
 
 
 
 
-    procedure trgcpu.ungetregisterint(list: taasmoutput; reg: tregister);
+    procedure trgcpu.ungetregisterint(list: TAsmList; reg: tregister);
 
 
       begin
       begin
         if reg = R_0 then
         if reg = R_0 then

+ 12 - 12
compiler/aopt.pas

@@ -28,14 +28,14 @@ Unit aopt;
   Interface
   Interface
 
 
     Uses
     Uses
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       aoptobj;
       aoptobj;
 
 
     Type
     Type
       TAsmOptimizer = class(TAoptObj)
       TAsmOptimizer = class(TAoptObj)
 
 
         { _AsmL is the PAasmOutpout list that has to be optimized }
         { _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 }
         { call the necessary optimizer procedures }
         Procedure Optimize;
         Procedure Optimize;
@@ -51,7 +51,7 @@ Unit aopt;
     var
     var
       casmoptimizer : class of tasmoptimizer;
       casmoptimizer : class of tasmoptimizer;
 
 
-    procedure Optimize(AsmL:taasmoutput);
+    procedure Optimize(AsmL:TAsmList);
 
 
   Implementation
   Implementation
 
 
@@ -59,7 +59,7 @@ Unit aopt;
       globtype, globals,
       globtype, globals,
       aoptda,aoptcpu,aoptcpud;
       aoptda,aoptcpu,aoptcpud;
 
 
-    Constructor TAsmOptimizer.create(_AsmL: taasmoutput);
+    Constructor TAsmOptimizer.create(_AsmL: TAsmList);
       Begin
       Begin
         inherited create(_asml,nil,nil,nil);
         inherited create(_asml,nil,nil,nil);
       {setup labeltable, always necessary}
       {setup labeltable, always necessary}
@@ -83,7 +83,7 @@ Unit aopt;
           Begin
           Begin
             While Assigned(P) And
             While Assigned(P) And
                   ((P.typ <> Ait_Marker) Or
                   ((P.typ <> Ait_Marker) Or
-                   (tai_Marker(P).Kind <> AsmBlockStart)) Do
+                   (tai_Marker(P).Kind <> mark_AsmBlockStart)) Do
               Begin
               Begin
                 If (p.typ = ait_label) Then
                 If (p.typ = ait_label) Then
                   If (tai_Label(p).labsym.is_used) Then
                   If (tai_Label(p).labsym.is_used) Then
@@ -98,7 +98,7 @@ Unit aopt;
                 GetNextInstruction(p, p)
                 GetNextInstruction(p, p)
               End;
               End;
             if (prev.typ = ait_marker) and
             if (prev.typ = ait_marker) and
-               (tai_marker(prev).kind = asmblockstart) then
+               (tai_marker(prev).kind = mark_AsmBlockStart) then
               blockend := prev
               blockend := prev
             else blockend := nil;
             else blockend := nil;
             If LabelFound
             If LabelFound
@@ -108,7 +108,7 @@ Unit aopt;
       End;
       End;
 
 
     Procedure TAsmOptimizer.BuildLabelTableAndFixRegAlloc;
     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)"           }
     { Also fixes some RegDeallocs like "# %eax released; push (%eax)"           }
     Var p, hp1, hp2: tai;
     Var p, hp1, hp2: tai;
         UsedRegs: TRegSet;
         UsedRegs: TRegSet;
@@ -228,16 +228,16 @@ Unit aopt;
             BlockStart := BlockEnd;
             BlockStart := BlockEnd;
             While Assigned(BlockStart) And
             While Assigned(BlockStart) And
                   (BlockStart.typ = ait_Marker) And
                   (BlockStart.typ = ait_Marker) And
-                  (tai_Marker(BlockStart).Kind = AsmBlockStart) Do
+                  (tai_Marker(BlockStart).Kind = mark_AsmBlockStart) Do
               Begin
               Begin
                { we stopped at an assembler block, so skip it    }
                { we stopped at an assembler block, so skip it    }
                While GetNextInstruction(BlockStart, BlockStart) And
                While GetNextInstruction(BlockStart, BlockStart) And
                      ((BlockStart.Typ <> Ait_Marker) Or
                      ((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
                If GetNextInstruction(BlockStart, HP) And
                   ((HP.typ <> ait_Marker) Or
                   ((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 }
                { There is no assembler block anymore after the current one, so }
                { optimize the next block of "normal" instructions              }
                { optimize the next block of "normal" instructions              }
                  pass_1
                  pass_1
@@ -254,7 +254,7 @@ Unit aopt;
       End;
       End;
 
 
 
 
-    procedure Optimize(AsmL:taasmoutput);
+    procedure Optimize(AsmL:TAsmList);
       var
       var
         p : TAsmOptimizer;
         p : TAsmOptimizer;
       begin
       begin

+ 9 - 9
compiler/aoptbase.pas

@@ -27,7 +27,7 @@ unit aoptbase;
   interface
   interface
 
 
     uses
     uses
-      aasmbase,aasmcpu,aasmtai,
+      aasmbase,aasmcpu,aasmtai,aasmdata,
       cpubase,
       cpubase,
       cgbase,
       cgbase,
       cgutils;
       cgutils;
@@ -157,16 +157,16 @@ unit aoptbase;
         Current := tai(Current.Next);
         Current := tai(Current.Next);
       If Assigned(Current) And
       If Assigned(Current) And
          (Current.typ = ait_Marker) And
          (Current.typ = ait_Marker) And
-         (Tai_Marker(Current).Kind = NoPropInfoStart) Then
+         (Tai_Marker(Current).Kind = mark_NoPropInfoStart) Then
         Begin
         Begin
           While Assigned(Current) And
           While Assigned(Current) And
                 ((Current.typ <> ait_Marker) Or
                 ((Current.typ <> ait_Marker) Or
-                 (Tai_Marker(Current).Kind <> NoPropInfoEnd)) Do
+                 (Tai_Marker(Current).Kind <> mark_NoPropInfoEnd)) Do
             Current := Tai(Current.Next);
             Current := Tai(Current.Next);
         End;
         End;
     Until Not(Assigned(Current)) Or
     Until Not(Assigned(Current)) Or
           (Current.typ <> ait_Marker) Or
           (Current.typ <> ait_Marker) Or
-          (Tai_Marker(Current).Kind <> NoPropInfoEnd);
+          (Tai_Marker(Current).Kind <> mark_NoPropInfoEnd);
     Next := Current;
     Next := Current;
     If Assigned(Current) And
     If Assigned(Current) And
        Not((Current.typ In SkipInstr) or
        Not((Current.typ In SkipInstr) or
@@ -186,29 +186,29 @@ unit aoptbase;
       Current := Tai(Current.previous);
       Current := Tai(Current.previous);
       While Assigned(Current) And
       While Assigned(Current) And
             (((Current.typ = ait_Marker) 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 In SkipInstr) or
              ((Current.typ = ait_label) And
              ((Current.typ = ait_label) And
                Not(Tai_Label(Current).labsym.is_used))) Do
                Not(Tai_Label(Current).labsym.is_used))) Do
         Current := Tai(Current.previous);
         Current := Tai(Current.previous);
       If Assigned(Current) And
       If Assigned(Current) And
          (Current.typ = ait_Marker) And
          (Current.typ = ait_Marker) And
-         (Tai_Marker(Current).Kind = NoPropInfoEnd) Then
+         (Tai_Marker(Current).Kind = mark_NoPropInfoEnd) Then
         Begin
         Begin
           While Assigned(Current) And
           While Assigned(Current) And
                 ((Current.typ <> ait_Marker) Or
                 ((Current.typ <> ait_Marker) Or
-                 (Tai_Marker(Current).Kind <> NoPropInfoStart)) Do
+                 (Tai_Marker(Current).Kind <> mark_NoPropInfoStart)) Do
             Current := Tai(Current.previous);
             Current := Tai(Current.previous);
         End;
         End;
     Until Not(Assigned(Current)) Or
     Until Not(Assigned(Current)) Or
           (Current.typ <> ait_Marker) Or
           (Current.typ <> ait_Marker) Or
-          (Tai_Marker(Current).Kind <> NoPropInfoStart);
+          (Tai_Marker(Current).Kind <> mark_NoPropInfoStart);
     If Not(Assigned(Current)) or
     If Not(Assigned(Current)) or
        (Current.typ In SkipInstr) or
        (Current.typ In SkipInstr) or
        ((Current.typ = ait_label) And
        ((Current.typ = ait_label) And
         Not(Tai_Label(Current).labsym.is_used)) or
         Not(Tai_Label(Current).labsym.is_used)) or
        ((Current.typ = ait_Marker) And
        ((Current.typ = ait_Marker) And
-        (Tai_Marker(Current).Kind = AsmBlockEnd))
+        (Tai_Marker(Current).Kind = mark_AsmBlockEnd))
       Then
       Then
         Begin
         Begin
           Last := Nil;
           Last := Nil;

+ 2 - 2
compiler/aoptcs.pas

@@ -678,7 +678,7 @@ Begin
 { insert a marker noting that for the following instructions no PPaiProp's }
 { insert a marker noting that for the following instructions no PPaiProp's }
 { (containing optimizer info) have been generated, so GetNext/             }
 { (containing optimizer info) have been generated, so GetNext/             }
 { LastInstruction will ignore them (it will use the original instructions) }
 { 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);
                         InsertLLItem(Pai(Current^.Previous), Current, hp3);
 { Prev is used to get the contents of the registers before the sequence }
 { Prev is used to get the contents of the registers before the sequence }
                         GetLastInstruction(Current, Prev);
                         GetLastInstruction(Current, Prev);
@@ -743,7 +743,7 @@ Begin
 
 
                           End;
                           End;
 { the end of the area where instructions without optimizer info can occur }
 { 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);
                         InsertLLItem(AsmL, Pai(Current^.Previous), Current, hp3);
 { if we found an instruction sequence that needs complete re-evaluation, }
 { if we found an instruction sequence that needs complete re-evaluation, }
 { process it                                                             }
 { process it                                                             }

+ 1 - 1
compiler/aoptda.pas

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

+ 10 - 10
compiler/aoptobj.pas

@@ -32,7 +32,7 @@ Unit AoptObj;
 
 
     uses
     uses
       globtype,
       globtype,
-      aasmbase,aasmcpu,aasmtai,
+      aasmbase,aasmcpu,aasmtai,aasmdata,
       cclasses,
       cclasses,
       cgbase,cgutils,
       cgbase,cgutils,
       cpubase,
       cpubase,
@@ -233,7 +233,7 @@ Unit AoptObj;
 
 
       TAOptObj = class(TAoptBaseCpu)
       TAOptObj = class(TAoptBaseCpu)
         { the PAasmOutput list this optimizer instance works on }
         { the PAasmOutput list this optimizer instance works on }
-        AsmL: TAasmOutput;
+        AsmL: TAsmList;
 
 
         { The labelinfo record contains the addresses of the Tai objects }
         { The labelinfo record contains the addresses of the Tai objects }
         { that are labels, how many labels there are and the min and max }
         { 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 }
         { _BlockStart and _BlockEnd the start and the end of the block }
         { that has to be optimized and _LabelInfo a pointer to a       }
         { that has to be optimized and _LabelInfo a pointer to a       }
         { TLabelInfo record                                            }
         { TLabelInfo record                                            }
-        Constructor create(_AsmL: TAasmOutput; _BlockStart, _BlockEnd: Tai;
+        Constructor create(_AsmL: TAsmList; _BlockStart, _BlockEnd: Tai;
                            _LabelInfo: PLabelInfo); virtual;
                            _LabelInfo: PLabelInfo); virtual;
 
 
         { processor independent methods }
         { processor independent methods }
@@ -726,7 +726,7 @@ Unit AoptObj;
       { ***************************** TAoptObj ********************************** }
       { ***************************** TAoptObj ********************************** }
       { ************************************************************************* }
       { ************************************************************************* }
 
 
-      Constructor TAoptObj.create(_AsmL: TAasmOutput; _BlockStart, _BlockEnd: Tai;
+      Constructor TAoptObj.create(_AsmL: TAsmList; _BlockStart, _BlockEnd: Tai;
                                   _LabelInfo: PLabelInfo);
                                   _LabelInfo: PLabelInfo);
       Begin
       Begin
         AsmL := _AsmL;
         AsmL := _AsmL;
@@ -782,19 +782,19 @@ Unit AoptObj;
           OldP := P;
           OldP := P;
           If (P.typ in SkipInstr) Or
           If (P.typ in SkipInstr) Or
              ((P.typ = ait_marker) And
              ((P.typ = ait_marker) And
-              (Tai_Marker(P).Kind = AsmBlockEnd)) Then
+              (Tai_Marker(P).Kind = mark_AsmBlockEnd)) Then
             GetNextInstruction(P, P)
             GetNextInstruction(P, P)
           Else If ((P.Typ = Ait_Marker) And
           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                                                         }
        { paasmoutput list                                                         }
             GetNextInstruction(Tai(P.Previous),P);
             GetNextInstruction(Tai(P.Previous),P);
           If (P.Typ = Ait_Marker) And
           If (P.Typ = Ait_Marker) And
-             (Tai_Marker(P).Kind = AsmBlockStart) Then
+             (Tai_Marker(P).Kind = mark_AsmBlockStart) Then
             Begin
             Begin
               P := Tai(P.Next);
               P := Tai(P.Next);
               While (P.typ <> Ait_Marker) Or
               While (P.typ <> Ait_Marker) Or
-                    (Tai_Marker(P).Kind <> AsmBlockEnd) Do
+                    (Tai_Marker(P).Kind <> mark_AsmBlockEnd) Do
                 P := Tai(P.Next)
                 P := Tai(P.Next)
             End;
             End;
           Until P = OldP;
           Until P = OldP;
@@ -960,7 +960,7 @@ Unit AoptObj;
                       insertllitem(asml,p1,p1.next,tai_comment.Create(
                       insertllitem(asml,p1,p1.next,tai_comment.Create(
                         strpnew('previous label inserted'))));
                         strpnew('previous label inserted'))));
       {$endif finaldestdebug}
       {$endif finaldestdebug}
-                      objectlibrary.getjumplabel(l);
+                      current_asmdata.getjumplabel(l);
                       insertllitem(p1,p1.next,tai_label.Create(l));
                       insertllitem(p1,p1.next,tai_label.Create(l));
                       tasmlabel(taicpu(hp).oper[0]^.ref^.symbol).decrefs;
                       tasmlabel(taicpu(hp).oper[0]^.ref^.symbol).decrefs;
                       hp.oper[0]^.ref^.symbol := l;
                       hp.oper[0]^.ref^.symbol := l;

+ 6 - 6
compiler/arm/aasmcpu.pas

@@ -27,7 +27,7 @@ interface
 
 
 uses
 uses
   cclasses,globtype,globals,verbose,
   cclasses,globtype,globals,verbose,
-  aasmbase,aasmtai,
+  aasmbase,aasmtai,aasmdata,
   ogbase,
   ogbase,
   symtype,
   symtype,
   cpubase,cpuinfo,cgbase,cgutils;
   cpubase,cpuinfo,cgbase,cgutils;
@@ -234,7 +234,7 @@ uses
     function setcondition(i : taicpu;c : tasmcond) : taicpu;
     function setcondition(i : taicpu;c : tasmcond) : taicpu;
 
 
     { inserts pc relative symbols at places where they are reachable }
     { inserts pc relative symbols at places where they are reachable }
-    procedure insertpcrelativedata(list,listtoinsert : taasmoutput);
+    procedure insertpcrelativedata(list,listtoinsert : TAsmList);
 
 
     procedure InitAsm;
     procedure InitAsm;
     procedure DoneAsm;
     procedure DoneAsm;
@@ -609,17 +609,17 @@ implementation
       end;
       end;
 
 
 
 
-    procedure insertpcrelativedata(list,listtoinsert : taasmoutput);
+    procedure insertpcrelativedata(list,listtoinsert : TAsmList);
       var
       var
         curpos : longint;
         curpos : longint;
         lastpos : longint;
         lastpos : longint;
         curop : longint;
         curop : longint;
         curtai : tai;
         curtai : tai;
         curdatatai,hp : tai;
         curdatatai,hp : tai;
-        curdata : taasmoutput;
+        curdata : TAsmList;
         l : tasmlabel;
         l : tasmlabel;
       begin
       begin
-        curdata:=taasmoutput.create;
+        curdata:=TAsmList.create;
         lastpos:=-1;
         lastpos:=-1;
         curpos:=0;
         curpos:=0;
         curtai:=tai(list.first);
         curtai:=tai(list.first);
@@ -668,7 +668,7 @@ implementation
               begin
               begin
                 lastpos:=curpos;
                 lastpos:=curpos;
                 hp:=tai(curtai.next);
                 hp:=tai(curtai.next);
-                objectlibrary.getjumplabel(l);
+                current_asmdata.getjumplabel(l);
                 curdata.insert(taicpu.op_sym(A_B,l));
                 curdata.insert(taicpu.op_sym(A_B,l));
                 curdata.concat(tai_label.create(l));
                 curdata.concat(tai_label.create(l));
                 list.insertlistafter(curtai,curdata);
                 list.insertlistafter(curtai,curdata);

+ 1 - 1
compiler/arm/agarmgas.pas

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

+ 101 - 101
compiler/arm/cgcpu.pas

@@ -30,7 +30,7 @@ unit cgcpu;
     uses
     uses
        globtype,symtype,symdef,
        globtype,symtype,symdef,
        cgbase,cgutils,cgobj,
        cgbase,cgutils,cgobj,
-       aasmbase,aasmcpu,aasmtai,
+       aasmbase,aasmcpu,aasmtai,aasmdata,
        parabase,
        parabase,
        cpubase,cpuinfo,node,cg64f32,rgcpu;
        cpubase,cpuinfo,node,cg64f32,rgcpu;
 
 
@@ -42,76 +42,76 @@ unit cgcpu;
         procedure init_register_allocators;override;
         procedure init_register_allocators;override;
         procedure done_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;
           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;
           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 }
         { 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 }
         { 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 }
         {  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;
           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;
       end;
 
 
       tcg64farm = class(tcg64f32)
       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;
       end;
 
 
     const
     const
@@ -175,7 +175,7 @@ unit cgcpu;
       end;
       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
       var
         ref: treference;
         ref: treference;
       begin
       begin
@@ -196,7 +196,7 @@ unit cgcpu;
       end;
       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
       var
         tmpref, ref: treference;
         tmpref, ref: treference;
         location: pcgparalocation;
         location: pcgparalocation;
@@ -244,7 +244,7 @@ unit cgcpu;
       end;
       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
       var
         ref: treference;
         ref: treference;
         tmpreg: tregister;
         tmpreg: tregister;
@@ -268,9 +268,9 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure tcgarm.a_call_name(list : taasmoutput;const s : string);
+    procedure tcgarm.a_call_name(list : TAsmList;const s : string);
       begin
       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
         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)
         for now we only need it after pass 2 (I hope) (JM)
@@ -281,7 +281,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure tcgarm.a_call_reg(list : taasmoutput;reg: tregister);
+    procedure tcgarm.a_call_reg(list : TAsmList;reg: tregister);
       var
       var
          r : tregister;
          r : tregister;
       begin
       begin
@@ -297,13 +297,13 @@ unit cgcpu;
       end;
       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
        begin
           a_op_const_reg_reg(list,op,size,a,reg,reg);
           a_op_const_reg_reg(list,op,size,a,reg,reg);
        end;
        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
        begin
          case op of
          case op of
            OP_NEG:
            OP_NEG:
@@ -330,7 +330,7 @@ unit cgcpu;
          A_NONE,A_NONE,A_NONE,A_SUB,A_EOR);
          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);
       size: tcgsize; a: aint; src, dst: tregister);
       var
       var
         ovloc : tlocation;
         ovloc : tlocation;
@@ -339,7 +339,7 @@ unit cgcpu;
       end;
       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);
       size: tcgsize; src1, src2, dst: tregister);
       var
       var
         ovloc : tlocation;
         ovloc : tlocation;
@@ -348,7 +348,7 @@ unit cgcpu;
       end;
       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
       var
         shift : byte;
         shift : byte;
         tmpreg : tregister;
         tmpreg : tregister;
@@ -455,7 +455,7 @@ unit cgcpu;
       end;
       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
       var
         so : tshifterop;
         so : tshifterop;
         tmpreg,overflowreg : tregister;
         tmpreg,overflowreg : tregister;
@@ -550,7 +550,7 @@ unit cgcpu;
       end;
       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
        var
           imm_shift : byte;
           imm_shift : byte;
           l : tasmlabel;
           l : tasmlabel;
@@ -566,7 +566,7 @@ unit cgcpu;
             begin
             begin
                reference_reset(hr);
                reference_reset(hr);
 
 
-               objectlibrary.getjumplabel(l);
+               current_asmdata.getjumplabel(l);
                cg.a_label(current_procinfo.aktlocaldata,l);
                cg.a_label(current_procinfo.aktlocaldata,l);
                hr.symboldata:=current_procinfo.aktlocaldata.last;
                hr.symboldata:=current_procinfo.aktlocaldata.last;
                current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(longint(a)));
                current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(longint(a)));
@@ -577,7 +577,7 @@ unit cgcpu;
        end;
        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
       var
         tmpreg : tregister;
         tmpreg : tregister;
         tmpref : treference;
         tmpref : treference;
@@ -632,7 +632,7 @@ unit cgcpu;
             tmpreg:=getintregister(list,OS_INT);
             tmpreg:=getintregister(list,OS_INT);
             if assigned(ref.symbol) then
             if assigned(ref.symbol) then
               begin
               begin
-                objectlibrary.getjumplabel(l);
+                current_asmdata.getjumplabel(l);
                 cg.a_label(current_procinfo.aktlocaldata,l);
                 cg.a_label(current_procinfo.aktlocaldata,l);
                 tmpref.symboldata:=current_procinfo.aktlocaldata.last;
                 tmpref.symboldata:=current_procinfo.aktlocaldata.last;
 
 
@@ -720,7 +720,7 @@ unit cgcpu;
       end;
       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
        var
          oppostfix:toppostfix;
          oppostfix:toppostfix;
        begin
        begin
@@ -742,7 +742,7 @@ unit cgcpu;
        end;
        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
        var
          oppostfix:toppostfix;
          oppostfix:toppostfix;
        begin
        begin
@@ -766,7 +766,7 @@ unit cgcpu;
        end;
        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
        var
          instr: taicpu;
          instr: taicpu;
          so : tshifterop;
          so : tshifterop;
@@ -834,7 +834,7 @@ unit cgcpu;
        end;
        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
       var
          href,href2 : treference;
          href,href2 : treference;
          hloc : pcgparalocation;
          hloc : pcgparalocation;
@@ -862,13 +862,13 @@ unit cgcpu;
       end;
       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
        begin
          list.concat(setoppostfix(taicpu.op_reg_reg(A_MVF,reg2,reg1),cgsize2fpuoppostfix[size]));
          list.concat(setoppostfix(taicpu.op_reg_reg(A_MVF,reg2,reg1),cgsize2fpuoppostfix[size]));
        end;
        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
        var
          oppostfix:toppostfix;
          oppostfix:toppostfix;
        begin
        begin
@@ -886,7 +886,7 @@ unit cgcpu;
        end;
        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
        var
          oppostfix:toppostfix;
          oppostfix:toppostfix;
        begin
        begin
@@ -905,7 +905,7 @@ unit cgcpu;
 
 
 
 
     {  comparison operations }
     {  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);
       l : tasmlabel);
       var
       var
         tmpreg : tregister;
         tmpreg : tregister;
@@ -927,26 +927,26 @@ unit cgcpu;
       end;
       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
       begin
         list.concat(taicpu.op_reg_reg(A_CMP,reg2,reg1));
         list.concat(taicpu.op_reg_reg(A_CMP,reg2,reg1));
         a_jmp_cond(list,cmp_op,l);
         a_jmp_cond(list,cmp_op,l);
       end;
       end;
 
 
 
 
-    procedure tcgarm.a_jmp_name(list : taasmoutput;const s : string);
+    procedure tcgarm.a_jmp_name(list : TAsmList;const s : string);
       begin
       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;
       end;
 
 
 
 
-    procedure tcgarm.a_jmp_always(list : taasmoutput;l: tasmlabel);
+    procedure tcgarm.a_jmp_always(list : TAsmList;l: tasmlabel);
       begin
       begin
         list.concat(taicpu.op_sym(A_B,l));
         list.concat(taicpu.op_sym(A_B,l));
       end;
       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
       var
         ai : taicpu;
         ai : taicpu;
       begin
       begin
@@ -956,7 +956,7 @@ unit cgcpu;
       end;
       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
       var
         ai : taicpu;
         ai : taicpu;
       begin
       begin
@@ -965,7 +965,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure tcgarm.g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean);
+    procedure tcgarm.g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean);
       var
       var
          ref : treference;
          ref : treference;
          shift : byte;
          shift : byte;
@@ -1034,7 +1034,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure tcgarm.g_proc_exit(list : taasmoutput;parasize : longint;nostackframe:boolean);
+    procedure tcgarm.g_proc_exit(list : TAsmList;parasize : longint;nostackframe:boolean);
       var
       var
          ref : treference;
          ref : treference;
          firstfloatreg,lastfloatreg,
          firstfloatreg,lastfloatreg,
@@ -1087,7 +1087,7 @@ unit cgcpu;
       end;
       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
       var
         b : byte;
         b : byte;
         tmpref : treference;
         tmpref : treference;
@@ -1147,7 +1147,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure tcgarm.fixref(list : taasmoutput;var ref : treference);
+    procedure tcgarm.fixref(list : TAsmList;var ref : treference);
       var
       var
         tmpreg : tregister;
         tmpreg : tregister;
         tmpref : treference;
         tmpref : treference;
@@ -1165,7 +1165,7 @@ unit cgcpu;
         }
         }
         { create consts entry }
         { create consts entry }
         reference_reset(tmpref);
         reference_reset(tmpref);
-        objectlibrary.getjumplabel(l);
+        current_asmdata.getjumplabel(l);
         cg.a_label(current_procinfo.aktlocaldata,l);
         cg.a_label(current_procinfo.aktlocaldata,l);
         tmpref.symboldata:=current_procinfo.aktlocaldata.last;
         tmpref.symboldata:=current_procinfo.aktlocaldata.last;
 
 
@@ -1203,7 +1203,7 @@ unit cgcpu;
       end;
       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
       var
         paraloc1,paraloc2,paraloc3 : TCGPara;
         paraloc1,paraloc2,paraloc3 : TCGPara;
       begin
       begin
@@ -1233,7 +1233,7 @@ unit cgcpu;
       end;
       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
       var
         srcref,dstref:treference;
         srcref,dstref:treference;
         srcreg,destreg,countreg,r:tregister;
         srcreg,destreg,countreg,r:tregister;
@@ -1247,7 +1247,7 @@ unit cgcpu;
         var
         var
           l : tasmlabel;
           l : tasmlabel;
         begin
         begin
-          objectlibrary.getjumplabel(l);
+          current_asmdata.getjumplabel(l);
           a_load_const_reg(list,OS_INT,count,countreg);
           a_load_const_reg(list,OS_INT,count,countreg);
           cg.a_label(list,l);
           cg.a_label(list,l);
           srcref.addressmode:=AM_POSTINDEXED;
           srcref.addressmode:=AM_POSTINDEXED;
@@ -1336,19 +1336,19 @@ unit cgcpu;
       end;
       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
       begin
         g_concatcopy_internal(list,source,dest,len,false);
         g_concatcopy_internal(list,source,dest,len,false);
       end;
       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
       begin
         g_concatcopy_internal(list,source,dest,len,true);
         g_concatcopy_internal(list,source,dest,len,true);
       end;
       end;
 
 
 
 
-    procedure tcgarm.g_overflowCheck(list : taasmoutput;const l : tlocation;def : tdef);
+    procedure tcgarm.g_overflowCheck(list : TAsmList;const l : tlocation;def : tdef);
       var
       var
         ovloc : tlocation;
         ovloc : tlocation;
       begin
       begin
@@ -1357,7 +1357,7 @@ unit cgcpu;
       end;
       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
       var
         hl : tasmlabel;
         hl : tasmlabel;
         ai:TAiCpu;
         ai:TAiCpu;
@@ -1365,7 +1365,7 @@ unit cgcpu;
       begin
       begin
         if not(cs_check_overflow in aktlocalswitches) then
         if not(cs_check_overflow in aktlocalswitches) then
           exit;
           exit;
-        objectlibrary.getjumplabel(hl);
+        current_asmdata.getjumplabel(hl);
         case ovloc.loc of
         case ovloc.loc of
           LOC_VOID:
           LOC_VOID:
             begin
             begin
@@ -1396,19 +1396,19 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure tcgarm.g_save_standard_registers(list : taasmoutput);
+    procedure tcgarm.g_save_standard_registers(list : TAsmList);
       begin
       begin
         { this work is done in g_proc_entry }
         { this work is done in g_proc_entry }
       end;
       end;
 
 
 
 
-    procedure tcgarm.g_restore_standard_registers(list : taasmoutput);
+    procedure tcgarm.g_restore_standard_registers(list : TAsmList);
       begin
       begin
         { this work is done in g_proc_exit }
         { this work is done in g_proc_exit }
       end;
       end;
 
 
 
 
-    procedure tcgarm.a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel);
+    procedure tcgarm.a_jmp_cond(list : TAsmList;cond : TOpCmp;l: tasmlabel);
       var
       var
         ai : taicpu;
         ai : taicpu;
       begin
       begin
@@ -1419,7 +1419,7 @@ unit cgcpu;
       end;
       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;
       procedure loadvmttor12;
         var
         var
@@ -1478,13 +1478,13 @@ unit cgcpu;
           end
           end
         { case 0 }
         { case 0 }
         else
         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));
         list.concat(Tai_symbol_end.Createname(labelname));
       end;
       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
       var
         tmpreg : tregister;
         tmpreg : tregister;
       begin
       begin
@@ -1505,13 +1505,13 @@ unit cgcpu;
       end;
       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
       begin
         a_op64_const_reg_reg(list,op,size,value,reg,reg);
         a_op64_const_reg_reg(list,op,size,value,reg,reg);
       end;
       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
       var
         ovloc : tlocation;
         ovloc : tlocation;
       begin
       begin
@@ -1519,7 +1519,7 @@ unit cgcpu;
       end;
       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
       var
         ovloc : tlocation;
         ovloc : tlocation;
       begin
       begin
@@ -1527,7 +1527,7 @@ unit cgcpu;
       end;
       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
       var
         tmpreg : tregister;
         tmpreg : tregister;
         b : byte;
         b : byte;
@@ -1651,7 +1651,7 @@ unit cgcpu;
       end;
       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
       var
         op1,op2:TAsmOp;
         op1,op2:TAsmOp;
       begin
       begin

+ 1 - 1
compiler/arm/cpupara.pas

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

+ 1 - 1
compiler/arm/cpupi.pas

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

+ 29 - 29
compiler/arm/narmadd.pas

@@ -46,9 +46,9 @@ interface
       globtype,systems,
       globtype,systems,
       cutils,verbose,globals,
       cutils,verbose,globals,
       symconst,symdef,paramgr,
       symconst,symdef,paramgr,
-      aasmbase,aasmtai,aasmcpu,defutil,htypechk,
+      aasmbase,aasmtai,aasmdata,aasmcpu,defutil,htypechk,
       cgbase,cgutils,cgcpu,
       cgbase,cgutils,cgcpu,
-      cpuinfo,pass_1,pass_2,regvars,
+      cpuinfo,pass_1,pass_2,regvars,procinfo,
       cpupara,
       cpupara,
       ncon,nset,nadd,
       ncon,nset,nadd,
       ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32;
       ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32;
@@ -147,8 +147,8 @@ interface
 
 
               { force fpureg as location, left right doesn't matter
               { force fpureg as location, left right doesn't matter
                 as both will be in a fpureg }
                 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));
               location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
               if left.location.loc<>LOC_CFPUREGISTER then
               if left.location.loc<>LOC_CFPUREGISTER then
@@ -156,7 +156,7 @@ interface
               else
               else
                 location.register:=right.location.register;
                 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),
                  location.register,left.location.register,right.location.register),
                  cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
                  cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
 
 
@@ -179,18 +179,18 @@ interface
 
 
         { force fpureg as location, left right doesn't matter
         { force fpureg as location, left right doesn't matter
           as both will be in a fpureg }
           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_reset(location,LOC_FLAGS,OS_NO);
         location.resflags:=getresflags(true);
         location.resflags:=getresflags(true);
 
 
         if nodetype in [equaln,unequaln] then
         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),
              left.location.register,right.location.register),
              cgsize2fpuoppostfix[def_cgsize(resulttype.def)]))
              cgsize2fpuoppostfix[def_cgsize(resulttype.def)]))
         else
         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),
              left.location.register,right.location.register),
              cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
              cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
 
 
@@ -212,12 +212,12 @@ interface
         case nodetype of
         case nodetype of
           equaln:
           equaln:
             begin
             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;
               location.resflags:=F_EQ;
             end;
             end;
           unequaln:
           unequaln:
             begin
             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;
               location.resflags:=F_NE;
             end;
             end;
           lten,
           lten,
@@ -228,9 +228,9 @@ interface
                  ((nf_swaped in flags) and
                  ((nf_swaped in flags) and
                   (nodetype = gten)) then
                   (nodetype = gten)) then
                 swapleftright;
                 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;
               location.resflags:=F_EQ;
             end;
             end;
           else
           else
@@ -256,22 +256,22 @@ interface
           begin
           begin
             location_reset(location,LOC_FLAGS,OS_NO);
             location_reset(location,LOC_FLAGS,OS_NO);
             location.resflags:=getresflags(unsigned);
             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
           end
         else
         else
         { operation requiring proper N, Z and V flags ? }
         { operation requiring proper N, Z and V flags ? }
           begin
           begin
             location_reset(location,LOC_JUMP,OS_NO);
             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 }
             { the jump the sequence is a little bit hairy }
             case nodetype of
             case nodetype of
                ltn,gtn:
                ltn,gtn:
                  begin
                  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 }
                     { cheat a little bit for the negative test }
                     toggleflag(nf_swaped);
                     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);
                     toggleflag(nf_swaped);
                  end;
                  end;
                lten,gten:
                lten,gten:
@@ -281,21 +281,21 @@ interface
                       nodetype:=ltn
                       nodetype:=ltn
                     else
                     else
                       nodetype:=gtn;
                       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 }
                     { cheat for the negative test }
                     if nodetype=ltn then
                     if nodetype=ltn then
                       nodetype:=gtn
                       nodetype:=gtn
                     else
                     else
                       nodetype:=ltn;
                       nodetype:=ltn;
-                    cg.a_jmp_flags(exprasmlist,getresflags(unsigned),falselabel);
+                    cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrFalseLabel);
                     nodetype:=oldnodetype;
                     nodetype:=oldnodetype;
                  end;
                  end;
             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
             { the comparisaion of the low dword have to be
                always unsigned!                            }
                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;
       end;
       end;
 
 
@@ -315,17 +315,17 @@ interface
         if right.location.loc = LOC_CONSTANT then
         if right.location.loc = LOC_CONSTANT then
           begin
           begin
              if is_shifter_const(right.location.value,b) then
              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
              else
                begin
                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);
                    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;
           end
           end
         else
         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_reset(location,LOC_FLAGS,OS_NO);
         location.resflags:=getresflags(unsigned);
         location.resflags:=getresflags(unsigned);

+ 34 - 34
compiler/arm/narmcnv.pas

@@ -58,10 +58,10 @@ implementation
 
 
    uses
    uses
       verbose,globtype,globals,systems,
       verbose,globtype,globals,systems,
-      symconst,symdef,aasmbase,aasmtai,
+      symconst,symdef,aasmbase,aasmtai,aasmdata,
       defutil,
       defutil,
       cgbase,cgutils,
       cgbase,cgutils,
-      pass_1,pass_2,
+      pass_1,pass_2,procinfo,
       ncon,ncal,
       ncon,ncal,
       ncgutil,
       ncgutil,
       cpubase,aasmcpu,
       cpubase,aasmcpu,
@@ -155,11 +155,11 @@ implementation
         instr : taicpu;
         instr : taicpu;
       begin
       begin
         location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
         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:=taicpu.op_reg_reg(A_FLT,location.register,left.location.register);
         instr.oppostfix:=cgsize2fpuoppostfix[def_cgsize(resulttype.def)];
         instr.oppostfix:=cgsize2fpuoppostfix[def_cgsize(resulttype.def)];
-        exprasmlist.concat(instr);
+        current_asmdata.CurrAsmList.concat(instr);
       end;
       end;
 
 
 
 
@@ -168,12 +168,12 @@ implementation
         hregister : tregister;
         hregister : tregister;
         href      : treference;
         href      : treference;
         resflags  : tresflags;
         resflags  : tresflags;
-        hlabel,oldtruelabel,oldfalselabel : tasmlabel;
+        hlabel,oldTrueLabel,oldFalseLabel : tasmlabel;
       begin
       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);
          secondpass(left);
          if codegenerror then
          if codegenerror then
           exit;
           exit;
@@ -184,8 +184,8 @@ implementation
             (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then
             (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then
            begin
            begin
               location_copy(location,left.location);
               location_copy(location,left.location);
-              truelabel:=oldtruelabel;
-              falselabel:=oldfalselabel;
+              current_procinfo.CurrTrueLabel:=oldTrueLabel;
+              current_procinfo.CurrFalseLabel:=oldFalseLabel;
               exit;
               exit;
            end;
            end;
 
 
@@ -197,19 +197,19 @@ implementation
               begin
               begin
                 if left.location.size in [OS_64,OS_S64] then
                 if left.location.size in [OS_64,OS_S64] then
                  begin
                  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;
                    href:=left.location.reference;
                    inc(href.offset,4);
                    inc(href.offset,4);
                    tcgarm(cg).cgsetflags:=true;
                    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;
                    tcgarm(cg).cgsetflags:=false;
                  end
                  end
                 else
                 else
                  begin
                  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;
                    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;
                    tcgarm(cg).cgsetflags:=false;
                  end;
                  end;
               end;
               end;
@@ -221,31 +221,31 @@ implementation
               begin
               begin
                 if left.location.size in [OS_64,OS_S64] then
                 if left.location.size in [OS_64,OS_S64] then
                  begin
                  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;
                    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;
                    tcgarm(cg).cgsetflags:=false;
                  end
                  end
                 else
                 else
                  begin
                  begin
                    tcgarm(cg).cgsetflags:=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;
                    tcgarm(cg).cgsetflags:=false;
                  end;
                  end;
               end;
               end;
             LOC_JUMP :
             LOC_JUMP :
               begin
               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;
                 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;
                 tcgarm(cg).cgsetflags:=false;
               end;
               end;
             else
             else
@@ -253,10 +253,10 @@ implementation
          end;
          end;
          { load flags to register }
          { load flags to register }
          location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def));
          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;
       end;
 
 
 
 

+ 6 - 6
compiler/arm/narmcon.pas

@@ -39,7 +39,7 @@ interface
       verbose,
       verbose,
       globtype,globals,
       globtype,globals,
       cpuinfo,
       cpuinfo,
-      aasmbase,aasmtai,
+      aasmbase,aasmtai,aasmdata,
       symconst,symdef,
       symconst,symdef,
       defutil,
       defutil,
       cgbase,cgutils,
       cgbase,cgutils,
@@ -70,7 +70,7 @@ interface
         { const already used ? }
         { const already used ? }
         if not assigned(lab_real) then
         if not assigned(lab_real) then
           begin
           begin
-            objectlibrary.getjumplabel(lastlabel);
+            current_asmdata.getjumplabel(lastlabel);
             lab_real:=lastlabel;
             lab_real:=lastlabel;
             current_procinfo.aktlocaldata.concat(Tai_label.Create(lastlabel));
             current_procinfo.aktlocaldata.concat(Tai_label.Create(lastlabel));
             location.reference.symboldata:=current_procinfo.aktlocaldata.last;
             location.reference.symboldata:=current_procinfo.aktlocaldata.last;
@@ -81,7 +81,7 @@ interface
                   { range checking? }
                   { range checking? }
                   if ((cs_check_range in aktlocalswitches) or
                   if ((cs_check_range in aktlocalswitches) or
                     (cs_check_overflow in aktlocalswitches)) and
                     (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);
                     Message(parser_e_range_check_error);
                 end;
                 end;
 
 
@@ -95,7 +95,7 @@ interface
                   { range checking? }
                   { range checking? }
                   if ((cs_check_range in aktlocalswitches) or
                   if ((cs_check_range in aktlocalswitches) or
                     (cs_check_overflow in aktlocalswitches)) and
                     (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);
                     Message(parser_e_range_check_error);
                end;
                end;
 
 
@@ -106,7 +106,7 @@ interface
                   { range checking? }
                   { range checking? }
                   if ((cs_check_range in aktlocalswitches) or
                   if ((cs_check_range in aktlocalswitches) or
                     (cs_check_overflow in aktlocalswitches)) and
                     (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);
                     Message(parser_e_range_check_error);
                 end;
                 end;
 {$ifdef cpufloat128}
 {$ifdef cpufloat128}
@@ -117,7 +117,7 @@ interface
                   { range checking? }
                   { range checking? }
                   if ((cs_check_range in aktlocalswitches) or
                   if ((cs_check_range in aktlocalswitches) or
                     (cs_check_overflow in aktlocalswitches)) and
                     (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);
                     Message(parser_e_range_check_error);
                 end;
                 end;
 {$endif cpufloat128}
 {$endif cpufloat128}

+ 10 - 10
compiler/arm/narminl.pas

@@ -59,7 +59,7 @@ implementation
       globtype,systems,
       globtype,systems,
       cutils,verbose,globals,fmodule,
       cutils,verbose,globals,fmodule,
       symconst,symdef,
       symconst,symdef,
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       cgbase,cgutils,
       cgbase,cgutils,
       pass_1,pass_2,
       pass_1,pass_2,
       cpubase,paramgr,
       cpubase,paramgr,
@@ -73,11 +73,11 @@ implementation
     procedure tarminlinenode.load_fpu_location;
     procedure tarminlinenode.load_fpu_location;
       begin
       begin
         secondpass(left);
         secondpass(left);
-        location_force_fpureg(exprasmlist,left.location,true);
+        location_force_fpureg(current_asmdata.CurrAsmList,left.location,true);
         location_copy(location,left.location);
         location_copy(location,left.location);
         if left.location.loc=LOC_CFPUREGISTER then
         if left.location.loc=LOC_CFPUREGISTER then
           begin
           begin
-           location.register:=cg.getfpuregister(exprasmlist,location.size);
+           location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
            location.loc := LOC_FPUREGISTER;
            location.loc := LOC_FPUREGISTER;
          end;
          end;
       end;
       end;
@@ -165,21 +165,21 @@ implementation
     procedure tarminlinenode.second_abs_real;
     procedure tarminlinenode.second_abs_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
 
 
 
 
     procedure tarminlinenode.second_sqr_real;
     procedure tarminlinenode.second_sqr_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
 
 
 
 
     procedure tarminlinenode.second_sqrt_real;
     procedure tarminlinenode.second_sqrt_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
 
 
 
 
@@ -187,27 +187,27 @@ implementation
     procedure tarminlinenode.second_arctan_real;
     procedure tarminlinenode.second_arctan_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
 
 
 
 
     procedure tarminlinenode.second_ln_real;
     procedure tarminlinenode.second_ln_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
 
 
     procedure tarminlinenode.second_cos_real;
     procedure tarminlinenode.second_cos_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
 
 
 
 
     procedure tarminlinenode.second_sin_real;
     procedure tarminlinenode.second_sin_real;
       begin
       begin
         load_fpu_location;
         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;
       end;
     }
     }
 
 

+ 13 - 13
compiler/arm/narmmat.pas

@@ -45,10 +45,10 @@ implementation
       globtype,systems,
       globtype,systems,
       cutils,verbose,globals,
       cutils,verbose,globals,
       symconst,symdef,
       symconst,symdef,
-      aasmbase,aasmcpu,aasmtai,
+      aasmbase,aasmcpu,aasmtai,aasmdata,
       defutil,
       defutil,
       cgbase,cgobj,cgutils,
       cgbase,cgobj,cgutils,
-      pass_1,pass_2,
+      pass_1,pass_2,procinfo,
       ncon,
       ncon,
       cpubase,cpuinfo,
       cpubase,cpuinfo,
       ncgutil,cgcpu,cg64f32,rgobj;
       ncgutil,cgcpu,cg64f32,rgobj;
@@ -67,14 +67,14 @@ implementation
         }
         }
         if left.expectloc=LOC_JUMP then
         if left.expectloc=LOC_JUMP then
           begin
           begin
-            hl:=truelabel;
-            truelabel:=falselabel;
-            falselabel:=hl;
+            hl:=current_procinfo.CurrTrueLabel;
+            current_procinfo.CurrTrueLabel:=current_procinfo.CurrFalseLabel;
+            current_procinfo.CurrFalseLabel:=hl;
             secondpass(left);
             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;
             location.loc:=LOC_JUMP;
           end
           end
         else
         else
@@ -88,8 +88,8 @@ implementation
                 end;
                 end;
               LOC_REGISTER,LOC_CREGISTER,LOC_REFERENCE,LOC_CREFERENCE :
               LOC_REGISTER,LOC_CREGISTER,LOC_REFERENCE,LOC_CREFERENCE :
                 begin
                 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_reset(location,LOC_FLAGS,OS_NO);
                   location.resflags:=F_EQ;
                   location.resflags:=F_EQ;
                end;
                end;
@@ -107,9 +107,9 @@ implementation
       begin
       begin
         secondpass(left);
         secondpass(left);
         location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
         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;
         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),
           location.register,left.location.register,0),
           cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
           cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
       end;
       end;

+ 3 - 3
compiler/arm/raarm.pas

@@ -27,7 +27,7 @@ unit raarm;
 
 
     uses
     uses
       cpubase,
       cpubase,
-      aasmtai,
+      aasmtai,aasmdata,
       rautils;
       rautils;
 
 
     type
     type
@@ -36,7 +36,7 @@ unit raarm;
 
 
       TARMInstruction=class(TInstruction)
       TARMInstruction=class(TInstruction)
         oppostfix : toppostfix;
         oppostfix : toppostfix;
-        function ConcatInstruction(p:TAAsmoutput) : tai;override;
+        function ConcatInstruction(p:TAsmList) : tai;override;
       end;
       end;
 
 
   implementation
   implementation
@@ -44,7 +44,7 @@ unit raarm;
     uses
     uses
       aasmcpu;
       aasmcpu;
 
 
-    function TARMInstruction.ConcatInstruction(p:TAAsmoutput) : tai;
+    function TARMInstruction.ConcatInstruction(p:TAsmList) : tai;
       begin
       begin
         result:=inherited ConcatInstruction(p);
         result:=inherited ConcatInstruction(p);
         (result as taicpu).oppostfix:=oppostfix;
         (result as taicpu).oppostfix:=oppostfix;

+ 1 - 1
compiler/arm/raarmgas.pas

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

+ 11 - 11
compiler/arm/rgcpu.pas

@@ -28,15 +28,15 @@ unit rgcpu;
   interface
   interface
 
 
      uses
      uses
-       aasmbase,aasmtai,aasmcpu,
+       aasmbase,aasmtai,aasmdata,aasmcpu,
        cgbase,cgutils,
        cgbase,cgutils,
        cpubase,
        cpubase,
        rgobj;
        rgobj;
 
 
      type
      type
        trgcpu = class(trgobj)
        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;
        end;
 
 
        trgintcpu = class(trgcpu)
        trgintcpu = class(trgcpu)
@@ -51,20 +51,20 @@ unit rgcpu;
       procinfo;
       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
       var
         helpins: tai;
         helpins: tai;
         tmpref : treference;
         tmpref : treference;
-        helplist : taasmoutput;
+        helplist : TAsmList;
         l : tasmlabel;
         l : tasmlabel;
         hreg : tregister;
         hreg : tregister;
       begin
       begin
         if abs(spilltemp.offset)>4095 then
         if abs(spilltemp.offset)>4095 then
           begin
           begin
-            helplist:=taasmoutput.create;
+            helplist:=TAsmList.create;
             reference_reset(tmpref);
             reference_reset(tmpref);
             { create consts entry }
             { create consts entry }
-            objectlibrary.getjumplabel(l);
+            current_asmdata.getjumplabel(l);
             cg.a_label(current_procinfo.aktlocaldata,l);
             cg.a_label(current_procinfo.aktlocaldata,l);
             tmpref.symboldata:=current_procinfo.aktlocaldata.last;
             tmpref.symboldata:=current_procinfo.aktlocaldata.last;
 
 
@@ -99,20 +99,20 @@ unit rgcpu;
       end;
       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
       var
         helpins: tai;
         helpins: tai;
         tmpref : treference;
         tmpref : treference;
-        helplist : taasmoutput;
+        helplist : TAsmList;
         l : tasmlabel;
         l : tasmlabel;
         hreg : tregister;
         hreg : tregister;
       begin
       begin
         if abs(spilltemp.offset)>4095 then
         if abs(spilltemp.offset)>4095 then
           begin
           begin
-            helplist:=taasmoutput.create;
+            helplist:=TAsmList.create;
             reference_reset(tmpref);
             reference_reset(tmpref);
             { create consts entry }
             { create consts entry }
-            objectlibrary.getjumplabel(l);
+            current_asmdata.getjumplabel(l);
             cg.a_label(current_procinfo.aktlocaldata,l);
             cg.a_label(current_procinfo.aktlocaldata,l);
             tmpref.symboldata:=current_procinfo.aktlocaldata.last;
             tmpref.symboldata:=current_procinfo.aktlocaldata.last;
 
 

+ 54 - 43
compiler/assemble.pas

@@ -38,7 +38,7 @@ interface
       strings,
       strings,
       dos,
       dos,
 {$ENDIF USE_SYSUTILS}
 {$ENDIF USE_SYSUTILS}
-      systems,globtype,globals,aasmbase,aasmtai,ogbase;
+      systems,globtype,globals,aasmbase,aasmtai,aasmdata,ogbase;
 
 
     const
     const
        { maximum of aasmoutput lists there will be }
        { maximum of aasmoutput lists there will be }
@@ -52,11 +52,11 @@ interface
       {filenames}
       {filenames}
         path     : pathstr;
         path     : pathstr;
         name     : namestr;
         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,
         SmartFilesCount,
         SmartHeaderCount : longint;
         SmartHeaderCount : longint;
         Constructor Create(smart:boolean);virtual;
         Constructor Create(smart:boolean);virtual;
@@ -116,7 +116,7 @@ interface
 
 
         {# This routine should be overriden for each assembler, it is used
         {# This routine should be overriden for each assembler, it is used
            to actually write the abstract assembler stream to file.}
            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
         {# This routine should be overriden for each assembler, it is used
            to actually write all the different abstract assembler streams
            to actually write all the different abstract assembler streams
@@ -135,10 +135,10 @@ interface
         FCObjOutput : TObjOutputclass;
         FCObjOutput : TObjOutputclass;
         { the aasmoutput lists that need to be processed }
         { the aasmoutput lists that need to be processed }
         lists        : byte;
         lists        : byte;
-        list         : array[1..maxoutputlists] of TAAsmoutput;
+        list         : array[1..maxoutputlists] of TAsmList;
         { current processing }
         { current processing }
         currlistidx  : byte;
         currlistidx  : byte;
-        currlist     : TAAsmoutput;
+        currlist     : TAsmList;
         procedure convertstab(p:pchar);
         procedure convertstab(p:pchar);
         function  MaybeNextList(var hp:Tai):boolean;
         function  MaybeNextList(var hp:Tai):boolean;
         function  TreePass0(hp:Tai):Tai;
         function  TreePass0(hp:Tai):Tai;
@@ -183,7 +183,8 @@ Implementation
 {$ifdef m68k}
 {$ifdef m68k}
       cpuinfo,
       cpuinfo,
 {$endif m68k}
 {$endif m68k}
-      aasmcpu
+      aasmcpu,
+      owbase,owar
       ;
       ;
 
 
     var
     var
@@ -197,8 +198,8 @@ Implementation
     Constructor TAssembler.Create(smart:boolean);
     Constructor TAssembler.Create(smart:boolean);
       begin
       begin
       { load start values }
       { 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^);
         name:=Lower(current_module.modulename^);
         path:=current_module.outputpath^;
         path:=current_module.outputpath^;
         asmprefix := current_module.asmprefix^;
         asmprefix := current_module.asmprefix^;
@@ -236,10 +237,10 @@ Implementation
           cut_end :
           cut_end :
             s:=asmprefix+tostr(SmartHeaderCount)+'t';
             s:=asmprefix+tostr(SmartHeaderCount)+'t';
         end;
         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 }
         { insert in container so it can be cleared after the linking }
-        SmartLinkOFiles.Insert(Objfile);
+        SmartLinkOFiles.Insert(ObjFileName);
       end;
       end;
 
 
 
 
@@ -415,10 +416,10 @@ Implementation
         if cs_asm_leave in aktglobalswitches then
         if cs_asm_leave in aktglobalswitches then
          exit;
          exit;
         if cs_asm_extern in aktglobalswitches then
         if cs_asm_extern in aktglobalswitches then
-         AsmRes.AddDeleteCommand(AsmFile)
+         AsmRes.AddDeleteCommand(AsmFileName)
         else
         else
          begin
          begin
-           assign(g,AsmFile);
+           assign(g,AsmFileName);
            {$I-}
            {$I-}
             erase(g);
             erase(g);
            {$I+}
            {$I+}
@@ -552,8 +553,8 @@ Implementation
 {$endif}
 {$endif}
         if (cs_link_on_target in aktglobalswitches) then
         if (cs_link_on_target in aktglobalswitches) then
          begin
          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
          end
         else
         else
          begin
          begin
@@ -562,8 +563,8 @@ Implementation
             Replace(result,'$ASM','')
             Replace(result,'$ASM','')
           else
           else
 {$endif}
 {$endif}
-             Replace(result,'$ASM',maybequoted(AsmFile));
-           Replace(result,'$OBJ',maybequoted(ObjFile));
+             Replace(result,'$ASM',maybequoted(AsmFileName));
+           Replace(result,'$OBJ',maybequoted(ObjFileName));
          end;
          end;
       end;
       end;
 
 
@@ -575,20 +576,20 @@ Implementation
 {$ifdef hasunix}
 {$ifdef hasunix}
         if DoPipe then
         if DoPipe then
          begin
          begin
-           Message1(exec_i_assembling_pipe,asmfile);
+           Message1(exec_i_assembling_pipe,AsmFileName);
            POpen(outfile,FindAssembler+' '+MakeCmdLine,'W');
            POpen(outfile,FindAssembler+' '+MakeCmdLine,'W');
          end
          end
         else
         else
 {$endif}
 {$endif}
          begin
          begin
-           Assign(outfile,asmfile);
+           Assign(outfile,AsmFileName);
            {$I-}
            {$I-}
            Rewrite(outfile,1);
            Rewrite(outfile,1);
            {$I+}
            {$I+}
            if ioresult<>0 then
            if ioresult<>0 then
              begin
              begin
                ioerror:=true;
                ioerror:=true;
-               Message1(exec_d_cant_create_asmfile,asmfile);
+               Message1(exec_d_cant_create_asmfile,AsmFileName);
              end;
              end;
          end;
          end;
         outcnt:=0;
         outcnt:=0;
@@ -640,7 +641,7 @@ Implementation
       end;
       end;
 
 
 
 
-    procedure TExternalAssembler.WriteTree(p:TAAsmoutput);
+    procedure TExternalAssembler.WriteTree(p:TAsmList);
       begin
       begin
       end;
       end;
 
 
@@ -1029,9 +1030,9 @@ Implementation
                if SmartAsm then
                if SmartAsm then
                 break;
                 break;
              ait_marker :
              ait_marker :
-               if tai_marker(hp).kind=InlineStart then
+               if tai_marker(hp).kind=mark_InlineStart then
                  inc(InlineLevel)
                  inc(InlineLevel)
-               else if tai_marker(hp).kind=InlineEnd then
+               else if tai_marker(hp).kind=mark_InlineEnd then
                  dec(InlineLevel);
                  dec(InlineLevel);
            end;
            end;
            hp:=Tai(hp.next);
            hp:=Tai(hp.next);
@@ -1138,9 +1139,9 @@ Implementation
                if SmartAsm then
                if SmartAsm then
                 break;
                 break;
              ait_marker :
              ait_marker :
-               if tai_marker(hp).kind=InlineStart then
+               if tai_marker(hp).kind=mark_InlineStart then
                  inc(InlineLevel)
                  inc(InlineLevel)
-               else if tai_marker(hp).kind=InlineEnd then
+               else if tai_marker(hp).kind=mark_InlineEnd then
                  dec(InlineLevel);
                  dec(InlineLevel);
            end;
            end;
            hp:=Tai(hp.next);
            hp:=Tai(hp.next);
@@ -1154,9 +1155,11 @@ Implementation
         doexit;
         doexit;
       var
       var
         hp : Tai;
         hp : Tai;
+        ObjWriter : TObjectWriter;
       begin
       begin
-        ObjOutput:=CObjOutput.Create(false);
-        ObjData:=ObjOutput.newObjData(Objfile);
+        ObjWriter:=TObjectwriter.create;
+        ObjOutput:=CObjOutput.Create(ObjWriter);
+        ObjData:=ObjOutput.newObjData(ObjFileName);
 
 
         { Pass 0 }
         { Pass 0 }
         ObjData.currpass:=0;
         ObjData.currpass:=0;
@@ -1218,7 +1221,7 @@ Implementation
         if errorcount=0 then
         if errorcount=0 then
          begin
          begin
            { write objectfile }
            { write objectfile }
-           ObjOutput.startobjectfile(ObjFile);
+           ObjOutput.startobjectfile(ObjFileName);
            ObjOutput.writeobjectfile(ObjData);
            ObjOutput.writeobjectfile(ObjData);
          end;
          end;
 
 
@@ -1226,6 +1229,7 @@ Implementation
         { Cleanup }
         { Cleanup }
         ObjData.free;
         ObjData.free;
         ObjData:=nil;
         ObjData:=nil;
+        ObjWriter.free;
       end;
       end;
 
 
 
 
@@ -1234,9 +1238,15 @@ Implementation
         hp : Tai;
         hp : Tai;
         startsectype : TAsmSectiontype;
         startsectype : TAsmSectiontype;
         place: tcutplace;
         place: tcutplace;
+        ObjWriter : TObjectWriter;
       begin
       begin
+        if not(cs_asm_leave in aktglobalswitches) then
+          ObjWriter:=TARObjectWriter.create(current_module.staticlibfilename^)
+        else
+          ObjWriter:=TObjectwriter.create;
+
         NextSmartName(cut_normal);
         NextSmartName(cut_normal);
-        ObjOutput:=CObjOutput.Create(true);
+        ObjOutput:=CObjOutput.Create(ObjWriter);
         startsectype:=sec_code;
         startsectype:=sec_code;
 
 
         { start with list 1 }
         { start with list 1 }
@@ -1245,7 +1255,7 @@ Implementation
         hp:=Tai(currList.first);
         hp:=Tai(currList.first);
         while assigned(hp) do
         while assigned(hp) do
          begin
          begin
-           ObjData:=ObjOutput.newObjData(Objfile);
+           ObjData:=ObjOutput.newObjData(ObjFileName);
 
 
            { Pass 0 }
            { Pass 0 }
            ObjData.currpass:=0;
            ObjData.currpass:=0;
@@ -1272,7 +1282,7 @@ Implementation
 
 
            { Pass 2 }
            { Pass 2 }
            ObjData.currpass:=2;
            ObjData.currpass:=2;
-           ObjOutput.startobjectfile(Objfile);
+           ObjOutput.startobjectfile(ObjFileName);
            ObjData.resetsections;
            ObjData.resetsections;
            ObjData.beforewrite;
            ObjData.beforewrite;
            ObjData.createsection(startsectype,'');
            ObjData.createsection(startsectype,'');
@@ -1320,34 +1330,35 @@ Implementation
          end;
          end;
         ObjData.free;
         ObjData.free;
         ObjData:=nil;
         ObjData:=nil;
+        ObjWriter.free;
       end;
       end;
 
 
 
 
     procedure TInternalAssembler.MakeObject;
     procedure TInternalAssembler.MakeObject;
 
 
-    var to_do:set of Tasmlist;
-        i:Tasmlist;
+    var to_do:set of TasmlistType;
+        i:TasmlistType;
 {$ifdef MEMDEBUG}
 {$ifdef MEMDEBUG}
         d : tmemdebug;
         d : tmemdebug;
 {$endif}
 {$endif}
 
 
-        procedure addlist(p:TAAsmoutput);
+        procedure addlist(p:TAsmList);
         begin
         begin
           inc(lists);
           inc(lists);
           list[lists]:=p;
           list[lists]:=p;
         end;
         end;
 
 
       begin
       begin
-        to_do:=[low(Tasmlist)..high(Tasmlist)];
+        to_do:=[low(Tasmlisttype)..high(Tasmlisttype)];
         if usedeffileforexports then
         if usedeffileforexports then
           exclude(to_do,al_exports);
           exclude(to_do,al_exports);
         {$warning TODO internal writer support for dwarf}
         {$warning TODO internal writer support for dwarf}
         exclude(to_do,al_dwarf);
         exclude(to_do,al_dwarf);
         if not(tf_section_threadvars in target_info.flags) then
         if not(tf_section_threadvars in target_info.flags) then
           exclude(to_do,al_threadvars);
           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
         if SmartAsm then
           writetreesmart
           writetreesmart
@@ -1362,7 +1373,7 @@ Implementation
 {$ifdef MEMDEBUG}
 {$ifdef MEMDEBUG}
             d:=tmemdebug.create(modulename^+' - librarydata');
             d:=tmemdebug.create(modulename^+' - librarydata');
 {$endif}
 {$endif}
-            objectlibrary.free;
+            current_asmdata.free;
             objectlibrary:=nil;
             objectlibrary:=nil;
             current_module.librarydata:=nil;
             current_module.librarydata:=nil;
 {$ifdef MEMDEBUG}
 {$ifdef MEMDEBUG}

+ 1 - 1
compiler/browcol.pas

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

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

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

+ 63 - 63
compiler/cg64f32.pas

@@ -31,7 +31,7 @@ unit cg64f32;
   interface
   interface
 
 
     uses
     uses
-       aasmbase,aasmtai,aasmcpu,
+       aasmbase,aasmtai,aasmdata,aasmcpu,
        cpubase,cpupara,
        cpubase,cpupara,
        cgbase,cgobj,parabase,cgutils,
        cgbase,cgobj,parabase,cgutils,
        symtype
        symtype
@@ -42,43 +42,43 @@ unit cg64f32;
          to handle 64-bit integers.
          to handle 64-bit integers.
       }
       }
       tcg64f32 = class(tcg64)
       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
         {# This routine tries to optimize the a_op64_const_reg operation, by
            removing superfluous opcodes. Returns TRUE if normal processing
            removing superfluous opcodes. Returns TRUE if normal processing
            must continue in op64_const_reg, otherwise, everything is processed
            must continue in op64_const_reg, otherwise, everything is processed
            entirely in this routine, by emitting the appropriate 32-bit opcodes.
            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;
       end;
 
 
     {# Creates a tregister64 record from 2 32 Bit registers. }
     {# Creates a tregister64 record from 2 32 Bit registers. }
@@ -177,7 +177,7 @@ unit cg64f32;
                                    TCG64F32
                                    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
       var
         tmpreg: tregister;
         tmpreg: tregister;
         tmpref: treference;
         tmpref: treference;
@@ -195,7 +195,7 @@ unit cg64f32;
       end;
       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
       var
         tmpref: treference;
         tmpref: treference;
       begin
       begin
@@ -208,7 +208,7 @@ unit cg64f32;
       end;
       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
       var
         tmpreg: tregister;
         tmpreg: tregister;
         tmpref: treference;
         tmpref: treference;
@@ -242,7 +242,7 @@ unit cg64f32;
       end;
       end;
 
 
 
 
-    procedure tcg64f32.a_load64_reg_reg(list : taasmoutput;regsrc,regdst : tregister64);
+    procedure tcg64f32.a_load64_reg_reg(list : TAsmList;regsrc,regdst : tregister64);
 
 
       begin
       begin
         cg.a_load_reg_reg(list,OS_32,OS_32,regsrc.reglo,regdst.reglo);
         cg.a_load_reg_reg(list,OS_32,OS_32,regsrc.reglo,regdst.reglo);
@@ -250,7 +250,7 @@ unit cg64f32;
       end;
       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
       begin
         cg.a_load_const_reg(list,OS_32,aint(lo(value)),reg.reglo);
         cg.a_load_const_reg(list,OS_32,aint(lo(value)),reg.reglo);
@@ -258,7 +258,7 @@ unit cg64f32;
       end;
       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
       begin
         case l.loc of
         case l.loc of
@@ -274,7 +274,7 @@ unit cg64f32;
       end;
       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
       begin
         case l.loc of
         case l.loc of
           LOC_REGISTER,LOC_CREGISTER:
           LOC_REGISTER,LOC_CREGISTER:
@@ -287,7 +287,7 @@ unit cg64f32;
       end;
       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
       begin
         case l.loc of
         case l.loc of
@@ -301,7 +301,7 @@ unit cg64f32;
       end;
       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
       begin
         case l.loc of
         case l.loc of
@@ -315,7 +315,7 @@ unit cg64f32;
       end;
       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
       var
         tmpref: treference;
         tmpref: treference;
       begin
       begin
@@ -329,7 +329,7 @@ unit cg64f32;
           end;
           end;
       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
       var
         tmpref: treference;
         tmpref: treference;
       begin
       begin
@@ -344,7 +344,7 @@ unit cg64f32;
       end;
       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
       var
         tmpref: treference;
         tmpref: treference;
       begin
       begin
@@ -359,7 +359,7 @@ unit cg64f32;
       end;
       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
       var
         tmpref: treference;
         tmpref: treference;
       begin
       begin
@@ -374,7 +374,7 @@ unit cg64f32;
       end;
       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
       begin
         case l.loc of
         case l.loc of
           LOC_REFERENCE,
           LOC_REFERENCE,
@@ -391,7 +391,7 @@ unit cg64f32;
       end;
       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
       begin
         case l.loc of
         case l.loc of
           LOC_REFERENCE,
           LOC_REFERENCE,
@@ -408,7 +408,7 @@ unit cg64f32;
       end;
       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
       begin
         case l.loc of
         case l.loc of
           LOC_REFERENCE, LOC_CREFERENCE:
           LOC_REFERENCE, LOC_CREFERENCE:
@@ -421,7 +421,7 @@ unit cg64f32;
       end;
       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
       begin
         case l.loc of
         case l.loc of
           LOC_REFERENCE, LOC_CREFERENCE:
           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
       begin
         case l.loc of
         case l.loc of
           LOC_REFERENCE, LOC_CREFERENCE:
           LOC_REFERENCE, LOC_CREFERENCE:
@@ -450,7 +450,7 @@ unit cg64f32;
       end;
       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
       var
         tempreg: tregister64;
         tempreg: tregister64;
       begin
       begin
@@ -461,7 +461,7 @@ unit cg64f32;
       end;
       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
       var
         tempreg: tregister64;
         tempreg: tregister64;
       begin
       begin
@@ -473,7 +473,7 @@ unit cg64f32;
       end;
       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
       var
         tempreg: tregister64;
         tempreg: tregister64;
       begin
       begin
@@ -485,7 +485,7 @@ unit cg64f32;
       end;
       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
       var
         tmplochi,tmploclo: tcgpara;
         tmplochi,tmploclo: tcgpara;
       begin
       begin
@@ -501,7 +501,7 @@ unit cg64f32;
       end;
       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
       var
         tmplochi,tmploclo: tcgpara;
         tmplochi,tmploclo: tcgpara;
       begin
       begin
@@ -517,7 +517,7 @@ unit cg64f32;
       end;
       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
       var
         tmprefhi,tmpreflo : treference;
         tmprefhi,tmpreflo : treference;
         tmploclo,tmplochi : tcgpara;
         tmploclo,tmplochi : tcgpara;
@@ -540,7 +540,7 @@ unit cg64f32;
       end;
       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
       begin
         case l.loc of
         case l.loc of
           LOC_REGISTER,
           LOC_REGISTER,
@@ -557,7 +557,7 @@ unit cg64f32;
       end;
       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
       var
         neglabel,
         neglabel,
@@ -585,7 +585,7 @@ unit cg64f32;
                  hreg:=cg.getintregister(list,OS_32);
                  hreg:=cg.getintregister(list,OS_32);
                  a_load64high_ref_reg(list,l.reference,hreg);
                  a_load64high_ref_reg(list,l.reference,hreg);
                end;
                end;
-             objectlibrary.getjumplabel(poslabel);
+             current_asmdata.getjumplabel(poslabel);
 
 
              { check high dword, must be 0 (for positive numbers) }
              { check high dword, must be 0 (for positive numbers) }
              cg.a_cmp_const_reg_label(list,OS_32,OC_EQ,0,hreg,poslabel);
              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 }
              { It can also be $ffffffff, but only for negative numbers }
              if from_signed and to_signed then
              if from_signed and to_signed then
                begin
                begin
-                 objectlibrary.getjumplabel(neglabel);
+                 current_asmdata.getjumplabel(neglabel);
                  cg.a_cmp_const_reg_label(list,OS_32,OC_EQ,-1,hreg,neglabel);
                  cg.a_cmp_const_reg_label(list,OS_32,OC_EQ,-1,hreg,neglabel);
                end;
                end;
              { For all other values we have a range check error }
              { For all other values we have a range check error }
@@ -616,7 +616,7 @@ unit cg64f32;
 
 
              if from_signed and to_signed then
              if from_signed and to_signed then
                begin
                begin
-                 objectlibrary.getjumplabel(endlabel);
+                 current_asmdata.getjumplabel(endlabel);
                  cg.a_jmp_always(list,endlabel);
                  cg.a_jmp_always(list,endlabel);
                  { if the high dword = $ffffffff, then the low dword (when }
                  { if the high dword = $ffffffff, then the low dword (when }
                  { considered as a longint) must be < 0                    }
                  { considered as a longint) must be < 0                    }
@@ -631,7 +631,7 @@ unit cg64f32;
                      a_load64low_ref_reg(list,l.reference,hreg);
                      a_load64low_ref_reg(list,l.reference,hreg);
                    end;
                    end;
                  { get a new neglabel (JM) }
                  { 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_cmp_const_reg_label(list,OS_32,OC_LT,0,hreg,neglabel);
 
 
                  cg.a_call_name(list,'FPC_RANGEERROR');
                  cg.a_call_name(list,'FPC_RANGEERROR');
@@ -682,7 +682,7 @@ unit cg64f32;
                    else
                    else
                      cg.a_load_ref_reg(list,l.size,OS_32,l.reference,hreg);
                      cg.a_load_ref_reg(list,l.size,OS_32,l.reference,hreg);
                  end;
                  end;
-               objectlibrary.getjumplabel(poslabel);
+               current_asmdata.getjumplabel(poslabel);
                cg.a_cmp_const_reg_label(list,opsize,OC_GTE,0,hreg,poslabel);
                cg.a_cmp_const_reg_label(list,opsize,OC_GTE,0,hreg,poslabel);
 
 
                cg.a_call_name(list,'FPC_RANGEERROR');
                cg.a_call_name(list,'FPC_RANGEERROR');
@@ -691,7 +691,7 @@ unit cg64f32;
       end;
       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
       var
         lowvalue, highvalue : longint;
         lowvalue, highvalue : longint;
         hreg: tregister;
         hreg: tregister;

File diff suppressed because it is too large
+ 201 - 207
compiler/cgobj.pas


+ 30 - 30
compiler/cresstr.pas

@@ -62,7 +62,7 @@ uses
    cutils,globtype,globals,
    cutils,globtype,globals,
    symdef,
    symdef,
    verbose,fmodule,
    verbose,fmodule,
-   aasmbase,aasmtai,
+   aasmbase,aasmtai,aasmdata,
    aasmcpu;
    aasmcpu;
 
 
 
 
@@ -144,60 +144,60 @@ procedure Tresourcestrings.CreateResourceStringList;
     with p Do
     with p Do
      begin
      begin
        if (Value=nil) or (len=0) then
        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
        else
          begin
          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);
             getmem(s,len+1);
             move(value^,s^,len);
             move(value^,s^,len);
             s[len]:=#0;
             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;
          end;
        { append Current value (nil) and hash...}
        { 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. }
        { Append the name as a ansistring. }
-       objectlibrary.getdatalabel(l1);
+       current_asmdata.getdatalabel(l1);
        l:=length(name);
        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);
        getmem(s,l+1);
        move(Name[1],s^,l);
        move(Name[1],s^,l);
        s[l]:=#0;
        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;
   end;
   end;
 
 
 Var
 Var
   R : tresourceStringItem;
   R : tresourceStringItem;
 begin
 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));
     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);
   R:=TResourceStringItem(List.First);
   while assigned(R) do
   while assigned(R) do
    begin
    begin
      AppendToAsmResList(R);
      AppendToAsmResList(R);
      R:=TResourceStringItem(R.Next);
      R:=TResourceStringItem(R.Next);
    end;
    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,'')));
     make_mangledname('RESOURCESTRINGLIST',current_module.localsymtable,'')));
 end;
 end;
 
 

+ 11 - 11
compiler/dbgbase.pas

@@ -30,7 +30,7 @@ interface
       systems,
       systems,
       symconst,symbase,symdef,symtype,symsym,symtable,
       symconst,symbase,symdef,symtype,symsym,symtable,
       fmodule,
       fmodule,
-      aasmtai;
+      aasmtai,aasmdata;
 
 
     type
     type
       TDebugInfo=class
       TDebugInfo=class
@@ -40,12 +40,12 @@ interface
 
 
         procedure inserttypeinfo;virtual;
         procedure inserttypeinfo;virtual;
         procedure insertmoduleinfo;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 field_write_defs(p:Tnamedindexitem;arg:pointer);
         procedure method_write_defs(p :tnamedindexitem;arg:pointer);
         procedure method_write_defs(p :tnamedindexitem;arg:pointer);
       end;
       end;
@@ -81,12 +81,12 @@ implementation
       end;
       end;
 
 
 
 
-    procedure tdebuginfo.insertlineinfo(list:taasmoutput);
+    procedure tdebuginfo.insertlineinfo(list:TAsmList);
       begin
       begin
       end;
       end;
 
 
 
 
-    procedure tdebuginfo.referencesections(list:taasmoutput);
+    procedure tdebuginfo.referencesections(list:TAsmList);
       begin
       begin
       end;
       end;
 
 
@@ -108,7 +108,7 @@ implementation
       begin
       begin
         if (Tsym(p).typ=fieldvarsym) and
         if (Tsym(p).typ=fieldvarsym) and
            not(sp_static in Tsym(p).symoptions) then
            not(sp_static in Tsym(p).symoptions) then
-          insertdef(taasmoutput(arg),tfieldvarsym(p).vartype.def);
+          insertdef(TAsmList(arg),tfieldvarsym(p).vartype.def);
       end;
       end;
 
 
 
 
@@ -119,12 +119,12 @@ implementation
         if tsym(p).typ=procsym then
         if tsym(p).typ=procsym then
           begin
           begin
             pd:=tprocsym(p).first_procdef;
             pd:=tprocsym(p).first_procdef;
-            insertdef(taasmoutput(arg),pd.rettype.def);
+            insertdef(TAsmList(arg),pd.rettype.def);
           end;
           end;
       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
       var
         pu : tused_unit;
         pu : tused_unit;
       begin
       begin

+ 156 - 156
compiler/dbgdwarf.pas

@@ -38,7 +38,7 @@ interface
 
 
     uses
     uses
       cclasses,
       cclasses,
-      aasmbase,aasmtai,
+      aasmbase,aasmtai,aasmdata,
       symbase,symtype,symdef,
       symbase,symtype,symdef,
       DbgBase;
       DbgBase;
 
 
@@ -212,19 +212,19 @@ interface
 
 
         procedure field_add_dwarftag(p:Tnamedindexitem;arg:pointer);
         procedure field_add_dwarftag(p:Tnamedindexitem;arg:pointer);
         procedure method_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;
         function def_dwarf_lab(def:tdef) : tasmsymbol;
       public
       public
-        procedure insertdef(list:taasmoutput;def:tdef);override;
+        procedure insertdef(list:TAsmList;def:tdef);override;
 
 
         procedure insertmoduleinfo;override;
         procedure insertmoduleinfo;override;
         procedure inserttypeinfo;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;
       end;
 
 
 implementation
 implementation
@@ -441,7 +441,7 @@ implementation
         { Need a new label? }
         { Need a new label? }
         if def.dwarf_lab=nil then
         if def.dwarf_lab=nil then
           begin
           begin
-            objectlibrary.getdatalabel(def.dwarf_lab);
+            current_asmdata.getdatalabel(def.dwarf_lab);
             if nextdefnumber>=defnumberlist.count then
             if nextdefnumber>=defnumberlist.count then
               defnumberlist.count:=nextdefnumber+250;
               defnumberlist.count:=nextdefnumber+250;
             defnumberlist[nextdefnumber]:=def;
             defnumberlist[nextdefnumber]:=def;
@@ -459,16 +459,16 @@ implementation
       begin
       begin
         inc(currabbrevnumber);
         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 }
         { 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 }
         { 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? }
         { 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;
         i:=0;
         while i<=high(data) do
         while i<=high(data) do
@@ -476,7 +476,7 @@ implementation
             { attribute }
             { attribute }
             if data[i].VType=vtInteger then
             if data[i].VType=vtInteger then
               begin
               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
               end
             else
             else
               internalerror(200601261);
               internalerror(200601261);
@@ -485,7 +485,7 @@ implementation
             { form }
             { form }
             if data[i].VType=vtInteger then
             if data[i].VType=vtInteger then
               begin
               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
               end
             else
             else
               internalerror(200601262);
               internalerror(200601262);
@@ -496,27 +496,27 @@ implementation
               DW_FORM_string:
               DW_FORM_string:
                 case data[i].VType of
                 case data[i].VType of
                   vtChar:
                   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:
                   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:
                   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
                   else
                     internalerror(200601264);
                     internalerror(200601264);
                 end;
                 end;
 
 
 
 
               DW_FORM_flag:
               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:
               DW_FORM_data1:
                  case data[i].VType of
                  case data[i].VType of
                   vtInteger:
                   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:
                   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:
                   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
                   else
                     internalerror(200602143);
                     internalerror(200602143);
                 end;
                 end;
@@ -524,11 +524,11 @@ implementation
               DW_FORM_data2:
               DW_FORM_data2:
                  case data[i].VType of
                  case data[i].VType of
                   vtInteger:
                   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:
                   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:
                   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
                   else
                     internalerror(200602144);
                     internalerror(200602144);
                 end;
                 end;
@@ -536,11 +536,11 @@ implementation
               DW_FORM_data4:
               DW_FORM_data4:
                  case data[i].VType of
                  case data[i].VType of
                   vtInteger:
                   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:
                   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:
                   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
                   else
                     internalerror(200602145);
                     internalerror(200602145);
                 end;
                 end;
@@ -548,11 +548,11 @@ implementation
               DW_FORM_data8:
               DW_FORM_data8:
                  case data[i].VType of
                  case data[i].VType of
                   vtInteger:
                   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:
                   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:
                   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
                   else
                     internalerror(200602146);
                     internalerror(200602146);
                 end;
                 end;
@@ -560,11 +560,11 @@ implementation
               DW_FORM_sdata:
               DW_FORM_sdata:
                 case data[i].VType of
                 case data[i].VType of
                   vtInteger:
                   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:
                   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:
                   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
                   else
                     internalerror(200601285);
                     internalerror(200601285);
                 end;
                 end;
@@ -572,11 +572,11 @@ implementation
               DW_FORM_udata:
               DW_FORM_udata:
                 case data[i].VType of
                 case data[i].VType of
                   vtInteger:
                   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:
                   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:
                   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
                   else
                     internalerror(200601284);
                     internalerror(200601284);
                 end;
                 end;
@@ -585,11 +585,11 @@ implementation
               DW_FORM_block1:
               DW_FORM_block1:
                  case data[i].VType of
                  case data[i].VType of
                   vtInteger:
                   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:
                   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:
                   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
                   else
                     internalerror(200602141);
                     internalerror(200602141);
                 end;
                 end;
@@ -603,42 +603,42 @@ implementation
 
 
     procedure TDebugInfoDwarf.append_labelentry(attr : tdwarf_attribute;sym : tasmsymbol);
     procedure TDebugInfoDwarf.append_labelentry(attr : tdwarf_attribute;sym : tasmsymbol);
       begin
       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;
       end;
 
 
 
 
     procedure TDebugInfoDwarf.append_labelentry_ref(attr : tdwarf_attribute;sym : tasmsymbol);
     procedure TDebugInfoDwarf.append_labelentry_ref(attr : tdwarf_attribute;sym : tasmsymbol);
       begin
       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;
       end;
 
 
 
 
     procedure TDebugInfoDwarf.append_labelentry_data(attr : tdwarf_attribute;sym : tasmsymbol);
     procedure TDebugInfoDwarf.append_labelentry_data(attr : tdwarf_attribute;sym : tasmsymbol);
       begin
       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}
 {$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}
 {$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}
 {$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;
       end;
 
 
 
 
     procedure TDebugInfoDwarf.finish_entry;
     procedure TDebugInfoDwarf.finish_entry;
       begin
       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;
       end;
 
 
 
 
     procedure TDebugInfoDwarf.finish_children;
     procedure TDebugInfoDwarf.finish_children;
       begin
       begin
-        asmlist[al_dwarf_info].concat(tai_const.create_8bit(0));
+        current_asmdata.asmlists[al_dwarf_info].concat(tai_const.create_8bit(0));
       end;
       end;
 
 
 
 
@@ -652,8 +652,8 @@ implementation
               DW_AT_name,DW_FORM_string,tsym(p).name+#0,
               DW_AT_name,DW_FORM_string,tsym(p).name+#0,
               DW_AT_data_member_location,DW_FORM_block1,1+lengthuleb128(tfieldvarsym(p).fieldoffset)
               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));
             append_labelentry_ref(DW_AT_type,def_dwarf_lab(tfieldvarsym(p).vartype.def));
             finish_entry;
             finish_entry;
@@ -666,7 +666,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TDebugInfoDwarf.append_dwarftag(list:taasmoutput;def:tdef);
+    procedure TDebugInfoDwarf.append_dwarftag(list:TAsmList;def:tdef);
 
 
       procedure append_dwarftag_orddef(def:torddef);
       procedure append_dwarftag_orddef(def:torddef);
         begin
         begin
@@ -904,11 +904,11 @@ implementation
               { !!! FIXME !!! }
               { !!! FIXME !!! }
               { gdb's dwarf implementation sucks, so we can't use DW_OP_push_object here (FK)
               { gdb's dwarf implementation sucks, so we can't use DW_OP_push_object here (FK)
               { insert location attribute manually }
               { 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;
               finish_entry;
@@ -972,8 +972,8 @@ implementation
                   DW_AT_accessibility,DW_FORM_data1,DW_ACCESS_public,
                   DW_AT_accessibility,DW_FORM_data1,DW_ACCESS_public,
                   DW_AT_data_member_location,DW_FORM_block1,1+lengthuleb128(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(def.childof));
                 append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.childof));
                 finish_entry;
                 finish_entry;
               end;
               end;
@@ -997,13 +997,13 @@ implementation
             odt_dispinterface,
             odt_dispinterface,
             odt_class:
             odt_class:
               begin
               begin
-                objectlibrary.getdatalabel(obj);
+                current_asmdata.getdatalabel(obj);
                 { implicit pointer }
                 { implicit pointer }
                 append_entry(DW_TAG_pointer_type,false,[]);
                 append_entry(DW_TAG_pointer_type,false,[]);
                 append_labelentry_ref(DW_AT_type,obj);
                 append_labelentry_ref(DW_AT_type,obj);
                 finish_entry;
                 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;
                 doappend;
               end;
               end;
             else
             else
@@ -1035,7 +1035,7 @@ implementation
                   slen:=255;
                   slen:=255;
 
 
                 { create a structure with two elements }
                 { create a structure with two elements }
-                objectlibrary.getdatalabel(arr);
+                current_asmdata.getdatalabel(arr);
                 append_entry(DW_TAG_structure_type,true,[
                 append_entry(DW_TAG_structure_type,true,[
                   DW_AT_name,DW_FORM_string,'ShortString'#0,
                   DW_AT_name,DW_FORM_string,'ShortString'#0,
                   DW_AT_byte_size,DW_FORM_data1,2*sizeof(aint)
                   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_name,DW_FORM_string,'Length'#0,
                   DW_AT_data_member_location,DW_FORM_block1,1+lengthuleb128(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));
                 append_labelentry_ref(DW_AT_type,def_dwarf_lab(u8inttype.def));
                 finish_entry;
                 finish_entry;
 
 
@@ -1057,15 +1057,15 @@ implementation
                   DW_AT_name,DW_FORM_string,'Data'#0,
                   DW_AT_name,DW_FORM_string,'Data'#0,
                   DW_AT_data_member_location,DW_FORM_block1,1+lengthuleb128(1)
                   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);
                 append_labelentry_ref(DW_AT_type,arr);
                 finish_entry;
                 finish_entry;
 
 
                 finish_children;
                 finish_children;
 
 
                 { now the data array }
                 { 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,[
                 append_entry(DW_TAG_array_type,true,[
                   DW_AT_byte_size,DW_FORM_udata,def.size,
                   DW_AT_byte_size,DW_FORM_udata,def.size,
                   DW_AT_stride_size,DW_FORM_udata,1*8
                   DW_AT_stride_size,DW_FORM_udata,1*8
@@ -1146,7 +1146,7 @@ implementation
           if def.is_methodpointer then
           if def.is_methodpointer then
             begin
             begin
               { create a structure with two elements }
               { create a structure with two elements }
-              objectlibrary.getdatalabel(proc);
+              current_asmdata.getdatalabel(proc);
               append_entry(DW_TAG_structure_type,true,[
               append_entry(DW_TAG_structure_type,true,[
                 DW_AT_byte_size,DW_FORM_data1,2*sizeof(aint)
                 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_name,DW_FORM_string,'Proc'#0,
                 DW_AT_data_member_location,DW_FORM_block1,1+lengthuleb128(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);
               append_labelentry_ref(DW_AT_type,proc);
               finish_entry;
               finish_entry;
 
 
@@ -1167,14 +1167,14 @@ implementation
                 DW_AT_name,DW_FORM_string,'Self'#0,
                 DW_AT_name,DW_FORM_string,'Self'#0,
                 DW_AT_data_member_location,DW_FORM_block1,1+lengthuleb128(sizeof(aint))
                 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));
               append_labelentry_ref(DW_AT_type,def_dwarf_lab(class_tobject));
               finish_entry;
               finish_entry;
 
 
               finish_children;
               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;
               doappend;
             end
             end
           else
           else
@@ -1296,7 +1296,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TDebugInfoDwarf.insertdef(list:taasmoutput;def:tdef);
+    procedure TDebugInfoDwarf.insertdef(list:TAsmList;def:tdef);
       var
       var
         anc : tobjectdef;
         anc : tobjectdef;
         oldtypesym : tsym;
         oldtypesym : tsym;
@@ -1382,9 +1382,9 @@ implementation
       end;
       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
          var
            p : tdef;
            p : tdef;
          begin
          begin
@@ -1419,7 +1419,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TDebugInfoDwarf.append_procdef(list:taasmoutput;pd:tprocdef);
+    procedure TDebugInfoDwarf.append_procdef(list:TAsmList;pd:tprocdef);
       var
       var
         procendlabel : tasmlabel;
         procendlabel : tasmlabel;
         mangled_length : longint;
         mangled_length : longint;
@@ -1436,16 +1436,16 @@ implementation
               }
               }
               ]);
               ]);
             { append block data }
             { 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
             if not(is_void(tprocdef(pd).rettype.def)) then
               append_labelentry_ref(DW_AT_type,def_dwarf_lab(tprocdef(pd).rettype.def));
               append_labelentry_ref(DW_AT_type,def_dwarf_lab(tprocdef(pd).rettype.def));
 
 
             { mark end of procedure }
             { 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);
             append_labelentry(DW_AT_high_pc,procendlabel);
 
 
             {
             {
@@ -1486,10 +1486,10 @@ implementation
 
 
             { last write the types from this procdef }
             { last write the types from this procdef }
             if assigned(pd.parast) then
             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
             if assigned(pd.localst) and
                (pd.localst.symtabletype=localsymtable) then
                (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;
             finish_children;
           end;
           end;
@@ -1497,11 +1497,11 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TDebugInfoDwarf.insertsym(list:taasmoutput;sym:tsym);
+    procedure TDebugInfoDwarf.insertsym(list:TAsmList;sym:tsym);
 
 
         procedure append_varsym(sym:tabstractnormalvarsym);
         procedure append_varsym(sym:tabstractnormalvarsym);
           var
           var
-            templist : taasmoutput;
+            templist : TAsmList;
             blocksize : longint;
             blocksize : longint;
             regidx : longint;
             regidx : longint;
             tag : tdwarf_tag;
             tag : tdwarf_tag;
@@ -1518,7 +1518,7 @@ implementation
             if (sym.owner.symtabletype=localsymtable) and (sym.refs=0) then
             if (sym.owner.symtabletype=localsymtable) and (sym.refs=0) then
               exit;
               exit;
 
 
-            templist:=taasmoutput.create;
+            templist:=TAsmList.create;
 
 
             case sym.localloc.loc of
             case sym.localloc.loc of
               LOC_REGISTER,
               LOC_REGISTER,
@@ -1580,7 +1580,7 @@ implementation
               DW_AT_location,DW_FORM_block1,blocksize
               DW_AT_location,DW_FORM_block1,blocksize
               ]);
               ]);
             { append block data }
             { 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));
             append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.vartype.def));
 
 
             templist.free;
             templist.free;
@@ -1597,13 +1597,13 @@ implementation
             { for string constants, consttype isn't set because they have no real type }
             { for string constants, consttype isn't set because they have no real type }
             if not(sym.consttyp in [conststring,constresourcestring]) then
             if not(sym.consttyp in [conststring,constresourcestring]) then
               append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.consttype.def));
               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
             case sym.consttyp of
               conststring:
               conststring:
                 begin
                 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;
                 end;
               constset,
               constset,
               constwstring,
               constwstring,
@@ -1611,55 +1611,55 @@ implementation
               constresourcestring:
               constresourcestring:
                 begin
                 begin
                   { write dummy for now }
                   { 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;
                 end;
               constord:
               constord:
                 begin
                 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;
                 end;
               constnil:
               constnil:
                 begin
                 begin
 {$ifdef cpu64bit}
 {$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}
 {$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}
 {$endif cpu64bit}
                 end;
                 end;
               constpointer:
               constpointer:
                 begin
                 begin
 {$ifdef cpu64bit}
 {$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}
 {$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}
 {$endif cpu64bit}
                 end;
                 end;
               constreal:
               constreal:
                 begin
                 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
                   case tfloatdef(sym.consttype.def).typ of
                     s32real:
                     s32real:
                       begin
                       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;
                       end;
                     s64comp,
                     s64comp,
                     s64currency,
                     s64currency,
                     s64real:
                     s64real:
                       begin
                       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;
                       end;
                     s80real:
                     s80real:
                       begin
                       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;
                       end;
                     else
                     else
                       internalerror(200601291);
                       internalerror(200601291);
@@ -1683,11 +1683,11 @@ implementation
 
 
         procedure append_absolutesym(sym:tabsolutevarsym);
         procedure append_absolutesym(sym:tabsolutevarsym);
           var
           var
-            templist : taasmoutput;
+            templist : TAsmList;
             blocksize : longint;
             blocksize : longint;
             symlist : psymlistitem;
             symlist : psymlistitem;
           begin
           begin
-            templist:=taasmoutput.create;
+            templist:=TAsmList.create;
             case tabsolutevarsym(sym).abstyp of
             case tabsolutevarsym(sym).abstyp of
               toaddr :
               toaddr :
                 begin
                 begin
@@ -1729,7 +1729,7 @@ implementation
               DW_AT_location,DW_FORM_block1,blocksize
               DW_AT_location,DW_FORM_block1,blocksize
               ]);
               ]);
             { append block data }
             { 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));
             append_labelentry_ref(DW_AT_type,def_dwarf_lab(sym.vartype.def));
 
 
             templist.free;
             templist.free;
@@ -1768,8 +1768,8 @@ implementation
                 DW_AT_location,DW_FORM_block1,1+sizeof(aword)
                 DW_AT_location,DW_FORM_block1,1+sizeof(aword)
               ]);
               ]);
               { append block data }
               { 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));
               append_labelentry_ref(DW_AT_type,def_dwarf_lab(ttypedconstsym(sym).typedconsttype.def));
 
 
               finish_entry;
               finish_entry;
@@ -1813,7 +1813,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TDebugInfoDwarf.write_symtable_syms(list:taasmoutput;st:tsymtable);
+    procedure TDebugInfoDwarf.write_symtable_syms(list:TAsmList;st:tsymtable);
       var
       var
         p : tsym;
         p : tsym;
       begin
       begin
@@ -1841,34 +1841,34 @@ implementation
 
 
     procedure TDebugInfoDwarf.insertmoduleinfo;
     procedure TDebugInfoDwarf.insertmoduleinfo;
       var
       var
-        templist : taasmoutput;
+        templist : TAsmList;
       begin
       begin
         { insert .Ltext0 label }
         { insert .Ltext0 label }
-        templist:=taasmoutput.create;
+        templist:=TAsmList.create;
         new_section(templist,sec_code,'',0);
         new_section(templist,sec_code,'',0);
         templist.concat(tai_symbol.createname('.Ltext0',AT_DATA,0));
         templist.concat(tai_symbol.createname('.Ltext0',AT_DATA,0));
-        asmlist[al_start].insertlist(templist);
+        current_asmdata.asmlists[al_start].insertlist(templist);
         templist.free;
         templist.free;
 
 
         { insert .Letext0 label }
         { insert .Letext0 label }
-        templist:=taasmoutput.create;
+        templist:=TAsmList.create;
         new_section(templist,sec_code,'',0);
         new_section(templist,sec_code,'',0);
         templist.concat(tai_symbol.createname('.Letext0',AT_DATA,0));
         templist.concat(tai_symbol.createname('.Letext0',AT_DATA,0));
-        asmlist[al_end].insertlist(templist);
+        current_asmdata.asmlists[al_end].insertlist(templist);
         templist.free;
         templist.free;
 
 
         { insert .Ldebug_abbrev0 label }
         { insert .Ldebug_abbrev0 label }
-        templist:=taasmoutput.create;
+        templist:=TAsmList.create;
         new_section(templist,sec_debug_abbrev,'',0);
         new_section(templist,sec_debug_abbrev,'',0);
         templist.concat(tai_symbol.createname('.Ldebug_abbrev0',AT_DATA,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;
         templist.free;
 
 
         { insert .Ldebug_line0 label }
         { insert .Ldebug_line0 label }
-        templist:=taasmoutput.create;
+        templist:=TAsmList.create;
         new_section(templist,sec_debug_line,'',0);
         new_section(templist,sec_debug_line,'',0);
         templist.concat(tai_symbol.createname('.Ldebug_line0',AT_DATA,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;
         templist.free;
       end;
       end;
 
 
@@ -1896,31 +1896,31 @@ implementation
         }
         }
 
 
         { write start labels }
         { 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 }
         { 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 }
         { debug info header }
-        objectlibrary.getlabel(lenstartlabel,alt_dbgfile);
+        current_asmdata.getlabel(lenstartlabel,alt_dbgfile);
         { size }
         { size }
         { currently we create only 32 bit dwarf }
         { 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)));
           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 }
         { 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 }
         { abbrev table }
         if isdwarf64 then
         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
         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 }
         { 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,[
         append_entry(DW_TAG_compile_unit,true,[
           DW_AT_name,DW_FORM_string,FixFileName(current_module.sourcefiles.get_file(1).name^)+#0,
           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]);
           DW_AT_identifier_case,DW_FORM_data1,DW_ID_case_insensitive]);
 
 
         { reference to line info section }
         { 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;
         finish_entry;
 
 
         { first write all global/local symbols. This will flag all required tdefs }
         { first write all global/local symbols. This will flag all required tdefs }
         if assigned(current_module.globalsymtable) then
         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
         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 flag }
         reset_unit_type_info;
         reset_unit_type_info;
 
 
         { write used types from the used units }
         { 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 }
         { last write the types from this unit }
         if assigned(current_module.globalsymtable) then
         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
         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 }
         { close compilation unit entry }
         finish_children;
         finish_children;
 
 
         { end of debug info table }
         { 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 }
        { reset all def labels }
         for i:=0 to defnumberlist.count-1 do
         for i:=0 to defnumberlist.count-1 do
           begin
           begin
@@ -1977,12 +1977,12 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TDebugInfoDwarf.referencesections(list:taasmoutput);
+    procedure TDebugInfoDwarf.referencesections(list:TAsmList);
       begin
       begin
       end;
       end;
 
 
 
 
-    procedure TDebugInfoDwarf.insertlineinfo(list:taasmoutput);
+    procedure TDebugInfoDwarf.insertlineinfo(list:TAsmList);
       var
       var
         currfileinfo,
         currfileinfo,
         lastfileinfo : tfileposinfo;
         lastfileinfo : tfileposinfo;

+ 39 - 39
compiler/dbgstabs.pas

@@ -29,7 +29,7 @@ interface
       cclasses,
       cclasses,
       dbgbase,
       dbgbase,
       symtype,symdef,symsym,symtable,symbase,
       symtype,symdef,symsym,symtable,symbase,
-      aasmtai;
+      aasmtai,aasmdata;
 
 
     type
     type
       TDebugInfoStabs=class(TDebugInfo)
       TDebugInfoStabs=class(TDebugInfo)
@@ -40,7 +40,7 @@ interface
         { tsym writing }
         { tsym writing }
         function  sym_var_value(const s:string;arg:pointer):string;
         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;
         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 }
         { tdef writing }
         function  def_stab_number(def:tdef):string;
         function  def_stab_number(def:tdef):string;
         function  def_stab_classnumber(def:tobjectdef):string;
         function  def_stab_classnumber(def:tobjectdef):string;
@@ -49,16 +49,16 @@ interface
         procedure field_add_stabstr(p:Tnamedindexitem;arg:pointer);
         procedure field_add_stabstr(p:Tnamedindexitem;arg:pointer);
         procedure method_add_stabstr(p:Tnamedindexitem;arg:pointer);
         procedure method_add_stabstr(p:Tnamedindexitem;arg:pointer);
         function  def_stabstr(def:tdef):pchar;
         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
       public
         procedure inserttypeinfo;override;
         procedure inserttypeinfo;override;
         procedure insertmoduleinfo;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;
       end;
 
 
 
 
@@ -736,7 +736,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TDebugInfoStabs.write_def_stabstr(list:taasmoutput;def:tdef);
+    procedure TDebugInfoStabs.write_def_stabstr(list:TAsmList;def:tdef);
       var
       var
         stabchar : string[2];
         stabchar : string[2];
         ss,st,su : pchar;
         ss,st,su : pchar;
@@ -776,7 +776,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TDebugInfoStabs.insertdef(list:taasmoutput;def:tdef);
+    procedure TDebugInfoStabs.insertdef(list:TAsmList;def:tdef);
       var
       var
         anc : tobjectdef;
         anc : tobjectdef;
         oldtypesym : tsym;
         oldtypesym : tsym;
@@ -882,9 +882,9 @@ implementation
       end;
       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
          var
            p : tdef;
            p : tdef;
          begin
          begin
@@ -919,9 +919,9 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TDebugInfoStabs.write_procdef(list:taasmoutput;pd:tprocdef);
+    procedure TDebugInfoStabs.write_procdef(list:TAsmList;pd:tprocdef);
       var
       var
-        templist : taasmoutput;
+        templist : TAsmList;
         stabsendlabel : tasmlabel;
         stabsendlabel : tasmlabel;
         mangled_length : longint;
         mangled_length : longint;
         p : pchar;
         p : pchar;
@@ -929,7 +929,7 @@ implementation
       begin
       begin
         if assigned(pd.procstarttai) then
         if assigned(pd.procstarttai) then
           begin
           begin
-            templist:=taasmoutput.create;
+            templist:=TAsmList.create;
             { para types }
             { para types }
             write_def_stabstr(templist,pd);
             write_def_stabstr(templist,pd);
             if assigned(pd.parast) then
             if assigned(pd.parast) then
@@ -939,9 +939,9 @@ implementation
             if assigned(pd.localst) and
             if assigned(pd.localst) and
                (pd.localst.symtabletype=localsymtable) then
                (pd.localst.symtabletype=localsymtable) then
               write_symtable_syms(templist,pd.localst);
               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 }
             { end of procedure }
-            objectlibrary.getlabel(stabsendlabel,alt_dbgtype);
+            current_asmdata.getlabel(stabsendlabel,alt_dbgtype);
             templist.concat(tai_label.create(stabsendlabel));
             templist.concat(tai_label.create(stabsendlabel));
             if assigned(pd.funcretsym) and
             if assigned(pd.funcretsym) and
                (tabstractnormalvarsym(pd.funcretsym).refs>0) then
                (tabstractnormalvarsym(pd.funcretsym).refs>0) then
@@ -983,7 +983,7 @@ implementation
               end;
               end;
             templist.concat(Tai_stab.Create(stab_stabn,strnew(p)));
             templist.concat(Tai_stab.Create(stab_stabn,strnew(p)));
             freemem(p,2*mangled_length+50);
             freemem(p,2*mangled_length+50);
-            asmlist[al_procedures].insertlistbefore(pd.procendtai,templist);
+            current_asmdata.asmlists[al_procedures].insertlistbefore(pd.procendtai,templist);
             templist.free;
             templist.free;
           end;
           end;
       end;
       end;
@@ -1030,7 +1030,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TDebugInfoStabs.insertsym(list:taasmoutput;sym:tsym);
+    procedure TDebugInfoStabs.insertsym(list:TAsmList;sym:tsym);
 
 
         function fieldvarsym_stabstr(sym:tfieldvarsym):Pchar;
         function fieldvarsym_stabstr(sym:tfieldvarsym):Pchar;
           begin
           begin
@@ -1285,7 +1285,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure TDebugInfoStabs.write_symtable_syms(list:taasmoutput;st:tsymtable);
+    procedure TDebugInfoStabs.write_symtable_syms(list:TAsmList;st:tsymtable);
       var
       var
         p : tsym;
         p : tsym;
       begin
       begin
@@ -1317,7 +1317,7 @@ implementation
     procedure tdebuginfostabs.inserttypeinfo;
     procedure tdebuginfostabs.inserttypeinfo;
       var
       var
         stabsvarlist,
         stabsvarlist,
-        stabstypelist : taasmoutput;
+        stabstypelist : TAsmList;
         storefilepos  : tfileposinfo;
         storefilepos  : tfileposinfo;
         st : tsymtable;
         st : tsymtable;
         i  : longint;
         i  : longint;
@@ -1327,8 +1327,8 @@ implementation
 
 
         global_stab_number:=0;
         global_stab_number:=0;
         defnumberlist:=TFPObjectlist.create(false);
         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 symbol that will be referenced from the main to be sure to
           include this debuginfo .o file }
           include this debuginfo .o file }
@@ -1339,8 +1339,8 @@ implementation
           end
           end
         else
         else
           st:=current_module.localsymtable;
           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  }
         { first write all global/local symbols. This will flag all required tdefs  }
         if assigned(current_module.globalsymtable) then
         if assigned(current_module.globalsymtable) then
@@ -1359,8 +1359,8 @@ implementation
         if assigned(current_module.localsymtable) then
         if assigned(current_module.localsymtable) then
           write_symtable_defs(stabstypelist,current_module.localsymtable);
           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 }
         { reset stab numbers }
         for i:=0 to defnumberlist.count-1 do
         for i:=0 to defnumberlist.count-1 do
@@ -1381,7 +1381,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure tdebuginfostabs.insertlineinfo(list:taasmoutput);
+    procedure tdebuginfostabs.insertlineinfo(list:TAsmList);
       var
       var
         currfileinfo,
         currfileinfo,
         lastfileinfo : tfileposinfo;
         lastfileinfo : tfileposinfo;
@@ -1417,7 +1417,7 @@ implementation
                     infile:=current_module.sourcefiles.get_file(currfileinfo.fileindex);
                     infile:=current_module.sourcefiles.get_file(currfileinfo.fileindex);
                     if assigned(infile) then
                     if assigned(infile) then
                       begin
                       begin
-                        objectlibrary.getlabel(hlabel,alt_dbgfile);
+                        current_asmdata.getlabel(hlabel,alt_dbgfile);
                         { emit stabs }
                         { emit stabs }
                         if (infile.path^<>'') then
                         if (infile.path^<>'') then
                           list.insertbefore(Tai_stab.Create_str(stab_stabs,'"'+BsToSlash(FixPath(infile.path^,false))+'",'+tostr(n_includefile)+
                           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
                      if assigned(currfuncname) and
                         (tf_use_function_relative_addresses in target_info.flags) then
                         (tf_use_function_relative_addresses in target_info.flags) then
                       begin
                       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)+','+
                         list.insertbefore(Tai_stab.Create_str(stab_stabn,tostr(n_textline)+',0,'+tostr(currfileinfo.line)+','+
                                           hlabel.name+' - '+{$IFDEF POWERPC64}'.'+{$ENDIF POWERPC64}currfuncname^),hp);
                                           hlabel.name+' - '+{$IFDEF POWERPC64}'.'+{$ENDIF POWERPC64}currfuncname^),hp);
                         list.insertbefore(tai_label.create(hlabel),hp);
                         list.insertbefore(tai_label.create(hlabel),hp);
@@ -1456,12 +1456,12 @@ implementation
       var
       var
         hlabel : tasmlabel;
         hlabel : tasmlabel;
         infile : tinputfile;
         infile : tinputfile;
-        templist : taasmoutput;
+        templist : TAsmList;
       begin
       begin
         { emit main source n_sourcefile for start of module }
         { 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);
         infile:=current_module.sourcefiles.get_file(1);
-        templist:=taasmoutput.create;
+        templist:=TAsmList.create;
         new_section(templist,sec_code,'',0);
         new_section(templist,sec_code,'',0);
         if (infile.path^<>'') then
         if (infile.path^<>'') then
           templist.concat(Tai_stab.Create_str(stab_stabs,'"'+BsToSlash(FixPath(infile.path^,false))+'",'+tostr(n_sourcefile)+
           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)+
         templist.concat(Tai_stab.Create_str(stab_stabs,'"'+FixFileName(infile.name^)+'",'+tostr(n_sourcefile)+
                     ',0,0,'+hlabel.name));
                     ',0,0,'+hlabel.name));
         templist.concat(tai_label.create(hlabel));
         templist.concat(tai_label.create(hlabel));
-        asmlist[al_start].insertlist(templist);
+        current_asmdata.asmlists[al_start].insertlist(templist);
         templist.free;
         templist.free;
         { emit empty n_sourcefile for end of module }
         { 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);
         new_section(templist,sec_code,'',0);
         templist.concat(Tai_stab.Create_str(stab_stabs,'"",'+tostr(n_sourcefile)+',0,0,'+hlabel.name));
         templist.concat(Tai_stab.Create_str(stab_stabs,'"",'+tostr(n_sourcefile)+',0,0,'+hlabel.name));
         templist.concat(tai_label.create(hlabel));
         templist.concat(tai_label.create(hlabel));
-        asmlist[al_end].insertlist(templist);
+        current_asmdata.asmlists[al_end].insertlist(templist);
         templist.free;
         templist.free;
       end;
       end;
 
 
 
 
-    procedure tdebuginfostabs.referencesections(list:taasmoutput);
+    procedure tdebuginfostabs.referencesections(list:TAsmList);
       var
       var
         hp   : tused_unit;
         hp   : tused_unit;
       begin
       begin

+ 5 - 2
compiler/finput.pas

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

+ 22 - 20
compiler/fmodule.pas

@@ -44,7 +44,7 @@ interface
     uses
     uses
        cutils,cclasses,
        cutils,cclasses,
        globals,finput,
        globals,finput,
-       symbase,symsym,aasmbase;
+       symbase,symsym,aasmbase,aasmtai,aasmdata;
 
 
 
 
     type
     type
@@ -129,8 +129,10 @@ interface
         localsymtable : tsymtable;{ pointer to the local symtable of this unit }
         localsymtable : tsymtable;{ pointer to the local symtable of this unit }
         globalmacrosymtable,           { pointer to the global macro 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 }
         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;
         loaded_from   : tmodule;
         uses_imports  : boolean;  { Set if the module imports from DLL's.}
         uses_imports  : boolean;  { Set if the module imports from DLL's.}
         imports       : tlinkedlist;
         imports       : tlinkedlist;
@@ -153,8 +155,6 @@ interface
         localincludesearchpath,
         localincludesearchpath,
         locallibrarysearchpath : TSearchPathList;
         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
         {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
         points to the module calling it. It is nil for the first compiled
         module. This allow inheritence of all path lists. MUST pay attention
         module. This allow inheritence of all path lists. MUST pay attention
@@ -454,7 +454,7 @@ implementation
         imports:=TLinkedList.Create;
         imports:=TLinkedList.Create;
         _exports:=TLinkedList.Create;
         _exports:=TLinkedList.Create;
         externals:=TLinkedList.Create;
         externals:=TLinkedList.Create;
-        librarydata:=TObjLibraryData.create(realmodulename^);
+        asmdata:=TAsmData.create(realmodulename^);
       end;
       end;
 
 
 
 
@@ -488,6 +488,12 @@ implementation
              current_scanner:=nil;
              current_scanner:=nil;
             tscannerfile(scanner).free;
             tscannerfile(scanner).free;
          end;
          end;
+        if assigned(asmdata) then
+          begin
+            if current_asmdata=asmdata then
+              current_asmdata:=nil;
+             asmdata.free;
+          end;
         if assigned(procinfo) then
         if assigned(procinfo) then
           begin
           begin
             if current_procinfo=tprocinfo(procinfo) then
             if current_procinfo=tprocinfo(procinfo) then
@@ -540,16 +546,6 @@ implementation
 {$ifdef MEMDEBUG}
 {$ifdef MEMDEBUG}
         d.free;
         d.free;
 {$endif}
 {$endif}
-        if assigned(librarydata) then
-          begin
-{$ifdef MEMDEBUG}
-            d:=tmemdebug.create(modulename^+' - librarydata');
-{$endif}
-            librarydata.free;
-{$ifdef MEMDEBUG}
-            d.free;
-{$endif}
-          end;
         stringdispose(modulename);
         stringdispose(modulename);
         inherited Destroy;
         inherited Destroy;
       end;
       end;
@@ -581,6 +577,13 @@ implementation
                procinfo:=hpi;
                procinfo:=hpi;
              end;
              end;
           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
         if assigned(globalsymtable) then
           begin
           begin
             globalsymtable.free;
             globalsymtable.free;
@@ -621,8 +624,7 @@ implementation
         derefdataintflen:=0;
         derefdataintflen:=0;
         sourcefiles.free;
         sourcefiles.free;
         sourcefiles:=tinputfilemanager.create;
         sourcefiles:=tinputfilemanager.create;
-        librarydata.free;
-        librarydata:=TObjLibraryData.create(realmodulename^);
+        asmdata:=TAsmData.create(realmodulename^);
         imports.free;
         imports.free;
         imports:=tlinkedlist.create;
         imports:=tlinkedlist.create;
         _exports.free;
         _exports.free;
@@ -838,8 +840,8 @@ implementation
         modulename:=stringdup(upper(s));
         modulename:=stringdup(upper(s));
         realmodulename:=stringdup(s);
         realmodulename:=stringdup(s);
         { also update asmlibrary names }
         { also update asmlibrary names }
-        librarydata.name:=modulename^;
-        librarydata.realname:=realmodulename^;
+        current_asmdata.name:=modulename^;
+        current_asmdata.realname:=realmodulename^;
       end;
       end;
 
 
 end.
 end.

+ 1 - 0
compiler/fppu.pas

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

+ 12 - 12
compiler/i386/ag386nsm.pas

@@ -28,7 +28,7 @@ interface
 
 
     uses
     uses
       cpubase,
       cpubase,
-      aasmbase,aasmtai,aasmcpu,assemble,cgutils;
+      aasmbase,aasmtai,aasmdata,aasmcpu,assemble,cgutils;
 
 
     type
     type
       T386NasmAssembler = class(texternalassembler)
       T386NasmAssembler = class(texternalassembler)
@@ -38,7 +38,7 @@ interface
         procedure WriteOper_jmp(const o:toper; op : tasmop);
         procedure WriteOper_jmp(const o:toper; op : tasmop);
         procedure WriteSection(atype:TAsmSectiontype;const aname:string);
         procedure WriteSection(atype:TAsmSectiontype;const aname:string);
       public
       public
-        procedure WriteTree(p:taasmoutput);override;
+        procedure WriteTree(p:TAsmList);override;
         procedure WriteAsmList;override;
         procedure WriteAsmList;override;
         procedure WriteExternals;
         procedure WriteExternals;
       end;
       end;
@@ -384,7 +384,7 @@ interface
         LasTSecType:=atype;
         LasTSecType:=atype;
       end;
       end;
 
 
-    procedure T386NasmAssembler.WriteTree(p:taasmoutput);
+    procedure T386NasmAssembler.WriteTree(p:TAsmList);
     var
     var
       s : string;
       s : string;
       hp       : tai;
       hp       : tai;
@@ -404,7 +404,7 @@ interface
       { lineinfo is only needed for al_procedures (PFV) }
       { lineinfo is only needed for al_procedures (PFV) }
       do_line:=(cs_asm_source in aktglobalswitches) or
       do_line:=(cs_asm_source in aktglobalswitches) or
                ((cs_lineinfo in aktmoduleswitches)
                ((cs_lineinfo in aktmoduleswitches)
-                 and (p=asmlist[al_procedures]));
+                 and (p=current_asmdata.asmlists[al_procedures]));
       hp:=tai(p.first);
       hp:=tai(p.first);
       while assigned(hp) do
       while assigned(hp) do
        begin
        begin
@@ -749,9 +749,9 @@ interface
              end;
              end;
 
 
            ait_marker :
            ait_marker :
-             if tai_marker(hp).kind=InlineStart then
+             if tai_marker(hp).kind=mark_InlineStart then
                inc(InlineLevel)
                inc(InlineLevel)
-             else if tai_marker(hp).kind=InlineEnd then
+             else if tai_marker(hp).kind=mark_InlineEnd then
                dec(InlineLevel);
                dec(InlineLevel);
 
 
            ait_directive :
            ait_directive :
@@ -789,13 +789,13 @@ interface
     procedure T386NasmAssembler.WriteExternals;
     procedure T386NasmAssembler.WriteExternals;
       begin
       begin
         currentasmlist:=self;
         currentasmlist:=self;
-        objectlibrary.symbolsearch.foreach_static(@writeexternal,nil);
+        current_asmdata.AsmSymbolDict.foreach_static(@writeexternal,nil);
       end;
       end;
 
 
 
 
     procedure T386NasmAssembler.WriteAsmList;
     procedure T386NasmAssembler.WriteAsmList;
     var
     var
-      hal : tasmlist;
+      hal : tasmlisttype;
     begin
     begin
 {$ifdef EXTDEBUG}
 {$ifdef EXTDEBUG}
       if assigned(current_module.mainsource) then
       if assigned(current_module.mainsource) then
@@ -811,11 +811,11 @@ interface
 
 
       WriteExternals;
       WriteExternals;
 
 
-      for hal:=low(Tasmlist) to high(Tasmlist) do
+      for hal:=low(TasmlistType) to high(TasmlistType) do
         begin
         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;
         end;
 
 
       AsmLn;
       AsmLn;

+ 8 - 8
compiler/i386/aopt386.pas

@@ -27,9 +27,9 @@ Unit aopt386;
 Interface
 Interface
 
 
 Uses
 Uses
-  aasmbase,aasmtai,aasmcpu;
+  aasmbase,aasmtai,aasmdata,aasmcpu;
 
 
-Procedure Optimize(AsmL: TAasmOutput);
+Procedure Optimize(AsmL: TAsmList);
 
 
 
 
 Implementation
 Implementation
@@ -40,7 +40,7 @@ Uses
   DAOpt386,POpt386,CSOpt386;
   DAOpt386,POpt386,CSOpt386;
 
 
 
 
-Procedure Optimize(AsmL: TAAsmOutput);
+Procedure Optimize(AsmL: TAsmList);
 Var
 Var
   BlockStart, BlockEnd, HP: Tai;
   BlockStart, BlockEnd, HP: Tai;
   pass: longint;
   pass: longint;
@@ -60,7 +60,7 @@ Begin
    { Setup labeltable, always necessary }
    { Setup labeltable, always necessary }
      blockstart := tai(asml.first);
      blockstart := tai(asml.first);
      blockend := dfa.pass_1(blockstart);
      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                                                                }
    { or nil                                                                }
      While Assigned(BlockStart) Do
      While Assigned(BlockStart) Do
        Begin
        Begin
@@ -91,17 +91,17 @@ Begin
          BlockStart := BlockEnd;
          BlockStart := BlockEnd;
          While Assigned(BlockStart) And
          While Assigned(BlockStart) And
                (BlockStart.typ = ait_Marker) And
                (BlockStart.typ = ait_Marker) And
-               (Tai_Marker(BlockStart).Kind = AsmBlockStart) Do
+               (Tai_Marker(BlockStart).Kind = mark_AsmBlockStart) Do
            Begin
            Begin
            { We stopped at an assembler block, so skip it }
            { We stopped at an assembler block, so skip it }
             Repeat
             Repeat
               BlockStart := Tai(BlockStart.Next);
               BlockStart := Tai(BlockStart.Next);
             Until (BlockStart.Typ = Ait_Marker) And
             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
              If GetNextInstruction(BlockStart, HP) And
                 ((HP.typ <> ait_Marker) Or
                 ((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 }
              { There is no assembler block anymore after the current one, so }
              { optimize the next block of "normal" instructions              }
              { optimize the next block of "normal" instructions              }
                BlockEnd := dfa.pass_1(blockstart)
                BlockEnd := dfa.pass_1(blockstart)

+ 36 - 36
compiler/i386/cgcpu.pas

@@ -28,7 +28,7 @@ unit cgcpu;
     uses
     uses
        globtype,
        globtype,
        cgbase,cgobj,cg64f32,cgx86,
        cgbase,cgobj,cg64f32,cgx86,
-       aasmbase,aasmtai,aasmcpu,
+       aasmbase,aasmtai,aasmdata,aasmcpu,
        cpubase,parabase,cgutils,
        cpubase,parabase,cgutils,
        symconst,symdef
        symconst,symdef
        ;
        ;
@@ -36,28 +36,28 @@ unit cgcpu;
     type
     type
       tcg386 = class(tcgx86)
       tcg386 = class(tcgx86)
         procedure init_register_allocators;override;
         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 }
         { 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;
      end;
 
 
       tcg64f386 = class(tcg64f32)
       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
       private
         procedure get_64bit_ops(op:TOpCG;var op1,op2:TAsmOp);
         procedure get_64bit_ops(op:TOpCG;var op1,op2:TAsmOp);
       end;
       end;
@@ -90,7 +90,7 @@ unit cgcpu;
         rgfpu:=Trgx86fpu.create;
         rgfpu:=Trgx86fpu.create;
       end;
       end;
 
 
-    procedure tcg386.do_register_allocation(list:Taasmoutput;headertai:tai);
+    procedure tcg386.do_register_allocation(list:TAsmList;headertai:tai);
       begin
       begin
         if pi_needs_got in current_procinfo.flags then
         if pi_needs_got in current_procinfo.flags then
           include(rg[R_INTREGISTER].used_in_proc,getsupreg(current_procinfo.got));
           include(rg[R_INTREGISTER].used_in_proc,getsupreg(current_procinfo.got));
@@ -98,7 +98,7 @@ unit cgcpu;
       end;
       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
       var
         pushsize : tcgsize;
         pushsize : tcgsize;
       begin
       begin
@@ -117,7 +117,7 @@ unit cgcpu;
       end;
       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
       var
         pushsize : tcgsize;
         pushsize : tcgsize;
       begin
       begin
@@ -135,7 +135,7 @@ unit cgcpu;
       end;
       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);
         procedure pushdata(paraloc:pcgparalocation;ofs:aint);
         var
         var
@@ -202,7 +202,7 @@ unit cgcpu;
       end;
       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
       var
         tmpreg : tregister;
         tmpreg : tregister;
         opsize : topsize;
         opsize : topsize;
@@ -241,7 +241,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure tcg386.g_proc_exit(list : taasmoutput;parasize:longint;nostackframe:boolean);
+    procedure tcg386.g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean);
       var
       var
         stacksize : longint;
         stacksize : longint;
       begin
       begin
@@ -328,7 +328,7 @@ unit cgcpu;
       end;
       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
       var
         power,len  : longint;
         power,len  : longint;
         opsize : topsize;
         opsize : topsize;
@@ -358,8 +358,8 @@ unit cgcpu;
         { so we have to access every page first              }
         { so we have to access every page first              }
         if target_info.system=system_i386_win32 then
         if target_info.system=system_i386_win32 then
           begin
           begin
-             objectlibrary.getjumplabel(again);
-             objectlibrary.getjumplabel(ok);
+             current_asmdata.getjumplabel(again);
+             current_asmdata.getjumplabel(ok);
              a_label(list,again);
              a_label(list,again);
              list.concat(Taicpu.op_const_reg(A_CMP,S_L,winstackpagesize,NR_EDI));
              list.concat(Taicpu.op_const_reg(A_CMP,S_L,winstackpagesize,NR_EDI));
              a_jmp_cond(list,OC_B,ok);
              a_jmp_cond(list,OC_B,ok);
@@ -444,7 +444,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure tcg386.g_exception_reason_save(list : taasmoutput; const href : treference);
+    procedure tcg386.g_exception_reason_save(list : TAsmList; const href : treference);
       begin
       begin
         if not use_fixed_stack then
         if not use_fixed_stack then
           list.concat(Taicpu.op_reg(A_PUSH,tcgsize2opsize[OS_INT],NR_FUNCTION_RESULT_REG))
           list.concat(Taicpu.op_reg(A_PUSH,tcgsize2opsize[OS_INT],NR_FUNCTION_RESULT_REG))
@@ -453,7 +453,7 @@ unit cgcpu;
       end;
       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
       begin
         if not use_fixed_stack then
         if not use_fixed_stack then
           list.concat(Taicpu.op_const(A_PUSH,tcgsize2opsize[OS_INT],a))
           list.concat(Taicpu.op_const(A_PUSH,tcgsize2opsize[OS_INT],a))
@@ -462,7 +462,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure tcg386.g_exception_reason_load(list : taasmoutput; const href : treference);
+    procedure tcg386.g_exception_reason_load(list : TAsmList; const href : treference);
       begin
       begin
         if not use_fixed_stack then
         if not use_fixed_stack then
           list.concat(Taicpu.op_reg(A_POP,tcgsize2opsize[OS_INT],NR_FUNCTION_RESULT_REG))
           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:
       possible calling conventions:
                     default stdcall cdecl pascal register
                     default stdcall cdecl pascal register
@@ -641,7 +641,7 @@ unit cgcpu;
         { case 0 }
         { case 0 }
         else
         else
           begin
           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));
             list.concat(taicpu.op_sym(A_JMP,S_NO,lab));
           end;
           end;
 
 
@@ -685,7 +685,7 @@ unit cgcpu;
       end;
       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
       var
         op1,op2 : TAsmOp;
         op1,op2 : TAsmOp;
         tempref : treference;
         tempref : treference;
@@ -698,7 +698,7 @@ unit cgcpu;
       end;
       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
       var
         op1,op2 : TAsmOp;
         op1,op2 : TAsmOp;
       begin
       begin
@@ -727,7 +727,7 @@ unit cgcpu;
       end;
       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
       var
         op1,op2 : TAsmOp;
         op1,op2 : TAsmOp;
       begin
       begin
@@ -750,7 +750,7 @@ unit cgcpu;
       end;
       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
       var
         op1,op2 : TAsmOp;
         op1,op2 : TAsmOp;
         tempref : treference;
         tempref : treference;

+ 3 - 3
compiler/i386/cpupara.pas

@@ -27,7 +27,7 @@ unit cpupara;
 
 
     uses
     uses
        globtype,
        globtype,
-       aasmtai,cpubase,cgbase,
+       aasmtai,aasmdata,cpubase,cgbase,
        symconst,symtype,symsym,symdef,
        symconst,symtype,symsym,symdef,
        parabase,paramgr;
        parabase,paramgr;
 
 
@@ -48,7 +48,7 @@ unit cpupara;
           procedure getintparaloc(calloption : tproccalloption; nr : longint;var cgpara:TCGPara);override;
           procedure getintparaloc(calloption : tproccalloption; nr : longint;var cgpara:TCGPara);override;
           function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
           function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
           function create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargsparalist):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
        private
           procedure create_funcretloc_info(p : tabstractprocdef; side: tcallercallee);
           procedure create_funcretloc_info(p : tabstractprocdef; side: tcallercallee);
           procedure create_stdcall_paraloc_info(p : tabstractprocdef; side: tcallercallee;paras:tparalist;var parasize:longint);
           procedure create_stdcall_paraloc_info(p : tabstractprocdef; side: tcallercallee;paras:tparalist;var parasize:longint);
@@ -614,7 +614,7 @@ unit cpupara;
       end;
       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
       var
         paraloc : pcgparalocation;
         paraloc : pcgparalocation;
       begin
       begin

+ 3 - 0
compiler/i386/cputarg.pas

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

+ 22 - 22
compiler/i386/csopt386.pas

@@ -26,9 +26,9 @@ unit CSOpt386;
 
 
 interface
 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 doReplaceReg(hp: taicpu; newReg, orgReg: tsuperregister): boolean;
 function changeOp(var o: toper; newReg, orgReg: tsuperregister): boolean;
 function changeOp(var o: toper; newReg, orgReg: tsuperregister): boolean;
@@ -832,7 +832,7 @@ begin
 end;
 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 }
 { first clears the contents of reg from p till endP. then the contents are }
 { cleared until the first instruction that changes reg                     }
 { cleared until the first instruction that changes reg                     }
 var
 var
@@ -883,7 +883,7 @@ begin
 {$endif replaceregdebug}
 {$endif replaceregdebug}
 end;
 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
 var
 {$ifdef replaceregdebug}
 {$ifdef replaceregdebug}
   l: longint;
   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;
           seqstart: tai; const c: TContent; orgRegCanBeModified: Boolean;
           var returnEndP: tai): Boolean;
           var returnEndP: tai): Boolean;
 { Tries to replace orgsupreg with newsupreg in all instructions coming after p }
 { Tries to replace orgsupreg with newsupreg in all instructions coming after p }
@@ -1482,7 +1482,7 @@ begin
 end;
 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  }
 { 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  }
 { possible that the contents are still used after p (used when removing  }
 { instructions because of a "call"), otherwise this is not necessary     }
 { instructions because of a "call"), otherwise this is not necessary     }
@@ -1619,7 +1619,7 @@ begin
 end;
 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
 var
   regsloaded: tregset;
   regsloaded: tregset;
   regloads, reguses: array[RS_EAX..RS_EDI] of tai;
   regloads, reguses: array[RS_EAX..RS_EDI] of tai;
@@ -1680,7 +1680,7 @@ begin
                 else
                 else
                   if assigned(regloads[reginfo.new2oldreg[regcounter]]) then
                   if assigned(regloads[reginfo.new2oldreg[regcounter]]) then
                     insertpos := regloads[reginfo.new2oldreg[regcounter]];
                     insertpos := regloads[reginfo.new2oldreg[regcounter]];
-                hp := Tai_Marker.Create(NoPropInfoStart);
+                hp := Tai_Marker.Create(mark_NoPropInfoStart);
                 InsertLLItem(asml, insertpos.previous,insertpos, hp);
                 InsertLLItem(asml, insertpos.previous,insertpos, hp);
                 hp2 := taicpu.Op_Reg_Reg(opc, S_L,
                 hp2 := taicpu.Op_Reg_Reg(opc, S_L,
                                            {old reg                                        new reg}
                                            {old reg                                        new reg}
@@ -1691,7 +1691,7 @@ begin
                 ptaiprop(hp2.optinfo)^ := ptaiprop(insertpos.optinfo)^;
                 ptaiprop(hp2.optinfo)^ := ptaiprop(insertpos.optinfo)^;
                 ptaiprop(hp2.optinfo)^.canBeRemoved := false;
                 ptaiprop(hp2.optinfo)^.canBeRemoved := false;
                 InsertLLItem(asml, insertpos.previous, insertpos, hp2);
                 InsertLLItem(asml, insertpos.previous, insertpos, hp2);
-                hp := Tai_Marker.Create(NoPropInfoEnd);
+                hp := Tai_Marker.Create(mark_NoPropInfoEnd);
                 InsertLLItem(asml, insertpos.previous, insertpos, hp);
                 InsertLLItem(asml, insertpos.previous, insertpos, hp);
                 { adjusts states in previous instruction so that it will  }
                 { adjusts states in previous instruction so that it will  }
                 { definitely be different from the previous or next state }
                 { definitely be different from the previous or next state }
@@ -1751,12 +1751,12 @@ begin
 end;
 end;
 
 
 
 
-procedure replaceoperandwithreg(asml: taasmoutput; p: tai; opnr: byte; reg: tregister);
+procedure replaceoperandwithreg(asml: TAsmList; p: tai; opnr: byte; reg: tregister);
 var
 var
   hp: tai;
   hp: tai;
 begin
 begin
   { new instruction -> it's info block is not in the big one allocated at the start }
   { 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);
   InsertLLItem(asml, p.previous,p, hp);
   { duplicate the original instruction and replace it's designated operant with the register }
   { duplicate the original instruction and replace it's designated operant with the register }
   hp := tai(p.getcopy);
   hp := tai(p.getcopy);
@@ -1770,12 +1770,12 @@ begin
   ptaiprop(p.optinfo)^.canBeRemoved := true;
   ptaiprop(p.optinfo)^.canBeRemoved := true;
   { insert end marker }
   { insert end marker }
   InsertLLItem(asml, p.previous, p, hp);
   InsertLLItem(asml, p.previous, p, hp);
-  hp := Tai_Marker.Create(NoPropInfoEnd);
+  hp := Tai_Marker.Create(mark_NoPropInfoEnd);
   InsertLLItem(asml, p.previous, p, hp);
   InsertLLItem(asml, p.previous, p, hp);
 end;
 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
 {marks the instructions that can be removed by RemoveInstructs. They're not
  removed immediately because sometimes an instruction needs to be checked in
  removed immediately because sometimes an instruction needs to be checked in
  two different sequences}
  two different sequences}
@@ -2028,7 +2028,7 @@ begin
                                   (RegLoadedWithNewValue(getsupreg(memreg),false,hp1) or
                                   (RegLoadedWithNewValue(getsupreg(memreg),false,hp1) or
                                    FindRegDealloc(getsupreg(memreg),hp1))) then
                                    FindRegDealloc(getsupreg(memreg),hp1))) then
                                 begin
                                 begin
-                                  hp1 := Tai_Marker.Create(NoPropInfoEnd);
+                                  hp1 := Tai_Marker.Create(mark_NoPropInfoEnd);
                                   insertllitem(asml,p,p.next,hp1);
                                   insertllitem(asml,p,p.next,hp1);
                                   hp1 := taicpu.op_reg_ref(A_MOV,reg2opsize(memreg),
                                   hp1 := taicpu.op_reg_ref(A_MOV,reg2opsize(memreg),
                                      memreg,taicpu(p).oper[0]^.ref^);
                                      memreg,taicpu(p).oper[0]^.ref^);
@@ -2038,7 +2038,7 @@ begin
                                   regcounter := getsupreg(memreg);
                                   regcounter := getsupreg(memreg);
                                   incstate(pTaiProp(hp1.optinfo)^.regs[regcounter].rstate,1);
                                   incstate(pTaiProp(hp1.optinfo)^.regs[regcounter].rstate,1);
                                   updatestate(regcounter,hp1);
                                   updatestate(regcounter,hp1);
-                                  hp1 := Tai_Marker.Create(NoPropInfoStart);
+                                  hp1 := Tai_Marker.Create(mark_NoPropInfoStart);
                                   insertllitem(asml,p,p.next,hp1);
                                   insertllitem(asml,p,p.next,hp1);
                                   replaceoperandwithreg(asml,p,0,memreg);
                                   replaceoperandwithreg(asml,p,0,memreg);
                                   allocregbetween(asml,memreg,hp5,
                                   allocregbetween(asml,memreg,hp5,
@@ -2081,7 +2081,7 @@ begin
                                   (RegLoadedWithNewValue(getsupreg(memreg),false,hp1) or
                                   (RegLoadedWithNewValue(getsupreg(memreg),false,hp1) or
                                    FindRegDealloc(getsupreg(memreg),hp1))) then
                                    FindRegDealloc(getsupreg(memreg),hp1))) then
                                 begin
                                 begin
-                                  hp1 := Tai_Marker.Create(NoPropInfoEnd);
+                                  hp1 := Tai_Marker.Create(mark_NoPropInfoEnd);
                                   insertllitem(asml,p,p.next,hp1);
                                   insertllitem(asml,p,p.next,hp1);
                                   hp1 := taicpu.op_reg_ref(A_MOV,reg2opsize(memreg),
                                   hp1 := taicpu.op_reg_ref(A_MOV,reg2opsize(memreg),
                                     memreg,taicpu(p).oper[1]^.ref^);
                                     memreg,taicpu(p).oper[1]^.ref^);
@@ -2091,7 +2091,7 @@ begin
                                   regcounter := getsupreg(memreg);
                                   regcounter := getsupreg(memreg);
                                   incstate(pTaiProp(hp1.optinfo)^.regs[regcounter].rstate,1);
                                   incstate(pTaiProp(hp1.optinfo)^.regs[regcounter].rstate,1);
                                   updatestate(regcounter,hp1);
                                   updatestate(regcounter,hp1);
-                                  hp1 := Tai_Marker.Create(NoPropInfoStart);
+                                  hp1 := Tai_Marker.Create(mark_NoPropInfoStart);
                                   insertllitem(asml,p,p.next,hp1);
                                   insertllitem(asml,p,p.next,hp1);
                                   replaceoperandwithreg(asml,p,1,memreg);
                                   replaceoperandwithreg(asml,p,1,memreg);
                                   allocregbetween(asml,memreg,hp5,
                                   allocregbetween(asml,memreg,hp5,
@@ -2109,7 +2109,7 @@ begin
     end;
     end;
 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 }
 { Removes the marked instructions and disposes the PTaiProps of the other }
 { instructions                                                            }
 { instructions                                                            }
 var
 var
@@ -2122,7 +2122,7 @@ begin
   while (p <> Last) do
   while (p <> Last) do
     begin
     begin
       if (p.typ = ait_marker) and
       if (p.typ = ait_marker) and
-         (Tai_marker(p).kind = noPropInfoStart) then
+         (Tai_marker(p).kind = mark_NoPropInfoStart) then
         begin
         begin
           hp1 := tai(p.next);
           hp1 := tai(p.next);
           asml.remove(p);
           asml.remove(p);
@@ -2138,8 +2138,8 @@ begin
                 begin
                 begin
                   case Tai_marker(hp1).kind of
                   case Tai_marker(hp1).kind of
                     { they can be nested! }
                     { they can be nested! }
-                    noPropInfoStart: inc(nopropinfolevel);
-                    noPropInfoEnd: dec(nopropinfolevel);
+                    mark_NoPropInfoStart: inc(nopropinfolevel);
+                    mark_NoPropInfoEnd: dec(nopropinfolevel);
                     else
                     else
                       begin
                       begin
                         hp1 := p;
                         hp1 := p;
@@ -2186,7 +2186,7 @@ begin
     end;
     end;
 end;
 end;
 
 
-function CSE(asml: TAAsmOutput; First, Last: tai; pass: longint): boolean;
+function CSE(asml: TAsmList; First, Last: tai; pass: longint): boolean;
 begin
 begin
   doCSE(asml, First, Last, not(cs_opt_asmcse in aktoptimizerswitches) or (pass >= 2),
   doCSE(asml, First, Last, not(cs_opt_asmcse in aktoptimizerswitches) or (pass >= 2),
         not(cs_opt_asmcse in aktoptimizerswitches) or (pass >= 1));
         not(cs_opt_asmcse in aktoptimizerswitches) or (pass >= 1));

+ 30 - 30
compiler/i386/daopt386.pas

@@ -29,7 +29,7 @@ interface
 
 
 uses
 uses
   globtype,
   globtype,
-  cclasses,aasmbase,aasmtai,aasmcpu,cgbase,cgutils,
+  cclasses,aasmbase,aasmtai,aasmdata,aasmcpu,cgbase,cgutils,
   cpubase,optbase;
   cpubase,optbase;
 
 
 {******************************* Constants *******************************}
 {******************************* Constants *******************************}
@@ -167,7 +167,7 @@ type
 
 
 {*********************** procedures and functions ************************}
 {*********************** 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;
 function RefsEqual(const R1, R2: TReference): Boolean;
@@ -193,11 +193,11 @@ function GetLastInstruction(Current: tai; var Last: tai): Boolean;
 procedure SkipHead(var p: tai);
 procedure SkipHead(var p: tai);
 function labelCanBeSkipped(p: tai_label): boolean;
 function labelCanBeSkipped(p: tai_label): boolean;
 
 
-procedure RemoveLastDeallocForFuncRes(asmL: TAAsmOutput; p: tai);
+procedure RemoveLastDeallocForFuncRes(asmL: TAsmList; p: tai);
 function regLoadedWithNewValue(supreg: tsuperregister; canDependOnPrevValue: boolean;
 function regLoadedWithNewValue(supreg: tsuperregister; canDependOnPrevValue: boolean;
            hp: tai): boolean;
            hp: tai): boolean;
 procedure UpdateUsedRegs(var UsedRegs: TRegSet; p: tai);
 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 FindRegDealloc(supreg: tsuperregister; p: tai): boolean;
 
 
 function InstructionsEquivalent(p1, p2: tai; var RegInfo: toptreginfo): Boolean;
 function InstructionsEquivalent(p1, p2: tai; var RegInfo: toptreginfo): Boolean;
@@ -207,7 +207,7 @@ function OpsEqual(const o1,o2:toper): Boolean;
 
 
 type
 type
   tdfaobj = class
   tdfaobj = class
-    constructor create(_list: taasmoutput); virtual;
+    constructor create(_list: TAsmList); virtual;
 
 
     function pass_1(_blockstart: tai): tai;
     function pass_1(_blockstart: tai): tai;
     function pass_2: boolean;
     function pass_2: boolean;
@@ -224,7 +224,7 @@ type
     procedure dodfapass2;
     procedure dodfapass2;
 
 
     { asm list we're working on }
     { asm list we're working on }
-    list: taasmoutput;
+    list: TAsmList;
 
 
     { current part of the asm list }
     { current part of the asm list }
     blockstart, blockend: tai;
     blockstart, blockend: tai;
@@ -379,9 +379,9 @@ begin
   until false;
   until false;
 end;
 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
   var
     hp2: tai;
     hp2: tai;
   begin
   begin
@@ -445,7 +445,7 @@ begin
 end;
 end;
 
 
 
 
-procedure AddRegDeallocFor(asml: taasmoutput; reg: tregister; p: tai);
+procedure AddRegDeallocFor(asml: TAsmList; reg: tregister; p: tai);
 var
 var
   hp1: tai;
   hp1: tai;
   funcResRegs: tregset;
   funcResRegs: tregset;
@@ -540,7 +540,7 @@ end;
 
 
 { inserts new_one between prev and foll }
 { 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
 begin
   if assigned(prev) then
   if assigned(prev) then
     if assigned(foll) then
     if assigned(foll) then
@@ -984,7 +984,7 @@ function GetNextInstruction(Current: tai; var Next: tai): Boolean;
 begin
 begin
   repeat
   repeat
     if (Current.typ = ait_marker) and
     if (Current.typ = ait_marker) and
-       (tai_Marker(current).Kind = AsmBlockStart) then
+       (tai_Marker(current).Kind = mark_AsmBlockStart) then
       begin
       begin
         GetNextInstruction := False;
         GetNextInstruction := False;
         Next := Nil;
         Next := Nil;
@@ -998,16 +998,16 @@ begin
       Current := tai(current.Next);
       Current := tai(current.Next);
 {    if assigned(Current) and
 {    if assigned(Current) and
        (current.typ = ait_Marker) and
        (current.typ = ait_Marker) and
-       (tai_Marker(current).Kind = NoPropInfoStart) then
+       (tai_Marker(current).Kind = mark_NoPropInfoStart) then
       begin
       begin
         while assigned(Current) and
         while assigned(Current) and
               ((current.typ <> ait_Marker) or
               ((current.typ <> ait_Marker) or
-               (tai_Marker(current).Kind <> NoPropInfoend)) Do
+               (tai_Marker(current).Kind <> mark_NoPropInfoEnd)) Do
           Current := tai(current.Next);
           Current := tai(current.Next);
       end;}
       end;}
   until not(assigned(Current)) or
   until not(assigned(Current)) or
         (current.typ <> ait_Marker) 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;
   Next := Current;
   if assigned(Current) and
   if assigned(Current) and
      not((current.typ in SkipInstr) or
      not((current.typ in SkipInstr) or
@@ -1016,7 +1016,7 @@ begin
     then
     then
       GetNextInstruction :=
       GetNextInstruction :=
          not((current.typ = ait_marker) and
          not((current.typ = ait_marker) and
-             (tai_marker(current).kind = asmBlockStart))
+             (tai_marker(current).kind = mark_AsmBlockStart))
     else
     else
       begin
       begin
         GetNextInstruction := False;
         GetNextInstruction := False;
@@ -1033,29 +1033,29 @@ begin
     Current := tai(current.previous);
     Current := tai(current.previous);
     while assigned(Current) and
     while assigned(Current) and
           (((current.typ = ait_Marker) 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 in SkipInstr) or
            ((current.typ = ait_label) and
            ((current.typ = ait_label) and
             labelCanBeSkipped(tai_label(current)))) Do
             labelCanBeSkipped(tai_label(current)))) Do
       Current := tai(current.previous);
       Current := tai(current.previous);
 {    if assigned(Current) and
 {    if assigned(Current) and
        (current.typ = ait_Marker) and
        (current.typ = ait_Marker) and
-       (tai_Marker(current).Kind = NoPropInfoend) then
+       (tai_Marker(current).Kind = mark_NoPropInfoEnd) then
       begin
       begin
         while assigned(Current) and
         while assigned(Current) and
               ((current.typ <> ait_Marker) or
               ((current.typ <> ait_Marker) or
-               (tai_Marker(current).Kind <> NoPropInfoStart)) Do
+               (tai_Marker(current).Kind <> mark_NoPropInfoStart)) Do
           Current := tai(current.previous);
           Current := tai(current.previous);
       end;}
       end;}
   until not(assigned(Current)) or
   until not(assigned(Current)) or
         (current.typ <> ait_Marker) 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
   if not(assigned(Current)) or
      (current.typ in SkipInstr) or
      (current.typ in SkipInstr) or
      ((current.typ = ait_label) and
      ((current.typ = ait_label) and
       labelCanBeSkipped(tai_label(current))) or
       labelCanBeSkipped(tai_label(current))) or
      ((current.typ = ait_Marker) and
      ((current.typ = ait_Marker) and
-      (tai_Marker(current).Kind = AsmBlockend))
+      (tai_Marker(current).Kind = mark_AsmBlockEnd))
     then
     then
       begin
       begin
         Last := nil;
         Last := nil;
@@ -1077,12 +1077,12 @@ begin
     oldp := p;
     oldp := p;
     if (p.typ in SkipInstr) or
     if (p.typ in SkipInstr) or
        ((p.typ = ait_marker) and
        ((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)
       GetNextInstruction(p,p)
     else if ((p.Typ = Ait_Marker) and
     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);
       GetNextInstruction(tai(p.previous),p);
     until p = oldp
     until p = oldp
 end;
 end;
@@ -1131,7 +1131,7 @@ begin
            ((p.typ = ait_label) and
            ((p.typ = ait_label) and
             labelCanBeSkipped(tai_label(p))) or
             labelCanBeSkipped(tai_label(p))) or
            ((p.typ = ait_marker) and
            ((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);
          p := tai(p.next);
     while assigned(p) and
     while assigned(p) and
           (p.typ=ait_RegAlloc) Do
           (p.typ=ait_RegAlloc) Do
@@ -1154,7 +1154,7 @@ begin
 end;
 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 }
 { allocates register reg between (and including) instructions p1 and p2 }
 { the type of p1 and p2 must not be in SkipInstr                        }
 { the type of p1 and p2 must not be in SkipInstr                        }
 { note that this routine is both called from the peephole optimizer     }
 { note that this routine is both called from the peephole optimizer     }
@@ -1964,7 +1964,7 @@ begin
 end;
 end;
 
 
 
 
-procedure AddInstr2RegContents({$ifdef statedebug} asml: taasmoutput; {$endif}
+procedure AddInstr2RegContents({$ifdef statedebug} asml: TAsmList; {$endif}
 p: taicpu; supreg: tsuperregister);
 p: taicpu; supreg: tsuperregister);
 {$ifdef statedebug}
 {$ifdef statedebug}
 var
 var
@@ -2004,7 +2004,7 @@ begin
 end;
 end;
 
 
 
 
-procedure AddInstr2OpContents({$ifdef statedebug} asml: TAAsmoutput; {$endif}
+procedure AddInstr2OpContents({$ifdef statedebug} asml: TAsmList; {$endif}
 p: taicpu; const oper: TOper);
 p: taicpu; const oper: TOper);
 begin
 begin
   if oper.typ = top_reg then
   if oper.typ = top_reg then
@@ -2021,7 +2021,7 @@ end;
 {************************************** TDFAOBJ **************************************}
 {************************************** TDFAOBJ **************************************}
 {*************************************************************************************}
 {*************************************************************************************}
 
 
-constructor tdfaobj.create(_list: taasmoutput);
+constructor tdfaobj.create(_list: TAsmList);
 begin
 begin
   list := _list;
   list := _list;
   blockstart := nil;
   blockstart := nil;
@@ -2066,7 +2066,7 @@ begin
       getnextinstruction(p, p);
       getnextinstruction(p, p);
     end;
     end;
   if (prev.typ = ait_marker) and
   if (prev.typ = ait_marker) and
-     (tai_marker(prev).kind = asmblockstart) then
+     (tai_marker(prev).kind = mark_AsmBlockStart) then
     blockend := prev
     blockend := prev
   else blockend := nil;
   else blockend := nil;
   if labelfound then
   if labelfound then

+ 53 - 53
compiler/i386/n386add.pas

@@ -41,8 +41,8 @@ interface
       globtype,systems,
       globtype,systems,
       cutils,verbose,globals,
       cutils,verbose,globals,
       symconst,symdef,paramgr,
       symconst,symdef,paramgr,
-      aasmbase,aasmtai,aasmcpu,
-      cgbase,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
+      cgbase,procinfo,
       ncon,nset,cgutils,tgobj,
       ncon,nset,cgutils,tgobj,
       cga,ncgutil,cgobj,cg64f32;
       cga,ncgutil,cgobj,cg64f32;
 
 
@@ -105,9 +105,9 @@ interface
          begin
          begin
            if (right.location.loc<>LOC_REGISTER) then
            if (right.location.loc<>LOC_REGISTER) then
             begin
             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);
               location_reset(left.location,LOC_REGISTER,OS_64);
               left.location.register64.reglo:=hregister;
               left.location.register64.reglo:=hregister;
               left.location.register64.reghi:=hregister2;
               left.location.register64.reghi:=hregister2;
@@ -125,7 +125,7 @@ interface
            { when swapped another result register }
            { when swapped another result register }
            if (nodetype=subn) and (nf_swaped in flags) then
            if (nodetype=subn) and (nf_swaped in flags) then
             begin
             begin
-              cg64.a_op64_reg_reg(exprasmlist,op,location.size,
+              cg64.a_op64_reg_reg(current_asmdata.CurrAsmList,op,location.size,
                 left.location.register64,
                 left.location.register64,
                 right.location.register64);
                 right.location.register64);
               location_swap(left.location,right.location);
               location_swap(left.location,right.location);
@@ -133,7 +133,7 @@ interface
             end
             end
            else
            else
             begin
             begin
-              cg64.a_op64_reg_reg(exprasmlist,op,location.size,
+              cg64.a_op64_reg_reg(current_asmdata.CurrAsmList,op,location.size,
                 right.location.register64,
                 right.location.register64,
                 left.location.register64);
                 left.location.register64);
             end;
             end;
@@ -143,21 +143,21 @@ interface
            { right.location<>LOC_REGISTER }
            { right.location<>LOC_REGISTER }
            if (nodetype=subn) and (nf_swaped in flags) then
            if (nodetype=subn) and (nf_swaped in flags) then
             begin
             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(op1,opsize,left.location.register64.reglo,r);
               emit_reg_reg(A_MOV,opsize,r,left.location.register64.reglo);
               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 }
               { the carry flag is still ok }
               emit_reg_reg(op2,opsize,left.location.register64.reghi,r);
               emit_reg_reg(op2,opsize,left.location.register64.reghi,r);
               emit_reg_reg(A_MOV,opsize,r,left.location.register64.reghi);
               emit_reg_reg(A_MOV,opsize,r,left.location.register64.reghi);
             end
             end
            else
            else
             begin
             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);
                 left.location.register64);
             end;
             end;
-          location_freetemp(exprasmlist,right.location);
+          location_freetemp(current_asmdata.CurrAsmList,right.location);
          end;
          end;
 
 
         { only in case of overflow operations }
         { only in case of overflow operations }
@@ -168,13 +168,13 @@ interface
          begin
          begin
            if cs_check_overflow in aktlocalswitches  then
            if cs_check_overflow in aktlocalswitches  then
             begin
             begin
-              objectlibrary.getjumplabel(hl4);
+              current_asmdata.getjumplabel(hl4);
               if unsigned then
               if unsigned then
-                cg.a_jmp_flags(exprasmlist,F_AE,hl4)
+                cg.a_jmp_flags(current_asmdata.CurrAsmList,F_AE,hl4)
               else
               else
-                cg.a_jmp_flags(exprasmlist,F_NO,hl4);
-              cg.a_call_name(exprasmlist,'FPC_OVERFLOW');
-              cg.a_label(exprasmlist,hl4);
+                cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NO,hl4);
+              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_OVERFLOW');
+              cg.a_label(current_asmdata.CurrAsmList,hl4);
             end;
             end;
          end;
          end;
 
 
@@ -196,16 +196,16 @@ interface
 
 
         begin
         begin
 {$ifdef OLDREGVARS}
 {$ifdef OLDREGVARS}
-           load_all_regvars(exprasmlist);
+           load_all_regvars(current_asmdata.CurrAsmList);
 {$endif OLDREGVARS}
 {$endif OLDREGVARS}
            { the jump the sequence is a little bit hairy }
            { the jump the sequence is a little bit hairy }
            case nodetype of
            case nodetype of
               ltn,gtn:
               ltn,gtn:
                 begin
                 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 }
                    { cheat a little bit for the negative test }
                    toggleflag(nf_swaped);
                    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);
                    toggleflag(nf_swaped);
                 end;
                 end;
               lten,gten:
               lten,gten:
@@ -215,19 +215,19 @@ interface
                      nodetype:=ltn
                      nodetype:=ltn
                    else
                    else
                      nodetype:=gtn;
                      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 }
                    { cheat for the negative test }
                    if nodetype=ltn then
                    if nodetype=ltn then
                      nodetype:=gtn
                      nodetype:=gtn
                    else
                    else
                      nodetype:=ltn;
                      nodetype:=ltn;
-                   cg.a_jmp_flags(exprasmlist,getresflags(unsigned),falselabel);
+                   cg.a_jmp_flags(current_asmdata.CurrAsmList,getresflags(unsigned),current_procinfo.CurrFalseLabel);
                    nodetype:=oldnodetype;
                    nodetype:=oldnodetype;
                 end;
                 end;
               equaln:
               equaln:
-                cg.a_jmp_flags(exprasmlist,F_NE,falselabel);
+                cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NE,current_procinfo.CurrFalseLabel);
               unequaln:
               unequaln:
-                cg.a_jmp_flags(exprasmlist,F_NE,truelabel);
+                cg.a_jmp_flags(current_asmdata.CurrAsmList,F_NE,current_procinfo.CurrTrueLabel);
            end;
            end;
         end;
         end;
 
 
@@ -240,18 +240,18 @@ interface
                 begin
                 begin
                    { the comparisaion of the low dword have to be }
                    { the comparisaion of the low dword have to be }
                    {  always unsigned!                            }
                    {  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;
               equaln:
               equaln:
                 begin
                 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;
                 end;
               unequaln:
               unequaln:
                 begin
                 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;
            end;
         end;
         end;
@@ -275,9 +275,9 @@ interface
               { we can reuse a CREGISTER for comparison }
               { we can reuse a CREGISTER for comparison }
               if (left.location.loc<>LOC_CREGISTER) then
               if (left.location.loc<>LOC_CREGISTER) then
                begin
                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);
                  location_reset(left.location,LOC_REGISTER,OS_64);
                  left.location.register64.reglo:=hregister;
                  left.location.register64.reglo:=hregister;
                  left.location.register64.reghi:=hregister2;
                  left.location.register64.reghi:=hregister2;
@@ -317,14 +317,14 @@ interface
                  firstjmp64bitcmp;
                  firstjmp64bitcmp;
                  emit_ref_reg(A_CMP,S_L,right.location.reference,left.location.register64.reglo);
                  emit_ref_reg(A_CMP,S_L,right.location.reference,left.location.register64.reglo);
                  secondjmp64bitcmp;
                  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;
                end;
              LOC_CONSTANT :
              LOC_CONSTANT :
                begin
                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;
                  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;
                  secondjmp64bitcmp;
                end;
                end;
              else
              else
@@ -332,7 +332,7 @@ interface
            end;
            end;
          end;
          end;
 
 
-        location_freetemp(exprasmlist,left.location);
+        location_freetemp(current_asmdata.CurrAsmList,left.location);
 
 
         { we have LOC_JUMP as result }
         { we have LOC_JUMP as result }
         location_reset(location,LOC_JUMP,OS_NO)
         location_reset(location,LOC_JUMP,OS_NO)
@@ -355,30 +355,30 @@ interface
       location_reset(location,LOC_REGISTER,OS_INT);
       location_reset(location,LOC_REGISTER,OS_INT);
       {Get a temp register and load the left value into it
       {Get a temp register and load the left value into it
        and free the location.}
        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.}
       {Allocate EAX.}
-      cg.getcpuregister(exprasmlist,NR_EAX);
+      cg.getcpuregister(current_asmdata.CurrAsmList,NR_EAX);
       {Load the right value.}
       {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).}
       {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);
       emit_reg(A_MUL,S_L,r);
       if cs_check_overflow in aktlocalswitches  then
       if cs_check_overflow in aktlocalswitches  then
        begin
        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;
        end;
       {Free EAX,EDX}
       {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.}
       {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;
     end;
 
 
 
 

+ 9 - 9
compiler/i386/n386cal.pas

@@ -45,7 +45,7 @@ implementation
       cutils,verbose,globals,
       cutils,verbose,globals,
       cgbase,cgutils,
       cgbase,cgutils,
       cpubase,paramgr,
       cpubase,paramgr,
-      aasmtai,aasmcpu,
+      aasmtai,aasmdata,aasmcpu,
       ncal,nbas,nmem,nld,ncnv,
       ncal,nbas,nmem,nld,ncnv,
       cga,cgobj,cpuinfo;
       cga,cgobj,cpuinfo;
 
 
@@ -77,15 +77,15 @@ implementation
             { old-style code (JM)                                         }
             { old-style code (JM)                                         }
             dec(pop_size,pushedparasize);
             dec(pop_size,pushedparasize);
             if (pop_size < 0) then
             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;
             exit;
           end;
           end;
 
 
         { better than an add on all processors }
         { better than an add on all processors }
         if pop_size=4 then
         if pop_size=4 then
           begin
           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
           end
         { the pentium has two pipes and pop reg is pairable }
         { the pentium has two pipes and pop reg is pairable }
         { but the registers must be different!        }
         { but the registers must be different!        }
@@ -94,14 +94,14 @@ implementation
              not(cs_opt_size in aktoptimizerswitches) and
              not(cs_opt_size in aktoptimizerswitches) and
              (aktoptimizecputype=cpu_Pentium) then
              (aktoptimizecputype=cpu_Pentium) then
             begin
             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
             end
         else
         else
           if pop_size<>0 then
           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;
       end;
 
 
 
 

+ 44 - 44
compiler/i386/n386mat.pas

@@ -50,7 +50,7 @@ implementation
     uses
     uses
       globtype,systems,
       globtype,systems,
       cutils,verbose,globals,
       cutils,verbose,globals,
-      symconst,symdef,aasmbase,aasmtai,defutil,
+      symconst,symdef,aasmbase,aasmtai,aasmdata,defutil,
       cgbase,pass_2,
       cgbase,pass_2,
       ncon,
       ncon,
       cpubase,cpuinfo,
       cpubase,cpuinfo,
@@ -94,7 +94,7 @@ implementation
           internalerror(200109052);
           internalerror(200109052);
         { put numerator in register }
         { put numerator in register }
         location_reset(location,LOC_REGISTER,OS_INT);
         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;
         hreg1:=left.location.register;
 
 
         if (nodetype=divn) and (right.nodetype=ordconstn) then
         if (nodetype=divn) and (right.nodetype=ordconstn) then
@@ -112,7 +112,7 @@ implementation
                         comp.compilers (JM) }
                         comp.compilers (JM) }
                       begin
                       begin
                         { no jumps, but more operations }
                         { 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);
                         emit_reg_reg(A_MOV,S_L,hreg1,hreg2);
                         {If the left value is signed, hreg2=$ffffffff, otherwise 0.}
                         {If the left value is signed, hreg2=$ffffffff, otherwise 0.}
                         emit_const_reg(A_SAR,S_L,31,hreg2);
                         emit_const_reg(A_SAR,S_L,31,hreg2);
@@ -127,13 +127,13 @@ implementation
                       begin
                       begin
                         { a jump, but less operations }
                         { a jump, but less operations }
                         emit_reg_reg(A_TEST,S_L,hreg1,hreg1);
                         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
                         if power=1 then
                           emit_reg(A_INC,S_L,hreg1)
                           emit_reg(A_INC,S_L,hreg1)
                         else
                         else
                           emit_const_reg(A_ADD,S_L,tordconstnode(right).value-1,hreg1);
                           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);
                         emit_const_reg(A_SAR,S_L,power,hreg1);
                       end
                       end
                   end
                   end
@@ -170,9 +170,9 @@ implementation
                       a:=1
                       a:=1
                     else
                     else
                       a:=0;
                       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);
                     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(A_IMUL,S_L,hreg1);
                     emit_reg_reg(A_MOV,S_L,hreg1,NR_EAX);
                     emit_reg_reg(A_MOV,S_L,hreg1,NR_EAX);
                     if a<>0 then
                     if a<>0 then
@@ -212,10 +212,10 @@ implementation
                     emit_reg_reg(A_ADD,S_L,NR_EAX,NR_EDX);
                     emit_reg_reg(A_ADD,S_L,NR_EAX,NR_EDX);
                     if e<0 then
                     if e<0 then
                       emit_reg(A_NEG,S_L,NR_EDX);
                       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
                   end
                 else
                 else
                   begin
                   begin
@@ -223,7 +223,7 @@ implementation
                     if d>=$80000000 then
                     if d>=$80000000 then
                       begin
                       begin
                         emit_const_reg(A_CMP,S_L,aint(d),hreg1);
                         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_MOV,S_L,0,location.register);
                         emit_const_reg(A_SBB,S_L,-1,location.register);
                         emit_const_reg(A_SBB,S_L,-1,location.register);
                       end
                       end
@@ -282,9 +282,9 @@ implementation
                           end;
                           end;
                         { Adjust multiplier for reduction of even divisors }
                         { Adjust multiplier for reduction of even divisors }
                         inc(s,n);
                         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);
                         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);
                         emit_reg(A_MUL,S_L,hreg1);
                         if a<>0 then
                         if a<>0 then
                           begin
                           begin
@@ -304,19 +304,19 @@ implementation
                           end;
                           end;
                         if s<>0 then
                         if s<>0 then
                           emit_const_reg(A_SHR,S_L,aint(s),NR_EDX);
                           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
               end
               end
           end
           end
         else
         else
           begin
           begin
-            cg.getcpuregister(exprasmlist,NR_EAX);
+            cg.getcpuregister(current_asmdata.CurrAsmList,NR_EAX);
             emit_reg_reg(A_MOV,S_L,hreg1,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.}
             {Sign extension depends on the left type.}
             if torddef(left.resulttype.def).typ=u32bit then
             if torddef(left.resulttype.def).typ=u32bit then
               emit_reg_reg(A_XOR,S_L,NR_EDX,NR_EDX)
               emit_reg_reg(A_XOR,S_L,NR_EDX,NR_EDX)
@@ -335,19 +335,19 @@ implementation
               emit_reg(op,S_L,right.location.register)
               emit_reg(op,S_L,right.location.register)
             else
             else
               begin
               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);
                 emit_reg(op,S_L,hreg1);
               end;
               end;
 
 
             {Copy the result into a new register. Release EAX & EDX.}
             {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
             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
             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;
       end;
       end;
 
 
@@ -371,7 +371,7 @@ implementation
         location_reset(location,LOC_REGISTER,OS_64);
         location_reset(location,LOC_REGISTER,OS_64);
 
 
         { load left operator in a register }
         { 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;
         hreg64hi:=left.location.register64.reghi;
         hreg64lo:=left.location.register64.reglo;
         hreg64lo:=left.location.register64.reglo;
 
 
@@ -415,8 +415,8 @@ implementation
         else
         else
           begin
           begin
             { load right operators in a register }
             { 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 }
             { left operator is already in a register }
             { hence are both 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 }
             { the damned shift instructions work only til a count of 32 }
             { so we've to do some tricks here                           }
             { 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);
             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,hreg64lo,hreg64lo);
             emit_reg_reg(A_XOR,S_L,hreg64hi,hreg64hi);
             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);
             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);
             emit_const_reg(A_SUB,S_L,32,NR_ECX);
             if nodetype=shln then
             if nodetype=shln then
               begin
               begin
                 emit_reg_reg(A_SHL,S_L,NR_CL,hreg64lo);
                 emit_reg_reg(A_SHL,S_L,NR_CL,hreg64lo);
                 emit_reg_reg(A_MOV,S_L,hreg64lo,hreg64hi);
                 emit_reg_reg(A_MOV,S_L,hreg64lo,hreg64hi);
                 emit_reg_reg(A_XOR,S_L,hreg64lo,hreg64lo);
                 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_reg(A_SHLD,S_L,NR_CL,hreg64lo,hreg64hi);
                 emit_reg_reg(A_SHL,S_L,NR_CL,hreg64lo);
                 emit_reg_reg(A_SHL,S_L,NR_CL,hreg64lo);
               end
               end
@@ -451,14 +451,14 @@ implementation
                 emit_reg_reg(A_SHR,S_L,NR_CL,hreg64hi);
                 emit_reg_reg(A_SHR,S_L,NR_CL,hreg64hi);
                 emit_reg_reg(A_MOV,S_L,hreg64hi,hreg64lo);
                 emit_reg_reg(A_MOV,S_L,hreg64hi,hreg64lo);
                 emit_reg_reg(A_XOR,S_L,hreg64hi,hreg64hi);
                 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_reg(A_SHRD,S_L,NR_CL,hreg64hi,hreg64lo);
                 emit_reg_reg(A_SHR,S_L,NR_CL,hreg64hi);
                 emit_reg_reg(A_SHR,S_L,NR_CL,hreg64hi);
               end;
               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.reglo:=hreg64lo;
             location.register64.reghi:=hreg64hi;
             location.register64.reghi:=hreg64hi;
           end;
           end;

+ 8 - 8
compiler/i386/n386mem.pas

@@ -50,7 +50,7 @@ implementation
       systems,
       systems,
       cutils,verbose,
       cutils,verbose,
       symdef,paramgr,
       symdef,paramgr,
-      aasmtai,
+      aasmtai,aasmdata,
       nld,ncon,nadd,
       nld,ncon,nadd,
       cgutils,cgobj;
       cgutils,cgobj;
 
 
@@ -97,16 +97,16 @@ implementation
          else if location.reference.base=NR_NO then
          else if location.reference.base=NR_NO then
           begin
           begin
             case location.reference.scalefactor of
             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;
             end;
             location.reference.base:=location.reference.index;
             location.reference.base:=location.reference.index;
           end
           end
          else
          else
           begin
           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);
             reference_reset_base(location.reference,hreg,0);
           end;
           end;
          { insert the new index register and scalefactor or
          { insert the new index register and scalefactor or
@@ -116,9 +116,9 @@ implementation
          else
          else
            begin
            begin
               if ispowerof2(l,l2) then
               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
               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;
          end;
          end;
          location.reference.index:=reg;
          location.reference.index:=reg;

+ 16 - 16
compiler/i386/n386set.pas

@@ -44,7 +44,7 @@ implementation
       systems,
       systems,
       verbose,globals,
       verbose,globals,
       symconst,symdef,defutil,
       symconst,symdef,defutil,
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       cgbase,pass_2,
       cgbase,pass_2,
       ncon,
       ncon,
       cpubase,cpuinfo,procinfo,
       cpubase,cpuinfo,procinfo,
@@ -83,7 +83,7 @@ implementation
         indexreg : tregister;
         indexreg : tregister;
         href : treference;
         href : treference;
 
 
-        procedure genitem(list:taasmoutput;t : pcaselabel);
+        procedure genitem(list:TAsmList;t : pcaselabel);
           var
           var
             i : aint;
             i : aint;
           begin
           begin
@@ -103,14 +103,14 @@ implementation
         if not(jumptable_no_range) then
         if not(jumptable_no_range) then
           begin
           begin
              { case expr less than min_ => goto elselabel }
              { 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 }
              { 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;
           end;
-        objectlibrary.getjumplabel(table);
+        current_asmdata.getjumplabel(table);
         { make it a 32bit register }
         { 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 }
         { create reference }
         reference_reset_symbol(href,table,0);
         reference_reset_symbol(href,table,0);
         href.offset:=(-aint(min_))*4;
         href.offset:=(-aint(min_))*4;
@@ -139,16 +139,16 @@ implementation
              { need we to test the first value }
              { need we to test the first value }
              if first and (t^._low>get_min_value(left.resulttype.def)) then
              if first and (t^._low>get_min_value(left.resulttype.def)) then
                begin
                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;
                end;
              if t^._low=t^._high then
              if t^._low=t^._high then
                begin
                begin
                   if t^._low-last=0 then
                   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
                   else
                     begin
                     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;
                     end;
                   last:=t^._low;
                   last:=t^._low;
                   lastrange:=false;
                   lastrange:=false;
@@ -162,7 +162,7 @@ implementation
                     begin
                     begin
                        { have we to ajust the first value ? }
                        { have we to ajust the first value ? }
                        if (t^._low>get_min_value(left.resulttype.def)) then
                        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
                     end
                   else
                   else
                     begin
                     begin
@@ -170,17 +170,17 @@ implementation
                       { present label then the lower limit can be checked    }
                       { present label then the lower limit can be checked    }
                       { immediately. else check the range in between:       }
                       { 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 }
                       { no jump necessary here if the new range starts at }
                       { at the value following the previous one           }
                       { at the value following the previous one           }
                       if ((t^._low-last) <> 1) or
                       if ((t^._low-last) <> 1) or
                          (not lastrange) then
                          (not lastrange) then
-                        cg.a_jmp_flags(exprasmlist,cond_lt,elselabel);
+                        cg.a_jmp_flags(current_asmdata.CurrAsmList,cond_lt,elselabel);
                     end;
                     end;
                   {we need to use A_SUB, because A_DEC does not set the correct flags, therefor
                   {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 }
                    using a_op_const_reg(OP_SUB) is not possible }
                   emit_const_reg(A_SUB,TCGSize2OpSize[opsize],aint(t^._high-t^._low),hregister);
                   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;
                   last:=t^._high;
                   lastrange:=true;
                   lastrange:=true;
                end;
                end;
@@ -209,7 +209,7 @@ implementation
                 lastrange:=false;
                 lastrange:=false;
                 first:=true;
                 first:=true;
                 genitem(hp);
                 genitem(hp);
-                cg.a_jmp_always(exprasmlist,elselabel);
+                cg.a_jmp_always(current_asmdata.CurrAsmList,elselabel);
              end;
              end;
         end;
         end;
 
 

+ 12 - 12
compiler/i386/popt386.pas

@@ -25,12 +25,12 @@ unit popt386;
 
 
 interface
 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
 implementation
 
 
@@ -56,7 +56,7 @@ begin
 end;
 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 }
 { returns true if a "continue" should be done after this optimization }
 var hp1, hp2: tai;
 var hp1, hp2: tai;
 begin
 begin
@@ -108,7 +108,7 @@ begin
 end;
 end;
 
 
 
 
-procedure PrePeepHoleOpts(asml: taasmoutput; BlockStart, BlockEnd: tai);
+procedure PrePeepHoleOpts(asml: TAsmList; BlockStart, BlockEnd: tai);
 var
 var
   p,hp1: tai;
   p,hp1: tai;
   l: aint;
   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}
 {First pass of peepholeoptimizations}
 
 
 var
 var
@@ -435,7 +435,7 @@ var
       end;
       end;
   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.
   {traces sucessive jumps to their final destination and sets it, e.g.
    je l1                je l3
    je l1                je l3
    <code>               <code>
    <code>               <code>
@@ -508,7 +508,7 @@ var
                   insertllitem(asml,p1,p1.next,tai_comment.Create(
                   insertllitem(asml,p1,p1.next,tai_comment.Create(
                     strpnew('previous label inserted'))));
                     strpnew('previous label inserted'))));
   {$endif finaldestdebug}
   {$endif finaldestdebug}
-                  objectlibrary.getjumplabel(l);
+                  current_asmdata.getjumplabel(l);
                   insertllitem(asml,p1,p1.next,tai_label.Create(l));
                   insertllitem(asml,p1,p1.next,tai_label.Create(l));
                   tasmlabel(taicpu(hp).oper[0]^.ref^.symbol).decrefs;
                   tasmlabel(taicpu(hp).oper[0]^.ref^.symbol).decrefs;
                   hp.oper[0]^.ref^.symbol := l;
                   hp.oper[0]^.ref^.symbol := l;
@@ -1657,7 +1657,7 @@ begin
 end;
 end;
 
 
 
 
-procedure PeepHoleOptPass2(asml: taasmoutput; BlockStart, BlockEnd: tai);
+procedure PeepHoleOptPass2(asml: TAsmList; BlockStart, BlockEnd: tai);
 
 
 {$ifdef  USECMOV}
 {$ifdef  USECMOV}
   function CanBeCMOV(p : tai) : boolean;
   function CanBeCMOV(p : tai) : boolean;
@@ -1918,7 +1918,7 @@ begin
 end;
 end;
 
 
 
 
-procedure PostPeepHoleOpts(asml: taasmoutput; BlockStart, BlockEnd: tai);
+procedure PostPeepHoleOpts(asml: TAsmList; BlockStart, BlockEnd: tai);
 var
 var
   p,hp1,hp2: tai;
   p,hp1,hp2: tai;
 begin
 begin

+ 4 - 4
compiler/i386/ra386int.pas

@@ -82,7 +82,7 @@ Unit Ra386int;
        globals,verbose,
        globals,verbose,
        systems,
        systems,
        { aasm }
        { aasm }
-       aasmtai,aasmcpu,
+       aasmtai,aasmdata,aasmcpu,
        { symtable }
        { symtable }
        symconst,symbase,symtype,symsym,symdef,symtable,
        symconst,symbase,symtype,symsym,symdef,symtable,
        { parser }
        { parser }
@@ -1395,7 +1395,7 @@ Unit Ra386int;
                    if GotStar then
                    if GotStar then
                     Message(asmr_e_only_add_relocatable_symbol);
                     Message(asmr_e_only_add_relocatable_symbol);
                    if not assigned(oper.opr.ref.symbol) then
                    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
                    else
                     Message(asmr_e_cant_have_multiple_relocatable_symbols);
                     Message(asmr_e_cant_have_multiple_relocatable_symbols);
                  end;
                  end;
@@ -1478,7 +1478,7 @@ Unit Ra386int;
           begin
           begin
             oper.opr.typ:=OPR_SYMBOL;
             oper.opr.typ:=OPR_SYMBOL;
             oper.opr.symofs:=l;
             oper.opr.symofs:=l;
-            oper.opr.symbol:=objectlibrary.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp);
+            oper.opr.symbol:=current_asmdata.newasmsymbol(tempstr,AB_EXTERNAL,tempsymtyp);
           end
           end
         else
         else
           if oper.opr.typ=OPR_NONE then
           if oper.opr.typ=OPR_NONE then
@@ -2021,7 +2021,7 @@ Unit Ra386int;
          _asmsorted:=TRUE;
          _asmsorted:=TRUE;
        end;
        end;
       }
       }
-      curlist:=TAAsmoutput.Create;
+      curlist:=TAsmList.Create;
       { setup label linked list }
       { setup label linked list }
       LocalLabelList:=TLocalLabelList.Create;
       LocalLabelList:=TLocalLabelList.Create;
       { start tokenizer }
       { start tokenizer }

+ 1 - 1
compiler/i386/rgcpu.pas

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

+ 4 - 4
compiler/i386/rropt386.pas

@@ -26,9 +26,9 @@ unit rropt386;
 
 
 interface
 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
 implementation
 
 
@@ -189,7 +189,7 @@ begin
 end;
 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 }
 { change movl  %reg1,%reg2 ... bla ... to ... bla with reg1 and reg2 switched }
 var
 var
   endP, hp, lastreg1,lastreg2: tai;
   endP, hp, lastreg1,lastreg2: tai;
@@ -329,7 +329,7 @@ begin
 end;
 end;
 
 
 
 
-procedure doRenaming(asml: taasmoutput; first, last: tai);
+procedure doRenaming(asml: TAsmList; first, last: tai);
 var
 var
   p: tai;
   p: tai;
 begin
 begin

+ 16 - 3
compiler/link.pas

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

+ 1 - 1
compiler/m68k/aasmcpu.pas

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

+ 1 - 1
compiler/m68k/ag68kgas.pas

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

+ 83 - 83
compiler/m68k/cgcpu.pas

@@ -28,7 +28,7 @@ unit cgcpu;
 
 
     uses
     uses
        cgbase,cgobj,globtype,
        cgbase,cgobj,globtype,
-       aasmbase,aasmtai,aasmcpu,
+       aasmbase,aasmtai,aasmdata,aasmcpu,
        cpubase,cpuinfo,
        cpubase,cpuinfo,
        parabase,cpupara,
        parabase,cpupara,
        node,symconst,symtype,symdef,
        node,symconst,symtype,symdef,
@@ -38,61 +38,61 @@ unit cgcpu;
       tcg68k = class(tcg)
       tcg68k = class(tcg)
         procedure init_register_allocators;override;
         procedure init_register_allocators;override;
         procedure done_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;
           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 }
         { 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
      protected
-        function fixref(list: taasmoutput; var ref: treference): boolean;
+        function fixref(list: TAsmList; var ref: treference): boolean;
      private
      private
         { # Sign or zero extend the register to a full 32-bit value.
         { # Sign or zero extend the register to a full 32-bit value.
             The new value is left in the same register.
             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;
      end;
 
 
      tcg64f68k = class(tcg64f32)
      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;
      end;
 
 
      { This function returns true if the reference+offset is valid.
      { This function returns true if the reference+offset is valid.
@@ -203,7 +203,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    function tcg68k.fixref(list: taasmoutput; var ref: treference): boolean;
+    function tcg68k.fixref(list: TAsmList; var ref: treference): boolean;
 
 
        begin
        begin
          result:=false;
          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
       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;
       end;
 
 
 
 
-    procedure tcg68k.a_call_reg(list : taasmoutput;reg : tregister);
+    procedure tcg68k.a_call_reg(list : TAsmList;reg : tregister);
      var
      var
        href : treference;
        href : treference;
      begin
      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
       begin
         if getregtype(register)=R_ADDRESSREGISTER then
         if getregtype(register)=R_ADDRESSREGISTER then
          begin
          begin
@@ -279,7 +279,7 @@ unit cgcpu;
       end;
       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
       var
        href : treference;
        href : treference;
       begin
       begin
@@ -290,7 +290,7 @@ unit cgcpu;
       end;
       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
       begin
          { move to destination register }
          { move to destination register }
          list.concat(taicpu.op_reg_reg(A_MOVE,S_L,reg1,reg2));
          list.concat(taicpu.op_reg_reg(A_MOVE,S_L,reg1,reg2));
@@ -299,7 +299,7 @@ unit cgcpu;
       end;
       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
       var
        href : treference;
        href : treference;
       begin
       begin
@@ -311,7 +311,7 @@ unit cgcpu;
       end;
       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
      var
        href : treference;
        href : treference;
 //       p: pointer;
 //       p: pointer;
@@ -329,7 +329,7 @@ unit cgcpu;
       end;
       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
       begin
         { in emulation mode, only 32-bit single is supported }
         { in emulation mode, only 32-bit single is supported }
         if cs_fp_emulation in aktmoduleswitches then
         if cs_fp_emulation in aktmoduleswitches then
@@ -339,7 +339,7 @@ unit cgcpu;
       end;
       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
      var
       opsize : topsize;
       opsize : topsize;
       href : treference;
       href : treference;
@@ -357,7 +357,7 @@ unit cgcpu;
            list.concat(taicpu.op_ref_reg(A_FMOVE,opsize,href,reg));
            list.concat(taicpu.op_ref_reg(A_FMOVE,opsize,href,reg));
       end;
       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
       var
        opsize : topsize;
        opsize : topsize;
       begin
       begin
@@ -373,31 +373,31 @@ unit cgcpu;
       end;
       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
       begin
         internalerror(20020729);
         internalerror(20020729);
       end;
       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
       begin
         internalerror(20020729);
         internalerror(20020729);
       end;
       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
       begin
         internalerror(20020729);
         internalerror(20020729);
       end;
       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
       begin
         internalerror(20020729);
         internalerror(20020729);
       end;
       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
       var
        scratch_reg : tregister;
        scratch_reg : tregister;
        scratch_reg2: tregister;
        scratch_reg2: tregister;
@@ -545,7 +545,7 @@ unit cgcpu;
       end;
       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
       var
        hreg1,hreg2,r,r2: tregister;
        hreg1,hreg2,r,r2: tregister;
       begin
       begin
@@ -713,7 +713,7 @@ unit cgcpu;
                   register.
                   register.
                 }
                 }
                 if reg1 <> NR_NO then
                 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
                 if (isaddressregister(reg2)) then
                   begin
                   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);
             l : tasmlabel);
       var
       var
        hregister : tregister;
        hregister : tregister;
@@ -780,14 +780,14 @@ unit cgcpu;
          a_jmp_cond(list,cmp_op,l);
          a_jmp_cond(list,cmp_op,l);
       end;
       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
       begin
          list.concat(taicpu.op_reg_reg(A_CMP,tcgsize2opsize[size],reg1,reg2));
          list.concat(taicpu.op_reg_reg(A_CMP,tcgsize2opsize[size],reg1,reg2));
          { emit the actual jump to the label }
          { emit the actual jump to the label }
          a_jmp_cond(list,cmp_op,l);
          a_jmp_cond(list,cmp_op,l);
       end;
       end;
 
 
-    procedure tcg68k.a_jmp_always(list : taasmoutput;l: tasmlabel);
+    procedure tcg68k.a_jmp_always(list : TAsmList;l: tasmlabel);
       var
       var
        ai: taicpu;
        ai: taicpu;
       begin
       begin
@@ -796,7 +796,7 @@ unit cgcpu;
          list.concat(ai);
          list.concat(ai);
       end;
       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
        var
          ai : taicpu;
          ai : taicpu;
        begin
        begin
@@ -806,7 +806,7 @@ unit cgcpu;
          list.concat(ai);
          list.concat(ai);
        end;
        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
        var
          ai : taicpu;
          ai : taicpu;
          hreg : tregister;
          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
      var
          helpsize : longint;
          helpsize : longint;
@@ -950,9 +950,9 @@ unit cgcpu;
                    helpsize := len - len mod 4;
                    helpsize := len - len mod 4;
                    len := len mod 4;
                    len := len mod 4;
                    list.concat(taicpu.op_const_reg(A_MOVE,S_L,helpsize div 4,hregister));
                    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);
                    a_jmp_always(list,hl2);
-                   objectlibrary.getjumplabel(hl);
+                   current_asmdata.getjumplabel(hl);
                    a_label(list,hl);
                    a_label(list,hl);
                    list.concat(taicpu.op_ref_ref(A_MOVE,S_L,hp1,hp2));
                    list.concat(taicpu.op_ref_ref(A_MOVE,S_L,hp1,hp2));
                    a_label(list,hl2);
                    a_label(list,hl2);
@@ -970,9 +970,9 @@ unit cgcpu;
                    { Fast 68010 loop mode with no possible alignment problems }
                    { Fast 68010 loop mode with no possible alignment problems }
                    helpsize := len;
                    helpsize := len;
                    list.concat(taicpu.op_const_reg(A_MOVE,S_L,helpsize,hregister));
                    list.concat(taicpu.op_const_reg(A_MOVE,S_L,helpsize,hregister));
-                   objectlibrary.getjumplabel(hl2);
+                   current_asmdata.getjumplabel(hl2);
                    a_jmp_always(list,hl2);
                    a_jmp_always(list,hl2);
-                   objectlibrary.getjumplabel(hl);
+                   current_asmdata.getjumplabel(hl);
                    a_label(list,hl);
                    a_label(list,hl);
                    list.concat(taicpu.op_ref_ref(A_MOVE,S_B,hp1,hp2));
                    list.concat(taicpu.op_ref_ref(A_MOVE,S_B,hp1,hp2));
                    a_label(list,hl2);
                    a_label(list,hl2);
@@ -992,16 +992,16 @@ unit cgcpu;
 //               tg.ungetiftemp(list,source);
 //               tg.ungetiftemp(list,source);
     end;
     end;
 
 
-    procedure tcg68k.g_overflowcheck(list: taasmoutput; const l:tlocation; def:tdef);
+    procedure tcg68k.g_overflowcheck(list: TAsmList; const l:tlocation; def:tdef);
       begin
       begin
       end;
       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
       begin
       end;
       end;
 
 
 
 
-    procedure tcg68k.g_proc_entry(list : taasmoutput;localsize : longint;nostackframe:boolean);
+    procedure tcg68k.g_proc_entry(list : TAsmList;localsize : longint;nostackframe:boolean);
       var
       var
         r,rsp:Tregister;
         r,rsp:Tregister;
         ref : treference;
         ref : treference;
@@ -1027,7 +1027,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-{    procedure tcg68k.g_restore_frame_pointer(list : taasmoutput);
+{    procedure tcg68k.g_restore_frame_pointer(list : TAsmList);
       var
       var
         r:Tregister;
         r:Tregister;
       begin
       begin
@@ -1036,7 +1036,7 @@ unit cgcpu;
       end;
       end;
 }
 }
 
 
-    procedure tcg68k.g_proc_exit(list : taasmoutput;parasize:longint;nostackframe:boolean);
+    procedure tcg68k.g_proc_exit(list : TAsmList;parasize:longint;nostackframe:boolean);
       var
       var
         r,hregister : tregister;
         r,hregister : tregister;
         ref : treference;
         ref : treference;
@@ -1094,7 +1094,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure Tcg68k.g_save_standard_registers(list:Taasmoutput);
+    procedure Tcg68k.g_save_standard_registers(list:TAsmList);
       var
       var
         tosave : tcpuregisterset;
         tosave : tcpuregisterset;
         ref : treference;
         ref : treference;
@@ -1111,7 +1111,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure Tcg68k.g_restore_standard_registers(list:Taasmoutput);
+    procedure Tcg68k.g_restore_standard_registers(list:TAsmList);
       var
       var
         torestore : tcpuregisterset;
         torestore : tcpuregisterset;
         r:Tregister;
         r:Tregister;
@@ -1129,15 +1129,15 @@ unit cgcpu;
       end;
       end;
 
 
 {
 {
-    procedure tcg68k.g_save_all_registers(list : taasmoutput);
+    procedure tcg68k.g_save_all_registers(list : TAsmList);
       begin
       begin
       end;
       end;
 
 
-    procedure tcg68k.g_restore_all_registers(list : taasmoutput;const funcretparaloc:TCGPara);
+    procedure tcg68k.g_restore_all_registers(list : TAsmList;const funcretparaloc:TCGPara);
       begin
       begin
       end;
       end;
 }
 }
-    procedure tcg68k.sign_extend(list: taasmoutput;_oldsize : tcgsize; reg: tregister);
+    procedure tcg68k.sign_extend(list: TAsmList;_oldsize : tcgsize; reg: tregister);
       begin
       begin
         case _oldsize of
         case _oldsize of
          { sign extend }
          { sign extend }
@@ -1173,7 +1173,7 @@ unit cgcpu;
         end; { otherwise the size is already correct }
         end; { otherwise the size is already correct }
       end;
       end;
 
 
-     procedure tcg68k.a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel);
+     procedure tcg68k.a_jmp_cond(list : TAsmList;cond : TOpCmp;l: tasmlabel);
 
 
        var
        var
          ai : taicpu;
          ai : taicpu;
@@ -1191,7 +1191,7 @@ unit cgcpu;
        end;
        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;
         procedure loadvmttor11;
         var
         var
@@ -1255,7 +1255,7 @@ unit cgcpu;
           end
           end
         { case 0 }
         { case 0 }
         else
         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));
         List.concat(Tai_symbol_end.Createname(labelname));
       end;
       end;
@@ -1264,7 +1264,7 @@ unit cgcpu;
 {****************************************************************************}
 {****************************************************************************}
 {                               TCG64F68K                                    }
 {                               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
   var
    hreg1, hreg2 : tregister;
    hreg1, hreg2 : tregister;
    opcode : tasmop;
    opcode : tasmop;
@@ -1327,7 +1327,7 @@ unit cgcpu;
   end;
   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
   var
    lowvalue : cardinal;
    lowvalue : cardinal;
    highvalue : cardinal;
    highvalue : cardinal;

+ 60 - 60
compiler/m68k/n68kadd.pas

@@ -39,7 +39,7 @@ interface
           procedure second_cmpordinal;override;
           procedure second_cmpordinal;override;
           procedure second_cmpsmallset;override;
           procedure second_cmpsmallset;override;
           procedure second_cmp64bit;override;
           procedure second_cmp64bit;override;
-          procedure second_cmpboolean;override;             
+          procedure second_cmpboolean;override;
        end;
        end;
 
 
 
 
@@ -49,9 +49,9 @@ implementation
       globtype,systems,
       globtype,systems,
       cutils,verbose,globals,
       cutils,verbose,globals,
       symconst,symdef,paramgr,
       symconst,symdef,paramgr,
-      aasmbase,aasmtai,aasmcpu,defutil,htypechk,
+      aasmbase,aasmtai,aasmdata,aasmcpu,defutil,htypechk,
       cgbase,cpuinfo,pass_1,pass_2,regvars,
       cgbase,cpuinfo,pass_1,pass_2,regvars,
-      cpupara,cgutils,
+      cpupara,cgutils,procinfo,
       ncon,nset,
       ncon,nset,
       ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32;
       ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32;
 
 
@@ -140,8 +140,8 @@ implementation
           swapleftright;
           swapleftright;
 
 
         // put both operands in a register
         // 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
         // initialize de result
         if not cmpop then
         if not cmpop then
@@ -152,7 +152,7 @@ implementation
             else if right.location.loc = LOC_FPUREGISTER then
             else if right.location.loc = LOC_FPUREGISTER then
               location.register := right.location.register
               location.register := right.location.register
             else
             else
-              location.register := cg.getfpuregister(exprasmlist,location.size);
+              location.register := cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
           end
           end
         else
         else
          begin
          begin
@@ -165,14 +165,14 @@ implementation
         if not cmpop then
         if not cmpop then
           begin
           begin
           {
           {
-            exprasmlist.concat(taicpu.op_reg_reg_reg(op,
+            current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op,
               location.register,left.location.register,
               location.register,left.location.register,
               right.location.register))
               right.location.register))
-             }  
+             }
           end
           end
         else
         else
           begin
           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))}
               newreg(R_SPECIALREGISTER,location.resflags.cr,R_SUBNONE),left.location.register,right.location.register))}
           end;
           end;
       end;
       end;
@@ -188,18 +188,18 @@ implementation
 }
 }
         { force fpureg as location, left right doesn't matter
         { force fpureg as location, left right doesn't matter
           as both will be in a fpureg }
           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_reset(location,LOC_FLAGS,OS_NO);
         location.resflags:=getresflags(true);
         location.resflags:=getresflags(true);
 {
 {
         if nodetype in [equaln,unequaln] then
         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),
              left.location.register,right.location.register),
              cgsize2fpuoppostfix[def_cgsize(resulttype.def)]))
              cgsize2fpuoppostfix[def_cgsize(resulttype.def)]))
         else
         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),
              left.location.register,right.location.register),
              cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
              cgsize2fpuoppostfix[def_cgsize(resulttype.def)]));
 
 
@@ -235,12 +235,12 @@ implementation
                   (nodetype = gten)) then
                   (nodetype = gten)) then
                 swapleftright;
                 swapleftright;
               // now we have to check whether left >= right
               // 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
               if left.location.loc = LOC_CONSTANT then
                 begin
                 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);
                     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 two instructions above should be folded together by
                   // the peepholeoptimizer
                   // the peepholeoptimizer
                 end
                 end
@@ -248,16 +248,16 @@ implementation
                 begin
                 begin
                   if right.location.loc = LOC_CONSTANT then
                   if right.location.loc = LOC_CONSTANT then
                     begin
                     begin
-                      cg.a_load_const_reg(exprasmlist,OS_INT,
+                      cg.a_load_const_reg(current_asmdata.CurrAsmList,OS_INT,
                         aword(right.location.value),tmpreg);
                         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));
                         tmpreg,left.location.register));
                     end
                     end
                   else
                   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));
                       right.location.register,left.location.register));
                 end;
                 end;
-//              cg.ungetcpuregister(exprasmlist,tmpreg);
+//              cg.ungetcpuregister(current_asmdata.CurrAsmList,tmpreg);
               location.resflags := getresflags(true);
               location.resflags := getresflags(true);
             end;
             end;
           else
           else
@@ -321,8 +321,8 @@ implementation
             else
             else
               begin
               begin
                 useconst := false;
                 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);
                   aword(right.location.value),tmpreg);
                end
                end
           end
           end
@@ -333,16 +333,16 @@ implementation
         op := A_CMP;
         op := A_CMP;
         if (right.location.loc = LOC_CONSTANT) then
         if (right.location.loc = LOC_CONSTANT) then
           if useconst 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)))
               left.location.register,longint(right.location.value)))
           else
           else
             begin
             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));
                 left.location.register,tmpreg));
-//              cg.ungetcpuregister(exprasmlist,tmpreg);
+//              cg.ungetcpuregister(current_asmdata.CurrAsmList,tmpreg);
             end
             end
         else
         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));
             left.location.register,right.location.register));
      end;
      end;
 
 
@@ -377,38 +377,38 @@ implementation
             isjump:=(left.location.loc=LOC_JUMP);
             isjump:=(left.location.loc=LOC_JUMP);
             if isjump then
             if isjump then
               begin
               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;
               end;
             secondpass(left);
             secondpass(left);
             if left.location.loc in [LOC_FLAGS,LOC_JUMP] then begin
             if left.location.loc in [LOC_FLAGS,LOC_JUMP] then begin
 //             writeln('ajjaj');
 //             writeln('ajjaj');
-             location_force_reg(exprasmlist,left.location,cgsize,false);
+             location_force_reg(current_asmdata.CurrAsmList,left.location,cgsize,false);
 //             writeln('reccs?');
 //             writeln('reccs?');
-            end; 
+            end;
             if isjump then
             if isjump then
              begin
              begin
-               truelabel:=otl;
-               falselabel:=ofl;
+               current_procinfo.CurrTrueLabel:=otl;
+               current_procinfo.CurrFalseLabel:=ofl;
              end;
              end;
 
 
             isjump:=(right.location.loc=LOC_JUMP);
             isjump:=(right.location.loc=LOC_JUMP);
             if isjump then
             if isjump then
               begin
               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;
               end;
             secondpass(right);
             secondpass(right);
             if right.location.loc in [LOC_FLAGS,LOC_JUMP] then
             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
             if isjump then
              begin
              begin
-               truelabel:=otl;
-               falselabel:=ofl;
+               current_procinfo.CurrTrueLabel:=otl;
+               current_procinfo.CurrFalseLabel:=ofl;
              end;
              end;
 
 
          location_reset(location,LOC_FLAGS,OS_NO);
          location_reset(location,LOC_FLAGS,OS_NO);
@@ -419,10 +419,10 @@ implementation
               swapleftright;
               swapleftright;
 
 
          if (right.location.loc <> LOC_CONSTANT) then
          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))
              left.location.register,right.location.register))
          else
          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));
              longint(right.location.value),left.location.register));
          location.resflags := getresflags(true);
          location.resflags := getresflags(true);
         end;
         end;
@@ -439,10 +439,10 @@ implementation
      begin
      begin
       writeln('second_cmp64bit');
       writeln('second_cmp64bit');
       pass_left_right;
       pass_left_right;
-      
-      
+
+
 //     load_left_right(true,false);
 //     load_left_right(true,false);
-(* 
+(*
         case nodetype of
         case nodetype of
           ltn,lten,
           ltn,lten,
           gtn,gten:
           gtn,gten:
@@ -470,11 +470,11 @@ implementation
                       else
                       else
                         begin
                         begin
                           if (aword(right.location.valueqword) <> 0) then
                           if (aword(right.location.valueqword) <> 0) then
-                            tempreg64.reglo := cg.getintregister(exprasmlist)
+                            tempreg64.reglo := cg.getintregister(current_asmdata.CurrAsmList)
                           else
                           else
                             tempreg64.reglo := left.location.register64.reglo;
                             tempreg64.reglo := left.location.register64.reglo;
                           if ((right.location.valueqword shr 32) <> 0) then
                           if ((right.location.valueqword shr 32) <> 0) then
-                            tempreg64.reghi := cg.getintregister(exprasmlist)
+                            tempreg64.reghi := cg.getintregister(current_asmdata.CurrAsmList)
                           else
                           else
                             tempreg64.reghi := left.location.register64.reghi;
                             tempreg64.reghi := left.location.register64.reghi;
                         end;
                         end;
@@ -484,42 +484,42 @@ implementation
                         { positive values < 65535 using XOR.        }
                         { positive values < 65535 using XOR.        }
                         if (longint(right.location.valueqword) >= -32767) and
                         if (longint(right.location.valueqword) >= -32767) and
                            (longint(right.location.valueqword) < 0) then
                            (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),
                             aword(right.location.valueqword),
                             left.location.register64.reglo,tempreg64.reglo)
                             left.location.register64.reglo,tempreg64.reglo)
                         else
                         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),
                             aword(right.location.valueqword),
                             left.location.register64.reglo,tempreg64.reglo);
                             left.location.register64.reglo,tempreg64.reglo);
 
 
                       if ((right.location.valueqword shr 32) <> 0) then
                       if ((right.location.valueqword shr 32) <> 0) then
                         if (longint(right.location.valueqword shr 32) >= -32767) and
                         if (longint(right.location.valueqword shr 32) >= -32767) and
                            (longint(right.location.valueqword shr 32) < 0) then
                            (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),
                             aword(right.location.valueqword shr 32),
                             left.location.register64.reghi,tempreg64.reghi)
                             left.location.register64.reghi,tempreg64.reghi)
                         else
                         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),
                             aword(right.location.valueqword shr 32),
                             left.location.register64.reghi,tempreg64.reghi);
                             left.location.register64.reghi,tempreg64.reghi);
                     end
                     end
                   else
                   else
                     begin
                     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,
                          left.location.register64,right.location.register64,
                          tempreg64);
                          tempreg64);
                     end;
                     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));
                     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
                   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
                   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_reset(location,LOC_FLAGS,OS_NO);
                   location.resflags := getresflags;
                   location.resflags := getresflags;

+ 2 - 2
compiler/m68k/n68kcal.pas

@@ -41,7 +41,7 @@ implementation
       cutils,verbose,globals,
       cutils,verbose,globals,
       symconst,symbase,symsym,symtable,defutil,paramgr,parabase,
       symconst,symbase,symsym,symtable,defutil,paramgr,parabase,
       cgbase,pass_2,
       cgbase,pass_2,
-      cpuinfo,cpubase,aasmbase,aasmtai,aasmcpu,
+      cpuinfo,cpubase,aasmbase,aasmtai,aasmdata,aasmcpu,
       nmem,nld,ncnv,
       nmem,nld,ncnv,
       ncgutil,cgutils,cgobj,tgobj,regvars,rgobj,rgcpu,
       ncgutil,cgutils,cgobj,tgobj,regvars,rgobj,rgcpu,
       cg64f32,cgcpu,cpupi,procinfo;
       cg64f32,cgcpu,cpupi,procinfo;
@@ -57,7 +57,7 @@ implementation
               if po_syscall_legacy in tprocdef(procdefinition).procoptions then
               if po_syscall_legacy in tprocdef(procdefinition).procoptions then
                 begin
                 begin
                   reference_reset_base(tmpref,NR_A6,-tprocdef(procdefinition).extnumber);
                   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
                 end
               else
               else
                 internalerror(2005010403);
                 internalerror(2005010403);

+ 16 - 16
compiler/m68k/n68kcnv.pas

@@ -41,7 +41,7 @@ implementation
 
 
    uses
    uses
       verbose,globals,systems,
       verbose,globals,systems,
-      symconst,symdef,aasmbase,aasmtai,
+      symconst,symdef,aasmbase,aasmtai,aasmdata,
       defutil,
       defutil,
       cgbase,pass_1,pass_2,
       cgbase,pass_1,pass_2,
       ncon,ncal,
       ncon,ncal,
@@ -134,17 +134,17 @@ implementation
         if not signed then
         if not signed then
            internalerror(20020814);
            internalerror(20020814);
 
 
-        location.register:=cg.getfpuregister(exprasmlist,opsize);
+        location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,opsize);
         case left.location.loc of
         case left.location.loc of
           LOC_REGISTER, LOC_CREGISTER:
           LOC_REGISTER, LOC_CREGISTER:
             begin
             begin
               leftreg := left.location.register;
               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));
                   location.register));
             end;
             end;
           LOC_REFERENCE,LOC_CREFERENCE:
           LOC_REFERENCE,LOC_CREFERENCE:
             begin
             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));
                   left.location.reference,location.register));
             end
             end
           else
           else
@@ -178,38 +178,38 @@ implementation
                 { can we optimize it, or do we need to fix the ref. ? }
                 { can we optimize it, or do we need to fix the ref. ? }
                 if isvalidrefoffset(left.location.reference) then
                 if isvalidrefoffset(left.location.reference) then
                   begin
                   begin
-                    exprasmlist.concat(taicpu.op_ref(A_TST,TCGSize2OpSize[opsize],
+                    current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_TST,TCGSize2OpSize[opsize],
                        left.location.reference));
                        left.location.reference));
                   end
                   end
                 else
                 else
                   begin
                   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);
                         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;
                   end;
-//                reference_release(exprasmlist,left.location.reference);
+//                reference_release(current_asmdata.CurrAsmList,left.location.reference);
                 resflags:=F_NE;
                 resflags:=F_NE;
-                hreg1:=cg.getintregister(exprasmlist,opsize);
+                hreg1:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
               end;
               end;
             LOC_REGISTER,LOC_CREGISTER :
             LOC_REGISTER,LOC_CREGISTER :
               begin
               begin
                 hreg2:=left.location.register;
                 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;
                 resflags:=F_NE;
               end;
               end;
             LOC_FLAGS :
             LOC_FLAGS :
               begin
               begin
-                hreg1:=cg.getintregister(exprasmlist,opsize);
+                hreg1:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
                 resflags:=left.location.resflags;
                 resflags:=left.location.resflags;
               end;
               end;
             else
             else
              internalerror(200512182);
              internalerror(200512182);
          end;
          end;
-         cg.g_flags2reg(exprasmlist,location.size,resflags,hreg1);
+         cg.g_flags2reg(current_asmdata.CurrAsmList,location.size,resflags,hreg1);
          location.register := hreg1;
          location.register := hreg1;
       end;
       end;
 
 

+ 78 - 78
compiler/m68k/n68kmat.pas

@@ -52,8 +52,8 @@ implementation
     uses
     uses
       globtype,systems,
       globtype,systems,
       cutils,verbose,globals,
       cutils,verbose,globals,
-      symconst,symdef,aasmbase,aasmtai,aasmcpu,
-      pass_1,pass_2,
+      symconst,symdef,aasmbase,aasmtai,aasmdata,aasmcpu,
+      pass_1,pass_2,procinfo,
       ncon,
       ncon,
       cpuinfo,paramgr,defutil,parabase,
       cpuinfo,paramgr,defutil,parabase,
       tgobj,ncgutil,cgobj,cgutils,rgobj,rgcpu,cgcpu,cg64f32;
       tgobj,ncgutil,cgobj,cgutils,rgobj,rgcpu,cgcpu,cg64f32;
@@ -83,19 +83,19 @@ implementation
               LOC_JUMP :
               LOC_JUMP :
                 begin
                 begin
                   location_reset(location,LOC_JUMP,OS_NO);
                   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);
                   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;
                 end;
               LOC_FLAGS :
               LOC_FLAGS :
                 begin
                 begin
                   location_copy(location,left.location);
                   location_copy(location,left.location);
-//                  location_release(exprasmlist,left.location);
+//                  location_release(current_asmdata.CurrAsmList,left.location);
                   inverse_flags(location.resflags);
                   inverse_flags(location.resflags);
                 end;
                 end;
               LOC_CONSTANT,
               LOC_CONSTANT,
@@ -104,9 +104,9 @@ implementation
               LOC_REFERENCE,
               LOC_REFERENCE,
               LOC_CREFERENCE :
               LOC_CREFERENCE :
                 begin
                 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_reset(location,LOC_FLAGS,OS_NO);
                   location.resflags:=F_E;
                   location.resflags:=F_E;
                 end;
                 end;
@@ -118,19 +118,19 @@ implementation
            begin
            begin
               secondpass(left);
               secondpass(left);
               location_copy(location,left.location);
               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));
                 joinreg64(location.register64.reglo,location.register64.reghi));
            end
            end
          else
          else
           begin
           begin
              secondpass(left);
              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);
              location_copy(location,left.location);
              if location.loc=LOC_CREGISTER then
              if location.loc=LOC_CREGISTER then
-              location.register := cg.getintregister(exprasmlist,opsize);
+              location.register := cg.getintregister(current_asmdata.CurrAsmList,opsize);
              { perform the NOT operation }
              { 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;
       end;
       end;
 
 
@@ -148,39 +148,39 @@ implementation
      if aktcputype <> cpu_MC68000 then
      if aktcputype <> cpu_MC68000 then
        begin
        begin
          { verify if denominator is zero }
          { verify if denominator is zero }
-         objectlibrary.getjumplabel(continuelabel);
+         current_asmdata.getjumplabel(continuelabel);
          { compare against zero, if not zero continue }
          { 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;
 //       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
          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
          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 }
          { 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
        end
      else
      else
        begin
        begin
          { On MC68000/68010 mw must pass through RTL routines }
          { On MC68000/68010 mw must pass through RTL routines }
          reg_d0:=NR_D0;
          reg_d0:=NR_D0;
-         cg.getcpuregister(exprasmlist,NR_D0);
+         cg.getcpuregister(current_asmdata.CurrAsmList,NR_D0);
          reg_d1:=NR_D1;
          reg_d1:=NR_D1;
-         cg.getcpuregister(exprasmlist,NR_D1);
+         cg.getcpuregister(current_asmdata.CurrAsmList,NR_D1);
          { put numerator in d0 }
          { 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 }
          { 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
          if signed then
-             cg.a_call_name(exprasmlist,'FPC_DIV_LONGINT')
+             cg.a_call_name(current_asmdata.CurrAsmList,'FPC_DIV_LONGINT')
          else
          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;
    end;
    end;
 
 
@@ -196,54 +196,54 @@ implementation
      if aktcputype <> cpu_MC68000 then
      if aktcputype <> cpu_MC68000 then
        begin
        begin
          { verify if denominator is zero }
          { verify if denominator is zero }
-         objectlibrary.getjumplabel(continuelabel);
+         current_asmdata.getjumplabel(continuelabel);
          { compare against zero, if not zero continue }
          { 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  }
          { we have to prepare the high register with the  }
          { correct sign. i.e we clear it, check if the low dword reg }
          { correct sign. i.e we clear it, check if the low dword reg }
          { which will participate in the division is signed, if so we}
          { which will participate in the division is signed, if so we}
          { we extend the sign to the high doword register by inverting }
          { we extend the sign to the high doword register by inverting }
          { all the bits.                                             }
          { 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 }
          { its a negative value, therefore change sign }
-         cg.a_label(exprasmlist,signlabel);
+         cg.a_label(current_asmdata.CurrAsmList,signlabel);
          { tmpreg:num / denum }
          { tmpreg:num / denum }
 
 
          if signed then
          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
          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 }
          { 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
        end
      else
      else
        begin
        begin
          { On MC68000/68010 mw must pass through RTL routines }
          { On MC68000/68010 mw must pass through RTL routines }
          Reg_d0:=NR_D0;
          Reg_d0:=NR_D0;
-         cg.getcpuregister(exprasmlist,NR_D0);
+         cg.getcpuregister(current_asmdata.CurrAsmList,NR_D0);
          Reg_d1:=NR_D1;
          Reg_d1:=NR_D1;
-         cg.getcpuregister(exprasmlist,NR_D1);
+         cg.getcpuregister(current_asmdata.CurrAsmList,NR_D1);
          { put numerator in d0 }
          { 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 }
          { 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
          if signed then
-             cg.a_call_name(exprasmlist,'FPC_MOD_LONGINT')
+             cg.a_call_name(current_asmdata.CurrAsmList,'FPC_MOD_LONGINT')
          else
          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;
        end;
 //      writeln('exits');
 //      writeln('exits');
     end;
     end;
@@ -275,7 +275,7 @@ implementation
             location_reset(location,LOC_REGISTER,OS_64);
             location_reset(location,LOC_REGISTER,OS_64);
 
 
             { load left operator in a register }
             { 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;
             hreg64hi:=left.location.register64.reghi;
             hreg64lo:=left.location.register64.reglo;
             hreg64lo:=left.location.register64.reglo;
 
 
@@ -284,35 +284,35 @@ implementation
               begin
               begin
                 if nodetype = shln then
                 if nodetype = shln then
                   begin
                   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
                     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
                   end
                 else
                 else
                   begin
                   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
                     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;
                   end;
                 location.register64.reglo:=hreg64hi;
                 location.register64.reglo:=hreg64hi;
                 location.register64.reghi:=hreg64lo;
                 location.register64.reghi:=hreg64lo;
               end
               end
             else
             else
               begin
               begin
-                hregister:=cg.getintregister(exprasmlist,OS_32);
+                hregister:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
                 if nodetype = shln then
                 if nodetype = shln then
                   begin
                   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
                   end
                 else
                 else
                   begin
                   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;
                   end;
                 location.register64.reghi:=hreg64hi;
                 location.register64.reghi:=hreg64hi;
                 location.register64.reglo:=hreg64lo;
                 location.register64.reglo:=hreg64lo;
@@ -321,14 +321,14 @@ implementation
         else
         else
           begin
           begin
             { load left operators in a register }
             { 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);
             location_copy(location,left.location);
             resultreg := location.register;
             resultreg := location.register;
             hregister1 := location.register;
             hregister1 := location.register;
             if (location.loc = LOC_CREGISTER) then
             if (location.loc = LOC_CREGISTER) then
               begin
               begin
                 location.loc := LOC_REGISTER;
                 location.loc := LOC_REGISTER;
-                resultreg := cg.GetIntRegister(exprasmlist,OS_INT);
+                resultreg := cg.GetIntRegister(current_asmdata.CurrAsmList,OS_INT);
                 location.register := resultreg;
                 location.register := resultreg;
               end;
               end;
             { determine operator }
             { determine operator }
@@ -340,13 +340,13 @@ implementation
             if (right.nodetype=ordconstn) then
             if (right.nodetype=ordconstn) then
               begin
               begin
                 if tordconstnode(right).value and 31<>0 then
                 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
               end
             else
             else
               begin
               begin
                 { load shift count in a register if necessary }
                 { 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;
           end;
       end;
       end;

+ 5 - 5
compiler/m68k/ra68k.pas

@@ -26,7 +26,7 @@ unit ra68k;
   interface
   interface
 
 
     uses
     uses
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       cpubase,rautils,cclasses;
       cpubase,rautils,cclasses;
 
 
     type
     type
@@ -35,8 +35,8 @@ unit ra68k;
 
 
       Tm68kInstruction=class(TInstruction)
       Tm68kInstruction=class(TInstruction)
         opsize : topsize;
         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;
       end;
 
 
   implementation
   implementation
@@ -49,7 +49,7 @@ unit ra68k;
 *****************************************************************************}
 *****************************************************************************}
 
 
 {
 {
- function TM68kInstruction.ConcatInstruction(p : taasmoutput):tai;
+ function TM68kInstruction.ConcatInstruction(p : TAsmList):tai;
   var
   var
     fits : boolean;
     fits : boolean;
   begin
   begin
@@ -321,7 +321,7 @@ unit ra68k;
  end;
  end;
 }
 }
 
 
-    function TM68kInstruction.ConcatLabeledInstr(p : taasmoutput):tai;
+    function TM68kInstruction.ConcatLabeledInstr(p : TAsmList):tai;
       begin
       begin
         if ((opcode >= A_BCC) and (opcode <= A_BVS)) or
         if ((opcode >= A_BCC) and (opcode <= A_BVS)) or
            (opcode = A_BRA) or (opcode = A_BSR) or
            (opcode = A_BRA) or (opcode = A_BSR) or

+ 3 - 3
compiler/m68k/ra68kmot.pas

@@ -98,7 +98,7 @@ Implementation
        globals,verbose,
        globals,verbose,
        systems,
        systems,
        { aasm }
        { aasm }
-       cpuinfo,aasmtai,aasmcpu,
+       cpuinfo,aasmtai,aasmdata,aasmcpu,
        cgbase,
        cgbase,
        { symtable }
        { symtable }
        symbase,symtype,symsym,symtable,
        symbase,symtype,symsym,symtable,
@@ -1311,7 +1311,7 @@ const
                           l:=oper.opr.val;
                           l:=oper.opr.val;
                           oper.opr.typ := OPR_SYMBOL;
                           oper.opr.typ := OPR_SYMBOL;
                           oper.opr.symofs := l;
                           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;
                  end;
                  end;
    { // Constant memory offset .              // }
    { // Constant memory offset .              // }
@@ -1713,7 +1713,7 @@ const
             SetupTables;
             SetupTables;
             _asmsorted := TRUE;
             _asmsorted := TRUE;
           end;
           end;
-        curlist:=TAAsmoutput.Create;
+        curlist:=TAsmList.Create;
         { setup label linked list }
         { setup label linked list }
         LocalLabelList:=TLocalLabelList.Create;
         LocalLabelList:=TLocalLabelList.Create;
         c:=current_scanner.asmgetchar;
         c:=current_scanner.asmgetchar;

+ 1 - 1
compiler/m68k/rgcpu.pas

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

+ 1 - 1
compiler/mips/aasmcpu.pas

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

+ 6 - 6
compiler/nbas.pas

@@ -28,7 +28,7 @@ interface
     uses
     uses
        globtype,
        globtype,
        cpuinfo,cpubase,cgbase,cgutils,
        cpuinfo,cpubase,cgbase,cgutils,
-       aasmbase,aasmtai,aasmcpu,
+       aasmbase,aasmtai,aasmdata,aasmcpu,
        node,
        node,
        symtype;
        symtype;
 
 
@@ -49,12 +49,12 @@ interface
        terrornodeclass = class of terrornode;
        terrornodeclass = class of terrornode;
 
 
        tasmnode = class(tnode)
        tasmnode = class(tnode)
-          p_asm : taasmoutput;
+          p_asm : TAsmList;
           currenttai : tai;
           currenttai : tai;
           { Used registers in assembler block }
           { Used registers in assembler block }
           used_regs_int,
           used_regs_int,
           used_regs_fpu : tcpuregisterset;
           used_regs_fpu : tcpuregisterset;
-          constructor create(p : taasmoutput);virtual;
+          constructor create(p : TAsmList);virtual;
           constructor create_get_position;
           constructor create_get_position;
           destructor destroy;override;
           destructor destroy;override;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
           constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
@@ -475,7 +475,7 @@ implementation
                              TASMNODE
                              TASMNODE
 *****************************************************************************}
 *****************************************************************************}
 
 
-    constructor tasmnode.create(p : taasmoutput);
+    constructor tasmnode.create(p : TAsmList);
       begin
       begin
         inherited create(asmn);
         inherited create(asmn);
         p_asm:=p;
         p_asm:=p;
@@ -509,7 +509,7 @@ implementation
         inherited ppuload(t,ppufile);
         inherited ppuload(t,ppufile);
         if not(nf_get_asm_position in flags) then
         if not(nf_get_asm_position in flags) then
           begin
           begin
-            p_asm:=taasmoutput.create;
+            p_asm:=TAsmList.create;
             repeat
             repeat
               hp:=ppuloadai(ppufile);
               hp:=ppuloadai(ppufile);
               if hp=nil then
               if hp=nil then
@@ -584,7 +584,7 @@ implementation
         n := tasmnode(inherited _getcopy);
         n := tasmnode(inherited _getcopy);
         if assigned(p_asm) then
         if assigned(p_asm) then
           begin
           begin
-            n.p_asm:=taasmoutput.create;
+            n.p_asm:=TAsmList.create;
             n.p_asm.concatlistcopy(p_asm);
             n.p_asm.concatlistcopy(p_asm);
           end
           end
         else n.p_asm := nil;
         else n.p_asm := nil;

+ 75 - 75
compiler/ncgadd.pas

@@ -71,8 +71,8 @@ interface
       globtype,systems,
       globtype,systems,
       cutils,verbose,globals,
       cutils,verbose,globals,
       symconst,symdef,paramgr,
       symconst,symdef,paramgr,
-      aasmbase,aasmtai,defutil,
-      cgbase,pass_2,
+      aasmbase,aasmtai,aasmdata,defutil,
+      cgbase,procinfo,pass_2,
       ncon,nset,ncgutil,cgobj,cgutils
       ncon,nset,ncgutil,cgobj,cgutils
       ;
       ;
 
 
@@ -98,45 +98,45 @@ interface
         isjump:=(left.expectloc=LOC_JUMP);
         isjump:=(left.expectloc=LOC_JUMP);
         if isjump then
         if isjump then
           begin
           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;
           end;
         secondpass(left);
         secondpass(left);
         if left.location.loc in [LOC_FLAGS,LOC_JUMP] then
         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
         if isjump then
           begin
           begin
-            truelabel:=otl;
-            falselabel:=ofl;
+            current_procinfo.CurrTrueLabel:=otl;
+            current_procinfo.CurrFalseLabel:=ofl;
           end;
           end;
 
 
         { are too few registers free? }
         { are too few registers free? }
         if left.location.loc=LOC_FPUREGISTER then
         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
         else
           pushedfpu:=false;
           pushedfpu:=false;
         isjump:=(right.expectloc=LOC_JUMP);
         isjump:=(right.expectloc=LOC_JUMP);
         if isjump then
         if isjump then
           begin
           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;
           end;
         secondpass(right);
         secondpass(right);
         if right.location.loc in [LOC_FLAGS,LOC_JUMP] then
         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
         if isjump then
           begin
           begin
-            truelabel:=otl;
-            falselabel:=ofl;
+            current_procinfo.CurrTrueLabel:=otl;
+            current_procinfo.CurrFalseLabel:=ofl;
           end;
           end;
         if pushedfpu then
         if pushedfpu then
           begin
           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);
             location_reset(left.location,LOC_FPUREGISTER,left.location.size);
             left.location.register := tmpreg;
             left.location.register := tmpreg;
 {$ifdef x86}
 {$ifdef x86}
@@ -186,12 +186,12 @@ interface
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
             if location.size in [OS_64,OS_S64] then
             if location.size in [OS_64,OS_S64] then
               begin
               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
               end
             else
             else
 {$endif}
 {$endif}
-            location.register := cg.getintregister(exprasmlist,location.size);
+            location.register := cg.getintregister(current_asmdata.CurrAsmList,location.size);
           end;
           end;
       end;
       end;
 
 
@@ -203,14 +203,14 @@ interface
                allow_constant and
                allow_constant and
                (left.location.loc in [LOC_CONSTANT,LOC_CREGISTER])
                (left.location.loc in [LOC_CONSTANT,LOC_CREGISTER])
               ) then
               ) 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
         if (right.location.loc<>LOC_REGISTER) and
            not(
            not(
                allow_constant and
                allow_constant and
                (right.location.loc in [LOC_CONSTANT,LOC_CREGISTER]) and
                (right.location.loc in [LOC_CONSTANT,LOC_CREGISTER]) and
                (left.location.loc<>LOC_CONSTANT)
                (left.location.loc<>LOC_CONSTANT)
               ) then
               ) 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 }
         { Left is always a register, right can be register or constant }
         if left.location.loc=LOC_CONSTANT then
         if left.location.loc=LOC_CONSTANT then
@@ -264,7 +264,7 @@ interface
           swapleftright;
           swapleftright;
         if (right.nodetype=setelementn) and
         if (right.nodetype=setelementn) and
            (left.location.loc<>LOC_REGISTER) then
            (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;
         set_result_location_reg;
 
 
@@ -278,20 +278,20 @@ interface
                   if assigned(tsetelementnode(right).right) then
                   if assigned(tsetelementnode(right).right) then
                    internalerror(43244);
                    internalerror(43244);
                   if (right.location.loc = LOC_CONSTANT) then
                   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),
                       aint(1 shl right.location.value),
                       left.location.register,location.register)
                       left.location.register,location.register)
                   else
                   else
                     begin
                     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);
                         right.location.register,tmpreg);
                       if left.location.loc <> LOC_CONSTANT then
                       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)
                             left.location.register,location.register)
                       else
                       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);
                             left.location.value,tmpreg,location.register);
                     end;
                     end;
                   opdone := true;
                   opdone := true;
@@ -322,18 +322,18 @@ interface
                 begin
                 begin
                   if left.location.loc = LOC_CONSTANT then
                   if left.location.loc = LOC_CONSTANT then
                     begin
                     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);
                         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
                     end
                   else
                   else
                     begin
                     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;
                 end;
             end;
             end;
@@ -347,11 +347,11 @@ interface
             if (left.location.loc = LOC_CONSTANT) then
             if (left.location.loc = LOC_CONSTANT) then
               swapleftright;
               swapleftright;
             if (right.location.loc = LOC_CONSTANT) then
             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,
                 right.location.value,left.location.register,
                 location.register)
                 location.register)
             else
             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,
                 right.location.register,left.location.register,
                 location.register);
                 location.register);
           end;
           end;
@@ -385,27 +385,27 @@ interface
             case nodetype of
             case nodetype of
               andn :
               andn :
                 begin
                 begin
-                   otl:=truelabel;
-                   objectlibrary.getjumplabel(truelabel);
+                   otl:=current_procinfo.CurrTrueLabel;
+                   current_asmdata.getjumplabel(current_procinfo.CurrTrueLabel);
                    secondpass(left);
                    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;
                 end;
               orn :
               orn :
                 begin
                 begin
-                   ofl:=falselabel;
-                   objectlibrary.getjumplabel(falselabel);
+                   ofl:=current_procinfo.CurrFalseLabel;
+                   current_asmdata.getjumplabel(current_procinfo.CurrFalseLabel);
                    secondpass(left);
                    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;
                 end;
               else
               else
                 internalerror(200307044);
                 internalerror(200307044);
             end;
             end;
             secondpass(right);
             secondpass(right);
-            maketojumpbool(exprasmlist,right,lr_load_regvars);
+            maketojumpbool(current_asmdata.CurrAsmList,right,lr_load_regvars);
           end
           end
         else
         else
           begin
           begin
@@ -425,11 +425,11 @@ interface
             end;
             end;
 
 
             if right.location.loc <> LOC_CONSTANT then
             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,
                  left.location.register,right.location.register,
                  location.register)
                  location.register)
             else
             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,
                  right.location.value,left.location.register,
                  location.register);
                  location.register);
          end;
          end;
@@ -495,10 +495,10 @@ interface
           xorn,orn,andn,addn:
           xorn,orn,andn,addn:
             begin
             begin
               if (right.location.loc = LOC_CONSTANT) then
               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)
                   left.location.register,location.register)
               else
               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);
                   left.location.register,location.register);
             end;
             end;
           subn:
           subn:
@@ -510,20 +510,20 @@ interface
                 begin
                 begin
                   if right.location.loc <> LOC_CONSTANT then
                   if right.location.loc <> LOC_CONSTANT then
                     // reg64 - reg64
                     // 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,
                       right.location.register,left.location.register,location.register,
                       checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc)
                       checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc)
                   else
                   else
                     // reg64 - const64
                     // 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,
                       right.location.value,left.location.register,location.register,
                       checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc);
                       checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc);
                 end
                 end
               else
               else
                 begin
                 begin
                   // const64 - reg64
                   // 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,
                     right.location.register,left.location.register,location.register,
                     checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc);
                     checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc);
                 end;
                 end;
@@ -536,11 +536,11 @@ interface
           xorn,orn,andn,addn:
           xorn,orn,andn,addn:
             begin
             begin
               if (right.location.loc = LOC_CONSTANT) then
               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,
                   left.location.register64,location.register64,
                   checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc)
                   checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc)
               else
               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,
                   left.location.register64,location.register64,
                   checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc);
                   checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc);
             end;
             end;
@@ -553,13 +553,13 @@ interface
                 begin
                 begin
                   if right.location.loc <> LOC_CONSTANT then
                   if right.location.loc <> LOC_CONSTANT then
                     // reg64 - reg64
                     // 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,
                       right.location.register64,left.location.register64,
                       location.register64,
                       location.register64,
                       checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc)
                       checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc)
                   else
                   else
                     // reg64 - const64
                     // 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,
                       right.location.value64,left.location.register64,
                       location.register64,
                       location.register64,
                       checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc)
                       checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc)
@@ -567,8 +567,8 @@ interface
               else
               else
                 begin
                 begin
                   // const64 - reg64
                   // 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,
                     right.location.register64,left.location.register64,
                     location.register64,
                     location.register64,
                     checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc);
                     checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc);
@@ -581,7 +581,7 @@ interface
 
 
         { emit overflow check if enabled }
         { emit overflow check if enabled }
         if checkoverflow then
         if checkoverflow then
-           cg.g_overflowcheck_loc(exprasmlist,Location,ResultType.Def,ovloc);
+           cg.g_overflowcheck_loc(current_asmdata.CurrAsmList,Location,ResultType.Def,ovloc);
       end;
       end;
 
 
 
 
@@ -679,11 +679,11 @@ interface
        if nodetype<>subn then
        if nodetype<>subn then
         begin
         begin
           if (right.location.loc<>LOC_CONSTANT) then
           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,
                left.location.register,right.location.register,
                location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc)
                location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc)
           else
           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,
                right.location.value,left.location.register,
                location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc);
                location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc);
         end
         end
@@ -694,27 +694,27 @@ interface
           if left.location.loc<>LOC_CONSTANT then
           if left.location.loc<>LOC_CONSTANT then
             begin
             begin
               if right.location.loc<>LOC_CONSTANT then
               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,
                     right.location.register,left.location.register,
                     location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc)
                     location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc)
               else
               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,
                   aword(right.location.value),left.location.register,
                   location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc);
                   location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc);
             end
             end
           else
           else
             begin
             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);
                 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);
                 right.location.register,tmpreg,location.register,checkoverflow and (cs_check_overflow in aktlocalswitches),ovloc);
             end;
             end;
         end;
         end;
 
 
         { emit overflow check if required }
         { emit overflow check if required }
         if checkoverflow then
         if checkoverflow then
-          cg.g_overflowcheck_loc(exprasmlist,Location,ResultType.Def,ovloc);
+          cg.g_overflowcheck_loc(current_asmdata.CurrAsmList,Location,ResultType.Def,ovloc);
       end;
       end;
 
 
 
 

+ 29 - 29
compiler/ncgbas.pas

@@ -68,7 +68,7 @@ interface
     uses
     uses
       globtype,globals,systems,
       globtype,globals,systems,
       cutils,verbose,
       cutils,verbose,
-      aasmbase,aasmtai,aasmcpu,symsym,symconst,
+      aasmbase,aasmtai,aasmdata,aasmcpu,symsym,symconst,
       defutil,
       defutil,
       nflw,pass_2,
       nflw,pass_2,
       cgbase,cgobj,
       cgbase,cgobj,
@@ -125,7 +125,7 @@ interface
              (p is tasmlabel) then
              (p is tasmlabel) then
            begin
            begin
              if not assigned(p.altsymbol) then
              if not assigned(p.altsymbol) then
-               objectlibrary.GenerateAltSymbol(p);
+               current_asmdata.GenerateAltSymbol(p);
              p:=p.altsymbol;
              p:=p.altsymbol;
              p.increfs;
              p.increfs;
            end;
            end;
@@ -217,13 +217,13 @@ interface
          if (nf_get_asm_position in flags) then
          if (nf_get_asm_position in flags) then
            begin
            begin
              { Add a marker, to be sure the list is not empty }
              { 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;
              exit;
            end;
            end;
 
 
          { Allocate registers used in the assembler block }
          { 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
          if (po_inline in current_procinfo.procdef.procoptions) then
            begin
            begin
@@ -272,18 +272,18 @@ interface
                    ait_marker :
                    ait_marker :
                      begin
                      begin
                      { it's not an assembler block anymore }
                      { 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;
                         skipnode:=true;
                      end;
                      end;
                 end;
                 end;
                 if not skipnode then
                 if not skipnode then
-                  exprasmList.concat(hp2)
+                  current_asmdata.CurrAsmList.concat(hp2)
                 else
                 else
                   hp2.free;
                   hp2.free;
                 hp:=tai(hp.next);
                 hp:=tai(hp.next);
               end;
               end;
              { restore used symbols }
              { restore used symbols }
-             objectlibrary.ResetAltSymbols;
+             current_asmdata.ResetAltSymbols;
            end
            end
          else
          else
            begin
            begin
@@ -308,11 +308,11 @@ interface
                 hp:=tai(hp.next);
                 hp:=tai(hp.next);
               end;
               end;
              { insert the list }
              { insert the list }
-             exprasmList.concatlist(p_asm);
+             current_asmdata.CurrAsmList.concatlist(p_asm);
            end;
            end;
 
 
          { Release register used in the assembler block }
          { 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;
        end;
 
 
 
 
@@ -330,8 +330,8 @@ interface
         { replace exitlabel? }
         { replace exitlabel? }
         if nf_block_with_exit in flags then
         if nf_block_with_exit in flags then
           begin
           begin
-            oldexitlabel:=current_procinfo.aktexitlabel;
-            objectlibrary.getjumplabel(current_procinfo.aktexitlabel);
+            oldexitlabel:=current_procinfo.CurrExitLabel;
+            current_asmdata.getjumplabel(current_procinfo.CurrExitLabel);
           end;
           end;
 
 
         { do second pass on left node }
         { do second pass on left node }
@@ -353,8 +353,8 @@ interface
         { write exitlabel }
         { write exitlabel }
         if nf_block_with_exit in flags then
         if nf_block_with_exit in flags then
           begin
           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;
       end;
       end;
 
 
@@ -375,7 +375,7 @@ interface
         if tempinfo^.restype.def.needs_inittable then
         if tempinfo^.restype.def.needs_inittable then
           begin
           begin
             location_reset(tempinfo^.location,LOC_REFERENCE,def_cgsize(tempinfo^.restype.def));
             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
           end
         else if tempinfo^.may_be_in_reg then
         else if tempinfo^.may_be_in_reg then
           begin
           begin
@@ -385,7 +385,7 @@ interface
                   location_reset(tempinfo^.location,LOC_CFPUREGISTER,def_cgsize(tempinfo^.restype.def))
                   location_reset(tempinfo^.location,LOC_CFPUREGISTER,def_cgsize(tempinfo^.restype.def))
                 else
                 else
                   location_reset(tempinfo^.location,LOC_FPUREGISTER,def_cgsize(tempinfo^.restype.def));
                   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
               end
             else
             else
               begin
               begin
@@ -396,18 +396,18 @@ interface
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                 if tempinfo^.location.size in [OS_64,OS_S64] then
                 if tempinfo^.location.size in [OS_64,OS_S64] then
                   begin
                   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
                   end
                 else
                 else
 {$endif cpu64bit}
 {$endif cpu64bit}
-                  tempinfo^.location.register:=cg.getintregister(exprasmlist,tempinfo^.location.size);
+                  tempinfo^.location.register:=cg.getintregister(current_asmdata.CurrAsmList,tempinfo^.location.size);
               end;
               end;
           end
           end
         else
         else
           begin
           begin
             location_reset(tempinfo^.location,LOC_REFERENCE,def_cgsize(tempinfo^.restype.def));
             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;
           end;
         tempinfo^.valid := true;
         tempinfo^.valid := true;
       end;
       end;
@@ -443,10 +443,10 @@ interface
         if (tempinfo^.location.loc<>LOC_REFERENCE) then
         if (tempinfo^.location.loc<>LOC_REFERENCE) then
           internalerror(2004020203);
           internalerror(2004020203);
         if (tempinfo^.temptype = tt_persistent) then
         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;
         tempinfo^.location.reference := ref;
-        tg.ChangeTempType(exprasmlist,tempinfo^.location.reference,tempinfo^.temptype);
+        tg.ChangeTempType(current_asmdata.CurrAsmList,tempinfo^.location.reference,tempinfo^.temptype);
         { adapt location }
         { adapt location }
         location.reference := ref;
         location.reference := ref;
         inc(location.reference.offset,offset);
         inc(location.reference.offset,offset);
@@ -465,10 +465,10 @@ interface
           LOC_REFERENCE:
           LOC_REFERENCE:
             begin
             begin
               if release_to_normal then
               if release_to_normal then
-                tg.ChangeTempType(exprasmlist,tempinfo^.location.reference,tt_normal)
+                tg.ChangeTempType(current_asmdata.CurrAsmList,tempinfo^.location.reference,tt_normal)
               else
               else
                 begin
                 begin
-                  tg.UnGetTemp(exprasmlist,tempinfo^.location.reference);
+                  tg.UnGetTemp(current_asmdata.CurrAsmList,tempinfo^.location.reference);
                   tempinfo^.valid := false;
                   tempinfo^.valid := false;
                 end;
                 end;
             end;
             end;
@@ -483,12 +483,12 @@ interface
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                   if tempinfo^.location.size in [OS_64,OS_S64] then
                   if tempinfo^.location.size in [OS_64,OS_S64] then
                     begin
                     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
                     end
                   else
                   else
 {$endif cpu64bit}
 {$endif cpu64bit}
-                    cg.a_reg_sync(exprasmlist,tempinfo^.location.register);
+                    cg.a_reg_sync(current_asmdata.CurrAsmList,tempinfo^.location.register);
                 end;
                 end;
               if release_to_normal then
               if release_to_normal then
                 tempinfo^.location.loc := LOC_REGISTER
                 tempinfo^.location.loc := LOC_REGISTER
@@ -503,7 +503,7 @@ interface
                 begin
                 begin
                   { make sure the register allocator doesn't reuse the }
                   { make sure the register allocator doesn't reuse the }
                   { register e.g. in the middle of a loop              }
                   { 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;
                 end;
               if release_to_normal then
               if release_to_normal then
                 tempinfo^.location.loc := LOC_FPUREGISTER
                 tempinfo^.location.loc := LOC_FPUREGISTER

+ 114 - 114
compiler/ncgcal.pas

@@ -78,7 +78,7 @@ implementation
       cutils,verbose,globals,
       cutils,verbose,globals,
       symconst,symtable,defutil,paramgr,
       symconst,symtable,defutil,paramgr,
       cgbase,pass_2,
       cgbase,pass_2,
-      aasmbase,aasmtai,
+      aasmbase,aasmtai,aasmdata,
       nbas,nmem,nld,ncnv,nutils,
       nbas,nmem,nld,ncnv,nutils,
 {$ifdef x86}
 {$ifdef x86}
       cga,cgx86,
       cga,cgx86,
@@ -110,7 +110,7 @@ implementation
       begin
       begin
         if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
         if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
           internalerror(200304235);
           internalerror(200304235);
-        cg.a_paramaddr_ref(exprasmlist,left.location.reference,tempcgpara);
+        cg.a_paramaddr_ref(current_asmdata.CurrAsmList,left.location.reference,tempcgpara);
       end;
       end;
 
 
 
 
@@ -127,7 +127,7 @@ implementation
 
 
         { Move flags and jump in register to make it less complex }
         { Move flags and jump in register to make it less complex }
         if left.location.loc in [LOC_FLAGS,LOC_JUMP] then
         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 }
         { Handle Floating point types differently }
         if (left.resulttype.def.deftype=floatdef) and not(cs_fp_emulation in aktmoduleswitches) then
         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);
                  size:=align(TCGSize2Size[left.location.size],tempcgpara.alignment);
                  if tempcgpara.location^.reference.index=NR_STACK_POINTER_REG then
                  if tempcgpara.location^.reference.index=NR_STACK_POINTER_REG then
                    begin
                    begin
-                     cg.g_stackpointer_alloc(exprasmlist,size);
+                     cg.g_stackpointer_alloc(current_asmdata.CurrAsmList,size);
                      reference_reset_base(href,NR_STACK_POINTER_REG,0);
                      reference_reset_base(href,NR_STACK_POINTER_REG,0);
                    end
                    end
                  else
                  else
                    reference_reset_base(href,tempcgpara.location^.reference.index,tempcgpara.location^.reference.offset);
                    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;
                end;
              LOC_MMREGISTER,
              LOC_MMREGISTER,
              LOC_CMMREGISTER:
              LOC_CMMREGISTER:
@@ -155,12 +155,12 @@ implementation
                  size:=align(tfloatdef(left.resulttype.def).size,tempcgpara.alignment);
                  size:=align(tfloatdef(left.resulttype.def).size,tempcgpara.alignment);
                  if tempcgpara.location^.reference.index=NR_STACK_POINTER_REG then
                  if tempcgpara.location^.reference.index=NR_STACK_POINTER_REG then
                    begin
                    begin
-                     cg.g_stackpointer_alloc(exprasmlist,size);
+                     cg.g_stackpointer_alloc(current_asmdata.CurrAsmList,size);
                      reference_reset_base(href,NR_STACK_POINTER_REG,0);
                      reference_reset_base(href,NR_STACK_POINTER_REG,0);
                    end
                    end
                  else
                  else
                    reference_reset_base(href,tempcgpara.location^.reference.index,tempcgpara.location^.reference.offset);
                    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;
                end;
              LOC_REFERENCE,
              LOC_REFERENCE,
              LOC_CREFERENCE :
              LOC_CREFERENCE :
@@ -168,11 +168,11 @@ implementation
                  size:=align(left.resulttype.def.size,tempcgpara.alignment);
                  size:=align(left.resulttype.def.size,tempcgpara.alignment);
                  if (not use_fixed_stack) and
                  if (not use_fixed_stack) and
                     (tempcgpara.location^.reference.index=NR_STACK_POINTER_REG) then
                     (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
                  else
                    begin
                    begin
                      reference_reset_base(href,tempcgpara.location^.reference.index,tempcgpara.location^.reference.offset);
                      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;
                end;
                end;
              else
              else
@@ -187,12 +187,12 @@ implementation
                  LOC_CREFERENCE,
                  LOC_CREFERENCE,
                  LOC_MMREGISTER,
                  LOC_MMREGISTER,
                  LOC_CMMREGISTER:
                  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_FPUREGISTER,
                  LOC_CFPUREGISTER:
                  LOC_CFPUREGISTER:
                    begin
                    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;
                    end;
                  else
                  else
                    internalerror(200204249);
                    internalerror(200204249);
@@ -203,18 +203,18 @@ implementation
                  LOC_MMREGISTER,
                  LOC_MMREGISTER,
                  LOC_CMMREGISTER:
                  LOC_CMMREGISTER:
                    begin
                    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;
                    end;
 {$ifdef x86_64}
 {$ifdef x86_64}
                  { x86_64 pushes s64comp in normal register }
                  { x86_64 pushes s64comp in normal register }
                  LOC_REGISTER,
                  LOC_REGISTER,
                  LOC_CREGISTER :
                  LOC_CREGISTER :
                    begin
                    begin
-                     location_force_mem(exprasmlist,left.location);
+                     location_force_mem(current_asmdata.CurrAsmList,left.location);
                      { force integer size }
                      { force integer size }
                      left.location.size:=int_cgsize(tcgsize2size[left.location.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;
                    end;
 {$endif x86_64}
 {$endif x86_64}
 {$ifdef powerpc}
 {$ifdef powerpc}
@@ -223,13 +223,13 @@ implementation
                    begin
                    begin
                      { aix abi passes floats of varargs in both fpu and }
                      { aix abi passes floats of varargs in both fpu and }
                      { integer registers                                }
                      { integer registers                                }
-                     location_force_mem(exprasmlist,left.location);
+                     location_force_mem(current_asmdata.CurrAsmList,left.location);
                      { force integer size }
                      { force integer size }
                      left.location.size:=int_cgsize(tcgsize2size[left.location.size]);
                      left.location.size:=int_cgsize(tcgsize2size[left.location.size]);
                      if (left.location.size in [OS_32,OS_S32]) then
                      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
                      else
-                       cg64.a_param64_ref(exprasmlist,left.location.reference,tempcgpara);
+                       cg64.a_param64_ref(current_asmdata.CurrAsmList,left.location.reference,tempcgpara);
                    end;
                    end;
 {$endif powerpc}
 {$endif powerpc}
 {$ifdef powerpc64}
 {$ifdef powerpc64}
@@ -237,10 +237,10 @@ implementation
                  LOC_CREGISTER :
                  LOC_CREGISTER :
                    begin
                    begin
                      { ppc64 abi passes floats of varargs in integer registers, so force a store }
                      { 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 }
                      { force integer size }
                      left.location.size:=int_cgsize(tcgsize2size[tempcgpara.location^.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;
                    end;
 {$endif powerpc64}
 {$endif powerpc64}
 {$if defined(sparc) or defined(arm)}
 {$if defined(sparc) or defined(arm)}
@@ -252,7 +252,7 @@ implementation
                  LOC_CREFERENCE,
                  LOC_CREFERENCE,
                  LOC_FPUREGISTER,
                  LOC_FPUREGISTER,
                  LOC_CFPUREGISTER:
                  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
                  else
                    internalerror(2002042433);
                    internalerror(2002042433);
                end;
                end;
@@ -261,7 +261,7 @@ implementation
                case tempcgpara.location^.loc of
                case tempcgpara.location^.loc of
                  LOC_MMREGISTER,
                  LOC_MMREGISTER,
                  LOC_CMMREGISTER:
                  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}
 {$ifdef x86_64}
                  { x86_64 pushes s64comp in normal register }
                  { x86_64 pushes s64comp in normal register }
                  LOC_REGISTER,
                  LOC_REGISTER,
@@ -269,7 +269,7 @@ implementation
                    begin
                    begin
                      { force integer size }
                      { force integer size }
                      left.location.size:=int_cgsize(tcgsize2size[left.location.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;
                    end;
 {$endif x86_64}
 {$endif x86_64}
 {$ifdef powerpc}
 {$ifdef powerpc}
@@ -280,9 +280,9 @@ implementation
                      { force integer size }
                      { force integer size }
                      left.location.size:=int_cgsize(tcgsize2size[left.location.size]);
                      left.location.size:=int_cgsize(tcgsize2size[left.location.size]);
                      if (left.location.size in [OS_32,OS_S32]) then
                      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
                      else
-                       cg64.a_param64_ref(exprasmlist,left.location.reference,tempcgpara);
+                       cg64.a_param64_ref(current_asmdata.CurrAsmList,left.location.reference,tempcgpara);
                    end;
                    end;
 {$endif powerpc}
 {$endif powerpc}
 {$ifdef powerpc64}
 {$ifdef powerpc64}
@@ -291,7 +291,7 @@ implementation
                    begin
                    begin
                      { force integer size }
                      { force integer size }
                      left.location.size:=int_cgsize(tcgsize2size[tempcgpara.location^.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;
                    end;
 {$endif powerpc64}
 {$endif powerpc64}
 {$if defined(sparc) or defined(arm) }
 {$if defined(sparc) or defined(arm) }
@@ -303,7 +303,7 @@ implementation
                  LOC_CREFERENCE,
                  LOC_CREFERENCE,
                  LOC_FPUREGISTER,
                  LOC_FPUREGISTER,
                  LOC_CFPUREGISTER:
                  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
                  else
                    internalerror(2002042431);
                    internalerror(2002042431);
                end;
                end;
@@ -324,7 +324,7 @@ implementation
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                  { use cg64 only for int64, not for 8 byte records }
                  { use cg64 only for int64, not for 8 byte records }
                  if is_64bit(left.resulttype.def) then
                  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
                  else
 {$endif cpu64bit}
 {$endif cpu64bit}
                    begin
                    begin
@@ -334,15 +334,15 @@ implementation
                        to a reference first. This situation can be triggered
                        to a reference first. This situation can be triggered
                        by typecasting an int64 constant to a record of 8 bytes }
                        by typecasting an int64 constant to a record of 8 bytes }
                      if left.location.size in [OS_64,OS_S64] then
                      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}
 {$endif cpu64bit}
-                     cg.a_param_loc(exprasmlist,left.location,tempcgpara);
+                     cg.a_param_loc(current_asmdata.CurrAsmList,left.location,tempcgpara);
                    end;
                    end;
                end;
                end;
 {$ifdef SUPPORT_MMX}
 {$ifdef SUPPORT_MMX}
              LOC_MMXREGISTER,
              LOC_MMXREGISTER,
              LOC_CMMXREGISTER:
              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}
 {$endif SUPPORT_MMX}
              else
              else
                internalerror(200204241);
                internalerror(200204241);
@@ -364,21 +364,21 @@ implementation
            a parameter }
            a parameter }
          if (left.nodetype<>nothingn) then
          if (left.nodetype<>nothingn) then
            begin
            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);
              secondpass(left);
 
 
              { release memory for refcnt out parameters }
              { release memory for refcnt out parameters }
              if (parasym.varspez=vs_out) and
              if (parasym.varspez=vs_out) and
                 (left.resulttype.def.needs_inittable) then
                 (left.resulttype.def.needs_inittable) then
                begin
                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;
                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 }
              { handle varargs first, because parasym is not valid }
              if (cpf_varargs_para in callparaflags) then
              if (cpf_varargs_para in callparaflags) then
@@ -408,7 +408,7 @@ implementation
                   { allow passing of a constant to a const formaldef }
                   { allow passing of a constant to a const formaldef }
                   if (parasym.varspez=vs_const) and
                   if (parasym.varspez=vs_const) and
                      (left.location.loc in [LOC_CONSTANT,LOC_REGISTER]) then
                      (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;
                   push_addr_para;
                end
                end
              { Normal parameter }
              { Normal parameter }
@@ -436,7 +436,7 @@ implementation
                           if (left.location.reference.index<>NR_NO) or
                           if (left.location.reference.index<>NR_NO) or
                              (left.location.reference.offset<>0) then
                              (left.location.reference.offset<>0) then
                             internalerror(200410107);
                             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
                         end
                       else
                       else
                         begin
                         begin
@@ -452,15 +452,15 @@ implementation
                            end;
                            end;
                           { Force to be in memory }
                           { Force to be in memory }
                           if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
                           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;
                           push_addr_para;
                         end;
                         end;
                    end
                    end
                  else
                  else
                    push_value_para;
                    push_value_para;
                end;
                end;
-             truelabel:=otlabel;
-             falselabel:=oflabel;
+             current_procinfo.CurrTrueLabel:=otlabel;
+             current_procinfo.CurrFalseLabel:=oflabel;
 
 
              { update return location in callnode when this is the function
              { update return location in callnode when this is the function
                result }
                result }
@@ -526,22 +526,22 @@ implementation
 
 
               { the FUNCTION_RESULT_REG is already allocated }
               { the FUNCTION_RESULT_REG is already allocated }
               if getsupreg(procdefinition.funcretloc[callerside].register)<first_int_imreg then
               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
               if not assigned(funcretnode) then
                 begin
                 begin
                   { reg_ref could generate two instrcutions and allocate a register so we've to
                   { reg_ref could generate two instrcutions and allocate a register so we've to
                     save the result first before releasing it }
                     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_reset(location,LOC_REFERENCE,OS_ADDR);
                   location.reference:=refcountedtemp;
                   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
                 end
               else
               else
                 begin
                 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 }
                   { in case of a regular funcretnode with ret_in_param, the }
                   { original funcretnode isn't touched -> make sure it's    }
                   { original funcretnode isn't touched -> make sure it's    }
                   { the same here (not sure if it's necessary)              }
                   { the same here (not sure if it's necessary)              }
@@ -549,8 +549,8 @@ implementation
                   tempnode.pass_2;
                   tempnode.pass_2;
                   location := tempnode.location;
                   location := tempnode.location;
                   tempnode.free;
                   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;
             end
             end
         else
         else
@@ -569,9 +569,9 @@ implementation
                        tcgx86(cg).inc_fpu_stack;
                        tcgx86(cg).inc_fpu_stack;
 {$else x86}
 {$else x86}
                        if getsupreg(procdefinition.funcretloc[callerside].register)<first_fpu_imreg then
                        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;
                        location.register:=hregister;
 {$endif x86}
 {$endif x86}
                      end;
                      end;
@@ -589,13 +589,13 @@ implementation
                                internalerror(200409141);
                                internalerror(200409141);
                              { the function result registers are already allocated }
                              { the function result registers are already allocated }
                              if getsupreg(retloc.register64.reglo)<first_int_imreg then
                              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
                              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
                            end
                           else
                           else
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -605,9 +605,9 @@ implementation
                                def_cgsize(resulttype.def) is used here because
                                def_cgsize(resulttype.def) is used here because
                                it could be a constructor call }
                                it could be a constructor call }
                              if getsupreg(procdefinition.funcretloc[callerside].register)<first_int_imreg then
                              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;
                         end
                         end
                        else
                        else
@@ -621,9 +621,9 @@ implementation
                      begin
                      begin
                        location_reset(location,LOC_MMREGISTER,cgsize);
                        location_reset(location,LOC_MMREGISTER,cgsize);
                        if getsupreg(procdefinition.funcretloc[callerside].register)<first_mm_imreg then
                        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;
                      end;
 
 
                    else
                    else
@@ -638,7 +638,7 @@ implementation
                   emit_reg(A_FSTP,S_NO,NR_FPU_RESULT_REG);
                   emit_reg(A_FSTP,S_NO,NR_FPU_RESULT_REG);
 {$endif x86}
 {$endif x86}
                 if cgsize<>OS_NO then
                 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);
                 location_reset(location,LOC_VOID,OS_NO);
               end;
               end;
            end;
            end;
@@ -650,8 +650,8 @@ implementation
             if location.loc=LOC_REFERENCE then
             if location.loc=LOC_REFERENCE then
               begin
               begin
                 if resulttype.def.needs_inittable then
                 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;
           end;
       end;
       end;
@@ -671,7 +671,7 @@ implementation
                  { don't release the funcret temp }
                  { don't release the funcret temp }
                  if not(assigned(ppn.parasym)) or
                  if not(assigned(ppn.parasym)) or
                     not(vo_is_funcret in ppn.parasym.varoptions) then
                     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 }
                  { process also all nodes of an array of const }
                  hp:=ppn.left;
                  hp:=ppn.left;
                  while (hp.nodetype=typeconvn) do
                  while (hp.nodetype=typeconvn) do
@@ -681,7 +681,7 @@ implementation
                    begin
                    begin
                      while assigned(hp) do
                      while assigned(hp) do
                        begin
                        begin
-                         location_freetemp(exprasmlist,tarrayconstructornode(hp).left.location);
+                         location_freetemp(current_asmdata.CurrAsmList,tarrayconstructornode(hp).left.location);
                          hp:=tarrayconstructornode(hp).right;
                          hp:=tarrayconstructornode(hp).right;
                        end;
                        end;
                    end;
                    end;
@@ -709,7 +709,7 @@ implementation
                  { better check for the real location of the parameter here, when stack passed parameters
                  { 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
                    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;
                  tmpparaloc:=ppn.tempcgpara.location;
                  sizeleft:=ppn.tempcgpara.intsize;
                  sizeleft:=ppn.tempcgpara.intsize;
                  callerparaloc:=ppn.parasym.paraloc[callerside].location;
                  callerparaloc:=ppn.parasym.paraloc[callerside].location;
@@ -726,8 +726,8 @@ implementation
                            if tmpparaloc^.loc<>LOC_REGISTER then
                            if tmpparaloc^.loc<>LOC_REGISTER then
                              internalerror(200408221);
                              internalerror(200408221);
                            if getsupreg(callerparaloc^.register)<first_int_imreg then
                            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);
                                tmpparaloc^.register,callerparaloc^.register);
                          end;
                          end;
                        LOC_FPUREGISTER:
                        LOC_FPUREGISTER:
@@ -735,16 +735,16 @@ implementation
                            if tmpparaloc^.loc<>LOC_FPUREGISTER then
                            if tmpparaloc^.loc<>LOC_FPUREGISTER then
                              internalerror(200408222);
                              internalerror(200408222);
                            if getsupreg(callerparaloc^.register)<first_fpu_imreg then
                            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;
                          end;
                        LOC_MMREGISTER:
                        LOC_MMREGISTER:
                          begin
                          begin
                            if tmpparaloc^.loc<>LOC_MMREGISTER then
                            if tmpparaloc^.loc<>LOC_MMREGISTER then
                              internalerror(200408223);
                              internalerror(200408223);
                            if getsupreg(callerparaloc^.register)<first_mm_imreg then
                            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);
                              tmpparaloc^.register,callerparaloc^.register,mms_movescalar);
                          end;
                          end;
                        LOC_REFERENCE:
                        LOC_REFERENCE:
@@ -767,16 +767,16 @@ implementation
                                     { use concatcopy, because it can also be a float which fails when
                                     { use concatcopy, because it can also be a float which fails when
                                       load_ref_ref is used }
                                       load_ref_ref is used }
                                     if (ppn.tempcgpara.size <> OS_NO) then
                                     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
                                     else
-                                      cg.g_concatcopy(exprasmlist,htempref,href,sizeleft)
+                                      cg.g_concatcopy(current_asmdata.CurrAsmList,htempref,href,sizeleft)
                                   end;
                                   end;
                                 LOC_REGISTER:
                                 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:
                                 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:
                                 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
                                 else
                                   internalerror(200402081);
                                   internalerror(200402081);
                              end;
                              end;
@@ -804,7 +804,7 @@ implementation
              if (ppn.left.nodetype<>nothingn) then
              if (ppn.left.nodetype<>nothingn) then
                begin
                begin
                  if (ppn.parasym.paraloc[callerside].location^.loc <> LOC_REFERENCE) then
                  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;
                end;
              ppn:=tcgcallparanode(ppn.right);
              ppn:=tcgcallparanode(ppn.right);
            end;
            end;
@@ -835,8 +835,8 @@ implementation
             not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) and
             not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) and
             not assigned(funcretnode) then
             not assigned(funcretnode) then
            begin
            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;
            end;
 
 
          regs_to_save_int:=paramanager.get_volatile_registers_int(procdefinition.proccalloption);
          regs_to_save_int:=paramanager.get_volatile_registers_int(procdefinition.proccalloption);
@@ -890,23 +890,23 @@ implementation
 
 
                  { Load VMT from self }
                  { Load VMT from self }
                  if methodpointer.resulttype.def.deftype=objectdef then
                  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
                  else
                    begin
                    begin
                      { Load VMT value in register }
                      { 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;
                      vmtreg:=methodpointer.location.register;
                    end;
                    end;
 
 
                  { test validity of VMT }
                  { test validity of VMT }
                  if not(is_interface(tprocdef(procdefinition)._class)) and
                  if not(is_interface(tprocdef(procdefinition)._class)) and
                     not(is_cppclass(tprocdef(procdefinition)._class)) then
                     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,
                  reference_reset_base(href,vmtreg,
                     tprocdef(procdefinition)._class.vmtmethodoffset(tprocdef(procdefinition).extnumber));
                     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
                  { Load parameters that are in temporary registers in the
                    correct parameter register }
                    correct parameter register }
@@ -917,15 +917,15 @@ implementation
                      freeparas;
                      freeparas;
                    end;
                    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
                  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
                  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 }
                  { call method }
                  extra_call_code;
                  extra_call_code;
-                 cg.a_call_reg(exprasmlist,pvreg);
+                 cg.a_call_reg(current_asmdata.CurrAsmList,pvreg);
                  extra_post_call_code;
                  extra_post_call_code;
                end
                end
              else
              else
@@ -939,11 +939,11 @@ implementation
                       freeparas;
                       freeparas;
                     end;
                     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
                   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
                   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
                   if procdefinition.proccalloption=pocall_syscall then
                     do_syscall
                     do_syscall
@@ -954,7 +954,7 @@ implementation
                       if (po_interrupt in procdefinition.procoptions) then
                       if (po_interrupt in procdefinition.procoptions) then
                         extra_interrupt_code;
                         extra_interrupt_code;
                       extra_call_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;
                       extra_post_call_code;
                     end;
                     end;
                end;
                end;
@@ -964,13 +964,13 @@ implementation
            begin
            begin
               secondpass(right);
               secondpass(right);
 
 
-              pvreg:=cg.getintregister(exprasmlist,OS_ADDR);
+              pvreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR);
               { Only load OS_ADDR from the reference }
               { Only load OS_ADDR from the reference }
               if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
               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
               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
               { Load parameters that are in temporary registers in the
                 correct parameter register }
                 correct parameter register }
@@ -981,18 +981,18 @@ implementation
                   freeparas;
                   freeparas;
                 end;
                 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
               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
               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
               { Calling interrupt from the same code requires some
                 extra code }
                 extra code }
               if (po_interrupt in procdefinition.procoptions) then
               if (po_interrupt in procdefinition.procoptions) then
                 extra_interrupt_code;
                 extra_interrupt_code;
               extra_call_code;
               extra_call_code;
-              cg.a_call_reg(exprasmlist,pvreg);
+              cg.a_call_reg(current_asmdata.CurrAsmList,pvreg);
               extra_post_call_code;
               extra_post_call_code;
            end;
            end;
 
 
@@ -1040,10 +1040,10 @@ implementation
               end;
               end;
            end;
            end;
          if cg.uses_registers(R_MMREGISTER) then
          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
          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 }
          { handle function results }
          if (not is_void(resulttype.def)) then
          if (not is_void(resulttype.def)) then
@@ -1059,9 +1059,9 @@ implementation
             (right=nil) and
             (right=nil) and
             not(po_virtualmethod in procdefinition.procoptions) then
             not(po_virtualmethod in procdefinition.procoptions) then
            begin
            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;
            end;
 
 
          { release temps of paras }
          { release temps of paras }

+ 69 - 69
compiler/ncgcnv.pas

@@ -58,10 +58,10 @@ interface
 
 
     uses
     uses
       cutils,verbose,globtype,globals,
       cutils,verbose,globtype,globals,
-      aasmbase,aasmtai,aasmcpu,symconst,symdef,paramgr,
+      aasmbase,aasmtai,aasmdata,aasmcpu,symconst,symdef,paramgr,
       ncon,ncal,
       ncon,ncal,
       cpubase,systems,
       cpubase,systems,
-      pass_2,
+      procinfo,pass_2,
       cgbase,
       cgbase,
       cgutils,cgobj,
       cgutils,cgobj,
       ncgutil,
       ncgutil,
@@ -80,7 +80,7 @@ interface
 
 
         { insert range check if not explicit conversion }
         { insert range check if not explicit conversion }
         if not(nf_explicit in flags) then
         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
         { is the result size smaller? when typecasting from void
           we always reuse the current location, because there is
           we always reuse the current location, because there is
@@ -101,7 +101,7 @@ interface
                   inc(location.reference.offset,leftsize-ressize);
                   inc(location.reference.offset,leftsize-ressize);
               end
               end
             else
             else
-              location_force_reg(exprasmlist,location,newsize,false);
+              location_force_reg(current_asmdata.CurrAsmList,location,newsize,false);
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
             // if is_signed(left.resulttype) and
             // if is_signed(left.resulttype) and
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -121,9 +121,9 @@ interface
                (location.loc in [LOC_REGISTER,LOC_CREGISTER]) and
                (location.loc in [LOC_REGISTER,LOC_CREGISTER]) and
                (orgsize <> newsize) then
                (orgsize <> newsize) then
               begin
               begin
-                location.register := cg.getintregister(exprasmlist,newsize);
+                location.register := cg.getintregister(current_asmdata.CurrAsmList,newsize);
                 location.loc := LOC_REGISTER;
                 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;
           end;
       end;
       end;
@@ -141,28 +141,28 @@ interface
          case tstringconstnode(left).cst_type of
          case tstringconstnode(left).cst_type of
            cst_conststring :
            cst_conststring :
              begin
              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;
              end;
            cst_shortstring :
            cst_shortstring :
              begin
              begin
                inc(left.location.reference.offset);
                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;
              end;
            cst_ansistring :
            cst_ansistring :
              begin
              begin
                if tstringconstnode(left).len=0 then
                if tstringconstnode(left).len=0 then
                 begin
                 begin
                   reference_reset(hr);
                   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
                 end
                else
                else
                 begin
                 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;
              end;
              end;
            cst_longstring:
            cst_longstring:
@@ -175,14 +175,14 @@ interface
                if tstringconstnode(left).len=0 then
                if tstringconstnode(left).len=0 then
                 begin
                 begin
                   reference_reset(hr);
                   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
                 end
                else
                else
                 begin
                 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);
                     location.register);
                 end;
                 end;
              end;
              end;
@@ -214,8 +214,8 @@ interface
 
 
       begin
       begin
          location_reset(location,LOC_REGISTER,OS_ADDR);
          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;
       end;
 
 
 
 
@@ -229,8 +229,8 @@ interface
             {$ifdef cpu_uses_separate_address_registers}
             {$ifdef cpu_uses_separate_address_registers}
               if getregtype(left.location.register)<>R_ADDRESSREGISTER then
               if getregtype(left.location.register)<>R_ADDRESSREGISTER then
                 begin
                 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);
                           left.location.register,location.reference.base);
                 end
                 end
               else
               else
@@ -239,17 +239,17 @@ interface
             end;
             end;
           LOC_CREGISTER :
           LOC_CREGISTER :
             begin
             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);
                 location.reference.base);
             end;
             end;
           LOC_REFERENCE,
           LOC_REFERENCE,
           LOC_CREFERENCE :
           LOC_CREFERENCE :
             begin
             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.reference.base);
-              location_freetemp(exprasmlist,left.location);
+              location_freetemp(current_asmdata.CurrAsmList,left.location);
             end;
             end;
           else
           else
             internalerror(2002032216);
             internalerror(2002032216);
@@ -263,10 +263,10 @@ interface
          case tstringdef(resulttype.def).string_typ of
          case tstringdef(resulttype.def).string_typ of
            st_shortstring :
            st_shortstring :
              begin
              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.reference);
-               location_freetemp(exprasmlist,left.location);
+               location_freetemp(current_asmdata.CurrAsmList,left.location);
              end;
              end;
            { the rest is removed in the resulttype pass and converted to compilerprocs }
            { the rest is removed in the resulttype pass and converted to compilerprocs }
            else
            else
@@ -285,7 +285,7 @@ interface
          if (expectloc=LOC_MMREGISTER) and
          if (expectloc=LOC_MMREGISTER) and
            (left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) and
            (left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) and
            (left.location.size=OS_F80) then
            (left.location.size=OS_F80) then
-           location_force_fpureg(exprasmlist,left.location,false);
+           location_force_fpureg(current_asmdata.CurrAsmList,left.location,false);
 {$endif x86}
 {$endif x86}
          case left.location.loc of
          case left.location.loc of
             LOC_FPUREGISTER,
             LOC_FPUREGISTER,
@@ -297,7 +297,7 @@ interface
                   LOC_FPUREGISTER:
                   LOC_FPUREGISTER:
                     ;
                     ;
                   LOC_MMREGISTER:
                   LOC_MMREGISTER:
-                    location_force_mmregscalar(exprasmlist,location,false);
+                    location_force_mmregscalar(current_asmdata.CurrAsmList,location,false);
                   else
                   else
                     internalerror(2003012262);
                     internalerror(2003012262);
                 end;
                 end;
@@ -309,15 +309,15 @@ interface
                  if expectloc=LOC_MMREGISTER then
                  if expectloc=LOC_MMREGISTER then
                    begin
                    begin
                      location_reset(location,LOC_MMREGISTER,def_cgsize(resulttype.def));
                      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
                    end
                   else
                   else
                     begin
                     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;
                     end;
-                 location_freetemp(exprasmlist,left.location);
+                 location_freetemp(current_asmdata.CurrAsmList,left.location);
               end;
               end;
             LOC_MMREGISTER,
             LOC_MMREGISTER,
             LOC_CMMREGISTER:
             LOC_CMMREGISTER:
@@ -326,7 +326,7 @@ interface
                 case expectloc of
                 case expectloc of
                   LOC_FPUREGISTER:
                   LOC_FPUREGISTER:
                     begin
                     begin
-                      location_force_fpureg(exprasmlist,location,false);
+                      location_force_fpureg(current_asmdata.CurrAsmList,location,false);
                       location.size:=def_cgsize(resulttype.def);
                       location.size:=def_cgsize(resulttype.def);
                     end;
                     end;
                   LOC_MMREGISTER:
                   LOC_MMREGISTER:
@@ -354,8 +354,8 @@ interface
         if tabstractprocdef(resulttype.def).is_addressonly then
         if tabstractprocdef(resulttype.def).is_addressonly then
           begin
           begin
             location_reset(location,LOC_REGISTER,OS_ADDR);
             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
           end
         else
         else
           location_copy(location,left.location);
           location_copy(location,left.location);
@@ -364,12 +364,12 @@ interface
 
 
     procedure tcgtypeconvnode.second_bool_to_int;
     procedure tcgtypeconvnode.second_bool_to_int;
       var
       var
-         oldtruelabel,oldfalselabel : tasmlabel;
+         oldTrueLabel,oldFalseLabel : tasmlabel;
       begin
       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);
          secondpass(left);
          location_copy(location,left.location);
          location_copy(location,left.location);
          { byte(boolean) or word(wordbool) or longint(longbool) must }
          { byte(boolean) or word(wordbool) or longint(longbool) must }
@@ -377,9 +377,9 @@ interface
          if not((nf_explicit in flags) and
          if not((nf_explicit in flags) and
                 (left.resulttype.def.size=resulttype.def.size) and
                 (left.resulttype.def.size=resulttype.def.size) and
                 (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER])) then
                 (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;
       end;
 
 
 
 
@@ -405,15 +405,15 @@ interface
          hr : treference;
          hr : treference;
       begin
       begin
          location_reset(location,LOC_REGISTER,OS_ADDR);
          location_reset(location,LOC_REGISTER,OS_ADDR);
-         objectlibrary.getjumplabel(l1);
+         current_asmdata.getjumplabel(l1);
          case left.location.loc of
          case left.location.loc of
             LOC_CREGISTER,LOC_REGISTER:
             LOC_CREGISTER,LOC_REGISTER:
               begin
               begin
                {$ifdef cpu_uses_separate_address_registers}
                {$ifdef cpu_uses_separate_address_registers}
                  if getregtype(left.location.register)<>R_ADDRESSREGISTER then
                  if getregtype(left.location.register)<>R_ADDRESSREGISTER then
                    begin
                    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);
                               left.location.register,location.register);
                    end
                    end
                  else
                  else
@@ -422,17 +422,17 @@ interface
               end;
               end;
             LOC_CREFERENCE,LOC_REFERENCE:
             LOC_CREFERENCE,LOC_REFERENCE:
               begin
               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;
             else
             else
               internalerror(2002032214);
               internalerror(2002032214);
          end;
          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);
          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;
       end;
 
 
 
 
@@ -446,28 +446,28 @@ interface
             LOC_CREFERENCE,
             LOC_CREFERENCE,
             LOC_REFERENCE:
             LOC_REFERENCE:
               begin
               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;
               end;
             LOC_CREGISTER:
             LOC_CREGISTER:
               begin
               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;
               end;
             LOC_REGISTER:
             LOC_REGISTER:
               location.register:=left.location.register;
               location.register:=left.location.register;
             else
             else
               internalerror(121120001);
               internalerror(121120001);
          end;
          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);
          hd:=tobjectdef(left.resulttype.def);
          while assigned(hd) do
          while assigned(hd) do
            begin
            begin
               if hd.implementedinterfaces.searchintf(resulttype.def)<>-1 then
               if hd.implementedinterfaces.searchintf(resulttype.def)<>-1 then
                 begin
                 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.ioffsets(
                        hd.implementedinterfaces.searchintf(resulttype.def)),location.register);
                        hd.implementedinterfaces.searchintf(resulttype.def)),location.register);
                    break;
                    break;
@@ -476,7 +476,7 @@ interface
            end;
            end;
          if hd=nil then
          if hd=nil then
            internalerror(2002081301);
            internalerror(2002081301);
-         cg.a_label(exprasmlist,l1);
+         cg.a_label(current_asmdata.CurrAsmList,l1);
       end;
       end;
 
 
 
 
@@ -510,7 +510,7 @@ interface
             (left.resulttype.def.deftype=floatdef) xor
             (left.resulttype.def.deftype=floatdef) xor
             (resulttype.def.deftype=floatdef)
             (resulttype.def.deftype=floatdef)
            ) then
            ) 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 }
         { but use the new size, but we don't know the size of all arrays }
         newsize:=def_cgsize(resulttype.def);
         newsize:=def_cgsize(resulttype.def);

+ 55 - 55
compiler/ncgcon.pas

@@ -64,7 +64,7 @@ implementation
     uses
     uses
       globtype,widestr,systems,
       globtype,widestr,systems,
       verbose,globals,
       verbose,globals,
-      symconst,symdef,aasmbase,aasmtai,aasmcpu,defutil,
+      symconst,symdef,aasmbase,aasmtai,aasmdata,aasmcpu,defutil,
       cpuinfo,cpubase,
       cpuinfo,cpubase,
       cgbase,cgobj,cgutils,
       cgbase,cgobj,cgutils,
       ncgutil
       ncgutil
@@ -100,7 +100,7 @@ implementation
         if not assigned(lab_real) then
         if not assigned(lab_real) then
           begin
           begin
              { tries to find an old entry }
              { tries to find an old entry }
-             hp1:=tai(asmlist[al_typedconsts].first);
+             hp1:=tai(current_asmdata.asmlists[al_typedconsts].first);
              while assigned(hp1) do
              while assigned(hp1) do
                begin
                begin
                   if hp1.typ=ait_label then
                   if hp1.typ=ait_label then
@@ -136,19 +136,19 @@ implementation
              { :-(, we must generate a new entry }
              { :-(, we must generate a new entry }
              if not assigned(lab_real) then
              if not assigned(lab_real) then
                begin
                begin
-                  objectlibrary.getdatalabel(lastlabel);
+                  current_asmdata.getdatalabel(lastlabel);
                   lab_real:=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
                   case realait of
                     ait_real_32bit :
                     ait_real_32bit :
                       begin
                       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? }
                         { range checking? }
                         if ((cs_check_range in aktlocalswitches) or
                         if ((cs_check_range in aktlocalswitches) or
                           (cs_check_overflow in aktlocalswitches)) and
                           (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);
                           Message(parser_e_range_check_error);
                       end;
                       end;
 
 
@@ -156,37 +156,37 @@ implementation
                       begin
                       begin
 {$ifdef ARM}
 {$ifdef ARM}
                         if hiloswapped then
                         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
                         else
 {$endif ARM}
 {$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? }
                         { range checking? }
                         if ((cs_check_range in aktlocalswitches) or
                         if ((cs_check_range in aktlocalswitches) or
                           (cs_check_overflow in aktlocalswitches)) and
                           (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);
                           Message(parser_e_range_check_error);
                      end;
                      end;
 
 
                     ait_real_80bit :
                     ait_real_80bit :
                       begin
                       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? }
                         { range checking? }
                         if ((cs_check_range in aktlocalswitches) or
                         if ((cs_check_range in aktlocalswitches) or
                           (cs_check_overflow in aktlocalswitches)) and
                           (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);
                           Message(parser_e_range_check_error);
                       end;
                       end;
 {$ifdef cpufloat128}
 {$ifdef cpufloat128}
                     ait_real_128bit :
                     ait_real_128bit :
                       begin
                       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? }
                         { range checking? }
                         if ((cs_check_range in aktlocalswitches) or
                         if ((cs_check_range in aktlocalswitches) or
                           (cs_check_overflow in aktlocalswitches)) and
                           (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);
                           Message(parser_e_range_check_error);
                       end;
                       end;
 {$endif cpufloat128}
 {$endif cpufloat128}
@@ -196,7 +196,7 @@ implementation
                       if (value_real>9223372036854775807.0) or (value_real<-9223372036854775808.0) then
                       if (value_real>9223372036854775807.0) or (value_real<-9223372036854775808.0) then
                         message(parser_e_range_check_error)
                         message(parser_e_range_check_error)
                       else
                       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
                   else
                     internalerror(10120);
                     internalerror(10120);
                   end;
                   end;
@@ -269,7 +269,7 @@ implementation
               if not(is_widestring(resulttype.def)) then
               if not(is_widestring(resulttype.def)) then
                 begin
                 begin
                   { tries to find an old entry }
                   { tries to find an old entry }
-                  hp1:=tai(asmlist[al_typedconsts].first);
+                  hp1:=tai(current_asmdata.asmlists[al_typedconsts].first);
                   while assigned(hp1) do
                   while assigned(hp1) do
                     begin
                     begin
                        if hp1.typ=ait_label then
                        if hp1.typ=ait_label then
@@ -382,32 +382,32 @@ implementation
               { :-(, we must generate a new entry }
               { :-(, we must generate a new entry }
               if not assigned(lab_str) then
               if not assigned(lab_str) then
                 begin
                 begin
-                   objectlibrary.getdatalabel(lastlabel);
+                   current_asmdata.getdatalabel(lastlabel);
                    lab_str:=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 ? }
                    { generate an ansi string ? }
                    case cst_type of
                    case cst_type of
                       cst_ansistring:
                       cst_ansistring:
                         begin
                         begin
                            { an empty ansi string is nil! }
                            { an empty ansi string is nil! }
                            if len=0 then
                            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
                            else
                              begin
                              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 }
                                 { include also terminating zero }
                                 getmem(pc,len+1);
                                 getmem(pc,len+1);
                                 move(value_str^,pc^,len);
                                 move(value_str^,pc^,len);
                                 pc[len]:=#0;
                                 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 }
                                 { return the offset of the real string }
                                 lab_str:=l2;
                                 lab_str:=l2;
                              end;
                              end;
@@ -416,24 +416,24 @@ implementation
                         begin
                         begin
                            { an empty wide string is nil! }
                            { an empty wide string is nil! }
                            if len=0 then
                            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
                            else
                              begin
                              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 }
                                 { we use always UTF-16 coding for constants }
                                 { at least for now                          }
                                 { at least for now                          }
                                 { Consts.concat(Tai_const.Create_8bit(2)); }
                                 { 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
                                 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 }
                                 { 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 }
                                 { return the offset of the real string }
                                 lab_str:=l2;
                                 lab_str:=l2;
                              end;
                              end;
@@ -450,7 +450,7 @@ implementation
                           move(value_str^,pc[1],l);
                           move(value_str^,pc[1],l);
                           pc[0]:=chr(l);
                           pc[0]:=chr(l);
                           pc[l+1]:=#0;
                           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;
                         end;
                       cst_conststring:
                       cst_conststring:
                         begin
                         begin
@@ -458,7 +458,7 @@ implementation
                           getmem(pc,len+1);
                           getmem(pc,len+1);
                           move(value_str^,pc[0],len);
                           move(value_str^,pc[0],len);
                           pc[len]:=#0;
                           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;
                    end;
                 end;
                 end;
@@ -503,7 +503,7 @@ implementation
         if not assigned(lab_set) then
         if not assigned(lab_set) then
           begin
           begin
              { tries to found an old entry }
              { tries to found an old entry }
-             hp1:=tai(asmlist[al_typedconsts].first);
+             hp1:=tai(current_asmdata.asmlists[al_typedconsts].first);
              while assigned(hp1) do
              while assigned(hp1) do
                begin
                begin
                   if hp1.typ=ait_label then
                   if hp1.typ=ait_label then
@@ -554,11 +554,11 @@ implementation
              { :-(, we must generate a new entry }
              { :-(, we must generate a new entry }
              if not assigned(lab_set) then
              if not assigned(lab_set) then
                begin
                begin
-                 objectlibrary.getdatalabel(lastlabel);
+                 current_asmdata.getdatalabel(lastlabel);
                  lab_set:=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)
                  { already handled at the start of this method?? (JM)
                  if tsetdef(resulttype.def).settype=smallset then
                  if tsetdef(resulttype.def).settype=smallset then
                   begin
                   begin
@@ -569,7 +569,7 @@ implementation
                  }
                  }
                   begin
                   begin
                     for i:=0 to 31 do
                     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;
                end;
           end;
           end;
@@ -599,14 +599,14 @@ implementation
       begin
       begin
         location_reset(location,LOC_CREFERENCE,OS_NO);
         location_reset(location,LOC_CREFERENCE,OS_NO);
         { label for GUID }
         { 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
         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;
         location.reference.symbol:=tmplabel;
       end;
       end;
 
 

File diff suppressed because it is too large
+ 280 - 280
compiler/ncgflw.pas


+ 85 - 85
compiler/ncginl.pas

@@ -56,7 +56,7 @@ implementation
       globtype,systems,
       globtype,systems,
       cutils,verbose,globals,fmodule,
       cutils,verbose,globals,fmodule,
       symconst,symdef,defutil,symsym,
       symconst,symdef,defutil,symsym,
-      aasmbase,aasmtai,aasmcpu,parabase,
+      aasmbase,aasmtai,aasmdata,aasmcpu,parabase,
       cgbase,pass_1,pass_2,
       cgbase,pass_1,pass_2,
       cpuinfo,cpubase,paramgr,procinfo,
       cpuinfo,cpubase,paramgr,procinfo,
       nbas,ncon,ncal,ncnv,nld,
       nbas,ncon,ncal,ncnv,nld,
@@ -194,13 +194,13 @@ implementation
        paramanager.getintparaloc(pocall_default,2,paraloc2);
        paramanager.getintparaloc(pocall_default,2,paraloc2);
        paramanager.getintparaloc(pocall_default,3,paraloc3);
        paramanager.getintparaloc(pocall_default,3,paraloc3);
        paramanager.getintparaloc(pocall_default,4,paraloc4);
        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);
        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
        { First call secondpass() before we can push the parameters, otherwise
          parameters allocated in the registers can be destroyed }
          parameters allocated in the registers can be destroyed }
        { generate filename string parameter }
        { generate filename string parameter }
@@ -215,30 +215,30 @@ implementation
        if codegenerror then
        if codegenerror then
           exit;
           exit;
        { push erroraddr }
        { 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 }
        { 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 }
        { 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 }
        { 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 }
        { 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;
        paraloc1.done;
        paraloc2.done;
        paraloc2.done;
        paraloc3.done;
        paraloc3.done;
@@ -265,14 +265,14 @@ implementation
         { for both cases load vmt }
         { for both cases load vmt }
         if left.nodetype=typen then
         if left.nodetype=typen then
           begin
           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
           end
         else
         else
           begin
           begin
             secondpass(left);
             secondpass(left);
-            hregister:=cg.getaddressregister(exprasmlist);
+            hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
 
 
             { handle self inside a method of a class }
             { handle self inside a method of a class }
             case left.location.loc of
             case left.location.loc of
@@ -281,12 +281,12 @@ implementation
                 begin
                 begin
                   if (left.resulttype.def.deftype=classrefdef) or
                   if (left.resulttype.def.deftype=classrefdef) or
                      (po_staticmethod in current_procinfo.procdef.procoptions) then
                      (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
                   else
                    begin
                    begin
                      { load VMT pointer }
                      { load VMT pointer }
                      reference_reset_base(hrefvmt,left.location.register,tobjectdef(left.resulttype.def).vmt_offset);
                      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
                 end;
                 end;
               LOC_REFERENCE,
               LOC_REFERENCE,
@@ -295,18 +295,18 @@ implementation
                   if is_class(left.resulttype.def) then
                   if is_class(left.resulttype.def) then
                    begin
                    begin
                      { deref class }
                      { 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 }
                      { load VMT pointer }
                      reference_reset_base(hrefvmt,hregister,tobjectdef(left.resulttype.def).vmt_offset);
                      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
                    end
                   else
                   else
                    begin
                    begin
                      { load VMT pointer, but not for classrefdefs }
                      { load VMT pointer, but not for classrefdefs }
                      if (left.resulttype.def.deftype=objectdef) then
                      if (left.resulttype.def.deftype=objectdef) then
                        inc(left.location.reference.offset,tobjectdef(left.resulttype.def).vmt_offset);
                        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;
                 end;
                 end;
               else
               else
@@ -317,8 +317,8 @@ implementation
         if inlinenumber=in_sizeof_x then
         if inlinenumber=in_sizeof_x then
            begin
            begin
              reference_reset_base(href,hregister,0);
              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;
            end;
         location.register:=hregister;
         location.register:=hregister;
      end;
      end;
@@ -344,15 +344,15 @@ implementation
         else
         else
          begin
          begin
            { length in ansi/wide strings is at offset -sizeof(aint) }
            { 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));
            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
            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_reset(location,LOC_REGISTER,OS_INT);
            location.register:=hregister;
            location.register:=hregister;
          end;
          end;
@@ -377,16 +377,16 @@ implementation
 
 
         { we need a value in a register }
         { we need a value in a register }
         location_copy(location,left.location);
         location_copy(location,left.location);
-        location_force_reg(exprasmlist,location,cgsize,false);
+        location_force_reg(current_asmdata.CurrAsmList,location,cgsize,false);
 
 
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
         if cgsize in [OS_64,OS_S64] then
         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
         else
 {$endif cpu64bit}
 {$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;
       end;
 
 
 
 
@@ -434,14 +434,14 @@ implementation
                  addvalue:=addvalue*get_ordinal_value(tcallparanode(tcallparanode(left).right).left)
                  addvalue:=addvalue*get_ordinal_value(tcallparanode(tcallparanode(left).right).left)
               else
               else
                 begin
                 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;
                   hregister:=tcallparanode(tcallparanode(left).right).left.location.register;
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                   hregisterhi:=tcallparanode(tcallparanode(left).right).left.location.register64.reghi;
                   hregisterhi:=tcallparanode(tcallparanode(left).right).left.location.register64.reghi;
 {$endif cpu64bit}
 {$endif cpu64bit}
                   { insert multiply with addvalue if its >1 }
                   { insert multiply with addvalue if its >1 }
                   if addvalue>1 then
                   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;
                   addconstant:=false;
                 end;
                 end;
             end;
             end;
@@ -450,25 +450,25 @@ implementation
             begin
             begin
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
               if cgsize in [OS_64,OS_S64] then
               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
               else
 {$endif cpu64bit}
 {$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);
                   aint(addvalue),tcallparanode(left).left.location);
             end
             end
            else
            else
              begin
              begin
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                if cgsize in [OS_64,OS_S64] then
                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)
                    joinreg64(hregister,hregisterhi),tcallparanode(left).left.location)
                else
                else
 {$endif cpu64bit}
 {$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);
                    hregister,tcallparanode(left).left.location);
              end;
              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);
               tcallparanode(left).left.resulttype.def);
         end;
         end;
 
 
@@ -481,9 +481,9 @@ implementation
          href : treference;
          href : treference;
         begin
         begin
           location_reset(location,LOC_REGISTER,OS_ADDR);
           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);
           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;
         end;
 
 
 
 
@@ -522,10 +522,10 @@ implementation
                   begin
                   begin
                     inc(tcallparanode(left).left.location.reference.offset,
                     inc(tcallparanode(left).left.location.reference.offset,
                       (tordconstnode(tcallparanode(tcallparanode(left).right).left).value div bitsperop)*tcgsize2size[opsize]);
                       (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;
                   end;
                 LOC_CREGISTER :
                 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
                 else
                   internalerror(200405021);
                   internalerror(200405021);
               end;
               end;
@@ -546,17 +546,17 @@ implementation
               secondpass(tcallparanode(tcallparanode(left).right).left);
               secondpass(tcallparanode(tcallparanode(left).right).left);
 
 
               { bitnumber - which must be loaded into register }
               { 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);
                   tcallparanode(tcallparanode(left).right).left.location,hregister);
 
 
               if use_small then
               if use_small then
                 begin
                 begin
                   { hregister contains the bitnumber to add }
                   { 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 :
                   { possiblities :
                        bitnumber : LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER
                        bitnumber : LOC_REFERENCE, LOC_REGISTER, LOC_CREGISTER
@@ -565,13 +565,13 @@ implementation
                   { location of set }
                   { location of set }
                   if inlinenumber=in_include_x_y then
                   if inlinenumber=in_include_x_y then
                     begin
                     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);
                       tcallparanode(left).left.location);
                     end
                     end
                   else
                   else
                     begin
                     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);
                           tcallparanode(left).left.location);
                     end;
                     end;
                 end
                 end
@@ -584,29 +584,29 @@ implementation
                   { hregister contains the bitnumber (div 32 to get the correct offset) }
                   { hregister contains the bitnumber (div 32 to get the correct offset) }
                   { hregister contains the bitnumber to add }
                   { 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 }
                   { 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 }
                   { 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 }
                   { 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);
                   reference_reset_base(href,addrreg,0);
 
 
                   if inlinenumber=in_include_x_y then
                   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
                   else
                     begin
                     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;
                 end;
             end;
             end;
@@ -677,8 +677,8 @@ implementation
         secondpass(tcallparanode(left).left);
         secondpass(tcallparanode(left).left);
         { force left to be an OS_ADDR, since in case of method procvars }
         { force left to be an OS_ADDR, since in case of method procvars }
         { the size is 2*OS_ADDR (JM)                                    }
         { 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);
         location_reset(location,LOC_JUMP,OS_NO);
       end;
       end;
 
 

+ 118 - 118
compiler/ncgld.pas

@@ -56,7 +56,7 @@ implementation
       verbose,globtype,globals,
       verbose,globtype,globals,
       symconst,symtype,symdef,symsym,defutil,paramgr,
       symconst,symtype,symdef,symsym,defutil,paramgr,
       ncnv,ncon,nmem,nbas,
       ncnv,ncon,nmem,nbas,
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       cgbase,pass_2,
       cgbase,pass_2,
       procinfo,
       procinfo,
       cpubase,parabase,
       cpubase,parabase,
@@ -72,7 +72,7 @@ implementation
       begin
       begin
 {$ifndef sparc}
 {$ifndef sparc}
         location.reference.base:=current_procinfo.got;
         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}
 {$endif sparc}
       end;
       end;
 
 
@@ -87,7 +87,7 @@ implementation
         norelocatelab : tasmlabel;
         norelocatelab : tasmlabel;
         paraloc1 : tcgpara;
         paraloc1 : tcgpara;
       begin
       begin
-         
+
          { we don't know the size of all arrays }
          { we don't know the size of all arrays }
          newsize:=def_cgsize(resulttype.def);
          newsize:=def_cgsize(resulttype.def);
          location_reset(location,LOC_REFERENCE,newsize);
          location_reset(location,LOC_REFERENCE,newsize);
@@ -105,7 +105,7 @@ implementation
                         location.reference.offset:=tabsolutevarsym(symtableentry).addroffset;
                         location.reference.offset:=tabsolutevarsym(symtableentry).addroffset;
                       end;
                       end;
                     toasm :
                     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
                     else
                       internalerror(200310283);
                       internalerror(200310283);
                   end;
                   end;
@@ -115,7 +115,7 @@ implementation
                  if tconstsym(symtableentry).consttyp=constresourcestring then
                  if tconstsym(symtableentry).consttyp=constresourcestring then
                    begin
                    begin
                       location_reset(location,LOC_CREFERENCE,OS_ADDR);
                       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);
                       location.reference.offset:=tconstsym(symtableentry).resstrindex*(4+sizeof(aint)*3)+4+sizeof(aint);
                    end
                    end
                  else
                  else
@@ -128,7 +128,7 @@ implementation
                   if (symtableentry.typ = globalvarsym) and
                   if (symtableentry.typ = globalvarsym) and
                      ([vo_is_dll_var,vo_is_external] * tglobalvarsym(symtableentry).varoptions <> []) then
                      ([vo_is_dll_var,vo_is_external] * tglobalvarsym(symtableentry).varoptions <> []) then
                     begin
                     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
                       if (location.reference.base <> NR_NO) then
                         exit;
                         exit;
                     end;
                     end;
@@ -138,9 +138,9 @@ implementation
                   if (vo_is_dll_var in tabstractvarsym(symtableentry).varoptions) then
                   if (vo_is_dll_var in tabstractvarsym(symtableentry).varoptions) then
                   { DLL variable }
                   { DLL variable }
                     begin
                     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);
                       reference_reset_base(location.reference,hregister,0);
                     end
                     end
                   { Thread variable }
                   { Thread variable }
@@ -157,37 +157,37 @@ implementation
                          call and then the address load to be sure that the
                          call and then the address load to be sure that the
                          register that is used for returning is the same (PFV)
                          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 }
                        { make sure hregister can't allocate the register necessary for the parameter }
                        paraloc1.init;
                        paraloc1.init;
                        paramanager.getintparaloc(pocall_default,1,paraloc1);
                        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 }
                        { 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;
                        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
                        { no relocation needed, load the address of the variable only, the
                          layout of a threadvar is (4 bytes pointer):
                          layout of a threadvar is (4 bytes pointer):
                            0 - Threadvar index
                            0 - Threadvar index
                            4 - Threadvar value in single threading }
                            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;
                        location.reference.base:=hregister;
                     end
                     end
                   { Nested variable }
                   { Nested variable }
@@ -238,7 +238,7 @@ implementation
                               staticsymtable :
                               staticsymtable :
                                 begin
                                 begin
                                   if tabstractnormalvarsym(symtableentry).localloc.loc=LOC_INVALID then
                                   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
                                   else
                                     location:=tglobalvarsym(symtableentry).localloc;
                                     location:=tglobalvarsym(symtableentry).localloc;
 {$ifdef i386}
 {$ifdef i386}
@@ -269,10 +269,10 @@ implementation
                         hregister:=location.register
                         hregister:=location.register
                       else
                       else
                         begin
                         begin
-                          hregister:=cg.getaddressregister(exprasmlist);
+                          hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
                           { we need to load only an address }
                           { we need to load only an address }
                           location.size:=OS_ADDR;
                           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;
                         end;
                       location_reset(location,LOC_REFERENCE,newsize);
                       location_reset(location,LOC_REFERENCE,newsize);
                       location.reference.base:=hregister;
                       location.reference.base:=hregister;
@@ -302,7 +302,7 @@ implementation
                          location_reset(location,LOC_CREFERENCE,OS_128)
                          location_reset(location,LOC_CREFERENCE,OS_128)
                       else
                       else
                          internalerror(20020520);
                          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);
                       secondpass(left);
 
 
                       { load class instance address }
                       { load class instance address }
@@ -318,12 +318,12 @@ implementation
                          LOC_CREFERENCE,
                          LOC_CREFERENCE,
                          LOC_REFERENCE:
                          LOC_REFERENCE:
                            begin
                            begin
-                              hregister:=cg.getaddressregister(exprasmlist);
+                              hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
                               if is_class_or_interface(left.resulttype.def) then
                               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
                               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;
                            end;
                          else
                          else
                            internalerror(26019);
                            internalerror(26019);
@@ -332,7 +332,7 @@ implementation
                       { store the class instance address }
                       { store the class instance address }
                       href:=location.reference;
                       href:=location.reference;
                       inc(href.offset,sizeof(aint));
                       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 ? }
                       { virtual method ? }
                       if (po_virtualmethod in procdef.procoptions) and
                       if (po_virtualmethod in procdef.procoptions) and
@@ -340,35 +340,35 @@ implementation
                         begin
                         begin
                           { load vmt pointer }
                           { load vmt pointer }
                           reference_reset_base(href,hregister,0);
                           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 }
                           { load method address }
                           reference_reset_base(href,hregister,procdef._class.vmtmethodoffset(procdef.extnumber));
                           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 }
                           { ... 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
                         end
                       else
                       else
                         begin
                         begin
                           { load address of the function }
                           { 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;
                     end
                     end
                   else
                   else
                     begin
                     begin
                        if (po_external in tprocsym(symtableentry).procdef[1].procoptions) then
                        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 }
                        {!!!!! Be aware, work on virtual methods too }
                        if (location.reference.base = NR_NO) then
                        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;
                end;
                end;
             typedconstsym :
             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 :
             labelsym :
               location.reference.symbol:=tcglabelnode((tlabelsym(symtableentry).code)).getasmlabel;
               location.reference.symbol:=tcglabelnode((tlabelsym(symtableentry).code)).getasmlabel;
             else internalerror(200510032);
             else internalerror(200510032);
@@ -392,10 +392,10 @@ implementation
       begin
       begin
         location_reset(location,LOC_VOID,OS_NO);
         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
           in most cases we can process first the right node which contains
@@ -422,9 +422,9 @@ implementation
            if (right.resulttype.def.needs_inittable) and
            if (right.resulttype.def.needs_inittable) and
               (right.nodetype<>stringconstn) then
               (right.nodetype<>stringconstn) then
             begin
             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;
             end;
            if codegenerror then
            if codegenerror then
              exit;
              exit;
@@ -437,8 +437,8 @@ implementation
               { decrement destination reference counter }
               { decrement destination reference counter }
               if (left.resulttype.def.needs_inittable) then
               if (left.resulttype.def.needs_inittable) then
                 begin
                 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;
                 end;
               if codegenerror then
               if codegenerror then
                 exit;
                 exit;
@@ -454,8 +454,8 @@ implementation
                { decrement destination reference counter }
                { decrement destination reference counter }
                if (left.resulttype.def.needs_inittable) then
                if (left.resulttype.def.needs_inittable) then
                  begin
                  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;
                  end;
                if codegenerror then
                if codegenerror then
                  exit;
                  exit;
@@ -469,9 +469,9 @@ implementation
            if (right.resulttype.def.needs_inittable) and
            if (right.resulttype.def.needs_inittable) and
               (right.nodetype<>stringconstn) then
               (right.nodetype<>stringconstn) then
              begin
              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;
              end;
 
 
            if codegenerror then
            if codegenerror then
@@ -487,7 +487,7 @@ implementation
            (left.location.loc = LOC_REFERENCE) and
            (left.location.loc = LOC_REFERENCE) and
            (right.location.loc = LOC_REFERENCE) and
            (right.location.loc = LOC_REFERENCE) and
            tg.istemp(right.location.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
           begin
             { in theory, we should also make sure the left temp type is   }
             { in theory, we should also make sure the left temp type is   }
             { already more or less of the same kind (ie. we must not      }
             { already more or less of the same kind (ie. we must not      }
@@ -510,7 +510,7 @@ implementation
             if (right.nodetype=stringconstn) and
             if (right.nodetype=stringconstn) and
                (tstringconstnode(right).len=0) then
                (tstringconstnode(right).len=0) then
               begin
               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
               end
             { char loading }
             { char loading }
             else if is_char(right.resulttype.def) then
             else if is_char(right.resulttype.def) then
@@ -518,27 +518,27 @@ implementation
                 if right.nodetype=ordconstn then
                 if right.nodetype=ordconstn then
                   begin
                   begin
                     if (target_info.endian = endian_little) then
                     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)
                           left.location.reference)
                     else
                     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);
                           left.location.reference);
                   end
                   end
                 else
                 else
                   begin
                   begin
                     href:=left.location.reference;
                     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);
                     inc(href.offset,1);
                     case right.location.loc of
                     case right.location.loc of
                       LOC_REGISTER,
                       LOC_REGISTER,
                       LOC_CREGISTER :
                       LOC_CREGISTER :
                         begin
                         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;
                         end;
                       LOC_REFERENCE,
                       LOC_REFERENCE,
                       LOC_CREFERENCE :
                       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
                       else
                         internalerror(200205111);
                         internalerror(200205111);
                     end;
                     end;
@@ -554,10 +554,10 @@ implementation
                 begin
                 begin
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                   if right.location.size in [OS_64,OS_S64] then
                   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
                   else
 {$endif cpu64bit}
 {$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;
                 end;
               LOC_REFERENCE,
               LOC_REFERENCE,
               LOC_CREFERENCE :
               LOC_CREFERENCE :
@@ -568,15 +568,15 @@ implementation
                       begin
                       begin
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                         if left.location.size in [OS_64,OS_S64] then
                         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
                         else
 {$endif cpu64bit}
 {$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;
                       end;
                     LOC_FPUREGISTER,
                     LOC_FPUREGISTER,
                     LOC_CFPUREGISTER :
                     LOC_CFPUREGISTER :
                       begin
                       begin
-                        cg.a_loadfpu_ref_reg(exprasmlist,
+                        cg.a_loadfpu_ref_reg(current_asmdata.CurrAsmList,
                             right.location.size,
                             right.location.size,
                             right.location.reference,
                             right.location.reference,
                             left.location.register);
                             left.location.register);
@@ -590,13 +590,13 @@ implementation
                         if (right.location.reference.offset mod sizeof(aint)<>0) or
                         if (right.location.reference.offset mod sizeof(aint)<>0) or
                             (left.location.reference.offset mod sizeof(aint)<>0) or
                             (left.location.reference.offset mod sizeof(aint)<>0) or
                             (right.resulttype.def.alignment<sizeof(aint)) then
                             (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
                         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;
                       end;
                     LOC_MMREGISTER,
                     LOC_MMREGISTER,
                     LOC_CMMREGISTER:
                     LOC_CMMREGISTER:
-                      cg.a_loadmm_ref_reg(exprasmlist,
+                      cg.a_loadmm_ref_reg(current_asmdata.CurrAsmList,
                         right.location.size,
                         right.location.size,
                         left.location.size,
                         left.location.size,
                         right.location.reference,
                         right.location.reference,
@@ -610,9 +610,9 @@ implementation
               LOC_MMXREGISTER:
               LOC_MMXREGISTER:
                 begin
                 begin
                   if left.location.loc=LOC_CMMXREGISTER then
                   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
                   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;
                 end;
 {$endif SUPPORT_MMX}
 {$endif SUPPORT_MMX}
               LOC_MMREGISTER,
               LOC_MMREGISTER,
@@ -624,9 +624,9 @@ implementation
                   else
                   else
                     begin
                     begin
                       if left.location.loc=LOC_CMMREGISTER then
                       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
                       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;
                 end;
                 end;
               LOC_REGISTER,
               LOC_REGISTER,
@@ -634,11 +634,11 @@ implementation
                 begin
                 begin
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                   if left.location.size in [OS_64,OS_S64] then
                   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)
                       right.location.register64,left.location)
                   else
                   else
 {$endif cpu64bit}
 {$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;
                 end;
               LOC_FPUREGISTER,
               LOC_FPUREGISTER,
               LOC_CFPUREGISTER :
               LOC_CFPUREGISTER :
@@ -657,37 +657,37 @@ implementation
                   { we can't do direct moves between fpu and mm registers }
                   { we can't do direct moves between fpu and mm registers }
                   if left.location.loc in [LOC_MMREGISTER,LOC_CMMREGISTER] then
                   if left.location.loc in [LOC_MMREGISTER,LOC_CMMREGISTER] then
                     begin
                     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],
                           tfloat2tcgsize[fputyp],tfloat2tcgsize[fputyp],
                           right.location.register,left.location.register,mms_movescalar);
                           right.location.register,left.location.register,mms_movescalar);
                     end
                     end
                   else
                   else
-                    cg.a_loadfpu_reg_loc(exprasmlist,
+                    cg.a_loadfpu_reg_loc(current_asmdata.CurrAsmList,
                         tfloat2tcgsize[fputyp],
                         tfloat2tcgsize[fputyp],
                         right.location.register,left.location);
                         right.location.register,left.location);
                 end;
                 end;
               LOC_JUMP :
               LOC_JUMP :
                 begin
                 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;
                 end;
 {$ifdef cpuflags}
 {$ifdef cpuflags}
               LOC_FLAGS :
               LOC_FLAGS :
                 begin
                 begin
                   {This can be a wordbool or longbool too, no?}
                   {This can be a wordbool or longbool too, no?}
                   if left.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
                   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
                   else
                     begin
                     begin
                       if not(left.location.loc = LOC_REFERENCE) then
                       if not(left.location.loc = LOC_REFERENCE) then
                        internalerror(200203273);
                        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;
                 end;
                 end;
 {$endif cpuflags}
 {$endif cpuflags}
@@ -695,10 +695,10 @@ implementation
          end;
          end;
 
 
         if releaseright then
         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;
       end;
 
 
 
 
@@ -751,9 +751,9 @@ implementation
         { Allocate always a temp, also if no elements are required, to
         { Allocate always a temp, also if no elements are required, to
           be sure that location is valid (PFV) }
           be sure that location is valid (PFV) }
          if tarraydef(resulttype.def).highrange=-1 then
          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
          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;
          href:=location.reference;
         { Process nodes in array constructor }
         { Process nodes in array constructor }
         hp:=self;
         hp:=self;
@@ -767,7 +767,7 @@ implementation
                exit;
                exit;
               { Move flags and jump in register }
               { Move flags and jump in register }
               if hp.left.location.loc in [LOC_FLAGS,LOC_JUMP] then
               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
               if dovariant then
                begin
                begin
                  { find the correct vtype value }
                  { find the correct vtype value }
@@ -871,16 +871,16 @@ implementation
                  inc(href.offset,sizeof(aint));
                  inc(href.offset,sizeof(aint));
                  if vaddr then
                  if vaddr then
                   begin
                   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
                   end
                  else
                  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 }
                  { update href to the vtype field and write it }
                  dec(href.offset,sizeof(aint));
                  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 }
                  { goto next array element }
                  inc(href.offset,sizeof(aint)*2);
                  inc(href.offset,sizeof(aint)*2);
                end
                end
@@ -892,30 +892,30 @@ implementation
                  case hp.left.location.loc of
                  case hp.left.location.loc of
                    LOC_FPUREGISTER,
                    LOC_FPUREGISTER,
                    LOC_CFPUREGISTER :
                    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_REFERENCE,
                    LOC_CREFERENCE :
                    LOC_CREFERENCE :
                      begin
                      begin
                        if is_shortstring(hp.left.resulttype.def) then
                        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)
                              Tstringdef(hp.left.resulttype.def).len)
                        else
                        else
-                         cg.g_concatcopy(exprasmlist,hp.left.location.reference,href,elesize);
+                         cg.g_concatcopy(current_asmdata.CurrAsmList,hp.left.location.reference,href,elesize);
                      end;
                      end;
                    else
                    else
                      begin
                      begin
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                        if hp.left.location.size in [OS_64,OS_S64] then
                        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
                        else
 {$endif cpu64bit}
 {$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;
                  end;
                  end;
                  inc(href.offset,elesize);
                  inc(href.offset,elesize);
                end;
                end;
               if freetemp then
               if freetemp then
-                location_freetemp(exprasmlist,hp.left.location);
+                location_freetemp(current_asmdata.CurrAsmList,hp.left.location);
             end;
             end;
            { load next entry }
            { load next entry }
            hp:=tarrayconstructornode(hp.right);
            hp:=tarrayconstructornode(hp.right);

+ 43 - 43
compiler/ncgmat.pas

@@ -127,7 +127,7 @@ implementation
     uses
     uses
       globtype,systems,
       globtype,systems,
       cutils,verbose,globals,
       cutils,verbose,globals,
-      symconst,aasmbase,aasmtai,aasmcpu,defutil,
+      symconst,aasmbase,aasmtai,aasmdata,aasmcpu,defutil,
       parabase,
       parabase,
       pass_2,
       pass_2,
       ncon,
       ncon,
@@ -149,9 +149,9 @@ implementation
         { get a temporary memory reference to store the floating
         { get a temporary memory reference to store the floating
           point value
           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 }
         { 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
         { only single and double ieee are supported, for little endian
           the signed bit is in the second dword }
           the signed bit is in the second dword }
         href2:=href;
         href2:=href;
@@ -165,9 +165,9 @@ implementation
             internalerror(200406021);
             internalerror(200406021);
         end;
         end;
         { flip sign-bit (bit 31/63) of single/double }
         { 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;
       end;
 
 
 
 
@@ -177,8 +177,8 @@ implementation
         secondpass(left);
         secondpass(left);
         { load left operator in a register }
         { load left operator in a register }
         location_copy(location,left.location);
         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));
            location,joinreg64(location.register64.reglo,location.register64.reghi));
       end;
       end;
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -191,8 +191,8 @@ implementation
           LOC_REFERENCE,
           LOC_REFERENCE,
           LOC_CREFERENCE :
           LOC_CREFERENCE :
             begin
             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),
                  def_cgsize(left.resulttype.def),
                  left.location.reference,location.register);
                  left.location.reference,location.register);
               emit_float_sign_change(location.register,def_cgsize(left.resulttype.def));
               emit_float_sign_change(location.register,def_cgsize(left.resulttype.def));
@@ -204,8 +204,8 @@ implementation
             end;
             end;
           LOC_CFPUREGISTER:
           LOC_CFPUREGISTER:
             begin
             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));
                emit_float_sign_change(location.register,def_cgsize(left.resulttype.def));
             end;
             end;
           else
           else
@@ -219,8 +219,8 @@ implementation
         secondpass(left);
         secondpass(left);
         { load left operator in a register }
         { load left operator in a register }
         location_copy(location,left.location);
         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;
       end;
 
 
 
 
@@ -281,9 +281,9 @@ implementation
              { this code valid for 64-bit cpu's only ,
              { this code valid for 64-bit cpu's only ,
                otherwise helpers are called in pass_1
                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_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),
              emit64_div_reg_reg(is_signed(left.resulttype.def),
                joinreg64(right.location.register64.reglo,right.location.register64.reghi),
                joinreg64(right.location.register64.reglo,right.location.register64.reghi),
                joinreg64(location.register64.reglo,location.register64.reghi));
                joinreg64(location.register64.reglo,location.register64.reghi));
@@ -292,7 +292,7 @@ implementation
 {$endif cpu64bit}
 {$endif cpu64bit}
            begin
            begin
               { put numerator in register }
               { 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;
               hreg1:=left.location.register;
 
 
               if (nodetype=divn) and
               if (nodetype=divn) and
@@ -304,17 +304,17 @@ implementation
                     "Cardinal($ffffffff) div 16" overflows! (JM) }
                     "Cardinal($ffffffff) div 16" overflows! (JM) }
                   If is_signed(left.resulttype.def) Then
                   If is_signed(left.resulttype.def) Then
                     Begin
                     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
                       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
                       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
                     End
                   Else { not signed }
                   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
                 End
               else
               else
                 begin
                 begin
@@ -322,21 +322,21 @@ implementation
                   { hdenom is always free, it's }
                   { hdenom is always free, it's }
                   { only used for temporary }
                   { only used for temporary }
                   { purposes                }
                   { 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
                   { verify if the divisor is zero, if so return an error
                     immediately
                     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;
                   paraloc1.init;
                   paramanager.getintparaloc(pocall_default,1,paraloc1);
                   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;
                   paraloc1.done;
-                  cg.a_label(exprasmlist,hl);
+                  cg.a_label(current_asmdata.CurrAsmList,hl);
                   if nodetype = modn then
                   if nodetype = modn then
                     emit_mod_reg_reg(is_signed(left.resulttype.def),hdenom,hreg1)
                     emit_mod_reg_reg(is_signed(left.resulttype.def),hdenom,hreg1)
                   else
                   else
@@ -345,7 +345,7 @@ implementation
               location_reset(location,LOC_REGISTER,OS_INT);
               location_reset(location,LOC_REGISTER,OS_INT);
               location.register:=hreg1;
               location.register:=hreg1;
            end;
            end;
-        cg.g_overflowcheck(exprasmlist,location,resulttype.def);
+        cg.g_overflowcheck(current_asmdata.CurrAsmList,location,resulttype.def);
       end;
       end;
 
 
 
 
@@ -375,7 +375,7 @@ implementation
          end;
          end;
          { load left operators in a register }
          { load left operators in a register }
          location_copy(location,left.location);
          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: }
          { shifting by a constant directly coded: }
          if (right.nodetype=ordconstn) then
          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)
               { l shl 32 should 0 imho, but neither TP nor Delphi do it in this way (FK)
               if right.value<=31 then
               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);
                 tordconstnode(right).value and 31,location.register);
               {
               {
               else
               else
@@ -399,12 +399,12 @@ implementation
               }
               }
               if right.location.loc<>LOC_REGISTER then
               if right.location.loc<>LOC_REGISTER then
                 begin
                 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
                 end
               else
               else
                 hcountreg:=right.location.register;
                 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;
       end;
       end;
 
 
@@ -430,10 +430,10 @@ implementation
     procedure tcgnotnode.second_64bit;
     procedure tcgnotnode.second_64bit;
       begin
       begin
         secondpass(left);
         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);
         location_copy(location,left.location);
         { perform the NOT operation }
         { 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;
       end;
 {$endif cpu64bit}
 {$endif cpu64bit}
 
 
@@ -441,10 +441,10 @@ implementation
     procedure tcgnotnode.second_integer;
     procedure tcgnotnode.second_integer;
       begin
       begin
         secondpass(left);
         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);
         location_copy(location,left.location);
         { perform the NOT operation }
         { 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;
       end;
 
 
 
 

+ 98 - 98
compiler/ncgmem.pas

@@ -80,7 +80,7 @@ implementation
       systems,
       systems,
       cutils,verbose,globals,
       cutils,verbose,globals,
       symconst,symdef,symsym,defutil,paramgr,
       symconst,symdef,symsym,defutil,paramgr,
-      aasmbase,aasmtai,
+      aasmbase,aasmtai,aasmdata,
       procinfo,pass_2,parabase,
       procinfo,pass_2,parabase,
       pass_1,nld,ncon,nadd,nutils,
       pass_1,nld,ncon,nadd,nutils,
       cgutils,cgobj,
       cgutils,cgobj,
@@ -101,15 +101,15 @@ implementation
          if (left.nodetype=typen) then
          if (left.nodetype=typen) then
            begin
            begin
              reference_reset_symbol(href,
              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
            end
          else
          else
            begin
            begin
              { left contains self, load vmt from self }
              { left contains self, load vmt from self }
              secondpass(left);
              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;
       end;
       end;
 
 
@@ -133,12 +133,12 @@ implementation
           begin
           begin
             currpi:=current_procinfo;
             currpi:=current_procinfo;
             location_reset(location,LOC_REGISTER,OS_ADDR);
             location_reset(location,LOC_REGISTER,OS_ADDR);
-            location.register:=cg.getaddressregister(exprasmlist);
+            location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
             { load framepointer of current proc }
             { load framepointer of current proc }
             hsym:=tparavarsym(currpi.procdef.parast.search('parentfp'));
             hsym:=tparavarsym(currpi.procdef.parast.search('parentfp'));
             if not assigned(hsym) then
             if not assigned(hsym) then
               internalerror(200309281);
               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 }
             { walk parents }
             while (currpi.procdef.owner.symtablelevel>parentpd.parast.symtablelevel) do
             while (currpi.procdef.owner.symtablelevel>parentpd.parast.symtablelevel) do
               begin
               begin
@@ -153,7 +153,7 @@ implementation
                   internalerror(200309283);
                   internalerror(200309283);
 
 
                 reference_reset_base(href,location.register,hsym.localloc.reference.offset);
                 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;
           end;
       end;
       end;
@@ -168,8 +168,8 @@ implementation
          secondpass(left);
          secondpass(left);
 
 
          location_reset(location,LOC_REGISTER,OS_ADDR);
          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;
       end;
 
 
 
 
@@ -190,8 +190,8 @@ implementation
               {$ifdef cpu_uses_separate_address_registers}
               {$ifdef cpu_uses_separate_address_registers}
                 if getregtype(left.location.register)<>R_ADDRESSREGISTER then
                 if getregtype(left.location.register)<>R_ADDRESSREGISTER then
                   begin
                   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);
                       location.reference.base);
                   end
                   end
                 else
                 else
@@ -201,8 +201,8 @@ implementation
             LOC_CREFERENCE,
             LOC_CREFERENCE,
             LOC_REFERENCE:
             LOC_REFERENCE:
               begin
               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;
             LOC_CONSTANT:
             LOC_CONSTANT:
               begin
               begin
@@ -219,13 +219,13 @@ implementation
           begin
           begin
             paraloc1.init;
             paraloc1.init;
             paramanager.getintparaloc(pocall_default,1,paraloc1);
             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;
             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;
       end;
       end;
 
 
@@ -253,8 +253,8 @@ implementation
                   {$ifdef cpu_uses_separate_address_registers}
                   {$ifdef cpu_uses_separate_address_registers}
                     if getregtype(left.location.register)<>R_ADDRESSREGISTER then
                     if getregtype(left.location.register)<>R_ADDRESSREGISTER then
                       begin
                       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);
                           left.location.register,location.reference.base);
                       end
                       end
                     else
                     else
@@ -264,8 +264,8 @@ implementation
                 LOC_CREFERENCE,
                 LOC_CREFERENCE,
                 LOC_REFERENCE:
                 LOC_REFERENCE:
                   begin
                   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;
              end;
              end;
              { implicit deferencing }
              { implicit deferencing }
@@ -274,31 +274,31 @@ implementation
                 not(cs_compilesystem in aktmoduleswitches) then
                 not(cs_compilesystem in aktmoduleswitches) then
               begin
               begin
                 paramanager.getintparaloc(pocall_default,1,paraloc1);
                 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;
            end
            end
          else if is_interfacecom(left.resulttype.def) then
          else if is_interfacecom(left.resulttype.def) then
            begin
            begin
              location_reset(location,LOC_REFERENCE,def_cgsize(resulttype.def));
              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 }
              { implicit deferencing also for interfaces }
              if (cs_use_heaptrc in aktglobalswitches) and
              if (cs_use_heaptrc in aktglobalswitches) and
                 (cs_checkpointer in aktlocalswitches) and
                 (cs_checkpointer in aktlocalswitches) and
                 not(cs_compilesystem in aktmoduleswitches) then
                 not(cs_compilesystem in aktmoduleswitches) then
               begin
               begin
                 paramanager.getintparaloc(pocall_default,1,paraloc1);
                 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;
            end
            end
          else
          else
@@ -349,23 +349,23 @@ implementation
          if location.reference.base=NR_NO then
          if location.reference.base=NR_NO then
           begin
           begin
             if l<>1 then
             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;
             location.reference.base:=reg;
           end
           end
          else if location.reference.index=NR_NO then
          else if location.reference.index=NR_NO then
           begin
           begin
             if l<>1 then
             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;
             location.reference.index:=reg;
           end
           end
          else
          else
           begin
           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);
             reference_reset_base(location.reference,hreg,0);
             { insert new index register }
             { insert new index register }
             if l<>1 then
             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;
             location.reference.index:=reg;
           end;
           end;
        end;
        end;
@@ -405,19 +405,19 @@ implementation
                secondpass(hightree);
                secondpass(hightree);
                { generate compares }
                { generate compares }
                if (right.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
                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
                else
                  begin
                  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;
                  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 }
                { release hightree }
                hightree.free;
                hightree.free;
              end;
              end;
@@ -427,18 +427,18 @@ implementation
             begin
             begin
                paramanager.getintparaloc(pocall_default,1,paraloc1);
                paramanager.getintparaloc(pocall_default,1,paraloc1);
                paramanager.getintparaloc(pocall_default,2,paraloc2);
                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
             end
          else
          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;
          paraloc1.done;
          paraloc2.done;
          paraloc2.done;
        end;
        end;
@@ -484,8 +484,8 @@ implementation
                 LOC_CREFERENCE,
                 LOC_CREFERENCE,
                 LOC_REFERENCE :
                 LOC_REFERENCE :
                   begin
                   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;
                   end;
                 else
                 else
                   internalerror(2002032218);
                   internalerror(2002032218);
@@ -496,12 +496,12 @@ implementation
               if (cs_check_range in aktlocalswitches) then
               if (cs_check_range in aktlocalswitches) then
                 begin
                 begin
                    paramanager.getintparaloc(pocall_default,1,paraloc1);
                    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;
                 end;
 
 
               { in ansistrings/widestrings S[1] is p<w>char(S)[0] !! }
               { in ansistrings/widestrings S[1] is p<w>char(S)[0] !! }
@@ -520,8 +520,8 @@ implementation
                 LOC_REFERENCE,
                 LOC_REFERENCE,
                 LOC_CREFERENCE :
                 LOC_CREFERENCE :
                   begin
                   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);
                       left.location.reference,location.reference.base);
                   end;
                   end;
                 else
                 else
@@ -580,17 +580,17 @@ implementation
                            begin
                            begin
                               paramanager.getintparaloc(pocall_default,1,paraloc1);
                               paramanager.getintparaloc(pocall_default,1,paraloc1);
                               paramanager.getintparaloc(pocall_default,2,paraloc2);
                               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;
                               href:=location.reference;
                               dec(href.offset,sizeof(aint)-offsetdec);
                               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;
                            end;
 
 
                          st_shortstring:
                          st_shortstring:
@@ -676,20 +676,20 @@ implementation
               isjump:=(right.expectloc=LOC_JUMP);
               isjump:=(right.expectloc=LOC_JUMP);
               if isjump then
               if isjump then
                begin
                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;
                end;
               secondpass(right);
               secondpass(right);
               
               
               { if mulsize = 1, we won't have to modify the index }
               { 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
               if isjump then
                begin
                begin
-                 truelabel:=otl;
-                 falselabel:=ofl;
+                 current_procinfo.CurrTrueLabel:=otl;
+                 current_procinfo.CurrFalseLabel:=ofl;
                end
                end
               else if (right.location.loc = LOC_JUMP) then
               else if (right.location.loc = LOC_JUMP) then
                 internalerror(2006010801);
                 internalerror(2006010801);
@@ -717,18 +717,18 @@ implementation
                            begin
                            begin
                               paramanager.getintparaloc(pocall_default,1,paraloc1);
                               paramanager.getintparaloc(pocall_default,1,paraloc1);
                               paramanager.getintparaloc(pocall_default,2,paraloc2);
                               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;
                               href:=location.reference;
                               dec(href.offset,sizeof(aint)-offsetdec);
                               dec(href.offset,sizeof(aint)-offsetdec);
                               //dec(href.offset,7);
                               //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;
                            end;
                          st_shortstring:
                          st_shortstring:
                            begin
                            begin

+ 19 - 19
compiler/ncgopt.pas

@@ -40,7 +40,7 @@ uses
   globtype,globals,
   globtype,globals,
   pass_1,defutil,htypechk,
   pass_1,defutil,htypechk,
   symdef,paramgr,
   symdef,paramgr,
-  aasmbase,aasmtai,
+  aasmbase,aasmtai,aasmdata,
   ncnv, ncon, pass_2,
   ncnv, ncon, pass_2,
   cgbase, cpubase,
   cgbase, cpubase,
   tgobj, cgobj, cgutils,ncgutil;
   tgobj, cgobj, cgutils,ncgutil;
@@ -93,12 +93,12 @@ begin
   { ti386addnode.pass_2                                     }
   { ti386addnode.pass_2                                     }
   secondpass(left);
   secondpass(left);
   if not(tg.istemp(left.location.reference) and
   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
      not(nf_use_strconcat in flags) then
     begin
     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 }
        { return temp reference }
        location_reset(left.location,LOC_REFERENCE,def_cgsize(resulttype.def));
        location_reset(left.location,LOC_REFERENCE,def_cgsize(resulttype.def));
        left.location.reference:=href;
        left.location.reference:=href;
@@ -116,16 +116,16 @@ begin
     if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
     if right.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
       begin
       begin
         { get register for the char }
         { 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) }
         { 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
       end
     else hreg := right.location.register;
     else hreg := right.location.register;
 
 
   { load the current string length }
   { 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 ? }
   { do we have to check the length ? }
   if tg.istemp(left.location.reference) then
   if tg.istemp(left.location.reference) then
@@ -135,12 +135,12 @@ begin
   if checklength then
   if checklength then
     begin
     begin
       { is it already maximal? }
       { is it already maximal? }
-      objectlibrary.getjumplabel(l);
+      current_asmdata.getjumplabel(l);
       if tg.istemp(left.location.reference) then
       if tg.istemp(left.location.reference) then
         len:=255
         len:=255
       else
       else
         len:=tstringdef(left.resulttype.def).len;
         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;
     end;
 
 
   { no, so increase the length and add the new character }
   { 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       }
       { they're not free, so add the base reg to       }
       { the string length (since the index can         }
       { the string length (since the index can         }
       { have a scalefactor) and use lengthreg as base  }
       { 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;
       href2.base := lengthreg;
     end
     end
   else
   else
@@ -176,16 +176,16 @@ begin
     begin
     begin
       { no new_reference(href2) because it's only }
       { no new_reference(href2) because it's only }
       { used once (JM)                            }
       { 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
     end
   else
   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 }
   { 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
   if checklength then
-    cg.a_label(exprasmlist,l);
+    cg.a_label(current_asmdata.CurrAsmList,l);
   location_copy(location,left.location);
   location_copy(location,left.location);
 end;
 end;
 
 

+ 104 - 104
compiler/ncgset.pas

@@ -27,7 +27,7 @@ interface
 
 
     uses
     uses
        globtype,globals,
        globtype,globals,
-       node,nset,cpubase,cgbase,cgobj,aasmbase,aasmtai;
+       node,nset,cpubase,cgbase,cgobj,aasmbase,aasmtai,aasmdata;
 
 
     type
     type
        tcgsetelementnode = class(tsetelementnode)
        tcgsetelementnode = class(tsetelementnode)
@@ -46,7 +46,7 @@ interface
              instructions to do bit tests.
              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;
                                           bitsize: tcgsize; bitnumber,value : tregister;
                                           ressize: tcgsize; res :tregister);virtual;
                                           ressize: tcgsize; res :tregister);virtual;
        end;
        end;
@@ -88,7 +88,7 @@ implementation
       verbose,
       verbose,
       symconst,symdef,defutil,
       symconst,symdef,defutil,
       paramgr,
       paramgr,
-      pass_2,tgobj,
+      procinfo,pass_2,tgobj,
       nbas,ncon,nflw,
       nbas,ncon,nflw,
       ncgutil,regvars,
       ncgutil,regvars,
       cgutils;
       cgutils;
@@ -103,7 +103,7 @@ implementation
        { load first value in 32bit register }
        { load first value in 32bit register }
          secondpass(left);
          secondpass(left);
          if left.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
          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 ? }
        { also a second value ? }
          if assigned(right) then
          if assigned(right) then
@@ -112,7 +112,7 @@ implementation
              if codegenerror then
              if codegenerror then
                exit;
                exit;
              if right.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
              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;
            end;
 
 
          { we doesn't modify the left side, we check only the type }
          { 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}
   {  __Result register is set to 1, if the bit is set otherwise, __Result}
   {   is set to zero. __RESULT register is also used as scratch.         }
   {   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;
                                             bitsize: tcgsize; bitnumber,value : tregister;
                                             ressize: tcgsize; res :tregister);
                                             ressize: tcgsize; res :tregister);
     begin
     begin
@@ -271,14 +271,14 @@ implementation
          if genjumps then
          if genjumps then
           begin
           begin
             { allocate a register for the result }
             { 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 }
             { Get a label to jump to the end }
-            objectlibrary.getjumplabel(l);
+            current_asmdata.getjumplabel(l);
 
 
             { clear the register value, indicating result is FALSE }
             { 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 }
             { 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;
             pleftreg := left.location.register;
 
 
             { how much have we already substracted from the x in the }
             { how much have we already substracted from the x in the }
@@ -302,16 +302,16 @@ implementation
                       if (left.location.loc = LOC_CREGISTER) and
                       if (left.location.loc = LOC_CREGISTER) and
                          (hr<>pleftreg) then
                          (hr<>pleftreg) then
                         begin
                         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;
                           pleftreg:=hr;
                         end
                         end
                       else
                       else
                         begin
                         begin
                           { otherwise, the value is already in a register   }
                           { otherwise, the value is already in a register   }
                           { that can be modified                            }
                           { 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)
                              setparts[i].start-adjustment,pleftreg)
                         end;
                         end;
                     { new total value substracted from x:           }
                     { new total value substracted from x:           }
@@ -322,32 +322,32 @@ implementation
                     { we need a carry in case the element is in the range }
                     { we need a carry in case the element is in the range }
                     { (this will never overflow since we check at the     }
                     { (this will never overflow since we check at the     }
                     { beginning whether stop-start <> 255)                }
                     { 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);
                       setparts[i].stop-setparts[i].start+1,pleftreg,l);
                   end
                   end
                 else
                 else
                   { if setparts[i].start = 0 and setparts[i].stop = 255,  }
                   { if setparts[i].start = 0 and setparts[i].stop = 255,  }
                   { it's always true since "in" is only allowed for bytes }
                   { it's always true since "in" is only allowed for bytes }
                   begin
                   begin
-                    cg.a_jmp_always(exprasmlist,l);
+                    cg.a_jmp_always(current_asmdata.CurrAsmList,l);
                   end;
                   end;
               end
               end
              else
              else
               begin
               begin
                 { Emit code to check if left is an element }
                 { 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);
                       setparts[i].stop-adjustment,pleftreg,l);
               end;
               end;
              { To compensate for not doing a second pass }
              { To compensate for not doing a second pass }
              right.location.reference.symbol:=nil;
              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 }
              { Now place the end label if IN success }
-             cg.a_label(exprasmlist,l);
+             cg.a_label(current_asmdata.CurrAsmList,l);
              { result register is 1 }
              { 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 }
              { in case value is not found }
-             cg.a_label(exprasmlist,l3);
+             cg.a_label(current_asmdata.CurrAsmList,l3);
           end
           end
          else
          else
          {*****************************************************************}
          {*****************************************************************}
@@ -361,21 +361,21 @@ implementation
                {****************************  SMALL SET **********************}
                {****************************  SMALL SET **********************}
                if left.nodetype=ordconstn then
                if left.nodetype=ordconstn then
                 begin
                 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 }
                   { 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 }
                   { 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
                 end
                else
                else
                 begin
                 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 }
                   { 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 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);
                       right.location.register,location.size,location.register);
                 end;
                 end;
              end
              end
@@ -391,27 +391,27 @@ implementation
                   { assumption (other cases will be caught by range checking) (JM)  }
                   { assumption (other cases will be caught by range checking) (JM)  }
 
 
                   { load left in register }
                   { 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
                   if left.location.loc = LOC_CREGISTER then
-                    hr := cg.getintregister(exprasmlist,opsize)
+                    hr := cg.getintregister(current_asmdata.CurrAsmList,opsize)
                   else
                   else
                     hr := left.location.register;
                     hr := left.location.register;
                   { load right in 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 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 }
                   { 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 }
                   { 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 }
                   { 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 }
                 end { of right.location.loc=LOC_CONSTANT }
                { do search in a normal set which could have >32 elementsm
                { do search in a normal set which could have >32 elementsm
                  but also used if the left side contains higher values > 32 }
                  but also used if the left side contains higher values > 32 }
@@ -424,21 +424,21 @@ implementation
                     { adjust for endianess differences }
                     { adjust for endianess differences }
                     inc(right.location.reference.offset,(tordconstnode(left).value shr 3) xor 3);
                     inc(right.location.reference.offset,(tordconstnode(left).value shr 3) xor 3);
                   { allocate a register for the result }
                   { 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);
                     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
                 end
                else
                else
                 begin
                 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;
                   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;
                   href := right.location.reference;
                   if (href.base = NR_NO) then
                   if (href.base = NR_NO) then
@@ -447,23 +447,23 @@ implementation
                     href.index := hr
                     href.index := hr
                   else
                   else
                     begin
                     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);
                       reference_reset_base(href,hr2,0);
                       href.index := hr;
                       href.index := hr;
                     end;
                     end;
                   { allocate a register for the result }
                   { 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;
              end;
           end;
           end;
-          location_freetemp(exprasmlist,right.location);
+          location_freetemp(current_asmdata.CurrAsmList,right.location);
        end;
        end;
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -512,8 +512,8 @@ implementation
                 to move the result before subtract to help
                 to move the result before subtract to help
                 the register allocator
                 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;
             end;
 
 
         begin
         begin
@@ -521,15 +521,15 @@ implementation
              genitem(t^.less);
              genitem(t^.less);
            { do we need to test the first value? }
            { do we need to test the first value? }
            if first and (t^._low>get_min_value(left.resulttype.def)) then
            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
            if t^._low=t^._high then
              begin
              begin
                 if t^._low-last=0 then
                 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
                 else
                   begin
                   begin
                       gensub(aint(t^._low-last));
                       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;
                   end;
                 last:=t^._low;
                 last:=t^._low;
              end
              end
@@ -550,10 +550,10 @@ implementation
                     { present label then the lower limit can be checked    }
                     { present label then the lower limit can be checked    }
                     { immediately. else check the range in between:       }
                     { immediately. else check the range in between:       }
                     gensub(aint(t^._low-last));
                     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;
                   end;
                 gensub(aint(t^._high-t^._low));
                 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;
                 last:=t^._high;
              end;
              end;
            first:=false;
            first:=false;
@@ -569,9 +569,9 @@ implementation
            begin
            begin
               last:=0;
               last:=0;
               first:=true;
               first:=true;
-              scratch_reg:=cg.getintregister(exprasmlist,opsize);
+              scratch_reg:=cg.getintregister(current_asmdata.CurrAsmList,opsize);
               genitem(hp);
               genitem(hp);
-              cg.a_jmp_always(exprasmlist,elselabel);
+              cg.a_jmp_always(current_asmdata.CurrAsmList,elselabel);
            end;
            end;
       end;
       end;
 
 
@@ -597,15 +597,15 @@ implementation
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                 if opsize in [OS_S64,OS_64] then
                 if opsize in [OS_S64,OS_64] then
                   begin
                   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
                   end
                 else
                 else
 {$endif cpu64bit}
 {$endif cpu64bit}
                   begin
                   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;
                   end;
                 { Reset last here, because we've only checked for one value and need to compare
                 { 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 }
                   for the next range both the lower and upper bound }
@@ -621,37 +621,37 @@ implementation
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                      if opsize in [OS_64,OS_S64] then
                      if opsize in [OS_64,OS_S64] then
                        begin
                        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);
                                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);
                                hregister2, l1);
                           { the comparisation of the low dword must be always unsigned! }
                           { 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
                        end
                      else
                      else
 {$endif cpu64bit}
 {$endif cpu64bit}
                        begin
                        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);
                            elselabel);
                        end;
                        end;
                   end;
                   end;
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                 if opsize in [OS_S64,OS_64] then
                 if opsize in [OS_S64,OS_64] then
                   begin
                   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));
                            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);
                            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
                   end
                 else
                 else
 {$endif cpu64bit}
 {$endif cpu64bit}
                   begin
                   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;
                   end;
 
 
                 last:=t^._high;
                 last:=t^._high;
@@ -665,7 +665,7 @@ implementation
          last:=0;
          last:=0;
          lastwasrange:=false;
          lastwasrange:=false;
          genitem(hp);
          genitem(hp);
-         cg.a_jmp_always(exprasmlist,elselabel);
+         cg.a_jmp_always(current_asmdata.CurrAsmList,elselabel);
       end;
       end;
 
 
 
 
@@ -684,10 +684,10 @@ implementation
          location_reset(location,LOC_VOID,OS_NO);
          location_reset(location,LOC_VOID,OS_NO);
 
 
          { Allocate labels }
          { Allocate labels }
-         objectlibrary.getjumplabel(endlabel);
-         objectlibrary.getjumplabel(elselabel);
+         current_asmdata.getjumplabel(endlabel);
+         current_asmdata.getjumplabel(elselabel);
          for i:=0 to blocks.count-1 do
          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);
          with_sign:=is_signed(left.resulttype.def);
          if with_sign then
          if with_sign then
@@ -703,21 +703,21 @@ implementation
               jmp_le:=OC_BE;
               jmp_le:=OC_BE;
            end;
            end;
 
 
-         { save current truelabel and falselabel }
+         { save current current_procinfo.CurrTrueLabel and current_procinfo.CurrFalseLabel }
          isjump:=false;
          isjump:=false;
          if left.location.loc=LOC_JUMP then
          if left.location.loc=LOC_JUMP then
           begin
           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;
             isjump:=true;
           end;
           end;
          secondpass(left);
          secondpass(left);
          { determines the size of the operand }
          { determines the size of the operand }
          opsize:=def_cgsize(left.resulttype.def);
          opsize:=def_cgsize(left.resulttype.def);
          { copy the case expression to a register }
          { 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}
 {$ifndef cpu64bit}
          if opsize in [OS_S64,OS_64] then
          if opsize in [OS_S64,OS_64] then
            begin
            begin
@@ -729,8 +729,8 @@ implementation
            hregister:=left.location.register;
            hregister:=left.location.register;
          if isjump then
          if isjump then
           begin
           begin
-            truelabel:=otl;
-            falselabel:=ofl;
+            current_procinfo.CurrTrueLabel:=otl;
+            current_procinfo.CurrFalseLabel:=ofl;
           end;
           end;
 
 
          { we need the min_label always to choose between }
          { we need the min_label always to choose between }
@@ -739,7 +739,7 @@ implementation
 
 
          { Generate the jumps }
          { Generate the jumps }
 {$ifdef OLDREGVARS}
 {$ifdef OLDREGVARS}
-         load_all_regvars(exprasmlist);
+         load_all_regvars(current_asmdata.CurrAsmList);
 {$endif OLDREGVARS}
 {$endif OLDREGVARS}
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
          if opsize in [OS_64,OS_S64] then
          if opsize in [OS_64,OS_S64] then
@@ -824,25 +824,25 @@ implementation
          { generate the instruction blocks }
          { generate the instruction blocks }
          for i:=0 to blocks.count-1 do
          for i:=0 to blocks.count-1 do
            begin
            begin
-              cg.a_label(exprasmlist,pcaseblock(blocks[i])^.blocklabel);
+              cg.a_label(current_asmdata.CurrAsmList,pcaseblock(blocks[i])^.blocklabel);
               secondpass(pcaseblock(blocks[i])^.statement);
               secondpass(pcaseblock(blocks[i])^.statement);
               { don't come back to case line }
               { don't come back to case line }
-              aktfilepos:=exprasmList.getlasttaifilepos^;
+              aktfilepos:=current_asmdata.CurrAsmList.getlasttaifilepos^;
 {$ifdef OLDREGVARS}
 {$ifdef OLDREGVARS}
-              load_all_regvars(exprasmlist);
+              load_all_regvars(current_asmdata.CurrAsmList);
 {$endif OLDREGVARS}
 {$endif OLDREGVARS}
-              cg.a_jmp_always(exprasmlist,endlabel);
+              cg.a_jmp_always(current_asmdata.CurrAsmList,endlabel);
            end;
            end;
          { ...and the else block }
          { ...and the else block }
-         cg.a_label(exprasmlist,elselabel);
+         cg.a_label(current_asmdata.CurrAsmList,elselabel);
          if assigned(elseblock) then
          if assigned(elseblock) then
            begin
            begin
               secondpass(elseblock);
               secondpass(elseblock);
 {$ifdef OLDREGVARS}
 {$ifdef OLDREGVARS}
-              load_all_regvars(exprasmlist);
+              load_all_regvars(current_asmdata.CurrAsmList);
 {$endif OLDREGVARS}
 {$endif OLDREGVARS}
            end;
            end;
-         cg.a_label(exprasmlist,endlabel);
+         cg.a_label(current_asmdata.CurrAsmList,endlabel);
 
 
          { Reset labels }
          { Reset labels }
          for i:=0 to blocks.count-1 do
          for i:=0 to blocks.count-1 do

+ 130 - 130
compiler/ncgutil.pas

@@ -29,7 +29,7 @@ interface
       node,cpuinfo,
       node,cpuinfo,
       globtype,
       globtype,
       cpubase,cgbase,parabase,cgutils,
       cpubase,cgbase,parabase,cgutils,
-      aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmdata,aasmcpu,
       symconst,symbase,symdef,symsym,symtype,symtable
       symconst,symbase,symdef,symsym,symtype,symtable
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
       ,cg64f32
       ,cg64f32
@@ -57,39 +57,39 @@ interface
 }
 }
 
 
     procedure firstcomplex(p : tbinarynode);
     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 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
     { 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 }
       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 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);
     procedure get_used_regvars(n: tnode; var rv: tusedregvars);
     { adds the regvars used in n and its children to rv.allregvars,
     { 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
       find out which regvars are used in two different node trees
       (e.g. in the "else" and "then" path, or in various case blocks }
       (e.g. in the "else" and "then" path, or in various case blocks }
 //    procedure get_used_regvars_common(n: tnode; var rv: tusedregvarscommon);
 //    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;
         reasonbuf  : treference;
       end;
       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 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 }
     { rtti and init/final }
     procedure generate_rtti(p:Ttypesym);
     procedure generate_rtti(p:Ttypesym);
     procedure generate_inittable(p:tsym);
     procedure generate_inittable(p:tsym);
 
 
-    procedure location_free(list: taasmoutput; const location : TLocation);
+    procedure location_free(list: TAsmList; const location : TLocation);
 
 
     function getprocalign : shortint;
     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
 implementation
 
 
@@ -157,7 +157,7 @@ implementation
     globals,systems,verbose,
     globals,systems,verbose,
     ppu,defutil,
     ppu,defutil,
     procinfo,paramgr,fmodule,
     procinfo,paramgr,fmodule,
-    regvars,dwarf,dbgbase,
+    regvars,dbgbase,
     pass_1,pass_2,
     pass_1,pass_2,
     nbas,ncon,nld,nutils,
     nbas,ncon,nld,nutils,
     tgobj,cgobj
     tgobj,cgobj
@@ -174,7 +174,7 @@ implementation
                                   Misc Helpers
                                   Misc Helpers
 *****************************************************************************}
 *****************************************************************************}
 
 
-    procedure location_free(list: taasmoutput; const location : TLocation);
+    procedure location_free(list: TAsmList; const location : TLocation);
       begin
       begin
         case location.loc of
         case location.loc of
           LOC_VOID:
           LOC_VOID:
@@ -249,7 +249,7 @@ implementation
       end;
       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
       produces jumps to true respectively false labels using boolean expressions
 
 
@@ -275,9 +275,9 @@ implementation
               if is_constboolnode(p) then
               if is_constboolnode(p) then
                 begin
                 begin
                    if tordconstnode(p).value<>0 then
                    if tordconstnode(p).value<>0 then
-                     cg.a_jmp_always(list,truelabel)
+                     cg.a_jmp_always(list,current_procinfo.CurrTrueLabel)
                    else
                    else
-                     cg.a_jmp_always(list,falselabel)
+                     cg.a_jmp_always(list,current_procinfo.CurrFalseLabel)
                 end
                 end
               else
               else
                 begin
                 begin
@@ -289,16 +289,16 @@ implementation
                          if (p.location.loc = LOC_CREGISTER) then
                          if (p.location.loc = LOC_CREGISTER) then
                            load_regvar_reg(list,p.location.register);
                            load_regvar_reg(list,p.location.register);
 {$endif OLDREGVARS}
 {$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;
                        end;
                      LOC_JUMP:
                      LOC_JUMP:
                        ;
                        ;
 {$ifdef cpuflags}
 {$ifdef cpuflags}
                      LOC_FLAGS :
                      LOC_FLAGS :
                        begin
                        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;
                        end;
 {$endif cpuflags}
 {$endif cpuflags}
                      else
                      else
@@ -347,7 +347,7 @@ implementation
                             EXCEPTION MANAGEMENT
                             EXCEPTION MANAGEMENT
 *****************************************************************************}
 *****************************************************************************}
 
 
-    procedure get_exception_temps(list:taasmoutput;var t:texceptiontemps);
+    procedure get_exception_temps(list:TAsmList;var t:texceptiontemps);
       var
       var
         srsym : ttypesym;
         srsym : ttypesym;
       begin
       begin
@@ -362,7 +362,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure unget_exception_temps(list:taasmoutput;const t:texceptiontemps);
+    procedure unget_exception_temps(list:TAsmList;const t:texceptiontemps);
       begin
       begin
         tg.Ungettemp(list,t.jmpbuf);
         tg.Ungettemp(list,t.jmpbuf);
         tg.ungettemp(list,t.envbuf);
         tg.ungettemp(list,t.envbuf);
@@ -370,7 +370,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure new_exception(list:TAAsmoutput;const t:texceptiontemps;exceptlabel:tasmlabel);
+    procedure new_exception(list:TAsmList;const t:texceptiontemps;exceptlabel:tasmlabel);
       var
       var
         paraloc1,paraloc2,paraloc3 : tcgpara;
         paraloc1,paraloc2,paraloc3 : tcgpara;
       begin
       begin
@@ -410,7 +410,7 @@ implementation
      end;
      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
      begin
          cg.allocallcpuregisters(list);
          cg.allocallcpuregisters(list);
          cg.a_call_name(list,'FPC_POPADDRSTACK');
          cg.a_call_name(list,'FPC_POPADDRSTACK');
@@ -430,7 +430,7 @@ implementation
 
 
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
     { 32-bit version }
     { 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
       var
         hregister,
         hregister,
         hregisterhi : tregister;
         hregisterhi : tregister;
@@ -461,11 +461,11 @@ implementation
                   cg.g_flags2reg(list,OS_INT,l.resflags,hregister);
                   cg.g_flags2reg(list,OS_INT,l.resflags,hregister);
                 LOC_JUMP :
                 LOC_JUMP :
                   begin
                   begin
-                    cg.a_label(list,truelabel);
+                    cg.a_label(list,current_procinfo.CurrTrueLabel);
                     cg.a_load_const_reg(list,OS_INT,1,hregister);
                     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_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_load_const_reg(list,OS_INT,0,hregister);
                     cg.a_label(list,hl);
                     cg.a_label(list,hl);
                   end;
                   end;
@@ -547,11 +547,11 @@ implementation
                cg.g_flags2reg(list,dst_size,l.resflags,hregister);
                cg.g_flags2reg(list,dst_size,l.resflags,hregister);
              LOC_JUMP :
              LOC_JUMP :
                begin
                begin
-                 cg.a_label(list,truelabel);
+                 cg.a_label(list,current_procinfo.CurrTrueLabel);
                  cg.a_load_const_reg(list,dst_size,1,hregister);
                  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_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_load_const_reg(list,dst_size,0,hregister);
                  cg.a_label(list,hl);
                  cg.a_label(list,hl);
                end;
                end;
@@ -596,7 +596,7 @@ implementation
 {$else cpu64bit}
 {$else cpu64bit}
 
 
     { 64-bit version }
     { 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
       var
         hregister : tregister;
         hregister : tregister;
         hl : tasmlabel;
         hl : tasmlabel;
@@ -610,11 +610,11 @@ implementation
             cg.g_flags2reg(list,dst_size,l.resflags,hregister);
             cg.g_flags2reg(list,dst_size,l.resflags,hregister);
           LOC_JUMP :
           LOC_JUMP :
             begin
             begin
-              cg.a_label(list,truelabel);
+              cg.a_label(list,current_procinfo.CurrTrueLabel);
               cg.a_load_const_reg(list,dst_size,1,hregister);
               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_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_load_const_reg(list,dst_size,0,hregister);
               cg.a_label(list,hl);
               cg.a_label(list,hl);
             end;
             end;
@@ -658,7 +658,7 @@ implementation
 {$endif cpu64bit}
 {$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
       var
         reg : tregister;
         reg : tregister;
         href : treference;
         href : treference;
@@ -683,7 +683,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure location_force_mmregscalar(list:TAAsmoutput;var l: tlocation;maybeconst:boolean);
+    procedure location_force_mmregscalar(list:TAsmList;var l: tlocation;maybeconst:boolean);
       var
       var
         reg : tregister;
         reg : tregister;
         href : treference;
         href : treference;
@@ -708,7 +708,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure location_force_mem(list:TAAsmoutput;var l:tlocation);
+    procedure location_force_mem(list:TAsmList;var l:tlocation);
       var
       var
         r : treference;
         r : treference;
       begin
       begin
@@ -751,7 +751,7 @@ implementation
       end;
       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
       begin
         case l.loc of
         case l.loc of
           LOC_REGISTER,
           LOC_REGISTER,
@@ -782,7 +782,7 @@ implementation
                                   Maybe_Save
                                   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
       begin
 {$ifdef i386}
 {$ifdef i386}
         if (needed>=maxfpuregs) and
         if (needed>=maxfpuregs) and
@@ -807,12 +807,12 @@ implementation
       var
       var
         href : treference;
         href : treference;
         hreg : tregister;
         hreg : tregister;
-        list : TAAsmoutput;
+        list : TAsmList;
         hsym : tparavarsym;
         hsym : tparavarsym;
         l    : longint;
         l    : longint;
         localcopyloc : tlocation;
         localcopyloc : tlocation;
       begin
       begin
-        list:=taasmoutput(arg);
+        list:=TAsmList(arg);
         if (tsym(p).typ=paravarsym) and
         if (tsym(p).typ=paravarsym) and
            (tparavarsym(p).varspez=vs_value) and
            (tparavarsym(p).varspez=vs_value) and
            (paramanager.push_addr_param(tparavarsym(p).varspez,tparavarsym(p).vartype.def,current_procinfo.procdef.proccalloption)) then
            (paramanager.push_addr_param(tparavarsym(p).varspez,tparavarsym(p).vartype.def,current_procinfo.procdef.proccalloption)) then
@@ -866,12 +866,12 @@ implementation
          begin
          begin
            case tglobalvarsym(p).localloc.loc of
            case tglobalvarsym(p).localloc.loc of
              LOC_CREGISTER :
              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);
                    tglobalvarsym(p).localloc.register);
              LOC_REFERENCE : ;
              LOC_REFERENCE : ;
              LOC_CMMREGISTER :
              LOC_CMMREGISTER :
                { clear the whole register }
                { 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,
                  tglobalvarsym(p).localloc.register,
                  tglobalvarsym(p).localloc.register,
                  nil);
                  nil);
@@ -887,7 +887,7 @@ implementation
     { generates the code for initialisation of local data }
     { generates the code for initialisation of local data }
     procedure initialize_data(p : tnamedindexitem;arg:pointer);
     procedure initialize_data(p : tnamedindexitem;arg:pointer);
       var
       var
-        oldexprasmlist : TAAsmoutput;
+        OldAsmList : TAsmList;
         hp : tnode;
         hp : tnode;
       begin
       begin
         if (tsym(p).typ in [globalvarsym,localvarsym]) and
         if (tsym(p).typ in [globalvarsym,localvarsym]) and
@@ -896,30 +896,30 @@ implementation
            not(is_class(tabstractvarsym(p).vartype.def)) and
            not(is_class(tabstractvarsym(p).vartype.def)) and
            tabstractvarsym(p).vartype.def.needs_inittable then
            tabstractvarsym(p).vartype.def.needs_inittable then
          begin
          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));
            hp:=initialize_data_node(cloadnode.create(tsym(p),tsym(p).owner));
            firstpass(hp);
            firstpass(hp);
            secondpass(hp);
            secondpass(hp);
            hp.free;
            hp.free;
-           exprasmlist:=oldexprasmlist;
+           current_asmdata.CurrAsmList:=OldAsmList;
          end;
          end;
       end;
       end;
 
 
 
 
-    procedure finalize_sym(asmlist:taasmoutput;sym:tsym);
+    procedure finalize_sym(asmlist:TAsmList;sym:tsym);
       var
       var
         hp : tnode;
         hp : tnode;
-        oldexprasmlist : TAAsmoutput;
+        OldAsmList : TAsmList;
       begin
       begin
         include(current_procinfo.flags,pi_needs_implicit_finally);
         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));
         hp:=finalize_data_node(cloadnode.create(sym,sym.owner));
         firstpass(hp);
         firstpass(hp);
         secondpass(hp);
         secondpass(hp);
         hp.free;
         hp.free;
-        exprasmlist:=oldexprasmlist;
+        current_asmdata.CurrAsmList:=OldAsmList;
       end;
       end;
 
 
 
 
@@ -932,7 +932,7 @@ implementation
            not(vo_is_funcret in tlocalvarsym(p).varoptions) and
            not(vo_is_funcret in tlocalvarsym(p).varoptions) and
            not(is_class(tlocalvarsym(p).vartype.def)) and
            not(is_class(tlocalvarsym(p).vartype.def)) and
            tlocalvarsym(p).vartype.def.needs_inittable then
            tlocalvarsym(p).vartype.def.needs_inittable then
-          finalize_sym(taasmoutput(arg),tsym(p));
+          finalize_sym(TAsmList(arg),tsym(p));
       end;
       end;
 
 
 
 
@@ -947,7 +947,7 @@ implementation
             begin
             begin
               if ttypedconstsym(p).is_writable and
               if ttypedconstsym(p).is_writable and
                  ttypedconstsym(p).typedconsttype.def.needs_inittable then
                  ttypedconstsym(p).typedconsttype.def.needs_inittable then
-                finalize_sym(taasmoutput(arg),tsym(p));
+                finalize_sym(TAsmList(arg),tsym(p));
             end;
             end;
           procsym :
           procsym :
             begin
             begin
@@ -979,13 +979,13 @@ implementation
                  not(vo_is_external in tglobalvarsym(p).varoptions) and
                  not(vo_is_external in tglobalvarsym(p).varoptions) and
                  not(is_class(tglobalvarsym(p).vartype.def)) and
                  not(is_class(tglobalvarsym(p).vartype.def)) and
                  tglobalvarsym(p).vartype.def.needs_inittable then
                  tglobalvarsym(p).vartype.def.needs_inittable then
-                finalize_sym(taasmoutput(arg),tsym(p));
+                finalize_sym(TAsmList(arg),tsym(p));
             end;
             end;
           typedconstsym :
           typedconstsym :
             begin
             begin
               if ttypedconstsym(p).is_writable and
               if ttypedconstsym(p).is_writable and
                  ttypedconstsym(p).typedconsttype.def.needs_inittable then
                  ttypedconstsym(p).typedconsttype.def.needs_inittable then
-                finalize_sym(taasmoutput(arg),tsym(p));
+                finalize_sym(TAsmList(arg),tsym(p));
             end;
             end;
           procsym :
           procsym :
             begin
             begin
@@ -1008,9 +1008,9 @@ implementation
       var
       var
         href : treference;
         href : treference;
         tmpreg : tregister;
         tmpreg : tregister;
-        list : TAAsmoutput;
+        list : TAsmList;
       begin
       begin
-        list:=taasmoutput(arg);
+        list:=TAsmList(arg);
         if (tsym(p).typ=paravarsym) and
         if (tsym(p).typ=paravarsym) and
            not is_class_or_interface(tparavarsym(p).vartype.def) and
            not is_class_or_interface(tparavarsym(p).vartype.def) and
            tparavarsym(p).vartype.def.needs_inittable then
            tparavarsym(p).vartype.def.needs_inittable then
@@ -1036,12 +1036,12 @@ implementation
     { generates the code for decrementing the reference count of parameters }
     { generates the code for decrementing the reference count of parameters }
     procedure final_paras(p : tnamedindexitem;arg:pointer);
     procedure final_paras(p : tnamedindexitem;arg:pointer);
       var
       var
-        list : TAAsmoutput;
+        list : TAsmList;
         href : treference;
         href : treference;
       begin
       begin
         if not(tsym(p).typ=paravarsym) then
         if not(tsym(p).typ=paravarsym) then
           exit;
           exit;
-        list:=taasmoutput(arg);
+        list:=TAsmList(arg);
         if not is_class_or_interface(tparavarsym(p).vartype.def) and
         if not is_class_or_interface(tparavarsym(p).vartype.def) and
            tparavarsym(p).vartype.def.needs_inittable then
            tparavarsym(p).vartype.def.needs_inittable then
          begin
          begin
@@ -1066,7 +1066,7 @@ implementation
 
 
 
 
     { Initialize temp ansi/widestrings,interfaces }
     { Initialize temp ansi/widestrings,interfaces }
-    procedure inittempvariables(list:taasmoutput);
+    procedure inittempvariables(list:TAsmList);
       var
       var
         hp : ptemprecord;
         hp : ptemprecord;
         href : treference;
         href : treference;
@@ -1085,7 +1085,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure finalizetempvariables(list:taasmoutput);
+    procedure finalizetempvariables(list:TAsmList);
       var
       var
         hp : ptemprecord;
         hp : ptemprecord;
         href : treference;
         href : treference;
@@ -1105,7 +1105,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_load_return_value(list:TAAsmoutput);
+    procedure gen_load_return_value(list:TAsmList);
       var
       var
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
         href   : treference;
         href   : treference;
@@ -1262,7 +1262,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_alloc_regvar(list:TAAsmoutput;sym: tabstractnormalvarsym);
+    procedure gen_alloc_regvar(list:TAsmList;sym: tabstractnormalvarsym);
       begin
       begin
         case sym.localloc.loc of
         case sym.localloc.loc of
           LOC_CREGISTER:
           LOC_CREGISTER:
@@ -1304,7 +1304,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_load_para_value(list:TAAsmoutput);
+    procedure gen_load_para_value(list:TAsmList);
 
 
        procedure get_para(const paraloc:TCGParaLocation);
        procedure get_para(const paraloc:TCGParaLocation);
          begin
          begin
@@ -1593,7 +1593,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_initialize_code(list:TAAsmoutput);
+    procedure gen_initialize_code(list:TAsmList);
       begin
       begin
         { initialize local data like ansistrings }
         { initialize local data like ansistrings }
         case current_procinfo.procdef.proctypeoption of
         case current_procinfo.procdef.proctypeoption of
@@ -1630,7 +1630,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_finalize_code(list:TAAsmoutput);
+    procedure gen_finalize_code(list:TAsmList);
       begin
       begin
 {$ifdef OLDREGVARS}
 {$ifdef OLDREGVARS}
         cleanup_regvars(list);
         cleanup_regvars(list);
@@ -1664,7 +1664,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_entry_code(list:TAAsmoutput);
+    procedure gen_entry_code(list:TAsmList);
       var
       var
         paraloc1,
         paraloc1,
         paraloc2 : tcgpara;
         paraloc2 : tcgpara;
@@ -1709,7 +1709,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_exit_code(list:TAAsmoutput);
+    procedure gen_exit_code(list:TAsmList);
       begin
       begin
         { call __EXIT for main program }
         { call __EXIT for main program }
         if (not DLLsource) and
         if (not DLLsource) and
@@ -1731,15 +1731,15 @@ implementation
           begin
           begin
             if (cs_profile in aktmoduleswitches) or
             if (cs_profile in aktmoduleswitches) or
                (po_global in current_procinfo.procdef.procoptions) then
                (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
             else
-               objectlibrary.newasmsymbol(item.str,AB_GLOBAL,AT_FUNCTION);
+               current_asmdata.newasmsymbol(item.str,AB_GLOBAL,AT_FUNCTION);
             item := tstringlistitem(item.next);
             item := tstringlistitem(item.next);
           end;
           end;
        end;
        end;
 
 
 
 
-    procedure gen_proc_symbol(list:Taasmoutput);
+    procedure gen_proc_symbol(list:TAsmList);
       var
       var
         hs : string;
         hs : string;
       begin
       begin
@@ -1761,7 +1761,7 @@ implementation
 
 
 
 
 
 
-    procedure gen_proc_symbol_end(list:Taasmoutput);
+    procedure gen_proc_symbol_end(list:TAsmList);
       begin
       begin
         list.concat(Tai_symbol_end.Createname(current_procinfo.procdef.mangledname));
         list.concat(Tai_symbol_end.Createname(current_procinfo.procdef.mangledname));
 
 
@@ -1809,13 +1809,13 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_proc_entry_code(list:Taasmoutput);
+    procedure gen_proc_entry_code(list:TAsmList);
       var
       var
         hitemp,
         hitemp,
         lotemp : longint;
         lotemp : longint;
       begin
       begin
         { generate call frame marker for dwarf call frame info }
         { 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 }
         { All temps are know, write offsets used for information }
         if (cs_asm_source in aktglobalswitches) then
         if (cs_asm_source in aktglobalswitches) then
@@ -1839,7 +1839,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_proc_exit_code(list:Taasmoutput);
+    procedure gen_proc_exit_code(list:TAsmList);
       var
       var
         parasize : longint;
         parasize : longint;
       begin
       begin
@@ -1862,11 +1862,11 @@ implementation
           location_free(list,current_procinfo.procdef.funcretloc[calleeside]);
           location_free(list,current_procinfo.procdef.funcretloc[calleeside]);
 
 
         { end of frame marker for call frame info }
         { end of frame marker for call frame info }
-        dwarfcfi.end_frame(list);
+        current_asmdata.asmcfi.end_frame(list);
       end;
       end;
 
 
 
 
-    procedure gen_stack_check_size_para(list:Taasmoutput);
+    procedure gen_stack_check_size_para(list:TAsmList);
       var
       var
         paraloc1   : tcgpara;
         paraloc1   : tcgpara;
       begin
       begin
@@ -1879,7 +1879,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_stack_check_call(list:Taasmoutput);
+    procedure gen_stack_check_call(list:TAsmList);
       var
       var
         paraloc1   : tcgpara;
         paraloc1   : tcgpara;
       begin
       begin
@@ -1896,7 +1896,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_save_used_regs(list:TAAsmoutput);
+    procedure gen_save_used_regs(list:TAsmList);
       begin
       begin
         { Pure assembler routines need to save the registers themselves }
         { Pure assembler routines need to save the registers themselves }
         if (po_assembler in current_procinfo.procdef.procoptions) then
         if (po_assembler in current_procinfo.procdef.procoptions) then
@@ -1908,7 +1908,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_restore_used_regs(list:TAAsmoutput);
+    procedure gen_restore_used_regs(list:TAsmList);
       begin
       begin
         { Pure assembler routines need to save the registers themselves }
         { Pure assembler routines need to save the registers themselves }
         if (po_assembler in current_procinfo.procdef.procoptions) then
         if (po_assembler in current_procinfo.procdef.procoptions) then
@@ -1920,7 +1920,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_got_load(list : taasmoutput);
+    procedure gen_got_load(list : TAsmList);
       begin
       begin
         { if loading got is necessary for more cpus, it can be moved
         { if loading got is necessary for more cpus, it can be moved
           to the cg }
           to the cg }
@@ -1932,7 +1932,7 @@ implementation
           begin
           begin
             current_module.requires_ebx_pic_helper:=true;
             current_module.requires_ebx_pic_helper:=true;
             cg.a_call_name_static(list,'fpc_geteipasebx');
             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));
             list.concat(tai_regalloc.alloc(NR_PIC_OFFSET_REG,nil));
             { ecx could be used in leave procedures }
             { ecx could be used in leave procedures }
             current_procinfo.got:=NR_EBX;
             current_procinfo.got:=NR_EBX;
@@ -1944,7 +1944,7 @@ implementation
                            External handling
                            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
       begin
         { add the procedure to the al_procedures }
         { add the procedure to the al_procedures }
         maybe_new_object_file(list);
         maybe_new_object_file(list);
@@ -1966,7 +1966,7 @@ implementation
         l : aint;
         l : aint;
         varalign : shortint;
         varalign : shortint;
         storefilepos : tfileposinfo;
         storefilepos : tfileposinfo;
-        list : Taasmoutput;
+        list : TAsmList;
         sectype : TAsmSectiontype;
         sectype : TAsmSectiontype;
       begin
       begin
         storefilepos:=aktfilepos;
         storefilepos:=aktfilepos;
@@ -1976,12 +1976,12 @@ implementation
           begin
           begin
             if (vo_is_thread_var in sym.varoptions) then
             if (vo_is_thread_var in sym.varoptions) then
               begin
               begin
-                list:=asmlist[al_threadvars];
+                list:=current_asmdata.asmlists[al_threadvars];
                 sectype:=sec_threadvar;
                 sectype:=sec_threadvar;
               end
               end
             else
             else
               begin
               begin
-                list:=asmlist[al_globals];
+                list:=current_asmdata.asmlists[al_globals];
                 sectype:=sec_bss;
                 sectype:=sec_bss;
               end;
               end;
           end
           end
@@ -1989,7 +1989,7 @@ implementation
           begin
           begin
             if (vo_is_thread_var in sym.varoptions) then
             if (vo_is_thread_var in sym.varoptions) then
               inc(l,sizeof(aint));
               inc(l,sizeof(aint));
-            list:=asmlist[al_globals];
+            list:=current_asmdata.asmlists[al_globals];
             sectype:=sec_bss;
             sectype:=sec_bss;
           end;
           end;
         varalign:=var_align(size_2_align(l));
         varalign:=var_align(size_2_align(l));
@@ -2034,7 +2034,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_alloc_symtable(list:TAAsmoutput;st:tsymtable);
+    procedure gen_alloc_symtable(list:TAsmList;st:tsymtable);
       var
       var
         sym     : tsym;
         sym     : tsym;
         isaddr  : boolean;
         isaddr  : boolean;
@@ -2102,7 +2102,7 @@ implementation
                                   { PIC, DLL and Threadvar need extra code and are handled in ncgld }
                                   { 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
                                   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
                                      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;
                                 end;
                               else
                               else
                                 internalerror(200410103);
                                 internalerror(200410103);
@@ -2220,7 +2220,7 @@ implementation
       end;
       end;
 *)
 *)
 
 
-    procedure gen_sync_regvars(list:TAAsmoutput; var rv: tusedregvars);
+    procedure gen_sync_regvars(list:TAsmList; var rv: tusedregvars);
       var
       var
         count: longint;
         count: longint;
       begin
       begin
@@ -2233,7 +2233,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_free_symtable(list:TAAsmoutput;st:tsymtable);
+    procedure gen_free_symtable(list:TAsmList;st:tsymtable);
       var
       var
         sym : tsym;
         sym : tsym;
       begin
       begin
@@ -2305,11 +2305,11 @@ implementation
            def.rttitablesym:=rsym;
            def.rttitablesym:=rsym;
            { write rtti data }
            { write rtti data }
            def.write_child_rtti_data(fullrtti);
            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);
            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;
       end;
       end;
 
 
@@ -2345,17 +2345,17 @@ implementation
            def.inittablesym:=rsym;
            def.inittablesym:=rsym;
            { write inittable data }
            { write inittable data }
            def.write_child_rtti_data(initrtti);
            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);
            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;
       end;
       end;
 
 
 
 
 
 
-    procedure gen_intf_wrapper(list:taasmoutput;_class:tobjectdef);
+    procedure gen_intf_wrapper(list:TAsmList;_class:tobjectdef);
       var
       var
         i,j,
         i,j,
         proccount : longint;
         proccount : longint;
@@ -2383,7 +2383,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_intf_wrappers(list:taasmoutput;st:tsymtable);
+    procedure gen_intf_wrappers(list:TAsmList;st:tsymtable);
       var
       var
         def : tstoreddef;
         def : tstoreddef;
       begin
       begin
@@ -2397,7 +2397,7 @@ implementation
       end;
       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
       var
         href : treference;
         href : treference;
       begin
       begin
@@ -2461,7 +2461,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure gen_pic_helpers(list : taasmoutput);
+    procedure gen_pic_helpers(list : TAsmList);
       var
       var
         href : treference;
         href : treference;
       begin
       begin

+ 1 - 1
compiler/ncon.pas

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

+ 95 - 95
compiler/nobj.pas

@@ -30,7 +30,7 @@ interface
        cutils,cclasses,
        cutils,cclasses,
        globtype,
        globtype,
        symdef,symsym,
        symdef,symsym,
-       aasmbase,aasmtai
+       aasmbase,aasmtai,aasmdata
        ;
        ;
 
 
     type
     type
@@ -92,12 +92,12 @@ interface
         function  newvmtentry(sym:tprocsym):pvmtentry;
         function  newvmtentry(sym:tprocsym):pvmtentry;
         procedure eachsym(sym : tnamedindexitem;arg:pointer);
         procedure eachsym(sym : tnamedindexitem;arg:pointer);
         procedure disposevmttree;
         procedure disposevmttree;
-        procedure writevirtualmethods(List:TAAsmoutput);
+        procedure writevirtualmethods(List:TAsmList);
       private
       private
         { interface tables }
         { interface tables }
         function  gintfgetvtbllabelname(intfindex: integer): string;
         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 gintfoptimizevtbls;
         procedure gintfwritedata;
         procedure gintfwritedata;
         function  gintfgetcprocdef(proc: tprocdef;const name: string): tprocdef;
         function  gintfgetcprocdef(proc: tprocdef;const name: string): tprocdef;
@@ -258,16 +258,16 @@ implementation
         ca : pchar;
         ca : pchar;
         len : longint;
         len : longint;
       begin
       begin
-         objectlibrary.getdatalabel(p^.nl);
+         current_asmdata.getdatalabel(p^.nl);
          if assigned(p^.l) then
          if assigned(p^.l) then
            writenames(p^.l);
            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);
          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);
          getmem(ca,len+1);
          move(p^.data.messageinf.str^,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
          if assigned(p^.r) then
            writenames(p^.r);
            writenames(p^.r);
       end;
       end;
@@ -279,8 +279,8 @@ implementation
            writestrentry(p^.l);
            writestrentry(p^.l);
 
 
          { write name label }
          { 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
          if assigned(p^.r) then
            writestrentry(p^.r);
            writestrentry(p^.r);
@@ -302,11 +302,11 @@ implementation
            writenames(root);
            writenames(root);
 
 
          { now start writing of the message string table }
          { 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;
          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
          if assigned(root) then
            begin
            begin
               writestrentry(root);
               writestrentry(root);
@@ -321,8 +321,8 @@ implementation
            writeintentry(p^.l);
            writeintentry(p^.l);
 
 
          { write name label }
          { 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
          if assigned(p^.r) then
            writeintentry(p^.r);
            writeintentry(p^.r);
@@ -340,11 +340,11 @@ implementation
          _class.symtable.foreach(@insertmsgint,@count);
          _class.symtable.foreach(@insertmsgint,@count);
 
 
          { now start writing of the message string table }
          { 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;
          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
          if assigned(root) then
            begin
            begin
               writeintentry(root);
               writeintentry(root);
@@ -417,7 +417,7 @@ implementation
 
 
          if count>0 then
          if count>0 then
            begin
            begin
-              objectlibrary.getdatalabel(r);
+              current_asmdata.getdatalabel(r);
               gendmt:=r;
               gendmt:=r;
               al_globals.concat(cai_align.create(const_align(sizeof(aint))));
               al_globals.concat(cai_align.create(const_align(sizeof(aint))));
               al_globals.concat(Tai_label.Create(r));
               al_globals.concat(Tai_label.Create(r));
@@ -473,18 +473,18 @@ implementation
                  if (pd.procsym=tsym(p)) and
                  if (pd.procsym=tsym(p)) and
                     (sp_published in pd.symoptions) then
                     (sp_published in pd.symoptions) then
                    begin
                    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
                      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
                      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;
                 end;
            end;
            end;
@@ -502,10 +502,10 @@ implementation
          _class.symtable.foreach(@do_count_published_methods,@count);
          _class.symtable.foreach(@do_count_published_methods,@count);
          if count>0 then
          if count>0 then
            begin
            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);
               _class.symtable.foreach(@do_gen_published_methods,nil);
               genpublishedmethodstable:=l;
               genpublishedmethodstable:=l;
            end
            end
@@ -865,7 +865,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure tclassheader.gintfcreatevtbl(intfindex: integer; rawdata: TAAsmoutput);
+    procedure tclassheader.gintfcreatevtbl(intfindex: integer; rawdata: TAsmList);
       var
       var
         implintf: timplementedinterfaces;
         implintf: timplementedinterfaces;
         curintf: tobjectdef;
         curintf: tobjectdef;
@@ -890,7 +890,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure tclassheader.gintfgenentry(intfindex, contintfindex: integer; rawdata: TAAsmoutput);
+    procedure tclassheader.gintfgenentry(intfindex, contintfindex: integer; rawdata: TAsmList);
       var
       var
         implintf: timplementedinterfaces;
         implintf: timplementedinterfaces;
         curintf: tobjectdef;
         curintf: tobjectdef;
@@ -903,7 +903,7 @@ implementation
         if curintf.objecttype in [odt_interfacecom] then
         if curintf.objecttype in [odt_interfacecom] then
           begin
           begin
             { label for GUID }
             { label for GUID }
-            objectlibrary.getdatalabel(tmplabel);
+            current_asmdata.getdatalabel(tmplabel);
             rawdata.concat(cai_align.create(const_align(sizeof(aint))));
             rawdata.concat(cai_align.create(const_align(sizeof(aint))));
             rawdata.concat(Tai_label.Create(tmplabel));
             rawdata.concat(Tai_label.Create(tmplabel));
             rawdata.concat(Tai_const.Create_32bit(longint(curintf.iidguid^.D1)));
             rawdata.concat(Tai_const.Create_32bit(longint(curintf.iidguid^.D1)));
@@ -911,19 +911,19 @@ implementation
             rawdata.concat(Tai_const.Create_16bit(curintf.iidguid^.D3));
             rawdata.concat(Tai_const.Create_16bit(curintf.iidguid^.D3));
             for i:=Low(curintf.iidguid^.D4) to High(curintf.iidguid^.D4) do
             for i:=Low(curintf.iidguid^.D4) to High(curintf.iidguid^.D4) do
               rawdata.concat(Tai_const.Create_8bit(curintf.iidguid^.D4[i]));
               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
           end
         else
         else
           begin
           begin
             { nil for Corba interfaces }
             { 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;
           end;
         { VTable }
         { 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 }
         { 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 }
         { IIDStr }
-        objectlibrary.getdatalabel(tmplabel);
+        current_asmdata.getdatalabel(tmplabel);
         rawdata.concat(cai_align.create(const_align(sizeof(aint))));
         rawdata.concat(cai_align.create(const_align(sizeof(aint))));
         rawdata.concat(Tai_label.Create(tmplabel));
         rawdata.concat(Tai_label.Create(tmplabel));
         rawdata.concat(Tai_const.Create_8bit(length(curintf.iidstr^)));
         rawdata.concat(Tai_const.Create_8bit(length(curintf.iidstr^)));
@@ -931,7 +931,7 @@ implementation
           rawdata.concat(Tai_string.Create(upper(curintf.iidstr^)))
           rawdata.concat(Tai_string.Create(upper(curintf.iidstr^)))
         else
         else
           rawdata.concat(Tai_string.Create(curintf.iidstr^));
           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;
       end;
 
 
 
 
@@ -1036,12 +1036,12 @@ implementation
 
 
     procedure tclassheader.gintfwritedata;
     procedure tclassheader.gintfwritedata;
       var
       var
-        rawdata: taasmoutput;
+        rawdata: TAsmList;
         max,i,j : smallint;
         max,i,j : smallint;
       begin
       begin
         max:=_class.implementedinterfaces.count;
         max:=_class.implementedinterfaces.count;
 
 
-        rawdata:=TAAsmOutput.Create;
+        rawdata:=TAsmList.Create;
         { Two pass, one for allocation and vtbl creation }
         { Two pass, one for allocation and vtbl creation }
         for i:=1 to max do
         for i:=1 to max do
           begin
           begin
@@ -1059,7 +1059,7 @@ implementation
               end;
               end;
           end;
           end;
         { second pass: for fill interfacetable and remained ioffsets }
         { 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
         for i:=1 to max do
           begin
           begin
             j:=_class.implementedinterfaces.implindex(i);
             j:=_class.implementedinterfaces.implindex(i);
@@ -1067,7 +1067,7 @@ implementation
               _class.implementedinterfaces.setioffsets(i,_class.implementedinterfaces.ioffsets(j));
               _class.implementedinterfaces.setioffsets(i,_class.implementedinterfaces.ioffsets(j));
             gintfgenentry(i,j,rawdata);
             gintfgenentry(i,j,rawdata);
           end;
           end;
-        asmlist[al_globals].concatlist(rawdata);
+        current_asmdata.asmlists[al_globals].concatlist(rawdata);
         rawdata.free;
         rawdata.free;
       end;
       end;
 
 
@@ -1167,9 +1167,9 @@ implementation
         { 2. Optimize interface tables to reuse wrappers }
         { 2. Optimize interface tables to reuse wrappers }
         gintfoptimizevtbls;
         gintfoptimizevtbls;
         { 3. Calculate offsets in object map and Write interface tables }
         { 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;
         gintfwritedata;
         genintftable:=intftable;
         genintftable:=intftable;
       end;
       end;
@@ -1184,25 +1184,25 @@ implementation
       if assigned(_class.iidguid) then
       if assigned(_class.iidguid) then
         begin
         begin
           s:=make_mangledname('IID',_class.owner,_class.objname^);
           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
           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;
         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^);
       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;
     end;
 
 
 
 
-    procedure tclassheader.writevirtualmethods(List:TAAsmoutput);
+    procedure tclassheader.writevirtualmethods(List:TAsmList);
       var
       var
          vmtentry : pvmtentry;
          vmtentry : pvmtentry;
          procdefcoll : pprocdefcoll;
          procdefcoll : pprocdefcoll;
@@ -1262,9 +1262,9 @@ implementation
            class is written, because we need the labels defined }
            class is written, because we need the labels defined }
          if is_class(_class) then
          if is_class(_class) then
           begin
           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 }
             { interface table }
             if _class.implementedinterfaces.count>0 then
             if _class.implementedinterfaces.count>0 then
@@ -1273,9 +1273,9 @@ implementation
             methodnametable:=genpublishedmethodstable;
             methodnametable:=genpublishedmethodstable;
             fieldtablelabel:=_class.generate_field_table;
             fieldtablelabel:=_class.generate_field_table;
             { write class name }
             { 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 }
             { generate message and dynamic tables }
             if (oo_has_msgstr in _class.objectoptions) then
             if (oo_has_msgstr in _class.objectoptions) then
@@ -1285,21 +1285,21 @@ implementation
           end;
           end;
 
 
         { write debug info }
         { 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 }
          { determine the size with symtable.datasize, because }
          { size gives back 4 for classes                    }
          { 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}
 {$ifdef WITHDMT}
          if _class.classtype=ct_object then
          if _class.classtype=ct_object then
            begin
            begin
               if assigned(dmtlabel) then
               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
               else
-                asmlist[al_globals].concat(Tai_const.Create_ptr(0));
+                current_asmdata.asmlists[al_globals].concat(Tai_const.Create_ptr(0));
            end;
            end;
 {$endif WITHDMT}
 {$endif WITHDMT}
          { write pointer to parent VMT, this isn't implemented in TP }
          { 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 !! }
          { it is not written for parents that don't have any vmt !! }
          if assigned(_class.childof) and
          if assigned(_class.childof) and
             (oo_has_vmt in _class.childof.objectoptions) then
             (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
          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 }
          { write extended info for classes, for the order see rtl/inc/objpash.inc }
          if is_class(_class) then
          if is_class(_class) then
           begin
           begin
             { pointer to class name string }
             { 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 }
             { pointer to dynamic table or nil }
             if (oo_has_msgint in _class.objectoptions) then
             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
             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 }
             { 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 }
             { 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 }
             { pointer to type info of published section }
             if (oo_can_have_published in _class.objectoptions) then
             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
             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 }
             { inittable for con-/destruction }
             if _class.members_need_inittable then
             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
             else
-              asmlist[al_globals].concat(Tai_const.Create_sym(nil));
+              current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil));
             { auto table }
             { auto table }
-            asmlist[al_globals].concat(Tai_const.Create_sym(nil));
+            current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil));
             { interface table }
             { interface table }
             if _class.implementedinterfaces.count>0 then
             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
             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 }
             { table for string messages }
             if (oo_has_msgstr in _class.objectoptions) then
             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
             else
-              asmlist[al_globals].concat(Tai_const.Create_sym(nil));
+              current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(nil));
           end;
           end;
          { write virtual methods }
          { 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 }
          { 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;
       end;
 
 
 
 

+ 1 - 1
compiler/node.pas

@@ -350,7 +350,7 @@ interface
 
 
        { this node is the anchestor for all nodes with at least   }
        { this node is the anchestor for all nodes with at least   }
        { one child, you have to use it if you want to use         }
        { one child, you have to use it if you want to use         }
-       { true- and falselabel                                     }
+       { true- and current_procinfo.CurrFalseLabel                                     }
        punarynode = ^tunarynode;
        punarynode = ^tunarynode;
        tunarynode = class(tnode)
        tunarynode = class(tnode)
           left : tnode;
           left : tnode;

+ 2 - 1
compiler/nset.pas

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

+ 44 - 25
compiler/ogbase.pas

@@ -31,7 +31,7 @@ interface
       { targets }
       { targets }
       systems,globtype,
       systems,globtype,
       { outputwriters }
       { outputwriters }
-      owbase,owar,
+      owbase,
       { assembler }
       { assembler }
       aasmbase;
       aasmbase;
 
 
@@ -223,7 +223,7 @@ interface
         function  writedata(data:TObjData):boolean;virtual;abstract;
         function  writedata(data:TObjData):boolean;virtual;abstract;
         property CObjData : TObjDataClass read FCObjData write FCObjData;
         property CObjData : TObjDataClass read FCObjData write FCObjData;
       public
       public
-        constructor create(smart:boolean);virtual;
+        constructor create(AWriter:TObjectWriter);virtual;
         destructor  destroy;override;
         destructor  destroy;override;
         function  newObjData(const n:string):TObjData;
         function  newObjData(const n:string):TObjData;
         function  startObjectfile(const fn:string):boolean;
         function  startObjectfile(const fn:string):boolean;
@@ -300,7 +300,6 @@ interface
         { writer }
         { writer }
         FWriter : TObjectwriter;
         FWriter : TObjectwriter;
         commonObjSection : TObjSection;
         commonObjSection : TObjSection;
-        commonobjdata,
         internalobjdata : TObjData;
         internalobjdata : TObjData;
         EntrySym  : TObjSymbol;
         EntrySym  : TObjSymbol;
         SectionDataAlign,
         SectionDataAlign,
@@ -317,7 +316,9 @@ interface
         procedure Load_EntryName(const aname:string);virtual;
         procedure Load_EntryName(const aname:string);virtual;
         procedure Load_Symbol(const aname:string);virtual;
         procedure Load_Symbol(const aname:string);virtual;
         procedure Order_Start;virtual;
         procedure Order_Start;virtual;
+        procedure Order_End;virtual;
         procedure Order_ExeSection(const aname:string);virtual;
         procedure Order_ExeSection(const aname:string);virtual;
+        procedure Order_Align(const aname:string);virtual;
         procedure Order_Zeros(const aname:string);virtual;
         procedure Order_Zeros(const aname:string);virtual;
         procedure Order_Symbol(const aname:string);virtual;
         procedure Order_Symbol(const aname:string);virtual;
         procedure Order_EndExeSection;virtual;
         procedure Order_EndExeSection;virtual;
@@ -486,6 +487,7 @@ implementation
         relocations.free;
         relocations.free;
         ObjSymbolRefs.Free;
         ObjSymbolRefs.Free;
         ObjSymbolDefines.Free;
         ObjSymbolDefines.Free;
+        inherited destroy;
       end;
       end;
 
 
 
 
@@ -655,6 +657,7 @@ implementation
 {$ifdef MEMDEBUG}
 {$ifdef MEMDEBUG}
         d.free;
         d.free;
 {$endif}
 {$endif}
+        inherited destroy;
       end;
       end;
 
 
 
 
@@ -994,21 +997,16 @@ implementation
                                 TObjOutput
                                 TObjOutput
 ****************************************************************************}
 ****************************************************************************}
 
 
-    constructor TObjOutput.create(smart:boolean);
+    constructor TObjOutput.create(AWriter:TObjectWriter);
       begin
       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;
         CObjData:=TObjData;
       end;
       end;
 
 
 
 
     destructor TObjOutput.destroy;
     destructor TObjOutput.destroy;
       begin
       begin
-        FWriter.free;
+        inherited destroy;
       end;
       end;
 
 
 
 
@@ -1081,6 +1079,7 @@ implementation
     destructor tExeSection.destroy;
     destructor tExeSection.destroy;
       begin
       begin
         ObjSectionList.Free;
         ObjSectionList.Free;
+        inherited destroy;
       end;
       end;
 
 
 
 
@@ -1145,6 +1144,7 @@ implementation
         FExeSectionList.free;
         FExeSectionList.free;
         objdatalist.free;
         objdatalist.free;
         FWriter.free;
         FWriter.free;
+        inherited destroy;
       end;
       end;
 
 
 
 
@@ -1185,15 +1185,10 @@ implementation
         ObjDataList.Clear;
         ObjDataList.Clear;
         { Globals defined in the linker script }
         { Globals defined in the linker script }
         if not assigned(internalobjdata) then
         if not assigned(internalobjdata) then
-          internalobjdata:=CObjData.create('*GLOBALS*');
+          internalobjdata:=CObjData.create('*Internal*');
         AddObjData(internalobjdata);
         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;
       end;
 
 
 
 
@@ -1215,6 +1210,12 @@ implementation
       end;
       end;
 
 
 
 
+    procedure TExeOutput.Order_End;
+      begin
+        internalobjdata.afterwrite;
+      end;
+
+
     procedure TExeOutput.Order_ExeSection(const aname:string);
     procedure TExeOutput.Order_ExeSection(const aname:string);
       var
       var
         sec : TExeSection;
         sec : TExeSection;
@@ -1272,6 +1273,22 @@ implementation
       end;
       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);
     procedure TExeOutput.Order_Zeros(const aname:string);
       var
       var
         zeros : array[0..1023] of byte;
         zeros : array[0..1023] of byte;
@@ -1288,7 +1305,6 @@ implementation
         inc(Fzeronr);
         inc(Fzeronr);
         objsec:=internalobjdata.createsection('*zeros'+tostr(Fzeronr),0,CurrExeSec.SecOptions+[oso_data,oso_keep]);
         objsec:=internalobjdata.createsection('*zeros'+tostr(Fzeronr),0,CurrExeSec.SecOptions+[oso_data,oso_keep]);
         internalobjdata.writebytes(zeros,len);
         internalobjdata.writebytes(zeros,len);
-        internalobjdata.afterwrite;
         CurrExeSec.AddObjSection(objsec);
         CurrExeSec.AddObjSection(objsec);
       end;
       end;
 
 
@@ -1553,10 +1569,10 @@ implementation
                           exemap.AddCommonSymbolsHeader;
                           exemap.AddCommonSymbolsHeader;
                         firstcommon:=false;
                         firstcommon:=false;
                       end;
                       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;
                     commonsym.size:=objsym.size;
-                    commonobjdata.alloc(objsym.size);
+                    internalobjdata.alloc(objsym.size);
                     if assigned(exemap) then
                     if assigned(exemap) then
                       exemap.AddCommonSymbol(commonsym);
                       exemap.AddCommonSymbol(commonsym);
                     { Assign to the exesymbol }
                     { Assign to the exesymbol }
@@ -1564,8 +1580,6 @@ implementation
                   end;
                   end;
               end;
               end;
           end;
           end;
-        if not firstcommon then
-          commonobjdata.afterwrite;
 
 
         { Generate a list of Unresolved External symbols }
         { Generate a list of Unresolved External symbols }
         for i:=0 to ExeSymbolList.count-1 do
         for i:=0 to ExeSymbolList.count-1 do
@@ -1776,6 +1790,8 @@ implementation
                 AddToObjSectionWorkList(refobjsec);
                 AddToObjSectionWorkList(refobjsec);
               end;
               end;
           end;
           end;
+        ObjSectionWorkList.Free;
+        ObjSectionWorkList:=nil;
 
 
         { Remove unused objsections from exesections }
         { Remove unused objsections from exesections }
         for i:=0 to ExeSections.Count-1 do
         for i:=0 to ExeSections.Count-1 do
@@ -1807,6 +1823,8 @@ implementation
             objdata.fixuprelocs;
             objdata.fixuprelocs;
           end;
           end;
       end;
       end;
+
+
 {****************************************************************************
 {****************************************************************************
                                 TObjInput
                                 TObjInput
 ****************************************************************************}
 ****************************************************************************}
@@ -1821,6 +1839,7 @@ implementation
     destructor TObjInput.destroy;
     destructor TObjInput.destroy;
       begin
       begin
         FReader.free;
         FReader.free;
+        inherited destroy;
       end;
       end;
 
 
 
 

+ 74 - 43
compiler/ogcoff.pas

@@ -33,7 +33,8 @@ interface
        { assembler }
        { assembler }
        cpuinfo,cpubase,aasmbase,assemble,link,
        cpuinfo,cpubase,aasmbase,assemble,link,
        { output }
        { output }
-       ogbase,ogmap;
+       ogbase,
+       owbase;
 
 
     type
     type
        TCoffObjSection = class(TObjSection)
        TCoffObjSection = class(TObjSection)
@@ -95,15 +96,47 @@ interface
        protected
        protected
          function writedata(data:TObjData):boolean;override;
          function writedata(data:TObjData):boolean;override;
        public
        public
-         constructor createcoff(smart:boolean;awin32:boolean);
+         constructor createcoff(AWriter:TObjectWriter;awin32:boolean);
+         destructor destroy;
        end;
        end;
 
 
        TDJCoffObjOutput = class(TCoffObjOutput)
        TDJCoffObjOutput = class(TCoffObjOutput)
-         constructor create(smart:boolean);override;
+         constructor create(AWriter:TObjectWriter);override;
        end;
        end;
 
 
        TPECoffObjOutput = class(TCoffObjOutput)
        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;
        end;
 
 
        TCoffExeSection = class(TExeSection)
        TCoffExeSection = class(TExeSection)
@@ -162,36 +195,6 @@ interface
        TObjSymbolArray = array[0..high(word)] of TObjSymbolrec;
        TObjSymbolArray = array[0..high(word)] of TObjSymbolrec;
        TObjSectionArray = array[0..high(smallint)] of TObjSection;
        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)
        TDJCoffAssembler = class(tinternalassembler)
          constructor create(smart:boolean);override;
          constructor create(smart:boolean);override;
        end;
        end;
@@ -214,9 +217,9 @@ interface
 implementation
 implementation
 
 
     uses
     uses
-       strings,
-       cutils,verbose,owbase,
-       globals,fmodule,aasmtai;
+       cutils,verbose,globals,
+       fmodule,aasmtai,aasmdata,
+       ogmap;
 
 
     const
     const
 {$ifdef i386}
 {$ifdef i386}
@@ -1015,13 +1018,23 @@ const win32stub : array[0..131] of byte=(
                                 TCoffObjOutput
                                 TCoffObjOutput
 ****************************************************************************}
 ****************************************************************************}
 
 
-    constructor TCoffObjOutput.createcoff(smart:boolean;awin32:boolean);
+    constructor TCoffObjOutput.createcoff(AWriter:TObjectWriter;awin32:boolean);
       begin
       begin
-        inherited create(smart);
+        inherited create(AWriter);
         win32:=awin32;
         win32:=awin32;
       end;
       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);
     procedure TCoffObjOutput.write_symbol(const name:string;value:aint;section:smallint;typ,aux:byte);
       var
       var
         sym : coffsymbol;
         sym : coffsymbol;
@@ -1298,16 +1311,16 @@ const win32stub : array[0..131] of byte=(
       end;
       end;
 
 
 
 
-    constructor TDJCoffObjOutput.create(smart:boolean);
+    constructor TDJCoffObjOutput.create(AWriter:TObjectWriter);
       begin
       begin
-        inherited createcoff(smart,false);
+        inherited createcoff(AWriter,false);
         cobjdata:=TDJCoffObjData;
         cobjdata:=TDJCoffObjData;
       end;
       end;
 
 
 
 
-    constructor TPECoffObjOutput.create(smart:boolean);
+    constructor TPECoffObjOutput.create(AWriter:TObjectWriter);
       begin
       begin
-        inherited createcoff(smart,true);
+        inherited createcoff(AWriter,true);
         cobjdata:=TPECoffObjData;
         cobjdata:=TPECoffObjData;
       end;
       end;
 
 
@@ -1320,6 +1333,21 @@ const win32stub : array[0..131] of byte=(
       begin
       begin
         inherited create;
         inherited create;
         win32:=awin32;
         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;
       end;
 
 
 
 
@@ -1655,7 +1683,9 @@ const win32stub : array[0..131] of byte=(
            ObjSectionList.ForEachCall(@objsections_read_relocs,nil);
            ObjSectionList.ForEachCall(@objsections_read_relocs,nil);
          end;
          end;
         FCoffStrs.Free;
         FCoffStrs.Free;
+        FCoffStrs:=nil;
         FCoffSyms.Free;
         FCoffSyms.Free;
+        FCoffSyms:=nil;
         result:=true;
         result:=true;
       end;
       end;
 
 
@@ -2237,6 +2267,7 @@ const win32stub : array[0..131] of byte=(
         UnresolvedExeSymbols.Pack;
         UnresolvedExeSymbols.Pack;
         if assigned(idata2objsection) then
         if assigned(idata2objsection) then
           EndImport;
           EndImport;
+        DLLReader.Free;
       end;
       end;
 
 
 
 

+ 6 - 5
compiler/ogelf.pas

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

+ 9 - 9
compiler/paramgr.pas

@@ -31,7 +31,7 @@ unit paramgr;
        cclasses,globtype,
        cclasses,globtype,
        cpubase,cgbase,
        cpubase,cgbase,
        parabase,
        parabase,
-       aasmtai,
+       aasmtai,aasmdata,
        symconst,symtype,symsym,symdef;
        symconst,symtype,symsym,symdef;
 
 
     type
     type
@@ -81,14 +81,14 @@ unit paramgr;
             @param(list Current assembler list)
             @param(list Current assembler list)
             @param(loc Parameter location)
             @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
           {# free a parameter location allocated with alloccgpara
 
 
             @param(list Current assembler list)
             @param(list Current assembler list)
             @param(loc Parameter location)
             @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
           { 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
             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;
           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 parseparaloc(parasym : tparavarsym;const s : string) : boolean;virtual;abstract;
           function parsefuncretloc(p : tabstractprocdef; const s : string) : boolean;virtual;abstract;
           function parsefuncretloc(p : tabstractprocdef; const s : string) : boolean;virtual;abstract;
@@ -216,7 +216,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure tparamanager.allocparaloc(list: taasmoutput; const cgpara: TCGPara);
+    procedure tparamanager.allocparaloc(list: TAsmList; const cgpara: TCGPara);
       var
       var
         paraloc : pcgparalocation;
         paraloc : pcgparalocation;
       begin
       begin
@@ -248,7 +248,7 @@ implementation
       end;
       end;
 
 
 
 
-    procedure tparamanager.freeparaloc(list: taasmoutput; const cgpara: TCGPara);
+    procedure tparamanager.freeparaloc(list: TAsmList; const cgpara: TCGPara);
       var
       var
         paraloc : Pcgparalocation;
         paraloc : Pcgparalocation;
         href : treference;
         href : treference;
@@ -297,7 +297,7 @@ implementation
       end;
       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
       var
         href : treference;
         href : treference;
         len  : aint;
         len  : aint;
@@ -347,7 +347,7 @@ implementation
       end;
       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
       var
         paraloc,
         paraloc,
         newparaloc : pcgparalocation;
         newparaloc : pcgparalocation;

+ 23 - 68
compiler/parser.pas

@@ -42,7 +42,7 @@ implementation
       globtype,version,tokens,systems,globals,verbose,
       globtype,version,tokens,systems,globals,verbose,
       symbase,symtable,symsym,
       symbase,symtable,symsym,
       finput,fmodule,fppu,
       finput,fmodule,fppu,
-      aasmbase,aasmtai,
+      aasmbase,aasmtai,aasmdata,
       cgbase,
       cgbase,
       script,gendef,
       script,gendef,
 {$ifdef BrowserCol}
 {$ifdef BrowserCol}
@@ -68,9 +68,9 @@ implementation
          testcurobject:=0;
          testcurobject:=0;
 
 
          { Current compiled module/proc }
          { Current compiled module/proc }
-         objectlibrary:=nil;
          current_module:=nil;
          current_module:=nil;
          compiled_module:=nil;
          compiled_module:=nil;
+         current_asmdata:=nil;
          current_procinfo:=nil;
          current_procinfo:=nil;
          SetCompileModule(nil);
          SetCompileModule(nil);
 
 
@@ -133,10 +133,10 @@ implementation
       begin
       begin
          { Reset current compiling info, so destroy routines can't
          { Reset current compiling info, so destroy routines can't
            reference the data that might already be destroyed }
            reference the data that might already be destroyed }
-         objectlibrary:=nil;
          current_module:=nil;
          current_module:=nil;
          compiled_module:=nil;
          compiled_module:=nil;
          current_procinfo:=nil;
          current_procinfo:=nil;
+         current_asmdata:=nil;
          SetCompileModule(nil);
          SetCompileModule(nil);
 
 
          { unload units }
          { unload units }
@@ -248,52 +248,6 @@ implementation
 {$endif PREPROCWRITE}
 {$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
                              Compile a source file
 *****************************************************************************}
 *****************************************************************************}
@@ -316,10 +270,6 @@ implementation
           oldaktprocsym    : tprocsym;
           oldaktprocsym    : tprocsym;
         { cg }
         { cg }
           oldparse_only  : boolean;
           oldparse_only  : boolean;
-        { asmlists }
-          oldexprasmlist:Taasmoutput;
-          oldasmlist:array[Tasmlist] of Taasmoutput;
-          oldobjectlibrary : TObjLibraryData;
         { al_resourcestrings }
         { al_resourcestrings }
           Oldresourcestrings : tresourcestrings;
           Oldresourcestrings : tresourcestrings;
         { akt.. things }
         { akt.. things }
@@ -371,10 +321,6 @@ implementation
             oldsourcecodepage:=aktsourcecodepage;
             oldsourcecodepage:=aktsourcecodepage;
           { save cg }
           { save cg }
             oldparse_only:=parse_only;
             oldparse_only:=parse_only;
-          { save assembler lists }
-            oldasmlist:=asmlist;
-            oldexprasmlist:=exprasmlist;
-            oldobjectlibrary:=objectlibrary;
             Oldresourcestrings:=resourcestrings;
             Oldresourcestrings:=resourcestrings;
           { save akt... state }
           { save akt... state }
           { handle the postponed case first }
           { handle the postponed case first }
@@ -453,6 +399,11 @@ implementation
          aktasmmode:=initasmmode;
          aktasmmode:=initasmmode;
          aktinterfacetype:=initinterfacetype;
          aktinterfacetype:=initinterfacetype;
 
 
+         resourcestrings:=Tresourcestrings.Create;
+
+         { load current asmdata from current_module }
+         current_asmdata:=TAsmData(current_module.asmdata);
+
          { startup scanner and load the first file }
          { startup scanner and load the first file }
          current_scanner:=tscannerfile.Create(filename);
          current_scanner:=tscannerfile.Create(filename);
          current_scanner.firstfile;
          current_scanner.firstfile;
@@ -466,9 +417,6 @@ implementation
          { read the first token }
          { read the first token }
          current_scanner.readtoken(false);
          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
          { If the compile level > 1 we get a nice "unit expected" error
            message if we are trying to use a program as unit.}
            message if we are trying to use a program as unit.}
          try
          try
@@ -492,9 +440,6 @@ implementation
                end;
                end;
            end;
            end;
          finally
          finally
-           { restore old state }
-           done_module;
-
            if assigned(current_module) then
            if assigned(current_module) then
              begin
              begin
                { module is now compiled }
                { module is now compiled }
@@ -507,6 +452,16 @@ implementation
                    tppumodule(current_module).ppufile:=nil;
                    tppumodule(current_module).ppufile:=nil;
                  end;
                  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 }
                { free scanner }
                if assigned(current_module.scanner) then
                if assigned(current_module.scanner) then
                  begin
                  begin
@@ -541,12 +496,12 @@ implementation
                 block_type:=old_block_type;
                 block_type:=old_block_type;
                 { restore cg }
                 { restore cg }
                 parse_only:=oldparse_only;
                 parse_only:=oldparse_only;
-                { restore asmlists }
-                exprasmlist:=oldexprasmlist;
-                asmlist:=oldasmlist;
-                { object data }
                 resourcestrings:=oldresourcestrings;
                 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 }
                 { restore previous scanner }
                 if assigned(old_compiled_module) then
                 if assigned(old_compiled_module) then
                   current_scanner:=tscannerfile(old_compiled_module.scanner)
                   current_scanner:=tscannerfile(old_compiled_module.scanner)

+ 4 - 4
compiler/pass_2.pas

@@ -49,7 +49,7 @@ implementation
      globtype,systems,verbose,
      globtype,systems,verbose,
      globals,
      globals,
      paramgr,
      paramgr,
-     aasmtai,
+     aasmtai,aasmdata,
      cgbase,
      cgbase,
      nflw,cgobj;
      nflw,cgobj;
 
 
@@ -143,7 +143,7 @@ implementation
           p := strpnew('second '+secondnames[ht]+' (entry)')
           p := strpnew('second '+secondnames[ht]+' (entry)')
         else
         else
           p := strpnew('second '+secondnames[ht]+' (exit)');
           p := strpnew('second '+secondnames[ht]+' (exit)');
-        exprasmlist.concat(tai_comment.create(p));
+        current_asmdata.CurrAsmList.concat(tai_comment.create(p));
       end;
       end;
 {$endif EXTDEBUG}
 {$endif EXTDEBUG}
 
 
@@ -195,8 +195,8 @@ implementation
 
 
     function do_secondpass(var p : tnode) : boolean;
     function do_secondpass(var p : tnode) : boolean;
       begin
       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);
            internalerror(200405201);
 
 
          { clear errors before starting }
          { clear errors before starting }

+ 1 - 1
compiler/pdecl.pas

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

+ 64 - 64
compiler/pmodules.pas

@@ -36,12 +36,12 @@ implementation
        cutils,cclasses,comphook,
        cutils,cclasses,comphook,
        globals,verbose,fmodule,finput,fppu,
        globals,verbose,fmodule,finput,fppu,
        symconst,symbase,symtype,symdef,symsym,symtable,
        symconst,symbase,symtype,symdef,symsym,symtable,
-       aasmtai,aasmcpu,aasmbase,
+       aasmtai,aasmdata,aasmcpu,aasmbase,
        cgbase,cgobj,
        cgbase,cgobj,
        nbas,ncgutil,
        nbas,ncgutil,
        link,assemble,import,export,gendef,ppu,comprsrc,dbgbase,
        link,assemble,import,export,gendef,ppu,comprsrc,dbgbase,
        cresstr,procinfo,
        cresstr,procinfo,
-       dwarf,pexports,
+       pexports,
        scanner,pbase,pexpr,psystem,psub,pdecsub;
        scanner,pbase,pexpr,psystem,psub,pdecsub;
 
 
 
 
@@ -72,10 +72,10 @@ implementation
            { Recreate import section }
            { Recreate import section }
            if (target_info.system in [system_i386_win32,system_i386_wdosx]) then
            if (target_info.system in [system_i386_win32,system_i386_wdosx]) then
             begin
             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
               else
-               asmlist[al_imports]:=taasmoutput.Create;
+               current_asmdata.asmlists[al_imports]:=TAsmList.Create;
               importlib.generatelib;
               importlib.generatelib;
             end;
             end;
            { Readd the not processed files }
            { Readd the not processed files }
@@ -101,10 +101,10 @@ implementation
            (not use_smartlink_section) then
            (not use_smartlink_section) then
          begin
          begin
            { regenerate the importssection for win32 }
            { 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
               (target_info.system in [system_i386_win32,system_i386_wdosx, system_arm_wince,system_i386_wince]) then
             begin
             begin
-              asmlist[al_imports].clear;
+              current_asmdata.asmlists[al_imports].clear;
               importlib.generatesmartlib;
               importlib.generatesmartlib;
             end;
             end;
 
 
@@ -143,8 +143,8 @@ implementation
         if (tf_needs_dwarf_cfi in target_info.flags) and
         if (tf_needs_dwarf_cfi in target_info.flags) and
            (af_supports_dwarf in target_asm.flags) then
            (af_supports_dwarf in target_asm.flags) then
           begin
           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;
       end;
       end;
 
 
@@ -152,10 +152,10 @@ implementation
     procedure InsertThreadvarTablesTable;
     procedure InsertThreadvarTablesTable;
       var
       var
         hp : tused_unit;
         hp : tused_unit;
-        ltvTables : taasmoutput;
+        ltvTables : TAsmList;
         count : longint;
         count : longint;
       begin
       begin
-        ltvTables:=TAAsmOutput.Create;
+        ltvTables:=TAsmList.Create;
         count:=0;
         count:=0;
         hp:=tused_unit(usedunits.first);
         hp:=tused_unit(usedunits.first);
         while assigned(hp) do
         while assigned(hp) do
@@ -176,19 +176,19 @@ implementation
         { Insert TableCount at start }
         { Insert TableCount at start }
         ltvTables.insert(Tai_const.Create_32bit(count));
         ltvTables.insert(Tai_const.Create_32bit(count));
         { insert in data segment }
         { 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;
         ltvTables.free;
       end;
       end;
 
 
     procedure AddToThreadvarList(p:tnamedindexitem;arg:pointer);
     procedure AddToThreadvarList(p:tnamedindexitem;arg:pointer);
       var
       var
-        ltvTable : taasmoutput;
+        ltvTable : TAsmList;
       begin
       begin
-        ltvTable:=taasmoutput(arg);
+        ltvTable:=TAsmList(arg);
         if (tsym(p).typ=globalvarsym) and
         if (tsym(p).typ=globalvarsym) and
            (vo_is_thread_var in tglobalvarsym(p).varoptions) then
            (vo_is_thread_var in tglobalvarsym(p).varoptions) then
          begin
          begin
@@ -203,9 +203,9 @@ implementation
     procedure InsertThreadvars;
     procedure InsertThreadvars;
       var
       var
         s : string;
         s : string;
-        ltvTable : TAAsmoutput;
+        ltvTable : TAsmList;
       begin
       begin
-         ltvTable:=TAAsmoutput.create;
+         ltvTable:=TAsmList.create;
          if assigned(current_module.globalsymtable) then
          if assigned(current_module.globalsymtable) then
            current_module.globalsymtable.foreach_static(@AddToThreadvarList,ltvTable);
            current_module.globalsymtable.foreach_static(@AddToThreadvarList,ltvTable);
          current_module.localsymtable.foreach_static(@AddToThreadvarList,ltvTable);
          current_module.localsymtable.foreach_static(@AddToThreadvarList,ltvTable);
@@ -215,11 +215,11 @@ implementation
             { end of the list marker }
             { end of the list marker }
             ltvTable.concat(tai_const.create_sym(nil));
             ltvTable.concat(tai_const.create_sym(nil));
             { add to datasegment }
             { 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;
             current_module.flags:=current_module.flags or uf_threadvars;
           end;
           end;
          ltvTable.Free;
          ltvTable.Free;
@@ -232,7 +232,7 @@ implementation
       hp           : tused_unit;
       hp           : tused_unit;
       found        : Boolean;
       found        : Boolean;
       I            : Integer;
       I            : Integer;
-      ResourceInfo : taasmoutput;
+      ResourceInfo : TAsmList;
 
 
     begin
     begin
       if target_res.id=res_elf then
       if target_res.id=res_elf then
@@ -246,7 +246,7 @@ implementation
             Found:=((hp.u.flags and uf_has_resourcefiles)=uf_has_resourcefiles);
             Found:=((hp.u.flags and uf_has_resourcefiles)=uf_has_resourcefiles);
             hp:=tused_unit(hp.next);
             hp:=tused_unit(hp.next);
             end;
             end;
-        ResourceInfo:=TAAsmOutput.Create;
+        ResourceInfo:=TAsmList.Create;
         if found then
         if found then
           begin
           begin
           { Valid pointer to resource information }
           { Valid pointer to resource information }
@@ -267,8 +267,8 @@ implementation
           ResourceInfo.concat(Tai_symbol.Createname_global('FPC_RESLOCATION',AT_DATA,0));
           ResourceInfo.concat(Tai_symbol.Createname_global('FPC_RESLOCATION',AT_DATA,0));
           ResourceInfo.Concat(Tai_const.Create_32bit(0));
           ResourceInfo.Concat(Tai_const.Create_32bit(0));
           end;
           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;
         ResourceInfo.free;
         end;
         end;
     end;
     end;
@@ -276,10 +276,10 @@ implementation
     Procedure InsertResourceTablesTable;
     Procedure InsertResourceTablesTable;
       var
       var
         hp : tused_unit;
         hp : tused_unit;
-        ResourceStringTables : taasmoutput;
+        ResourceStringTables : tasmlist;
         count : longint;
         count : longint;
       begin
       begin
-        ResourceStringTables:=TAAsmOutput.Create;
+        ResourceStringTables:=tasmlist.Create;
         count:=0;
         count:=0;
         hp:=tused_unit(usedunits.first);
         hp:=tused_unit(usedunits.first);
         while assigned(hp) do
         while assigned(hp) do
@@ -300,11 +300,11 @@ implementation
         { Insert TableCount at start }
         { Insert TableCount at start }
         ResourceStringTables.insert(Tai_const.Create_32bit(count));
         ResourceStringTables.insert(Tai_const.Create_32bit(count));
         { Add to data segment }
         { 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;
         ResourceStringTables.free;
       end;
       end;
 
 
@@ -312,10 +312,10 @@ implementation
     procedure InsertInitFinalTable;
     procedure InsertInitFinalTable;
       var
       var
         hp : tused_unit;
         hp : tused_unit;
-        unitinits : taasmoutput;
+        unitinits : TAsmList;
         count : longint;
         count : longint;
       begin
       begin
-        unitinits:=TAAsmOutput.Create;
+        unitinits:=TAsmList.Create;
         count:=0;
         count:=0;
         hp:=tused_unit(usedunits.first);
         hp:=tused_unit(usedunits.first);
         while assigned(hp) do
         while assigned(hp) do
@@ -352,11 +352,11 @@ implementation
         unitinits.insert(Tai_const.Create_32bit(0));
         unitinits.insert(Tai_const.Create_32bit(0));
         unitinits.insert(Tai_const.Create_32bit(count));
         unitinits.insert(Tai_const.Create_32bit(count));
         { Add to data segment }
         { 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;
         unitinits.free;
       end;
       end;
 
 
@@ -368,10 +368,10 @@ implementation
 {$ENDIF POWERPC}
 {$ENDIF POWERPC}
       begin
       begin
         { stacksize can be specified and is now simulated }
         { 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}
 {$IFDEF POWERPC}
         { AmigaOS4 "stack cookie" support }
         { AmigaOS4 "stack cookie" support }
         if ( target_info.system = system_powerpc_amiga ) then
         if ( target_info.system = system_powerpc_amiga ) then
@@ -381,17 +381,17 @@ implementation
            { note: won't work for m68k amigaos or morphos. (KB) }
            { note: won't work for m68k amigaos or morphos. (KB) }
            str(stacksize,stkcookie);
            str(stacksize,stkcookie);
            stkcookie:='$STACK: '+stkcookie+#0;
            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;
          end;
 {$ENDIF POWERPC}
 {$ENDIF POWERPC}
         { Initial heapsize }
         { 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;
       end;
 
 
 
 
@@ -785,13 +785,13 @@ implementation
 
 
       function is_assembler_generated:boolean;
       function is_assembler_generated:boolean;
       var
       var
-        hal : tasmlist;
+        hal : tasmlisttype;
       begin
       begin
         result:=false;
         result:=false;
         if Errorcount=0 then
         if Errorcount=0 then
           begin
           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
                 begin
                   result:=true;
                   result:=true;
                   exit;
                   exit;
@@ -1094,11 +1094,11 @@ implementation
            debuginfo.inserttypeinfo;
            debuginfo.inserttypeinfo;
 
 
          { generate wrappers for interfaces }
          { 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 }
          { 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 }
          { generate a list of threadvars }
          if not(tf_section_threadvars in target_info.flags) then
          if not(tf_section_threadvars in target_info.flags) then
@@ -1328,7 +1328,7 @@ implementation
          if assigned(exportlib) and
          if assigned(exportlib) and
             (target_info.system in [system_i386_win32,system_i386_wdosx]) and
             (target_info.system in [system_i386_win32,system_i386_wdosx]) and
             ((current_module.flags and uf_has_exports)<>0) then
             ((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
          If resourcestrings.ResStrCount>0 then
           begin
           begin
@@ -1398,10 +1398,10 @@ implementation
            debuginfo.inserttypeinfo;
            debuginfo.inserttypeinfo;
 
 
          { generate wrappers for interfaces }
          { 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 }
          { 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 }
          { generate a list of threadvars }
          if not(tf_section_threadvars in target_info.flags) then
          if not(tf_section_threadvars in target_info.flags) then

+ 4 - 4
compiler/powerpc/aasmcpu.pas

@@ -27,7 +27,7 @@ interface
 
 
 uses
 uses
   globtype,verbose,
   globtype,verbose,
-  aasmbase,aasmtai,
+  aasmbase,aasmtai,aasmdata,
   cpubase,cgbase,cgutils;
   cpubase,cgbase,cgutils;
 
 
     const
     const
@@ -98,7 +98,7 @@ uses
     function spilling_create_load(const ref:treference;r:tregister): tai;
     function spilling_create_load(const ref:treference;r:tregister): tai;
     function spilling_create_store(r:tregister; const ref:treference): tai;
     function spilling_create_store(r:tregister; const ref:treference): tai;
 
 
-    procedure fixup_jmps(list: taasmoutput);
+    procedure fixup_jmps(list: TAsmList);
 
 
 implementation
 implementation
 
 
@@ -431,7 +431,7 @@ uses cutils, cclasses;
       end;
       end;
 
 
 
 
-    procedure fixup_jmps(list: taasmoutput);
+    procedure fixup_jmps(list: TAsmList);
       var
       var
         p: tai;
         p: tai;
         newjmp: taicpu;
         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
                            (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
                           begin
                             // add a new label after this jump
                             // add a new label after this jump
-                            objectlibrary.getjumplabel(l);
+                            current_asmdata.getjumplabel(l);
                             list.insertafter(tai_label.create(l),p);
                             list.insertafter(tai_label.create(l),p);
                             // add a new unconditional jump between this jump and the label
                             // add a new unconditional jump between this jump and the label
                             newjmp := taicpu.op_sym(A_B,taicpu(p).oper[0]^.ref^.symbol);
                             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
     uses
        aasmbase,
        aasmbase,
-       aasmtai,
+       aasmtai,aasmdata,
        aggas,
        aggas,
        cpubase,
        cpubase,
        globtype;
        globtype;

+ 13 - 13
compiler/powerpc/agppcmpw.pas

@@ -29,13 +29,13 @@ unit agppcmpw;
 interface
 interface
 
 
     uses
     uses
-       aasmtai,
+       aasmtai,aasmdata,
        globals,aasmbase,aasmcpu,assemble,
        globals,aasmbase,aasmcpu,assemble,
        cpubase;
        cpubase;
 
 
     type
     type
       TPPCMPWAssembler = class(TExternalAssembler)
       TPPCMPWAssembler = class(TExternalAssembler)
-        procedure WriteTree(p:TAAsmoutput);override;
+        procedure WriteTree(p:TAsmList);override;
         procedure WriteAsmList;override;
         procedure WriteAsmList;override;
         Function  DoAssemble:boolean;override;
         Function  DoAssemble:boolean;override;
         procedure WriteExternals;
         procedure WriteExternals;
@@ -74,7 +74,7 @@ interface
         'csect', {read only data}
         'csect', {read only data}
         'csect', {bss} 'csect',
         'csect', {bss} 'csect',
         'csect','csect','csect','csect',
         'csect','csect','csect','csect',
-         '','','','','','','','','','','',''
+         '','','','','','','','','','','','','',''
       );
       );
 
 
     type
     type
@@ -673,7 +673,7 @@ interface
         (#9'dc.l'#9,#9'dc.w'#9,#9'dc.b'#9);
         (#9'dc.l'#9,#9'dc.w'#9,#9'dc.b'#9);
 
 
 
 
-    procedure TPPCMPWAssembler.WriteTree(p:TAAsmoutput);
+    procedure TPPCMPWAssembler.WriteTree(p:TAsmList);
     var
     var
       s,
       s,
       prefix,
       prefix,
@@ -700,7 +700,7 @@ interface
       { lineinfo is only needed for al_procedures (PFV) }
       { lineinfo is only needed for al_procedures (PFV) }
       do_line:=((cs_asm_source in aktglobalswitches) or
       do_line:=((cs_asm_source in aktglobalswitches) or
                 (cs_lineinfo in aktmoduleswitches))
                 (cs_lineinfo in aktmoduleswitches))
-                 and (p=asmlist[al_procedures]);
+                 and (p=current_asmdata.asmlists[al_procedures]);
       DoNotSplitLine:=false;
       DoNotSplitLine:=false;
       hp:=tai(p.first);
       hp:=tai(p.first);
       while assigned(hp) do
       while assigned(hp) do
@@ -1108,9 +1108,9 @@ interface
                 end;
                 end;
               ait_marker :
               ait_marker :
                  begin
                  begin
-                   if tai_marker(hp).kind=InlineStart then
+                   if tai_marker(hp).kind=mark_InlineStart then
                      inc(InlineLevel)
                      inc(InlineLevel)
-                   else if tai_marker(hp).kind=InlineEnd then
+                   else if tai_marker(hp).kind=mark_InlineEnd then
                      dec(InlineLevel);
                      dec(InlineLevel);
                  end;
                  end;
          else
          else
@@ -1204,7 +1204,7 @@ interface
     procedure TPPCMPWAssembler.WriteExternals;
     procedure TPPCMPWAssembler.WriteExternals;
       begin
       begin
         currentasmlist:=self;
         currentasmlist:=self;
-        objectlibrary.symbolsearch.foreach_static(@writeexternal,nil);
+        current_asmdata.asmsymboldict.foreach_static(@writeexternal,nil);
       end;
       end;
 
 
 
 
@@ -1253,7 +1253,7 @@ interface
 
 
     procedure TPPCMPWAssembler.WriteAsmList;
     procedure TPPCMPWAssembler.WriteAsmList;
     var
     var
-      hal : tasmlist;
+      hal : tasmlisttype;
     begin
     begin
 {$ifdef EXTDEBUG}
 {$ifdef EXTDEBUG}
       if assigned(current_module.mainsource) then
       if assigned(current_module.mainsource) then
@@ -1264,11 +1264,11 @@ interface
       WriteAsmFileHeader;
       WriteAsmFileHeader;
       WriteExternals;
       WriteExternals;
 
 
-      for hal:=low(Tasmlist) to high(Tasmlist) do
+      for hal:=low(TasmlistType) to high(TasmlistType) do
         begin
         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;
         end;
 
 
       AsmWriteLn(#9'end');
       AsmWriteLn(#9'end');

Some files were not shown because too many files changed in this diff