Explorar el Código

* procinfo unit contains tprocinfo
* cginfo renamed to cgbase
* moved cgmessage to verbose
* fixed ppc and sparc compiles

peter hace 22 años
padre
commit
70fe77ca7c
Se han modificado 100 ficheros con 1838 adiciones y 1792 borrados
  1. 21 5
      compiler/aasmtai.pas
  2. 8 2
      compiler/aggas.pas
  3. 8 2
      compiler/browcol.pas
  4. 8 3
      compiler/cg64f32.pas
  5. 258 681
      compiler/cgbase.pas
  6. 0 443
      compiler/cginfo.pas
  7. 16 8
      compiler/cgobj.pas
  8. 75 4
      compiler/defutil.pas
  9. 16 10
      compiler/fmodule.pas
  10. 15 8
      compiler/globals.pas
  11. 8 2
      compiler/htypechk.pas
  12. 8 2
      compiler/i386/ag386nsm.pas
  13. 8 2
      compiler/i386/cgcpu.pas
  14. 20 79
      compiler/i386/cpupara.pas
  15. 8 2
      compiler/i386/cpupi.pas
  16. 8 2
      compiler/i386/n386add.pas
  17. 9 3
      compiler/i386/n386cal.pas
  18. 8 2
      compiler/i386/n386cnv.pas
  19. 9 2
      compiler/i386/n386con.pas
  20. 9 2
      compiler/i386/n386inl.pas
  21. 8 2
      compiler/i386/n386mat.pas
  22. 8 2
      compiler/i386/n386mem.pas
  23. 8 2
      compiler/i386/n386obj.pas
  24. 9 3
      compiler/i386/n386set.pas
  25. 8 2
      compiler/i386/ra386att.pas
  26. 9 4
      compiler/i386/ra386int.pas
  27. 8 2
      compiler/i386/rgcpu.pas
  28. 9 3
      compiler/nadd.pas
  29. 10 3
      compiler/nbas.pas
  30. 9 2
      compiler/ncal.pas
  31. 8 2
      compiler/ncgadd.pas
  32. 9 2
      compiler/ncgbas.pas
  33. 14 7
      compiler/ncgcal.pas
  34. 9 3
      compiler/ncgcnv.pas
  35. 8 2
      compiler/ncgcon.pas
  36. 8 2
      compiler/ncgflw.pas
  37. 9 3
      compiler/ncginl.pas
  38. 14 8
      compiler/ncgld.pas
  39. 8 2
      compiler/ncgmat.pas
  40. 9 3
      compiler/ncgmem.pas
  41. 9 3
      compiler/ncgopt.pas
  42. 8 2
      compiler/ncgset.pas
  43. 11 5
      compiler/ncgutil.pas
  44. 8 2
      compiler/ncnv.pas
  45. 12 3
      compiler/ncon.pas
  46. 8 2
      compiler/nflw.pas
  47. 8 3
      compiler/ninl.pas
  48. 11 4
      compiler/nld.pas
  49. 8 2
      compiler/nmat.pas
  50. 8 2
      compiler/nmem.pas
  51. 16 5
      compiler/nobj.pas
  52. 8 2
      compiler/node.pas
  53. 8 2
      compiler/nopt.pas
  54. 8 2
      compiler/nset.pas
  55. 8 2
      compiler/nutils.pas
  56. 65 28
      compiler/paramgr.pas
  57. 81 10
      compiler/parser.pas
  58. 8 3
      compiler/pass_1.pas
  59. 9 5
      compiler/pass_2.pas
  60. 8 2
      compiler/pexpr.pas
  61. 8 2
      compiler/pinline.pas
  62. 8 2
      compiler/pmodules.pas
  63. 8 2
      compiler/powerpc/aasmcpu.pas
  64. 8 2
      compiler/powerpc/agppcgas.pas
  65. 8 2
      compiler/powerpc/agppcmpw.pas
  66. 19 38
      compiler/powerpc/cgcpu.pas
  67. 8 19
      compiler/powerpc/cpubase.pas
  68. 31 17
      compiler/powerpc/cpupara.pas
  69. 13 9
      compiler/powerpc/cpupi.pas
  70. 8 2
      compiler/powerpc/itppcgas.pas
  71. 8 2
      compiler/powerpc/nppcadd.pas
  72. 11 69
      compiler/powerpc/nppccal.pas
  73. 8 2
      compiler/powerpc/nppccnv.pas
  74. 9 2
      compiler/powerpc/nppcinl.pas
  75. 8 2
      compiler/powerpc/nppcmat.pas
  76. 8 2
      compiler/powerpc/nppcset.pas
  77. 13 15
      compiler/powerpc/radirect.pas
  78. 7 2
      compiler/powerpc/rgcpu.pas
  79. 236 0
      compiler/procinfo.pas
  80. 9 3
      compiler/pstatmnt.pas
  81. 10 7
      compiler/psub.pas
  82. 9 3
      compiler/rautils.pas
  83. 9 3
      compiler/regvars.pas
  84. 15 7
      compiler/rgobj.pas
  85. 8 2
      compiler/sparc/aasmcpu.pas
  86. 8 13
      compiler/sparc/cgcpu.pas
  87. 8 18
      compiler/sparc/cpubase.pas
  88. 32 18
      compiler/sparc/cpupara.pas
  89. 10 4
      compiler/sparc/cpupi.pas
  90. 8 2
      compiler/sparc/ncpuadd.pas
  91. 8 2
      compiler/sparc/ncpucnv.pas
  92. 8 2
      compiler/sparc/ncpuinln.pas
  93. 8 2
      compiler/sparc/ncpumat.pas
  94. 13 24
      compiler/sparc/radirect.pas
  95. 8 2
      compiler/sparc/rgcpu.pas
  96. 10 2
      compiler/symdef.pas
  97. 12 5
      compiler/symsym.pas
  98. 14 7
      compiler/tgobj.pas
  99. 183 61
      compiler/verbose.pas
  100. 9 2
      compiler/x86/aasmcpu.pas

+ 21 - 5
compiler/aasmtai.pas

@@ -35,7 +35,8 @@ interface
     uses
        cutils,cclasses,
        globtype,globals,systems,
-       cginfo,cpuinfo,cpubase,
+       cpuinfo,cpubase,
+       cgbase,
        symppu,symtype,
        aasmbase;
 
@@ -143,7 +144,7 @@ interface
 
     type
       { Types of operand }
-      toptype=(top_none,top_reg,top_ref,top_const,top_symbol,top_local);
+      toptype=(top_none,top_reg,top_ref,top_const,top_symbol,top_bool,top_local);
 
       toper=record
         ot : longint;
@@ -153,6 +154,7 @@ interface
          top_ref    : (ref:preference);
          top_const  : (val:aword);
          top_symbol : (sym:tasmsymbol;symofs:longint);
+         top_bool   : (b:boolean);
          { local varsym that will be inserted in pass_2 }
          top_local  : (localsym:pointer;localsymderef:tderef;localsymofs:longint);
       end;
@@ -503,8 +505,16 @@ interface
     var
       { array with all class types for tais }
       aiclass : taiclassarray;
-      { temporary lists }
-      exprasmlist,
+
+      { Current expression list }
+      exprasmlist : taasmoutput;
+
+      { labels for BREAK and CONTINUE }
+      aktbreaklabel,aktcontinuelabel : tasmlabel;
+
+      { label when the result is true or false }
+      truelabel,falselabel : tasmlabel;
+
       { default lists }
       datasegment,codesegment,bsssegment,
       debuglist,withdebuglist,consts,
@@ -2141,7 +2151,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.40  2003-09-23 17:56:05  peter
+  Revision 1.41  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.40  2003/09/23 17:56:05  peter
     * locals and paras are allocated in the code generation
     * tvarsym.localloc contains the location of para/local when
       generating code for the current procedure

+ 8 - 2
compiler/aggas.pas

@@ -69,7 +69,7 @@ implementation
       dos,
 {$endif Delphi}
       cutils,globtype,systems,
-      fmodule,finput,verbose,cpubase,cginfo
+      fmodule,finput,verbose,cpubase
 {$ifdef GDB}
   {$ifdef delphi}
       ,sysutils
@@ -832,7 +832,13 @@ var
 end.
 {
   $Log$
-  Revision 1.35  2003-09-23 17:56:05  peter
+  Revision 1.36  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.35  2003/09/23 17:56:05  peter
     * locals and paras are allocated in the code generation
     * tvarsym.localloc contains the location of para/local when
       generating code for the current procedure

+ 8 - 2
compiler/browcol.pas

@@ -267,7 +267,7 @@ uses
   CUtils,
   globtype,globals,comphook,
   finput,fmodule,
-  cpuinfo,cginfo,aasmbase,aasmtai,paramgr,
+  cpuinfo,cgbase,aasmbase,aasmtai,paramgr,
   symsym,symdef,symtype,symbase;
 
 const
@@ -2112,7 +2112,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.35  2003-09-24 13:02:10  marco
+  Revision 1.36  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.35  2003/09/24 13:02:10  marco
    * (Peter) patch to fix snapshot
 
   Revision 1.34  2003/09/07 22:09:34  peter

+ 8 - 3
compiler/cg64f32.pas

@@ -34,7 +34,7 @@ unit cg64f32;
     uses
        aasmbase,aasmtai,aasmcpu,
        cpuinfo, cpubase,cpupara,
-       cginfo, cgobj,
+       cgbase, cgobj,
        node,symtype
 {$ifdef delphi}
        ,dmisc
@@ -94,7 +94,6 @@ unit cg64f32;
 
     uses
        globtype,globals,systems,
-       cgbase,
        verbose,
        symbase,symconst,symdef,defutil,rgobj,tgobj,paramgr;
 
@@ -762,7 +761,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.49  2003-09-03 15:55:00  peter
+  Revision 1.50  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.49  2003/09/03 15:55:00  peter
     * NEWRA branch merged
 
   Revision 1.48.2.2  2003/08/28 18:35:07  peter

+ 258 - 681
compiler/cgbase.pas

@@ -2,7 +2,7 @@
     $Id$
     Copyright (c) 1998-2002 by Florian Klaempfl
 
-    This unit exports some help routines for the code generation
+    Some basic types and constants for the code generation
 
     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
@@ -20,461 +20,310 @@
 
  ****************************************************************************
 }
-{# Some helpers for the code generator.
-}
+{# This unit exports some types which are used across the code generator }
 unit cgbase;
 
 {$i fpcdefs.inc}
 
-  interface
+interface
 
     uses
-      { common }
-      cclasses,
-      { global }
-      globtype,globals,verbose,
-      { symtable }
-      symconst,symtype,symdef,symsym,
-      { aasm }
-      cpubase,cpuinfo,cginfo,aasmbase,aasmtai
-      ;
-
+      cpuinfo,
+      symconst;
 
     type
-      tprocinfoflag=(
-        {# procedure uses asm }
-        pi_uses_asm,
-        {# procedure does a call }
-        pi_do_call,
-        {# procedure has a try statement = no register optimization }
-        pi_uses_exceptions,
-        {# procedure is declared as @var(assembler), don't optimize}
-        pi_is_assembler,
-        {# procedure contains data which needs to be finalized }
-        pi_needs_implicit_finally
+       { Location types where value can be stored }
+       TCGLoc=(
+         LOC_INVALID,      { added for tracking problems}
+         LOC_VOID,         { no value is available }
+         LOC_CONSTANT,     { constant value }
+         LOC_JUMP,         { boolean results only, jump to false or true label }
+         LOC_FLAGS,        { boolean results only, flags are set }
+         LOC_CREFERENCE,   { in memory constant value reference (cannot change) }
+         LOC_REFERENCE,    { in memory value }
+         LOC_REGISTER,     { in a processor register }
+         LOC_CREGISTER,    { Constant register which shouldn't be modified }
+         LOC_FPUREGISTER,  { FPU stack }
+         LOC_CFPUREGISTER, { if it is a FPU register variable on the fpu stack }
+         LOC_MMXREGISTER,  { MMX register }
+         { MMX register variable }
+         LOC_CMMXREGISTER,
+         LOC_SSEREGISTER,
+         LOC_CSSEREGISTER,
+         { multimedia register }
+         LOC_MMREGISTER,
+         { Constant multimedia reg which shouldn't be modified }
+         LOC_CMMREGISTER
+       );
+
+       {# Generic opcodes, which must be supported by all processors
+       }
+       topcg =
+       (
+          OP_NONE,
+          OP_ADD,       { simple addition          }
+          OP_AND,       { simple logical and       }
+          OP_DIV,       { simple unsigned division }
+          OP_IDIV,      { simple signed division   }
+          OP_IMUL,      { simple signed multiply   }
+          OP_MUL,       { simple unsigned multiply }
+          OP_NEG,       { simple negate            }
+          OP_NOT,       { simple logical not       }
+          OP_OR,        { simple logical or        }
+          OP_SAR,       { arithmetic shift-right   }
+          OP_SHL,       { logical shift left       }
+          OP_SHR,       { logical shift right      }
+          OP_SUB,       { simple subtraction       }
+          OP_XOR        { simple exclusive or      }
+        );
+
+       {# Generic flag values - used for jump locations }
+       TOpCmp =
+       (
+          OC_NONE,
+          OC_EQ,           { equality comparison              }
+          OC_GT,           { greater than (signed)            }
+          OC_LT,           { less than (signed)               }
+          OC_GTE,          { greater or equal than (signed)   }
+          OC_LTE,          { less or equal than (signed)      }
+          OC_NE,           { not equal                        }
+          OC_BE,           { less or equal than (unsigned)    }
+          OC_B,            { less than (unsigned)             }
+          OC_AE,           { greater or equal than (unsigned) }
+          OC_A             { greater than (unsigned)          }
+        );
+
+       { OS_NO is also used memory references with large data that can
+         not be loaded in a register directly }
+       TCgSize = (OS_NO,
+                 { integer registers }
+                  OS_8,OS_16,OS_32,OS_64,OS_S8,OS_S16,OS_S32,OS_S64,
+                 { single,double,extended,comp,float128 }
+                  OS_F32,OS_F64,OS_F80,OS_C64,OS_F128,
+                 { multi-media sizes: split in byte, word, dword, ... }
+                 { entities, then the signed counterparts             }
+                  OS_M8,OS_M16,OS_M32,OS_M64,OS_M128,OS_MS8,OS_MS16,OS_MS32,
+                  OS_MS64,OS_MS128);
+
+      { Register types }
+      TRegisterType = (
+        R_INVALIDREGISTER, { = 0 }
+        R_INTREGISTER,     { = 1 }
+        R_FPUREGISTER,     { = 2 }
+        { used by Intel only }
+        R_MMXREGISTER,     { = 3 }
+        R_MMREGISTER,      { = 4 }
+        R_SPECIALREGISTER, { = 5 }
+        R_ADDRESSREGISTER  { = 6 }
       );
-      tprocinfoflags=set of tprocinfoflag;
 
-    type
-       {# This object gives information on the current routine being
-          compiled.
-       }
-       tprocinfo = class(tlinkedlistitem)
-          { pointer to parent in nested procedures }
-          parent : tprocinfo;
-          {# the definition of the routine itself }
-          procdef : tprocdef;
-          { file location of begin of procedure }
-          entrypos  : tfileposinfo;
-          { file location of end of procedure }
-          exitpos   : tfileposinfo;
-          { local switches at begin of procedure }
-          entryswitches : tlocalswitches;
-          { local switches at end of procedure }
-          exitswitches  : tlocalswitches;
-
-          { Size of the parameters on the stack }
-          para_stack_size : longint;
-
-          {# some collected informations about the procedure
-             see pi_xxxx constants above
-          }
-          flags : tprocinfoflags;
-
-          { register used as frame pointer }
-          framepointer : tregister;
-
-          { Holds the reference used to store alll saved registers. }
-          save_regs_ref : treference;
-
-          { label to leave the sub routine }
-          aktexitlabel : tasmlabel;
-
-          {# The code for the routine itself, excluding entry and
-             exit code. This is a linked list of tai classes.
-          }
-          aktproccode : taasmoutput;
-          { Data (like jump tables) that belongs to this routine }
-          aktlocaldata : taasmoutput;
-
-          constructor create(aparent:tprocinfo);virtual;
-          destructor destroy;override;
-
-          { Allocate framepointer so it can not be used by the
-            register allocator }
-          procedure allocate_framepointer_reg;virtual;
-
-          procedure allocate_push_parasize(size:longint);virtual;
-
-          function calc_stackframe_size:longint;virtual;
-
-          { Does the necessary stuff before a procedure body is compiled }
-          procedure handle_body_start;virtual;
-
-          { This procedure is called after the pass 1 of the subroutine body is done.
-            Here the address fix ups to generate code for the body must be done.
-          }
-          procedure after_pass1;virtual;
-       end;
-
-       pregvarinfo = ^tregvarinfo;
-       tregvarinfo = record
-          regvars : array[1..maxvarregs] of tvarsym;
-          regvars_para : array[1..maxvarregs] of boolean;
-          regvars_refs : array[1..maxvarregs] of longint;
-
-          fpuregvars : array[1..maxfpuvarregs] of tvarsym;
-          fpuregvars_para : array[1..maxfpuvarregs] of boolean;
-          fpuregvars_refs : array[1..maxfpuvarregs] of longint;
-       end;
-
-       tcprocinfo = class of tprocinfo;
-
-    var
-       cprocinfo : tcprocinfo;
-       {# information about the current sub routine being parsed (@var(pprocinfo))}
-       current_procinfo : tprocinfo;
-
-       { labels for BREAK and CONTINUE }
-       aktbreaklabel,aktcontinuelabel : tasmlabel;
-
-       { label when the result is true or false }
-       truelabel,falselabel : tasmlabel;
-
-       {# true, if there was an error while code generation occurs }
-       codegenerror : boolean;
-
-       { save the size of pushed parameter, needed for aligning }
-       pushedparasize : longint;
-
-    { message calls with codegenerror support }
-    procedure cgmessage(t : longint);
-    procedure cgmessage1(t : longint;const s : string);
-    procedure cgmessage2(t : longint;const s1,s2 : string);
-    procedure cgmessage3(t : longint;const s1,s2,s3 : string);
-    procedure CGMessagePos(const pos:tfileposinfo;t:longint);
-    procedure CGMessagePos1(const pos:tfileposinfo;t:longint;const s1:string);
-    procedure CGMessagePos2(const pos:tfileposinfo;t:longint;const s1,s2:string);
-    procedure CGMessagePos3(const pos:tfileposinfo;t:longint;const s1,s2,s3:string);
-
-    { initialize respectively terminates the code generator }
-    { for a new module or procedure                      }
-    procedure codegen_newmodule;
-    procedure codegen_donemodule;
-
-    {# From a definition return the abstract code generator size enum. It is
-       to note that the value returned can be @var(OS_NO) }
-    function def_cgsize(def: tdef): tcgsize;
+      { Sub registers }
+      TSubRegister = (
+        R_SUBNONE, { = 0; no sub register possible }
+        R_SUBL,    { = 1; 8 bits, Like AL }
+        R_SUBH,    { = 2; 8 bits, Like AH }
+        R_SUBW,    { = 3; 16 bits, Like AX }
+        R_SUBD,    { = 4; 32 bits, Like EAX }
+        R_SUBQ     { = 5; 64 bits, Like RAX }
+      );
+
+      TSuperRegister = type byte;
+
+      {
+        The new register coding:
+
+        SuperRegister   (bits 0..7)
+        Unused          (bits 8..15)
+        Subregister     (bits 16..23)
+        Register type   (bits 24..31)
+      }
+      TRegister = type cardinal;
+      TRegisterRec=packed record
+{$ifdef FPC_BIG_ENDIAN}
+         regtype : Tregistertype;
+         subreg  : Tsubregister;
+         unused  : byte;
+         supreg  : Tsuperregister;
+{$else FPC_BIG_ENDIAN}
+         supreg  : Tsuperregister;
+         unused  : byte;
+         subreg  : Tsubregister;
+         regtype : Tregistertype;
+{$endif FPC_BIG_ENDIAN}
+      end;
+
+      { A type to store register locations for 64 Bit values. }
+{$ifdef cpu64bit}
+      tregister64 = tregister;
+{$else cpu64bit}
+      tregister64 = packed record
+         reglo,reghi : tregister;
+      end;
+{$endif cpu64bit}
+
+      { Set type definition for registers }
+      tsuperregisterset = set of tsuperregister;
+
+      { Temp types }
+      ttemptype = (tt_none,
+                   tt_free,tt_normal,tt_persistent,
+                   tt_noreuse,tt_freenoreuse,
+                   tt_ansistring,tt_freeansistring,
+                   tt_widestring,tt_freewidestring,
+                   tt_interfacecom,tt_freeinterfacecom);
+      ttemptypeset = set of ttemptype;
+
+
+    const
+       { Invalid register number }
+       RS_INVALID    = $ff;
+
+       tcgsize2size : Array[tcgsize] of integer =
+         { integer values }
+        (0,1,2,4,8,1,2,4,8,
+         { floating point values }
+         4,8,EXTENDED_SIZE,8,16,
+         { multimedia values }
+         1,2,4,8,16,1,2,4,8,16);
+
+       tfloat2tcgsize: array[tfloattype] of tcgsize =
+         (OS_F32,OS_F64,OS_F80,OS_C64,OS_C64,OS_F128);
+
+       tcgsize2tfloat: array[OS_F32..OS_C64] of tfloattype =
+         (s32real,s64real,s80real,s64comp);
+
+       { Table to convert tcgsize variables to the correspondending
+         unsigned types }
+       tcgsize2unsigned : array[tcgsize] of tcgsize = (OS_NO,
+          OS_8,OS_16,OS_32,OS_64,OS_8,OS_16,OS_32,OS_64,
+          OS_F32,OS_F64,OS_F80,OS_C64,OS_F128,
+          OS_M8,OS_M16,OS_M32,OS_M64,OS_M128,OS_M8,OS_M16,OS_M32,
+          OS_M64,OS_M128);
+
+       tcgloc2str : array[TCGLoc] of string[11] = (
+            'LOC_INVALID',
+            'LOC_VOID',
+            'LOC_CONST',
+            'LOC_JUMP',
+            'LOC_FLAGS',
+            'LOC_CREF',
+            'LOC_REF',
+            'LOC_REG',
+            'LOC_CREG',
+            'LOC_FPUREG',
+            'LOC_CFPUREG',
+            'LOC_MMXREG',
+            'LOC_CMMXREG',
+            'LOC_SSEREG',
+            'LOC_CSSEREG',
+            'LOC_MMREG',
+            'LOC_CMMREG');
+
+    function newreg(rt:tregistertype;sr:tsuperregister;sb:tsubregister):tregister;{$ifdef USEINLINE}inline;{$endif}
+    function getsubreg(r:tregister):tsubregister;{$ifdef USEINLINE}inline;{$endif}
+    function getsupreg(r:tregister):tsuperregister;{$ifdef USEINLINE}inline;{$endif}
+    function getregtype(r:tregister):tregistertype;{$ifdef USEINLINE}inline;{$endif}
+    procedure setsubreg(var r:tregister;sr:tsubregister);{$ifdef USEINLINE}inline;{$endif}
+    procedure setsupreg(var r:tregister;sr:tsuperregister);{$ifdef USEINLINE}inline;{$endif}
+    function generic_regname(r:tregister):string;
+
     {# From a constant numeric value, return the abstract code generator
        size.
     }
     function int_cgsize(const a: aword): tcgsize;
 
-    {# return the inverse condition of opcmp }
+    { return the inverse condition of opcmp }
     function inverse_opcmp(opcmp: topcmp): topcmp;
 
-    {# return whether op is commutative }
+    { return whether op is commutative }
     function commutativeop(op: topcg): boolean;
 
 
 implementation
 
-     uses
-        cutils,systems,
-        cresstr,
-        tgobj,rgobj,
-        defutil,
-        fmodule
-        ,symbase,paramgr
-        ;
-
-
-{*****************************************************************************
-            override the message calls to set codegenerror
-*****************************************************************************}
-
-    procedure cgmessage(t : longint);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=Errorcount;
-              verbose.Message(t);
-              codegenerror:=olderrorcount<>Errorcount;
-           end;
-      end;
-
-    procedure cgmessage1(t : longint;const s : string);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=Errorcount;
-              verbose.Message1(t,s);
-              codegenerror:=olderrorcount<>Errorcount;
-           end;
-      end;
-
-    procedure cgmessage2(t : longint;const s1,s2 : string);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=Errorcount;
-              verbose.Message2(t,s1,s2);
-              codegenerror:=olderrorcount<>Errorcount;
-           end;
-      end;
-
-    procedure cgmessage3(t : longint;const s1,s2,s3 : string);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=Errorcount;
-              verbose.Message3(t,s1,s2,s3);
-              codegenerror:=olderrorcount<>Errorcount;
-           end;
-      end;
-
-
-    procedure cgmessagepos(const pos:tfileposinfo;t : longint);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=Errorcount;
-              verbose.MessagePos(pos,t);
-              codegenerror:=olderrorcount<>Errorcount;
-           end;
-      end;
-
-    procedure cgmessagepos1(const pos:tfileposinfo;t : longint;const s1 : string);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=Errorcount;
-              verbose.MessagePos1(pos,t,s1);
-              codegenerror:=olderrorcount<>Errorcount;
-           end;
-      end;
-
-    procedure cgmessagepos2(const pos:tfileposinfo;t : longint;const s1,s2 : string);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=Errorcount;
-              verbose.MessagePos2(pos,t,s1,s2);
-              codegenerror:=olderrorcount<>Errorcount;
-           end;
-      end;
-
-    procedure cgmessagepos3(const pos:tfileposinfo;t : longint;const s1,s2,s3 : string);
-      var
-         olderrorcount : longint;
-      begin
-         if not(codegenerror) then
-           begin
-              olderrorcount:=Errorcount;
-              verbose.MessagePos3(pos,t,s1,s2,s3);
-              codegenerror:=olderrorcount<>Errorcount;
-           end;
-      end;
-
-
-{****************************************************************************
-                                 TProcInfo
-****************************************************************************}
-
-    constructor tprocinfo.create(aparent:tprocinfo);
-      begin
-        parent:=aparent;
-        procdef:=nil;
-        para_stack_size:=0;
-        flags:=[];
-        framepointer:=NR_FRAME_POINTER_REG;
-        { asmlists }
-        aktproccode:=Taasmoutput.Create;
-        aktlocaldata:=Taasmoutput.Create;
-        reference_reset(save_regs_ref);
-        { labels }
-        objectlibrary.getlabel(aktexitlabel);
-      end;
-
+    uses
+      verbose;
 
-    destructor tprocinfo.destroy;
+    function newreg(rt:tregistertype;sr:tsuperregister;sb:tsubregister):tregister;{$ifdef USEINLINE}inline;{$endif}
       begin
-         aktproccode.free;
-         aktlocaldata.free;
+        tregisterrec(result).regtype:=rt;
+        tregisterrec(result).unused:=0;
+        tregisterrec(result).supreg:=sr;
+        tregisterrec(result).subreg:=sb;
       end;
 
 
-    procedure tprocinfo.allocate_framepointer_reg;
+    function getsubreg(r:tregister):tsubregister;{$ifdef USEINLINE}inline;{$endif}
       begin
-        if framepointer=NR_FRAME_POINTER_REG then
-          begin
-            { Make sure the register allocator won't allocate registers
-              into ebp }
-            include(rg.used_in_proc_int,RS_FRAME_POINTER_REG);
-            exclude(rg.unusedregsint,RS_FRAME_POINTER_REG);
-          end;
+        result:=tregisterrec(r).subreg;
       end;
 
 
-    procedure tprocinfo.allocate_push_parasize(size:longint);
+    function getsupreg(r:tregister):tsuperregister;{$ifdef USEINLINE}inline;{$endif}
       begin
+        result:=tregisterrec(r).supreg;
       end;
 
 
-    function tprocinfo.calc_stackframe_size:longint;
-      var
-        _align : longint;
+    function getregtype(r:tregister):tregistertype;{$ifdef USEINLINE}inline;{$endif}
       begin
-        { align to 4 bytes at least
-          otherwise all those subl $2,%esp are meaningless PM }
-        _align:=target_info.alignment.localalignmin;
-        if _align<4 then
-          _align:=4;
-        result:=Align(tg.direction*tg.lasttemp,_align);
+        result:=tregisterrec(r).regtype;
       end;
 
 
-    procedure tprocinfo.handle_body_start;
+    procedure setsubreg(var r:tregister;sr:tsubregister);{$ifdef USEINLINE}inline;{$endif}
       begin
+        tregisterrec(r).subreg:=sr;
       end;
 
 
-    procedure tprocinfo.after_pass1;
+    procedure setsupreg(var r:tregister;sr:tsuperregister);{$ifdef USEINLINE}inline;{$endif}
       begin
+        tregisterrec(r).supreg:=sr;
       end;
 
 
-{*****************************************************************************
-         initialize/terminate the codegen for procedure and modules
-*****************************************************************************}
-
-    procedure codegen_newmodule;
-      begin
-         exprasmlist:=taasmoutput.create;
-         datasegment:=taasmoutput.create;
-         codesegment:=taasmoutput.create;
-         bsssegment:=taasmoutput.create;
-         debuglist:=taasmoutput.create;
-         withdebuglist:=taasmoutput.create;
-         consts:=taasmoutput.create;
-         rttilist:=taasmoutput.create;
-         ResourceStringList:=Nil;
-         importssection:=nil;
-         exportssection:=nil;
-         resourcesection:=nil;
-         { resourcestrings }
-         ResourceStrings:=TResourceStrings.Create;
-         { use the librarydata from current_module }
-         objectlibrary:=current_module.librarydata;
-      end;
-
-
-    procedure codegen_donemodule;
-{$ifdef MEMDEBUG}
+    function generic_regname(r:tregister):string;
       var
-        d : tmemdebug;
-{$endif}
-      begin
-{$ifdef MEMDEBUG}
-         d:=tmemdebug.create(current_module.modulename^+' - asmlists');
-{$endif}
-         exprasmlist.free;
-         codesegment.free;
-         bsssegment.free;
-         datasegment.free;
-         debuglist.free;
-         withdebuglist.free;
-         consts.free;
-         rttilist.free;
-         if assigned(ResourceStringList) then
-          ResourceStringList.free;
-         if assigned(importssection) then
-          importssection.free;
-         if assigned(exportssection) then
-          exportssection.free;
-         if assigned(resourcesection) then
-          resourcesection.free;
-{$ifdef MEMDEBUG}
-         d.free;
-{$endif}
-         { resource strings }
-         ResourceStrings.free;
-         objectlibrary:=nil;
-      end;
-
-
-    function def_cgsize(def: tdef): tcgsize;
+        t,sub : char;
+        nr    : string[12];
       begin
-        case def.deftype of
-          orddef,
-          enumdef,
-          setdef:
-            begin
-              result := int_cgsize(def.size);
-              if is_signed(def) then
-                result := tcgsize(ord(result)+(ord(OS_S8)-ord(OS_8)));
-            end;
-          classrefdef,
-          pointerdef:
-            result := OS_ADDR;
-          procvardef:
-            begin
-              if tprocvardef(def).is_methodpointer and
-                 (not tprocvardef(def).is_addressonly) then
-                result := OS_64
-              else
-                result := OS_ADDR;
-            end;
-          stringdef :
-            begin
-              if is_ansistring(def) or is_widestring(def) then
-                result := OS_ADDR
-              else
-                result := OS_NO;
-            end;
-          objectdef :
-            begin
-              if is_class_or_interface(def) then
-                result := OS_ADDR
-              else
-                result := OS_NO;
-            end;
-          floatdef:
-            result := tfloat2tcgsize[tfloatdef(def).typ];
-          recorddef :
-            result:=int_cgsize(def.size);
-          arraydef :
-            begin
-              if not is_special_array(def) then
-                result := int_cgsize(def.size)
-              else
-                begin
-                  if is_dynamic_array(def) then
-                    result := OS_ADDR
-                  else
-                    result := OS_NO;
-                end;
-            end;
+        case getregtype(r) of
+          R_INTREGISTER:
+            t:='i';
+          R_FPUREGISTER:
+            t:='f';
+          R_MMXREGISTER:
+            t:='x';
+          R_MMREGISTER:
+            t:='m';
           else
             begin
-              { undefined size }
-              result:=OS_NO;
+              result:='INVALID';
+              exit;
             end;
         end;
+        str(getsupreg(r),nr);
+        case getsubreg(r) of
+          R_SUBNONE:
+            sub:=' ';
+          R_SUBL:
+            sub:='l';
+          R_SUBH:
+            sub:='h';
+          R_SUBW:
+            sub:='w';
+          R_SUBD:
+            sub:='d';
+          R_SUBQ:
+            sub:='q';
+          else
+            internalerror(200308252);
+        end;
+        if sub<>' ' then
+          result:=t+'reg'+nr+sub
+        else
+          result:=t+'reg'+nr;
       end;
 
 
@@ -517,286 +366,14 @@ implementation
         commutativeop := list[op];
       end;
 
+
 end.
 {
   $Log$
-  Revision 1.66  2003-09-28 17:55:03  peter
-    * parent framepointer changed to hidden parameter
-    * tloadparentfpnode added
-
-  Revision 1.65  2003/09/25 21:25:13  peter
-    * remove allocate_intterupt_parameter, allocation is platform
-      dependent and needs to be done in create_paraloc_info
-
-  Revision 1.64  2003/09/23 17:56:05  peter
-    * locals and paras are allocated in the code generation
-    * tvarsym.localloc contains the location of para/local when
-      generating code for the current procedure
-
-  Revision 1.63  2003/09/14 19:18:10  peter
-    * remove obsolete code already in comments
-
-  Revision 1.62  2003/09/07 22:09:34  peter
-    * preparations for different default calling conventions
-    * various RA fixes
-
-  Revision 1.61  2003/09/03 15:55:00  peter
-    * NEWRA branch merged
-
-  Revision 1.60.2.1  2003/08/29 17:28:59  peter
-    * next batch of updates
-
-  Revision 1.60  2003/08/26 12:43:02  peter
-    * methodpointer fixes
-
-  Revision 1.59  2003/08/20 17:48:49  peter
-    * fixed stackalloc to not allocate localst.datasize twice
-    * order of stackalloc code fixed for implicit init/final
-
-  Revision 1.58  2003/08/11 21:18:20  peter
-    * start of sparc support for newra
-
-  Revision 1.57  2003/07/06 17:58:22  peter
-    * framepointer fixes for sparc
-    * parent framepointer code more generic
-
-  Revision 1.56  2003/06/13 21:19:30  peter
-    * current_procdef removed, use current_procinfo.procdef instead
-
-  Revision 1.55  2003/06/12 16:43:07  peter
-    * newra compiles for sparc
-
-  Revision 1.54  2003/06/09 12:23:29  peter
-    * init/final of procedure data splitted from genentrycode
-    * use asmnode getposition to insert final at the correct position
-      als for the implicit try...finally
-
-  Revision 1.53  2003/06/02 21:42:05  jonas
-    * function results can now also be regvars
-    - removed tprocinfo.return_offset, never use it again since it's invalid
-      if the result is a regvar
-
-  Revision 1.52  2003/05/26 21:17:17  peter
-    * procinlinenode removed
-    * aktexit2label removed, fast exit removed
-    + tcallnode.inlined_pass_2 added
-
-  Revision 1.51  2003/05/23 14:27:35  peter
-    * remove some unit dependencies
-    * current_procinfo changes to store more info
-
-  Revision 1.50  2003/05/16 20:54:12  jonas
-    - undid previous commit, it wasn't necessary
-
-  Revision 1.49  2003/05/16 20:00:39  jonas
-    * powerpc nested procedure fixes, should work completely now if all
-      local variables of the parent procedure are declared before the
-      nested procedures are declared
-
-  Revision 1.48  2003/05/15 18:58:53  peter
-    * removed selfpointer_offset, vmtpointer_offset
-    * tvarsym.adjusted_address
-    * address in localsymtable is now in the real direction
-    * removed some obsolete globals
-
-  Revision 1.47  2003/05/13 19:14:41  peter
-    * failn removed
-    * inherited result code check moven to pexpr
-
-  Revision 1.46  2003/05/09 17:47:02  peter
-    * self moved to hidden parameter
-    * removed hdisposen,hnewn,selfn
-
-  Revision 1.45  2003/04/27 11:21:32  peter
-    * aktprocdef renamed to current_procinfo.procdef
-    * procinfo renamed to current_procinfo
-    * procinfo will now be stored in current_module so it can be
-      cleaned up properly
-    * gen_main_procsym changed to create_main_proc and release_main_proc
-      to also generate a tprocinfo structure
-    * fixed unit implicit initfinal
-
-  Revision 1.44  2003/04/27 07:29:50  peter
-    * current_procinfo.procdef cleanup, current_procdef is now always nil when parsing
-      a new procdef declaration
-    * aktprocsym removed
-    * lexlevel removed, use symtable.symtablelevel instead
-    * implicit init/final code uses the normal genentry/genexit
-    * funcret state checking updated for new funcret handling
-
-  Revision 1.43  2003/04/26 00:31:42  peter
-    * set return_offset moved to after_header
-
-  Revision 1.42  2003/04/25 20:59:33  peter
-    * removed funcretn,funcretsym, function result is now in varsym
-      and aliases for result and function name are added using absolutesym
-    * vs_hidden parameter for funcret passed in parameter
-    * vs_hidden fixes
-    * writenode changed to printnode and released from extdebug
-    * -vp option added to generate a tree.log with the nodetree
-    * nicer printnode for statements, callnode
-
-  Revision 1.41  2003/04/23 12:35:34  florian
-    * fixed several issues with powerpc
-    + applied a patch from Jonas for nested function calls (PowerPC only)
-    * ...
-
-  Revision 1.40  2003/04/22 13:47:08  peter
-    * fixed C style array of const
-    * fixed C array passing
-    * fixed left to right with high parameters
-
-  Revision 1.39  2003/04/05 21:09:31  jonas
-    * several ppc/generic result offset related fixes. The "normal" result
-      offset seems now to be calculated correctly and a lot of duplicate
-      calculations have been removed. Nested functions accessing the parent's
-      function result don't work at all though :(
-
-  Revision 1.38  2003/03/28 19:16:56  peter
-    * generic constructor working for i386
-    * remove fixed self register
-    * esi added as address register for i386
-
-  Revision 1.37  2003/03/20 17:51:45  peter
-    * dynamic arrays have size OS_ADDR
-
-  Revision 1.36  2003/01/08 18:43:56  daniel
-   * Tregister changed into a record
-
-  Revision 1.35  2003/01/01 21:04:48  peter
-    * removed unused method
-
-  Revision 1.34  2002/11/25 17:43:16  peter
-    * splitted defbase in defutil,symutil,defcmp
-    * merged isconvertable and is_equal into compare_defs(_ext)
-    * made operator search faster by walking the list only once
-
-  Revision 1.33  2002/11/18 17:31:54  peter
-    * pass proccalloption to ret_in_xxx and push_xxx functions
-
-  Revision 1.32  2002/10/05 12:43:23  carl
-    * fixes for Delphi 6 compilation
-     (warning : Some features do not work under Delphi)
-
-  Revision 1.31  2002/10/03 21:20:19  carl
-    * range check error fix
-
-  Revision 1.30  2002/09/30 07:00:44  florian
-    * fixes to common code to get the alpha compiler compiled applied
-
-  Revision 1.29  2002/09/07 19:35:45  florian
-    + tcg.direction is used now
-
-  Revision 1.28  2002/09/07 15:25:01  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.27  2002/09/05 19:29:42  peter
-    * memdebug enhancements
-
-  Revision 1.26  2002/08/18 20:06:23  peter
-    * inlining is now also allowed in interface
-    * renamed write/load to ppuwrite/ppuload
-    * tnode storing in ppu
-    * nld,ncon,nbas are already updated for storing in ppu
-
-  Revision 1.25  2002/08/17 09:23:33  florian
-    * first part of procinfo rewrite
-
-  Revision 1.24  2002/08/11 14:32:26  peter
-    * renamed current_library to objectlibrary
-
-  Revision 1.23  2002/08/11 13:24:11  peter
-    * saving of asmsymbols in ppu supported
-    * asmsymbollist global is removed and moved into a new class
-      tasmlibrarydata that will hold the info of a .a file which
-      corresponds with a single module. Added librarydata to tmodule
-      to keep the library info stored for the module. In the future the
-      objectfiles will also be stored to the tasmlibrarydata class
-    * all getlabel/newasmsymbol and friends are moved to the new class
-
-  Revision 1.22  2002/08/06 20:55:20  florian
-    * first part of ppc calling conventions fix
-
-  Revision 1.21  2002/08/05 18:27:48  carl
-    + more more more documentation
-    + first version include/exclude (can't test though, not enough scratch for i386 :()...
-
-  Revision 1.20  2002/08/04 19:06:41  carl
-    + added generic exception support (still does not work!)
-    + more documentation
-
-  Revision 1.19  2002/07/20 11:57:53  florian
-    * types.pas renamed to defbase.pas because D6 contains a types
-      unit so this would conflicts if D6 programms are compiled
-    + Willamette/SSE2 instructions to assembler added
-
-  Revision 1.18  2002/07/01 18:46:22  peter
-    * internal linker
-    * reorganized aasm layer
-
-  Revision 1.17  2002/05/20 13:30:40  carl
-  * bugfix of hdisponen (base must be set, not index)
-  * more portability fixes
-
-  Revision 1.16  2002/05/18 13:34:05  peter
-    * readded missing revisions
-
-  Revision 1.15  2002/05/16 19:46:35  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.13  2002/04/25 20:16:38  peter
-    * moved more routines from cga/n386util
-
-  Revision 1.12  2002/04/21 15:28:06  carl
-  - remove duplicate constants
-  - move some constants to cginfo
-
-  Revision 1.11  2002/04/20 21:32:23  carl
-  + generic FPC_CHECKPOINTER
-  + first parameter offset in stack now portable
-  * rename some constants
-  + move some cpu stuff to other units
-  - remove unused constents
-  * fix stacksize for some targets
-  * fix generic size problems which depend now on EXTEND_SIZE constant
-
-  Revision 1.10  2002/04/07 09:13:39  carl
-  + documentation
-  - remove unused variables
-
-  Revision 1.9  2002/04/04 19:05:54  peter
-    * removed unused units
-    * use tlocation.size in cg.a_*loc*() routines
-
-  Revision 1.8  2002/04/02 17:11:27  peter
-    * tlocation,treference update
-    * LOC_CONSTANT added for better constant handling
-    * secondadd splitted in multiple routines
-    * location_force_reg added for loading a location to a register
-      of a specified size
-    * secondassignment parses now first the right and then the left node
-      (this is compatible with Kylix). This saves a lot of push/pop especially
-      with string operations
-    * adapted some routines to use the new cg methods
-
-  Revision 1.7  2002/03/31 20:26:33  jonas
-    + a_loadfpu_* and a_loadmm_* methods in tcg
-    * register allocation is now handled by a class and is mostly processor
-      independent (+rgobj.pas and i386/rgcpu.pas)
-    * temp allocation is now handled by a class (+tgobj.pas, -i386\tgcpu.pas)
-    * some small improvements and fixes to the optimizer
-    * some register allocation fixes
-    * some fpuvaroffset fixes in the unary minus node
-    * push/popusedregisters is now called rg.save/restoreusedregisters and
-      (for i386) uses temps instead of push/pop's when using -Op3 (that code is
-      also better optimizable)
-    * fixed and optimized register saving/restoring for new/dispose nodes
-    * LOC_FPU locations now also require their "register" field to be set to
-      R_ST, not R_ST0 (the latter is used for LOC_CFPUREGISTER locations only)
-    - list field removed of the tnode class because it's not used currently
-      and can cause hard-to-find bugs
+  Revision 1.67  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
 
 }

+ 0 - 443
compiler/cginfo.pas

@@ -1,443 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Florian Klaempfl
-
-    This unit exports some types and constants for the code generation
-
-    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.
-
- ****************************************************************************
-}
-{# This unit exports some types which are used across the code generator }
-unit cginfo;
-
-{$i fpcdefs.inc}
-
-interface
-
-  uses cpuinfo,symconst;
-
-    type
-       { Location types where value can be stored }
-       TCGLoc=(
-         LOC_INVALID,      { added for tracking problems}
-         LOC_VOID,         { no value is available }
-         LOC_CONSTANT,     { constant value }
-         LOC_JUMP,         { boolean results only, jump to false or true label }
-         LOC_FLAGS,        { boolean results only, flags are set }
-         LOC_CREFERENCE,   { in memory constant value reference (cannot change) }
-         LOC_REFERENCE,    { in memory value }
-         LOC_REGISTER,     { in a processor register }
-         LOC_CREGISTER,    { Constant register which shouldn't be modified }
-         LOC_FPUREGISTER,  { FPU stack }
-         LOC_CFPUREGISTER, { if it is a FPU register variable on the fpu stack }
-         LOC_MMXREGISTER,  { MMX register }
-         { MMX register variable }
-         LOC_CMMXREGISTER,
-         LOC_SSEREGISTER,
-         LOC_CSSEREGISTER,
-         { multimedia register }
-         LOC_MMREGISTER,
-         { Constant multimedia reg which shouldn't be modified }
-         LOC_CMMREGISTER
-       );
-
-       {# Generic opcodes, which must be supported by all processors
-       }
-       topcg =
-       (
-          OP_NONE,
-          OP_ADD,       { simple addition          }
-          OP_AND,       { simple logical and       }
-          OP_DIV,       { simple unsigned division }
-          OP_IDIV,      { simple signed division   }
-          OP_IMUL,      { simple signed multiply   }
-          OP_MUL,       { simple unsigned multiply }
-          OP_NEG,       { simple negate            }
-          OP_NOT,       { simple logical not       }
-          OP_OR,        { simple logical or        }
-          OP_SAR,       { arithmetic shift-right   }
-          OP_SHL,       { logical shift left       }
-          OP_SHR,       { logical shift right      }
-          OP_SUB,       { simple subtraction       }
-          OP_XOR        { simple exclusive or      }
-        );
-
-       {# Generic flag values - used for jump locations }
-       TOpCmp =
-       (
-          OC_NONE,
-          OC_EQ,           { equality comparison              }
-          OC_GT,           { greater than (signed)            }
-          OC_LT,           { less than (signed)               }
-          OC_GTE,          { greater or equal than (signed)   }
-          OC_LTE,          { less or equal than (signed)      }
-          OC_NE,           { not equal                        }
-          OC_BE,           { less or equal than (unsigned)    }
-          OC_B,            { less than (unsigned)             }
-          OC_AE,           { greater or equal than (unsigned) }
-          OC_A             { greater than (unsigned)          }
-        );
-
-       { OS_NO is also used memory references with large data that can
-         not be loaded in a register directly }
-       TCgSize = (OS_NO,
-                 { integer registers }
-                  OS_8,OS_16,OS_32,OS_64,OS_S8,OS_S16,OS_S32,OS_S64,
-                 { single,double,extended,comp,float128 }
-                  OS_F32,OS_F64,OS_F80,OS_C64,OS_F128,
-                 { multi-media sizes: split in byte, word, dword, ... }
-                 { entities, then the signed counterparts             }
-                  OS_M8,OS_M16,OS_M32,OS_M64,OS_M128,OS_MS8,OS_MS16,OS_MS32,
-                  OS_MS64,OS_MS128);
-
-      { Register types }
-      TRegisterType = (
-        R_INVALIDREGISTER, { = 0 }
-        R_INTREGISTER,     { = 1 }
-        R_FPUREGISTER,     { = 2 }
-        { used by Intel only }
-        R_MMXREGISTER,     { = 3 }
-        R_MMREGISTER,      { = 4 }
-        R_SPECIALREGISTER, { = 5 }
-        R_ADDRESSREGISTER  { = 6 }
-      );
-
-      { Sub registers }
-      TSubRegister = (
-        R_SUBNONE, { = 0; no sub register possible }
-        R_SUBL,    { = 1; 8 bits, Like AL }
-        R_SUBH,    { = 2; 8 bits, Like AH }
-        R_SUBW,    { = 3; 16 bits, Like AX }
-        R_SUBD,    { = 4; 32 bits, Like EAX }
-        R_SUBQ     { = 5; 64 bits, Like RAX }
-      );
-
-      TSuperRegister = type byte;
-
-      {
-        The new register coding:
-
-        SuperRegister   (bits 0..7)
-        Unused          (bits 8..15)
-        Subregister     (bits 16..23)
-        Register type   (bits 24..31)
-      }
-      TRegister = type cardinal;
-      TRegisterRec=packed record
-{$ifdef FPC_BIG_ENDIAN}
-         regtype : Tregistertype;
-         subreg  : Tsubregister;
-         unused  : byte;
-         supreg  : Tsuperregister;
-{$else FPC_BIG_ENDIAN}
-         supreg  : Tsuperregister;
-         unused  : byte;
-         subreg  : Tsubregister;
-         regtype : Tregistertype;
-{$endif FPC_BIG_ENDIAN}
-      end;
-
-      { A type to store register locations for 64 Bit values. }
-{$ifdef cpu64bit}
-      tregister64 = tregister;
-{$else cpu64bit}
-      tregister64 = packed record
-         reglo,reghi : tregister;
-      end;
-{$endif cpu64bit}
-
-      { Set type definition for registers }
-      tsuperregisterset = set of tsuperregister;
-
-      { Temp types }
-      ttemptype = (tt_none,
-                   tt_free,tt_normal,tt_persistent,
-                   tt_noreuse,tt_freenoreuse,
-                   tt_ansistring,tt_freeansistring,
-                   tt_widestring,tt_freewidestring,
-                   tt_interfacecom,tt_freeinterfacecom);
-      ttemptypeset = set of ttemptype;
-
-
-    const
-       { Invalid register number }
-       RS_INVALID    = $ff;
-
-       tcgsize2size : Array[tcgsize] of integer =
-         { integer values }
-        (0,1,2,4,8,1,2,4,8,
-         { floating point values }
-         4,8,EXTENDED_SIZE,8,16,
-         { multimedia values }
-         1,2,4,8,16,1,2,4,8,16);
-
-       tfloat2tcgsize: array[tfloattype] of tcgsize =
-         (OS_F32,OS_F64,OS_F80,OS_C64,OS_C64,OS_F128);
-
-       tcgsize2tfloat: array[OS_F32..OS_C64] of tfloattype =
-         (s32real,s64real,s80real,s64comp);
-
-       { Table to convert tcgsize variables to the correspondending
-         unsigned types }
-       tcgsize2unsigned : array[tcgsize] of tcgsize = (OS_NO,
-          OS_8,OS_16,OS_32,OS_64,OS_8,OS_16,OS_32,OS_64,
-          OS_F32,OS_F64,OS_F80,OS_C64,OS_F128,
-          OS_M8,OS_M16,OS_M32,OS_M64,OS_M128,OS_M8,OS_M16,OS_M32,
-          OS_M64,OS_M128);
-
-       tcgloc2str : array[TCGLoc] of string[11] = (
-            'LOC_INVALID',
-            'LOC_VOID',
-            'LOC_CONST',
-            'LOC_JUMP',
-            'LOC_FLAGS',
-            'LOC_CREF',
-            'LOC_REF',
-            'LOC_REG',
-            'LOC_CREG',
-            'LOC_FPUREG',
-            'LOC_CFPUREG',
-            'LOC_MMXREG',
-            'LOC_CMMXREG',
-            'LOC_SSEREG',
-            'LOC_CSSEREG',
-            'LOC_MMREG',
-            'LOC_CMMREG');
-
-    function newreg(rt:tregistertype;sr:tsuperregister;sb:tsubregister):tregister;{$ifdef USEINLINE}inline;{$endif}
-    function getsubreg(r:tregister):tsubregister;{$ifdef USEINLINE}inline;{$endif}
-    function getsupreg(r:tregister):tsuperregister;{$ifdef USEINLINE}inline;{$endif}
-    function getregtype(r:tregister):tregistertype;{$ifdef USEINLINE}inline;{$endif}
-    procedure setsubreg(var r:tregister;sr:tsubregister);{$ifdef USEINLINE}inline;{$endif}
-    procedure setsupreg(var r:tregister;sr:tsuperregister);{$ifdef USEINLINE}inline;{$endif}
-    function generic_regname(r:tregister):string;
-
-
-implementation
-
-    uses
-      verbose;
-
-    function newreg(rt:tregistertype;sr:tsuperregister;sb:tsubregister):tregister;{$ifdef USEINLINE}inline;{$endif}
-      begin
-        tregisterrec(result).regtype:=rt;
-        tregisterrec(result).unused:=0;
-        tregisterrec(result).supreg:=sr;
-        tregisterrec(result).subreg:=sb;
-      end;
-
-
-    function getsubreg(r:tregister):tsubregister;{$ifdef USEINLINE}inline;{$endif}
-      begin
-        result:=tregisterrec(r).subreg;
-      end;
-
-
-    function getsupreg(r:tregister):tsuperregister;{$ifdef USEINLINE}inline;{$endif}
-      begin
-        result:=tregisterrec(r).supreg;
-      end;
-
-
-    function getregtype(r:tregister):tregistertype;{$ifdef USEINLINE}inline;{$endif}
-      begin
-        result:=tregisterrec(r).regtype;
-      end;
-
-
-    procedure setsubreg(var r:tregister;sr:tsubregister);{$ifdef USEINLINE}inline;{$endif}
-      begin
-        tregisterrec(r).subreg:=sr;
-      end;
-
-
-    procedure setsupreg(var r:tregister;sr:tsuperregister);{$ifdef USEINLINE}inline;{$endif}
-      begin
-        tregisterrec(r).supreg:=sr;
-      end;
-
-
-    function generic_regname(r:tregister):string;
-      var
-        t,sub : char;
-        nr    : string[12];
-      begin
-        case getregtype(r) of
-          R_INTREGISTER:
-            t:='i';
-          R_FPUREGISTER:
-            t:='f';
-          R_MMXREGISTER:
-            t:='x';
-          R_MMREGISTER:
-            t:='m';
-          else
-            begin
-              result:='INVALID';
-              exit;
-            end;
-        end;
-        str(getsupreg(r),nr);
-        case getsubreg(r) of
-          R_SUBNONE:
-            sub:=' ';
-          R_SUBL:
-            sub:='l';
-          R_SUBH:
-            sub:='h';
-          R_SUBW:
-            sub:='w';
-          R_SUBD:
-            sub:='d';
-          R_SUBQ:
-            sub:='q';
-          else
-            internalerror(200308252);
-        end;
-        if sub<>' ' then
-          result:=t+'reg'+nr+sub
-        else
-          result:=t+'reg'+nr;
-      end;
-
-end.
-{
-  $Log$
-  Revision 1.27  2003-09-23 17:56:05  peter
-    * locals and paras are allocated in the code generation
-    * tvarsym.localloc contains the location of para/local when
-      generating code for the current procedure
-
-  Revision 1.26  2003/09/14 19:30:58  daniel
-    * Fixed endian problem in Tregisterrec record
-
-  Revision 1.25  2003/09/04 21:07:03  florian
-    * ARM compiler compiles again
-
-  Revision 1.24  2003/09/03 21:06:19  peter
-    * write INVALID as register name instead of IE
-
-  Revision 1.23  2003/09/03 16:29:37  peter
-    * superregisters also from .dat file
-
-  Revision 1.22  2003/09/03 15:55:00  peter
-    * NEWRA branch merged
-
-  Revision 1.21.2.4  2003/09/01 21:02:55  peter
-    * sparc updates for new tregister
-
-  Revision 1.21.2.3  2003/08/29 17:28:59  peter
-    * next batch of updates
-
-  Revision 1.21.2.2  2003/08/28 18:35:07  peter
-    * tregister changed to cardinal
-
-  Revision 1.21.2.1  2003/08/27 19:55:54  peter
-    * first tregister patch
-
-  Revision 1.21  2003/04/25 20:59:33  peter
-    * removed funcretn,funcretsym, function result is now in varsym
-      and aliases for result and function name are added using absolutesym
-    * vs_hidden parameter for funcret passed in parameter
-    * vs_hidden fixes
-    * writenode changed to printnode and released from extdebug
-    * -vp option added to generate a tree.log with the nodetree
-    * nicer printnode for statements, callnode
-
-  Revision 1.20  2003/04/23 12:35:34  florian
-    * fixed several issues with powerpc
-    + applied a patch from Jonas for nested function calls (PowerPC only)
-    * ...
-
-  Revision 1.19  2003/04/22 23:50:22  peter
-    * firstpass uses expectloc
-    * checks if there are differences between the expectloc and
-      location.loc from secondpass in EXTDEBUG
-
-  Revision 1.18  2003/01/09 22:00:53  florian
-    * fixed some PowerPC issues
-
-  Revision 1.17  2003/01/05 13:36:53  florian
-    * x86-64 compiles
-    + very basic support for float128 type (x86-64 only)
-
-  Revision 1.16  2002/09/07 15:25:01  peter
-    * old logs removed and tabs fixed
-
-  Revision 1.15  2002/08/05 18:27:48  carl
-    + more more more documentation
-    + first version include/exclude (can't test though, not enough scratch for i386 :()...
-
-  Revision 1.14  2002/08/04 19:06:41  carl
-    + added generic exception support (still does not work!)
-    + more documentation
-
-  Revision 1.13  2002/07/07 09:52:32  florian
-    * powerpc target fixed, very simple units can be compiled
-    * some basic stuff for better callparanode handling, far from being finished
-
-  Revision 1.12  2002/07/01 16:23:52  peter
-    * cg64 patch
-    * basics for currency
-    * asnode updates for class and interface (not finished)
-
-  Revision 1.11  2002/05/27 19:16:08  carl
-  + added comments to virtual comparison flags
-
-  Revision 1.10  2002/05/18 13:34:05  peter
-    * readded missing revisions
-
-  Revision 1.9  2002/05/16 19:46:35  carl
-  + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
-  + try to fix temp allocation (still in ifdef)
-  + generic constructor calls
-  + start of tassembler / tmodulebase class cleanup
-
-  Revision 1.7  2002/05/13 19:54:36  peter
-    * removed n386ld and n386util units
-    * maybe_save/maybe_restore added instead of the old maybe_push
-
-  Revision 1.6  2002/05/06 19:48:26  carl
-  + added more patches from Mazen for SPARC port
-
-  Revision 1.5  2002/04/21 19:46:52  carl
-  + added patch for SPARC from Mazen (to move to cpuinfo)
-
-  Revision 1.4  2002/04/21 15:26:15  carl
-  * move stuff to cpuinfo and cpubase
-  + documented
-
-  Revision 1.3  2002/04/20 21:32:23  carl
-  + generic FPC_CHECKPOINTER
-  + first parameter offset in stack now portable
-  * rename some constants
-  + move some cpu stuff to other units
-  - remove unused constents
-  * fix stacksize for some targets
-  * fix generic size problems which depend now on EXTEND_SIZE constant
-
-  Revision 1.2  2002/04/19 15:46:01  peter
-    * mangledname rewrite, tprocdef.mangledname is now created dynamicly
-      in most cases and not written to the ppu
-    * add mangeledname_prefix() routine to generate the prefix of
-      manglednames depending on the current procedure, object and module
-    * removed static procprefix since the mangledname is now build only
-      on demand from tprocdef.mangledname
-
-  Revision 1.1  2002/04/02 18:09:47  jonas
-    + initial implementation (Peter forgot to commit it)
-
-}

+ 16 - 8
compiler/cgobj.pas

@@ -38,13 +38,13 @@ unit cgobj;
   interface
 
     uses
-       cclasses,aasmbase,aasmtai,aasmcpu,symtable,
-       cpubase,cpuinfo,
-       cginfo,
-       symconst,symbase,symtype,symdef
 {$ifdef delphi}
-       ,dmisc
+       dmisc,
 {$endif}
+       cclasses,
+       cpubase,cpuinfo,cgbase,
+       aasmbase,aasmtai,aasmcpu,
+       symconst,symbase,symtype,symdef,symtable
        ;
 
     type
@@ -471,10 +471,11 @@ unit cgobj;
        {# Code generator class for all operations working with 64-Bit operands }
        cg64 : tcg64;
 
-  implementation
+
+implementation
 
     uses
-       globals,globtype,options,systems,cgbase,
+       globals,globtype,options,systems,
        verbose,defutil,paramgr,symsym,
        rgobj,cutils;
 
@@ -484,6 +485,7 @@ unit cgobj;
         Declaring it as string here results in an error when compiling (PFV) }
       exprasmlist = 'error';
 
+
 {*****************************************************************************
                             basic functionallity
 ******************************************************************************}
@@ -1524,7 +1526,13 @@ finalization
 end.
 {
   $Log$
-  Revision 1.125  2003-09-28 17:55:03  peter
+  Revision 1.126  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.125  2003/09/28 17:55:03  peter
     * parent framepointer changed to hidden parameter
     * tloadparentfpnode added
 

+ 75 - 4
compiler/defutil.pas

@@ -28,10 +28,9 @@ interface
 
     uses
        cclasses,
-       cpuinfo,
        globals,
-       node,
-       symconst,symbase,symtype,symdef;
+       symconst,symbase,symtype,symdef,
+       cgbase,cpuinfo,cpubase;
 
     type
        tmmxtype = (mmxno,mmxu8bit,mmxs8bit,mmxu16bit,mmxs16bit,
@@ -180,6 +179,10 @@ interface
     {# returns the mmx type }
     function mmx_type(p : tdef) : tmmxtype;
 
+    {# From a definition return the abstract code generator size enum. It is
+       to note that the value returned can be @var(OS_NO) }
+    function def_cgsize(def: tdef): tcgsize;
+
 
 implementation
 
@@ -754,10 +757,78 @@ implementation
 {$endif SUPPORT_MMX}
       end;
 
+
+    function def_cgsize(def: tdef): tcgsize;
+      begin
+        case def.deftype of
+          orddef,
+          enumdef,
+          setdef:
+            begin
+              result := int_cgsize(def.size);
+              if is_signed(def) then
+                result := tcgsize(ord(result)+(ord(OS_S8)-ord(OS_8)));
+            end;
+          classrefdef,
+          pointerdef:
+            result := OS_ADDR;
+          procvardef:
+            begin
+              if tprocvardef(def).is_methodpointer and
+                 (not tprocvardef(def).is_addressonly) then
+                result := OS_64
+              else
+                result := OS_ADDR;
+            end;
+          stringdef :
+            begin
+              if is_ansistring(def) or is_widestring(def) then
+                result := OS_ADDR
+              else
+                result := OS_NO;
+            end;
+          objectdef :
+            begin
+              if is_class_or_interface(def) then
+                result := OS_ADDR
+              else
+                result := OS_NO;
+            end;
+          floatdef:
+            result := tfloat2tcgsize[tfloatdef(def).typ];
+          recorddef :
+            result:=int_cgsize(def.size);
+          arraydef :
+            begin
+              if not is_special_array(def) then
+                result := int_cgsize(def.size)
+              else
+                begin
+                  if is_dynamic_array(def) then
+                    result := OS_ADDR
+                  else
+                    result := OS_NO;
+                end;
+            end;
+          else
+            begin
+              { undefined size }
+              result:=OS_NO;
+            end;
+        end;
+      end;
+
+
 end.
 {
   $Log$
-  Revision 1.5  2003-04-25 20:59:33  peter
+  Revision 1.6  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.5  2003/04/25 20:59:33  peter
     * removed funcretn,funcretsym, function result is now in varsym
       and aliases for result and function name are added using absolutesym
     * vs_hidden parameter for funcret passed in parameter

+ 16 - 10
compiler/fmodule.pas

@@ -165,15 +165,15 @@ function get_source_file(moduleindex,fileindex : longint) : tinputfile;
 
 implementation
 
-uses
-{$ifdef delphi}
-  dmisc,
-{$else}
-  dos,
-{$endif}
-  verbose,systems,
-  scanner,
-  cgbase;
+    uses
+    {$ifdef delphi}
+      dmisc,
+    {$else}
+      dos,
+    {$endif}
+      verbose,systems,
+      scanner,
+      procinfo;
 
 
 {*****************************************************************************
@@ -652,7 +652,13 @@ uses
 end.
 {
   $Log$
-  Revision 1.37  2003-08-23 22:31:42  peter
+  Revision 1.38  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.37  2003/08/23 22:31:42  peter
     * reload also caller module when it is already compiled
 
   Revision 1.36  2003/06/07 20:26:32  peter

+ 15 - 8
compiler/globals.pas

@@ -158,11 +158,12 @@ interface
        akttokenpos,                  { position of the last token }
        aktfilepos : tfileposinfo;    { current position }
 
-       { ad 18.05.2001: Screen and Threadname for Netware }
        nwscreenname : string;
        nwthreadname : string;
        nwcopyright  : string;
 
+       codegenerror : boolean;           { true if there is an error reported }
+
        block_type : tblock_type;         { type of currently parsed block }
 
        parsing_para_level : integer;     { parameter level, used to convert
@@ -968,7 +969,7 @@ implementation
    Function GetFileTime ( Var F : File) : Longint;
      Var
      {$ifdef hasunix}
-	info: Stat;
+        info: Stat;
      {$endif}
        L : longint;
      begin
@@ -976,13 +977,13 @@ implementation
        {$IFDEF VER1_0}
         FStat (F,Info);
         {$ifdef BSD}
- 	L:=Info.st_Mtime;
- 	{$else}
- 	L:=Info.Mtime;
-	{$endif}
+        L:=Info.st_Mtime;
+        {$else}
+        L:=Info.Mtime;
+        {$endif}
        {$ELSE}
         FPFStat (F,Info);
-	L:=Info.st_Mtime;
+        L:=Info.st_Mtime;
        {$ENDIF}
      {$else}
        GetFTime(f,l);
@@ -1695,7 +1696,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.103  2003-09-24 17:13:22  florian
+  Revision 1.104  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.103  2003/09/24 17:13:22  florian
     + processor type intialization for x86-64 added
 
   Revision 1.102  2003/09/18 15:38:17  marco

+ 8 - 2
compiler/htypechk.pas

@@ -123,7 +123,7 @@ implementation
        defutil,defcmp,cpubase,
        ncnv,nld,
        nmem,ncal,nmat,
-       cginfo,cgbase
+       cgbase,procinfo
        ;
 
     type
@@ -996,7 +996,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.66  2003-08-23 18:52:18  peter
+  Revision 1.67  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.66  2003/08/23 18:52:18  peter
     * don't check size for open array in valid_for_assign
 
   Revision 1.65  2003/07/08 15:20:56  peter

+ 8 - 2
compiler/i386/ag386nsm.pas

@@ -52,7 +52,7 @@ interface
       sysutils,
 {$endif}
       cutils,globtype,globals,systems,cclasses,
-      fmodule,finput,verbose,cpuinfo,cginfo
+      fmodule,finput,verbose,cpuinfo,cgbase
       ;
 
     const
@@ -900,7 +900,13 @@ initialization
 end.
 {
   $Log$
-  Revision 1.39  2003-09-23 17:56:06  peter
+  Revision 1.40  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.39  2003/09/23 17:56:06  peter
     * locals and paras are allocated in the code generation
     * tvarsym.localloc contains the location of para/local when
       generating code for the current procedure

+ 8 - 2
compiler/i386/cgcpu.pas

@@ -29,7 +29,7 @@ unit cgcpu;
   interface
 
     uses
-       cginfo,cgbase,cgobj,cg64f32,cgx86,
+       cgbase,cgobj,cg64f32,cgx86,
        aasmbase,aasmtai,aasmcpu,
        cpubase,cpuinfo,
        node,symconst
@@ -207,7 +207,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.38  2003-09-25 13:13:32  florian
+  Revision 1.39  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.38  2003/09/25 13:13:32  florian
     * more x86-64 fixes
 
   Revision 1.37  2003/09/03 15:55:01  peter

+ 20 - 79
compiler/i386/cpupara.pas

@@ -32,7 +32,7 @@ unit cpupara;
        aasmtai,
        cpubase,
        globtype,
-       cginfo,
+       cgbase,
        symconst,symtype,symdef,paramgr;
 
     type
@@ -47,11 +47,10 @@ unit cpupara;
           function get_volatile_registers_int(calloption : tproccalloption):tsuperregisterset;override;
           function get_volatile_registers_fpu(calloption : tproccalloption):tsuperregisterset;override;
           function getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;override;
-          procedure create_paraloc_info(p : tabstractprocdef; side: tcallercallee);override;
+          function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
        private
           procedure create_funcret_paraloc_info(p : tabstractprocdef; side: tcallercallee);
           function create_stdcall_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;
-          function create_inline_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;
           function create_register_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;
        end;
 
@@ -61,8 +60,8 @@ unit cpupara;
        cutils,
        systems,globals,verbose,
        symsym,
-       cpuinfo,
-       cgbase;
+       defutil,
+       cpuinfo;
 
       const
         parasupregs : array[0..2] of tsuperregister = (RS_EAX,RS_EDX,RS_ECX);
@@ -267,10 +266,7 @@ unit cpupara;
             else
               paraloc.size:=def_cgsize(hp.paratype.def);
             paraloc.loc:=LOC_REFERENCE;
-            if assigned(current_procinfo) then
-              paraloc.reference.index:=current_procinfo.framepointer
-            else
-              paraloc.reference.index:=NR_FRAME_POINTER_REG;
+            paraloc.reference.index:=NR_FRAME_POINTER_REG;
             l:=push_size(hp.paratyp,hp.paratype.def,p.proccalloption);
             varalign:=size_2_align(l);
             paraloc.reference.offset:=parasize+target_info.first_parm_offset;
@@ -336,10 +332,7 @@ unit cpupara;
             else
               begin
                 paraloc.loc:=LOC_REFERENCE;
-                if assigned(current_procinfo) then
-                  paraloc.reference.index:=current_procinfo.framepointer
-                else
-                  paraloc.reference.index:=NR_FRAME_POINTER_REG;
+                paraloc.reference.index:=NR_FRAME_POINTER_REG;
                 l:=push_size(hp.paratyp,hp.paratype.def,p.proccalloption);
                 varalign:=size_2_align(l);
                 paraloc.reference.offset:=parasize+target_info.first_parm_offset;
@@ -360,84 +353,26 @@ unit cpupara;
       end;
 
 
-    function ti386paramanager.create_inline_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;
-      var
-        hp : tparaitem;
-        paraloc : tparalocation;
-        l,
-        varalign,
-        parasize : longint;
-      begin
-        parasize:=0;
-        hp:=tparaitem(p.para.first);
-        while assigned(hp) do
-          begin
-            if push_addr_param(hp.paratyp,hp.paratype.def,p.proccalloption) then
-              paraloc.size:=OS_ADDR
-            else
-              paraloc.size:=def_cgsize(hp.paratype.def);
-            if paraloc.size=OS_NO then
-              internalerror(200309301);
-            { Indicate parameter is loaded in register, the register
-              will be allocated when the allocpara is called }
-            paraloc.loc:=LOC_REGISTER;
-            paraloc.register:=NR_NO;
-(*
-                paraloc.loc:=LOC_REFERENCE;
-                if assigned(current_procinfo) then
-                  paraloc.reference.index:=current_procinfo.framepointer
-                else
-                  paraloc.reference.index:=NR_FRAME_POINTER_REG;
-                l:=push_size(hp.paratyp,hp.paratype.def,p.proccalloption);
-                varalign:=size_2_align(l);
-                paraloc.reference.offset:=parasize+target_info.first_parm_offset;
-                varalign:=used_align(varalign,p.paraalign,p.paraalign);
-                parasize:=align(parasize+l,varalign);
-*)
-            hp.paraloc[side]:=paraloc;
-            hp:=tparaitem(hp.next);
-          end;
-        { We need to return the size allocated }
-        result:=parasize;
-      end;
-
-
-    procedure ti386paramanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee);
-      var
-        l : longint;
+    function ti386paramanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;
       begin
+        result:=0;
         case p.proccalloption of
           pocall_register :
-            l:=create_register_paraloc_info(p,side);
-          pocall_inline :
-            begin
-              if inlining_procedure then
-                l:=create_inline_paraloc_info(p,side)
-              else
-                begin
-                  { Use default calling }
-                  if (pocall_default=pocall_register) then
-                    l:=create_register_paraloc_info(p,side)
-                  else
-                    l:=create_stdcall_paraloc_info(p,side);
-                end;
-            end;
+            result:=create_register_paraloc_info(p,side);
+          pocall_inline,
           pocall_compilerproc,
           pocall_internproc :
             begin
               { Use default calling }
               if (pocall_default=pocall_register) then
-                l:=create_register_paraloc_info(p,side)
+                result:=create_register_paraloc_info(p,side)
               else
-                l:=create_stdcall_paraloc_info(p,side);
+                result:=create_stdcall_paraloc_info(p,side);
             end;
           else
-            l:=create_stdcall_paraloc_info(p,side);
+            result:=create_stdcall_paraloc_info(p,side);
         end;
         create_funcret_paraloc_info(p,side);
-        { Store the size of the parameters on the stack }
-        if (side=calleeside) then
-          current_procinfo.para_stack_size:=l;
       end;
 
 
@@ -446,7 +381,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.34  2003-09-30 21:02:37  peter
+  Revision 1.35  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.34  2003/09/30 21:02:37  peter
     * updates for inlining
 
   Revision 1.33  2003/09/28 17:55:04  peter

+ 8 - 2
compiler/i386/cpupi.pas

@@ -39,14 +39,20 @@ unit cpupi;
   implementation
 
     uses
-      cgbase, cpubase, rgobj;
+      procinfo;
 
 begin
    cprocinfo:=ti386procinfo;
 end.
 {
   $Log$
-  Revision 1.13  2003-09-25 21:30:11  peter
+  Revision 1.14  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.13  2003/09/25 21:30:11  peter
     * parameter fixes
 
   Revision 1.12  2003/09/23 17:56:06  peter

+ 8 - 2
compiler/i386/n386add.pas

@@ -27,7 +27,7 @@ unit n386add;
 interface
 
     uses
-       node,nadd,cpubase,cginfo;
+       node,nadd,cpubase;
 
     type
        ti386addnode = class(taddnode)
@@ -1485,7 +1485,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.79  2003-09-28 21:48:20  peter
+  Revision 1.80  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.79  2003/09/28 21:48:20  peter
     * fix register leaks
 
   Revision 1.78  2003/09/28 13:35:40  peter

+ 9 - 3
compiler/i386/n386cal.pas

@@ -54,8 +54,8 @@ implementation
   {$endif}
       gdb,
 {$endif GDB}
-      cginfo,cgbase,pass_2,
-      cpubase,paramgr,
+      cgbase,pass_2,
+      cpubase,paramgr,procinfo,
       aasmbase,aasmtai,aasmcpu,
       node,ncal,nbas,nmem,nld,ncnv,
       ncgutil,cga,cgobj,tgobj,rgobj,cpuinfo;
@@ -170,7 +170,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.95  2003-09-23 17:56:06  peter
+  Revision 1.96  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.95  2003/09/23 17:56:06  peter
     * locals and paras are allocated in the code generation
     * tvarsym.localloc contains the location of para/local when
       generating code for the current procedure

+ 8 - 2
compiler/i386/n386cnv.pas

@@ -64,7 +64,7 @@ implementation
    uses
       verbose,systems,globtype,
       symconst,symdef,aasmbase,aasmtai,aasmcpu,
-      cginfo,cgbase,pass_2,
+      cgbase,pass_2,
       ncon,ncal,ncnv,
       cpubase,
       cgobj,cga,tgobj,rgobj,rgcpu,ncgutil;
@@ -332,7 +332,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.64  2003-09-28 21:48:20  peter
+  Revision 1.65  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.64  2003/09/28 21:48:20  peter
     * fix register leaks
 
   Revision 1.63  2003/09/03 15:55:01  peter

+ 9 - 2
compiler/i386/n386con.pas

@@ -39,8 +39,9 @@ implementation
 
     uses
       systems,globtype,globals,
+      defutil,
       cpubase,
-      cga,cginfo,cgbase,rgobj,rgcpu;
+      cga,cgbase,rgobj,rgcpu;
 
 {*****************************************************************************
                            TI386REALCONSTNODE
@@ -90,7 +91,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.21  2003-09-06 16:47:24  florian
+  Revision 1.22  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.21  2003/09/06 16:47:24  florian
     + support of NaN and Inf in the compiler as values of real constants
 
   Revision 1.20  2003/09/03 15:55:01  peter

+ 9 - 2
compiler/i386/n386inl.pas

@@ -62,8 +62,9 @@ implementation
     uses
       systems,globtype,
       cutils,verbose,
+      defutil,
       aasmtai,
-      cginfo,cgbase,pass_2,
+      cgbase,pass_2,
       cpubase,paramgr,
       nbas,ncon,ncal,ncnv,nld,
       cga,tgobj,ncgutil,cgobj,rgobj,rgcpu;
@@ -323,7 +324,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.67  2003-09-28 21:48:20  peter
+  Revision 1.68  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.67  2003/09/28 21:48:20  peter
     * fix register leaks
 
   Revision 1.66  2003/09/07 22:09:35  peter

+ 8 - 2
compiler/i386/n386mat.pas

@@ -62,7 +62,7 @@ implementation
       globtype,systems,
       cutils,verbose,globals,
       symconst,symdef,aasmbase,aasmtai,defutil,
-      cginfo,cgbase,pass_1,pass_2,
+      cgbase,pass_1,pass_2,
       ncon,
       cpubase,cpuinfo,
       cga,tgobj,ncgutil,cgobj,rgobj;
@@ -569,7 +569,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.62  2003-09-29 20:58:56  peter
+  Revision 1.63  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.62  2003/09/29 20:58:56  peter
     * optimized releasing of registers
 
   Revision 1.61  2003/09/28 21:48:20  peter

+ 8 - 2
compiler/i386/n386mem.pas

@@ -27,7 +27,7 @@ unit n386mem;
 interface
 
     uses
-      cginfo,cpuinfo,cpubase,
+      cgbase,cpuinfo,cpubase,
       node,nmem,ncgmem;
 
     type
@@ -142,7 +142,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.55  2003-09-29 20:58:56  peter
+  Revision 1.56  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.55  2003/09/29 20:58:56  peter
     * optimized releasing of registers
 
   Revision 1.54  2003/09/03 15:55:01  peter

+ 8 - 2
compiler/i386/n386obj.pas

@@ -36,7 +36,7 @@ uses
   symconst,symtype,symdef,symsym,
   fmodule,
   nobj,
-  cpuinfo,cpubase,cginfo,
+  cpuinfo,cpubase,
   cga,tgobj,rgobj,cgobj;
 
    type
@@ -223,7 +223,13 @@ initialization
 end.
 {
   $Log$
-  Revision 1.25  2003-09-25 21:30:11  peter
+  Revision 1.26  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.25  2003/09/25 21:30:11  peter
     * parameter fixes
 
   Revision 1.24  2003/09/25 14:59:06  peter

+ 9 - 3
compiler/i386/n386set.pas

@@ -51,9 +51,9 @@ implementation
       verbose,globals,
       symconst,symdef,defutil,
       aasmbase,aasmtai,aasmcpu,
-      cginfo,cgbase,pass_2,
+      cgbase,pass_2,
       ncon,
-      cpubase,cpuinfo,
+      cpubase,cpuinfo,procinfo,
       cga,cgobj,tgobj,ncgutil,rgobj,
       cgx86;
 
@@ -672,7 +672,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.66  2003-09-28 21:48:20  peter
+  Revision 1.67  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.66  2003/09/28 21:48:20  peter
     * fix register leaks
 
   Revision 1.65  2003/09/07 22:09:35  peter

+ 8 - 2
compiler/i386/ra386att.pas

@@ -50,7 +50,7 @@ Implementation
        scanner,
        itx86att,
        rax86,rautils,
-       cginfo,cgobj
+       procinfo,cgbase,cgobj
        ;
 
 type
@@ -2129,7 +2129,13 @@ finalization
 end.
 {
   $Log$
-  Revision 1.48  2003-09-23 20:37:53  peter
+  Revision 1.49  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.48  2003/09/23 20:37:53  peter
     * fix global var+offset
 
   Revision 1.47  2003/09/23 17:56:06  peter

+ 9 - 4
compiler/i386/ra386int.pas

@@ -47,12 +47,11 @@ Implementation
        { pass 1 }
        nbas,
        { parser }
-       rgobj,
-       { register allocator }
        scanner,
+       { register allocator }
        rautils,rax86,itx86int,
        { codegen }
-       cginfo,cgbase,cgobj
+       rgobj,cgbase,cgobj,procinfo
        ;
 
 type
@@ -1929,7 +1928,13 @@ finalization
 end.
 {
   $Log$
-  Revision 1.52  2003-09-23 20:37:53  peter
+  Revision 1.53  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.52  2003/09/23 20:37:53  peter
     * fix global var+offset
 
   Revision 1.51  2003/09/23 17:56:06  peter

+ 8 - 2
compiler/i386/rgcpu.pas

@@ -32,7 +32,7 @@ unit rgcpu;
       cpubase,
       cpuinfo,
       aasmbase,aasmtai,
-      cclasses,globtype,cgbase,cginfo,rgobj;
+      cclasses,globtype,cgbase,rgobj;
 
     type
        trgcpu = class(trgobj)
@@ -242,7 +242,13 @@ unit rgcpu;
 end.
 {
   $Log$
-  Revision 1.35  2003-09-11 11:55:00  florian
+  Revision 1.36  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.35  2003/09/11 11:55:00  florian
     * improved arm code generation
     * move some protected and private field around
     * the temp. register for register parameters/arguments are now released

+ 9 - 3
compiler/nadd.pas

@@ -72,13 +72,13 @@ implementation
       globtype,systems,
       cutils,verbose,globals,widestr,
       symconst,symtype,symdef,symsym,symtable,defutil,defcmp,
-      cginfo,cgbase,
+      cgbase,
       htypechk,pass_1,
       nbas,nmat,ncnv,ncon,nset,nopt,ncal,ninl,
       {$ifdef state_tracking}
       nstate,
       {$endif}
-      cpubase,cpuinfo;
+      cpubase,cpuinfo,procinfo;
 
 
 {*****************************************************************************
@@ -1873,7 +1873,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.95  2003-09-06 16:47:24  florian
+  Revision 1.96  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.95  2003/09/06 16:47:24  florian
     + support of NaN and Inf in the compiler as values of real constants
 
   Revision 1.94  2003/09/03 15:55:00  peter

+ 10 - 3
compiler/nbas.pas

@@ -27,7 +27,7 @@ unit nbas;
 interface
 
     uses
-       cpubase,cginfo,
+       cpubase,cgbase,
        aasmbase,aasmtai,aasmcpu,
        node,
        symtype,symppu;
@@ -177,7 +177,8 @@ implementation
       verbose,globals,globtype,systems,
       symconst,symdef,symsym,symutil,defutil,defcmp,
       pass_1,
-      nld,ncal,nflw,rgobj,cgbase
+      nld,ncal,nflw,
+      rgobj,procinfo
       ;
 
 
@@ -832,7 +833,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.62  2003-09-23 17:56:05  peter
+  Revision 1.63  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.62  2003/09/23 17:56:05  peter
     * locals and paras are allocated in the code generation
     * tvarsym.localloc contains the location of para/local when
       generating code for the current procedure

+ 9 - 2
compiler/ncal.pas

@@ -186,7 +186,8 @@ implementation
       htypechk,pass_1,cpubase,
       ncnv,nld,ninl,nadd,ncon,nmem,
       nutils,
-      rgobj,cginfo,cgbase
+      rgobj,
+      cgbase,procinfo
       ;
 
 type
@@ -2515,7 +2516,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.184  2003-09-28 21:44:55  peter
+  Revision 1.185  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.184  2003/09/28 21:44:55  peter
     * fix check that filedef needs var para
 
   Revision 1.183  2003/09/28 17:55:03  peter

+ 8 - 2
compiler/ncgadd.pas

@@ -27,7 +27,7 @@ unit ncgadd;
 interface
 
     uses
-       node,nadd,cpubase,cginfo;
+       node,nadd,cpubase;
 
     type
        tcgaddnode = class(taddnode)
@@ -735,7 +735,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.19  2003-09-14 21:57:08  jonas
+  Revision 1.20  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.19  2003/09/14 21:57:08  jonas
     * fixed release_reg_left_right for fpu registers
 
   Revision 1.18  2003/09/14 21:34:16  peter

+ 9 - 2
compiler/ncgbas.pas

@@ -70,8 +70,9 @@ interface
       globtype,systems,
       cutils,verbose,globals,
       aasmbase,aasmtai,aasmcpu,symsym,
+      defutil,
       nflw,pass_2,
-      cgbase,cginfo,cgobj,tgobj,rgobj
+      cgbase,procinfo,cgobj,tgobj,rgobj
       ;
 
 {*****************************************************************************
@@ -363,7 +364,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.40  2003-09-23 17:56:05  peter
+  Revision 1.41  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.40  2003/09/23 17:56:05  peter
     * locals and paras are allocated in the code generation
     * tvarsym.localloc contains the location of para/local when
       generating code for the current procedure

+ 14 - 7
compiler/ncgcal.pas

@@ -82,7 +82,7 @@ implementation
   {$endif}
       gdb,
 {$endif GDB}
-      cginfo,cgbase,pass_2,
+      cgbase,pass_2,
       cpuinfo,aasmbase,aasmtai,aasmcpu,
       nbas,nmem,nld,ncnv,
 {$ifdef x86}
@@ -93,7 +93,9 @@ implementation
 {$else cpu64bit}
       cg64f32,
 {$endif cpu64bit}
-      ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu;
+      ncgutil,cgobj,tgobj,
+      regvars,rgobj,rgcpu,
+      procinfo;
 
 
 {*****************************************************************************
@@ -209,10 +211,10 @@ implementation
                case left.location.loc of
                  LOC_FPUREGISTER,
                  LOC_CFPUREGISTER:
-                   cg.a_paramfpu_reg(exprasmlist,def_cgsize(p.resulttype.def),left.location.register,tempparaloc);
+                   cg.a_paramfpu_reg(exprasmlist,def_cgsize(left.resulttype.def),left.location.register,tempparaloc);
                  LOC_REFERENCE,
                  LOC_CREFERENCE :
-                   cg.a_paramfpu_ref(exprasmlist,def_cgsize(p.resulttype.def),left.location.reference,tempparaloc)
+                   cg.a_paramfpu_ref(exprasmlist,def_cgsize(left.resulttype.def),left.location.reference,tempparaloc)
                  else
                    internalerror(200204243);
                end;
@@ -1006,8 +1008,7 @@ implementation
          inlining_procedure:=true;
 
          { calculate registers to pass the parameters }
-         paramanager.create_paraloc_info(procdefinition,callerside);
-         paramanager.create_paraloc_info(procdefinition,calleeside);
+         paramanager.create_inline_paraloc_info(procdefinition);
 
 (*
          { deallocate the registers used for the current procedure's regvars }
@@ -1308,7 +1309,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.122  2003-09-30 21:02:37  peter
+  Revision 1.123  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.122  2003/09/30 21:02:37  peter
     * updates for inlining
 
   Revision 1.121  2003/09/30 19:55:19  peter

+ 9 - 3
compiler/ncgcnv.pas

@@ -61,12 +61,12 @@ interface
   implementation
 
     uses
-      cutils,verbose,globtype,
+      cutils,verbose,globtype,globals,
       aasmbase,aasmtai,aasmcpu,symconst,symdef,paramgr,
       ncon,ncal,
       cpubase,cpuinfo,systems,
       pass_2,
-      cginfo,cgbase,
+      procinfo,cgbase,
       cgobj,
       ncgutil,
       tgobj,rgobj
@@ -511,7 +511,13 @@ end.
 
 {
   $Log$
-  Revision 1.46  2003-09-28 13:39:38  peter
+  Revision 1.47  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.46  2003/09/28 13:39:38  peter
     * optimized releasing of registers
 
   Revision 1.45  2003/08/26 12:43:02  peter

+ 8 - 2
compiler/ncgcon.pas

@@ -67,7 +67,7 @@ implementation
       verbose,globals,
       symconst,symdef,aasmbase,aasmtai,aasmcpu,defutil,
       cpuinfo,cpubase,
-      cginfo,cgbase,tgobj,rgobj
+      cgbase,tgobj,rgobj
 {$ifdef delphi}
       ,dmisc
 {$endif}
@@ -554,7 +554,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.30  2003-09-06 16:47:24  florian
+  Revision 1.31  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.30  2003/09/06 16:47:24  florian
     + support of NaN and Inf in the compiler as values of real constants
 
   Revision 1.29  2003/09/03 15:55:00  peter

+ 8 - 2
compiler/ncgflw.pas

@@ -86,7 +86,7 @@ implementation
     uses
       verbose,globals,systems,globtype,
       symconst,symsym,aasmbase,aasmtai,aasmcpu,defutil,
-      cginfo,cgbase,pass_2,
+      procinfo,cgbase,pass_2,
       cpubase,cpuinfo,
       nld,ncon,
       ncgutil,
@@ -1444,7 +1444,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.81  2003-09-23 17:56:05  peter
+  Revision 1.82  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.81  2003/09/23 17:56:05  peter
     * locals and paras are allocated in the code generation
     * tvarsym.localloc contains the location of para/local when
       generating code for the current procedure

+ 9 - 3
compiler/ncginl.pas

@@ -56,8 +56,8 @@ implementation
       cutils,verbose,globals,fmodule,
       symconst,symdef,defutil,symsym,
       aasmbase,aasmtai,aasmcpu,
-      cginfo,cgbase,pass_1,pass_2,
-      cpuinfo,cpubase,paramgr,
+      cgbase,pass_1,pass_2,
+      cpuinfo,cpubase,paramgr,procinfo,
       nbas,ncon,ncal,ncnv,nld,
       tgobj,ncgutil,cgobj,rgobj
 {$ifndef cpu64bit}
@@ -663,7 +663,13 @@ end.
 
 {
   $Log$
-  Revision 1.42  2003-09-10 08:31:47  marco
+  Revision 1.43  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.42  2003/09/10 08:31:47  marco
    * Patch from Peter for paraloc
 
   Revision 1.41  2003/09/07 22:09:35  peter

+ 14 - 8
compiler/ncgld.pas

@@ -53,8 +53,8 @@ implementation
       symconst,symtype,symdef,symsym,symtable,defutil,paramgr,
       ncnv,ncon,nmem,nbas,
       aasmbase,aasmtai,aasmcpu,regvars,
-      cginfo,cgbase,pass_2,
-      cpubase,cpuinfo,
+      cgbase,pass_2,
+      cpubase,cpuinfo,procinfo,
       tgobj,ncgutil,cgobj,rgobj,ncgbas;
 
 {*****************************************************************************
@@ -699,12 +699,12 @@ implementation
 
         procedure push_value(p:tnode);
         var
-          href : treference;
 {$ifdef i386}
+          href : treference;
           tempreference : treference;
           sizetopush : longint;
-{$endif i386}
           size : longint;
+{$endif i386}
           cgsize : tcgsize;
         begin
           { we've nothing to push when the size of the parameter is 0 }
@@ -761,10 +761,10 @@ implementation
               case p.location.loc of
                 LOC_FPUREGISTER,
                 LOC_CFPUREGISTER:
-                  cg.a_paramfpu_reg(exprasmlist,def_cgsize(p.resulttype.def),p.location.register,locpara);
+                  cg.a_paramfpu_reg(exprasmlist,def_cgsize(p.resulttype.def),p.location.register,paraloc);
                 LOC_REFERENCE,
                 LOC_CREFERENCE :
-                  cg.a_paramfpu_ref(exprasmlist,def_cgsize(p.resulttype.def),p.location.reference,locpara)
+                  cg.a_paramfpu_ref(exprasmlist,def_cgsize(p.resulttype.def),p.location.reference,paraloc)
                 else
                   internalerror(200204243);
               end;
@@ -786,7 +786,7 @@ implementation
                  reference_reset_base(href,NR_STACK_POINTER_REG,0);
                  cg.g_concatcopy(exprasmlist,p.location.reference,href,size,false,false);
 {$else i386}
-                 cg.a_param_copy_ref(exprasmlist,p.resulttype.def.size,p.location.reference,locpara);
+                 cg.a_param_copy_ref(exprasmlist,p.resulttype.def.size,p.location.reference,paraloc);
 {$endif i386}
                end
               else
@@ -1045,7 +1045,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.88  2003-09-29 20:58:56  peter
+  Revision 1.89  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.88  2003/09/29 20:58:56  peter
     * optimized releasing of registers
 
   Revision 1.87  2003/09/28 21:46:18  peter

+ 8 - 2
compiler/ncgmat.pas

@@ -27,7 +27,7 @@ unit ncgmat;
 interface
 
     uses
-      node,nmat,cpubase,cgbase,cginfo;
+      node,nmat,cpubase,cgbase;
 
 type
       tcgunaryminusnode = class(tunaryminusnode)
@@ -502,7 +502,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.18  2003-09-10 08:31:47  marco
+  Revision 1.19  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.18  2003/09/10 08:31:47  marco
    * Patch from Peter for paraloc
 
   Revision 1.17  2003/09/03 15:55:00  peter

+ 9 - 3
compiler/ncgmem.pas

@@ -30,7 +30,7 @@ unit ncgmem;
 interface
 
     uses
-      cginfo,cpuinfo,cpubase,
+      cgbase,cpuinfo,cpubase,
       node,nmem;
 
     type
@@ -92,7 +92,7 @@ implementation
       cutils,verbose,globals,
       symconst,symdef,symsym,symtable,defutil,paramgr,
       aasmbase,aasmtai,
-      cgbase,pass_2,
+      procinfo,pass_2,
       pass_1,nld,ncon,nadd,
       cgobj,tgobj,rgobj,ncgutil,symbase
       ;
@@ -870,7 +870,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.76  2003-09-29 20:58:56  peter
+  Revision 1.77  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.76  2003/09/29 20:58:56  peter
     * optimized releasing of registers
 
   Revision 1.75  2003/09/28 21:45:52  peter

+ 9 - 3
compiler/ncgopt.pas

@@ -38,12 +38,12 @@ type
 implementation
 
 uses
-  globtype,
+  globtype,globals,
   pass_1,defutil,htypechk,
   symdef,paramgr,
   aasmbase,aasmtai,
   ncnv, ncon, pass_2,
-  cginfo, cgbase, cpubase,
+  cgbase, cpubase,
   tgobj, rgobj, cgobj, ncgutil;
 
 
@@ -201,7 +201,13 @@ end.
 
 {
   $Log$
-  Revision 1.8  2003-09-07 22:09:35  peter
+  Revision 1.9  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.8  2003/09/07 22:09:35  peter
     * preparations for different default calling conventions
     * various RA fixes
 

+ 8 - 2
compiler/ncgset.pas

@@ -27,7 +27,7 @@ unit ncgset;
 interface
 
     uses
-       node,nset,cpubase,cginfo,cgbase,cgobj,aasmbase,aasmtai,globals;
+       node,nset,cpubase,cgbase,cgobj,aasmbase,aasmtai,globals;
 
     type
        tcgsetelementnode = class(tsetelementnode)
@@ -1003,7 +1003,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.48  2003-09-03 15:55:01  peter
+  Revision 1.49  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.48  2003/09/03 15:55:01  peter
     * NEWRA branch merged
 
   Revision 1.47.2.1  2003/08/29 17:28:59  peter

+ 11 - 5
compiler/ncgutil.pas

@@ -29,9 +29,9 @@ interface
     uses
       node,cpuinfo,
       globtype,
-      cpubase,
+      cpubase,cgbase,
       aasmbase,aasmtai,aasmcpu,
-      cginfo,symconst,symbase,symdef,symsym,symtype,symtable,
+      symconst,symbase,symdef,symsym,symtype,symtable,
 {$ifndef cpu64bit}
       cg64f32,
 {$endif cpu64bit}
@@ -106,8 +106,8 @@ implementation
     cutils,cclasses,
     globals,systems,verbose,
     defutil,
-    paramgr,fmodule,
-    cgbase,regvars,
+    procinfo,paramgr,fmodule,
+    regvars,
 {$ifdef GDB}
     gdb,
 {$endif GDB}
@@ -1859,7 +1859,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.153  2003-09-30 21:02:37  peter
+  Revision 1.154  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.153  2003/09/30 21:02:37  peter
     * updates for inlining
 
   Revision 1.152  2003/09/29 20:58:56  peter

+ 8 - 2
compiler/ncnv.pas

@@ -178,7 +178,7 @@ implementation
       cutils,verbose,globals,widestr,
       symconst,symdef,symsym,symtable,
       ncon,ncal,nset,nadd,ninl,nmem,nmat,
-      cginfo,cgbase,
+      cgbase,procinfo,
       htypechk,pass_1,cpubase,cpuinfo;
 
 
@@ -2102,7 +2102,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.119  2003-09-25 14:57:51  peter
+  Revision 1.120  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.119  2003/09/25 14:57:51  peter
     * fix different expectloc
 
   Revision 1.118  2003/09/06 22:27:08  florian

+ 12 - 3
compiler/ncon.pas

@@ -171,8 +171,11 @@ interface
 implementation
 
     uses
-      cutils,verbose,systems,
-      defutil,cpubase,cginfo,nld;
+      cutils,
+      verbose,systems,
+      defutil,
+      cpubase,cgbase,
+      nld;
 
     function genintconstnode(v : TConstExprInt) : tordconstnode;
 
@@ -905,7 +908,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.51  2003-09-06 16:47:24  florian
+  Revision 1.52  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.51  2003/09/06 16:47:24  florian
     + support of NaN and Inf in the compiler as values of real constants
 
   Revision 1.50  2003/09/03 15:55:01  peter

+ 8 - 2
compiler/nflw.pas

@@ -220,7 +220,7 @@ implementation
     {$ifdef state_tracking}
       nstate,
     {$endif}
-      cginfo,cgbase
+      cgbase,procinfo
       ;
 
     function genloopnode(t : tnodetype;l,r,n1 : tnode;back : boolean) : tnode;
@@ -1429,7 +1429,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.79  2003-07-06 15:31:20  daniel
+  Revision 1.80  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.79  2003/07/06 15:31:20  daniel
     * Fixed register allocator. *Lots* of fixes.
 
   Revision 1.78  2003/06/13 21:19:30  peter

+ 8 - 3
compiler/ninl.pas

@@ -75,7 +75,7 @@ implementation
       symbase,symconst,symtype,symdef,symsym,symtable,paramgr,defutil,defcmp,
       pass_1,
       ncal,ncon,ncnv,nadd,nld,nbas,nflw,nmem,nmat,
-      cpubase,cginfo,cgbase
+      cpubase,cgbase,procinfo
       ;
 
    function geninlinenode(number : byte;is_const:boolean;l : tnode) : tinlinenode;
@@ -129,7 +129,6 @@ implementation
         newparas,
         dest,
         source  : tcallparanode;
-        newnode : tnode;
         procname: string;
         is_real : boolean;
 
@@ -2358,7 +2357,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.118  2003-09-23 21:10:11  peter
+  Revision 1.119  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.118  2003/09/23 21:10:11  peter
     * don't call firstpass in resulttypepass
 
   Revision 1.117  2003/09/23 17:56:05  peter

+ 11 - 4
compiler/nld.pas

@@ -142,10 +142,11 @@ implementation
 
     uses
       cutils,verbose,globtype,globals,systems,
-      symtable,paramgr,defutil,defcmp,
+      symtable,symnot,
+      defutil,defcmp,
       htypechk,pass_1,
-      ncon,ninl,ncnv,nmem,ncal,cpubase,rgobj,cginfo,cgbase
-      ,symnot
+      ncon,ninl,ncnv,nmem,ncal,
+      paramgr,cpubase,rgobj,cgbase,procinfo
       ;
 
 {*****************************************************************************
@@ -1273,7 +1274,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.107  2003-09-28 17:55:03  peter
+  Revision 1.108  2003-10-01 20:34:48  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.107  2003/09/28 17:55:03  peter
     * parent framepointer changed to hidden parameter
     * tloadparentfpnode added
 

+ 8 - 2
compiler/nmat.pas

@@ -86,7 +86,7 @@ implementation
       globtype,
       symconst,symtype,symtable,symdef,defutil,
       htypechk,pass_1,cpubase,
-      cginfo,cgbase,
+      cgbase,procinfo,
       ncon,ncnv,ncal,nadd;
 
 {****************************************************************************
@@ -831,7 +831,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.51  2003-09-07 22:09:35  peter
+  Revision 1.52  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.51  2003/09/07 22:09:35  peter
     * preparations for different default calling conventions
     * various RA fixes
 

+ 8 - 2
compiler/nmem.pas

@@ -124,7 +124,7 @@ implementation
       cutils,verbose,globals,
       symconst,symbase,defutil,defcmp,
       nbas,
-      htypechk,pass_1,ncal,nld,ncon,ncnv,cginfo,cgbase
+      htypechk,pass_1,ncal,nld,ncon,ncnv,cgbase,procinfo
       ;
 
 {*****************************************************************************
@@ -904,7 +904,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.63  2003-09-28 17:55:04  peter
+  Revision 1.64  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.63  2003/09/28 17:55:04  peter
     * parent framepointer changed to hidden parameter
     * tloadparentfpnode added
 

+ 16 - 5
compiler/nobj.pas

@@ -28,11 +28,14 @@ unit nobj;
 interface
 
     uses
-       cutils,cclasses,cpuinfo,
-       symdef,aasmbase,aasmtai,aasmcpu,globtype
 {$ifdef Delphi}
-       ,dmisc
+       dmisc,
 {$endif}
+       cutils,cclasses,
+       globtype,
+       symdef,
+       aasmbase,aasmtai,
+       cpuinfo
        ;
 
     type
@@ -149,7 +152,9 @@ implementation
 {$ifdef GDB}
        gdb,
 {$endif GDB}
-       cpubase,cgbase,cginfo,cgobj,rgobj
+       aasmcpu,
+       cpubase,procinfo,cgbase,
+       cgobj,rgobj
        ;
 
 
@@ -1339,7 +1344,13 @@ initialization
 end.
 {
   $Log$
-  Revision 1.48  2003-09-23 17:56:05  peter
+  Revision 1.49  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.48  2003/09/23 17:56:05  peter
     * locals and paras are allocated in the code generation
     * tvarsym.localloc contains the location of para/local when
       generating code for the current procedure

+ 8 - 2
compiler/node.pas

@@ -29,7 +29,7 @@ interface
     uses
        cclasses,
        globtype,globals,
-       cpubase,cginfo,
+       cpubase,cgbase,
        aasmbase,
        symtype,symppu;
 
@@ -977,7 +977,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.67  2003-09-28 17:55:04  peter
+  Revision 1.68  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.67  2003/09/28 17:55:04  peter
     * parent framepointer changed to hidden parameter
     * tloadparentfpnode added
 

+ 8 - 2
compiler/nopt.pas

@@ -86,7 +86,7 @@ var
 implementation
 
 uses cutils, htypechk, defutil, defcmp, globtype, globals, cpubase, ncnv, ncon,ncal,
-     verbose, symdef, cginfo,cgbase;
+     verbose, symdef, cgbase, procinfo;
 
 
 {*****************************************************************************
@@ -290,7 +290,13 @@ end.
 
 {
   $Log$
-  Revision 1.16  2003-05-26 21:15:18  peter
+  Revision 1.17  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.16  2003/05/26 21:15:18  peter
     * disable string node optimizations for the moment
 
   Revision 1.15  2003/04/27 11:21:33  peter

+ 8 - 2
compiler/nset.pas

@@ -118,7 +118,7 @@ implementation
       verbose,
       symconst,symdef,symsym,defutil,defcmp,
       htypechk,pass_1,
-      nbas,ncnv,ncon,cpubase,nld,rgobj,cginfo,cgbase;
+      nbas,ncnv,ncon,cpubase,nld,rgobj,cgbase;
 
     function gencasenode(l,r : tnode;nodes : pcaserecord) : tnode;
 
@@ -686,7 +686,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.44  2003-09-03 15:55:01  peter
+  Revision 1.45  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.44  2003/09/03 15:55:01  peter
     * NEWRA branch merged
 
   Revision 1.43  2003/06/12 22:09:54  jonas

+ 8 - 2
compiler/nutils.pas

@@ -61,7 +61,7 @@ implementation
       verbose,
       symconst,symsym,symtype,symdef,symtable,
       nbas,ncon,ncnv,nld,nflw,nset,ncal,nadd,nmem,
-      cgbase,
+      cgbase,procinfo,
       pass_1;
 
   function foreachnode(var n: tnode; f: foreachnodefunction): boolean;
@@ -254,7 +254,13 @@ end.
 
 {
   $Log$
-  Revision 1.6  2003-06-13 21:19:30  peter
+  Revision 1.7  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.6  2003/06/13 21:19:30  peter
     * current_procdef removed, use current_procinfo.procdef instead
 
   Revision 1.5  2003/05/26 21:17:17  peter

+ 65 - 28
compiler/paramgr.pas

@@ -29,9 +29,9 @@ unit paramgr;
   interface
 
     uses
-       cpubase,cginfo,
-       aasmtai,
        globtype,
+       cpubase,cgbase,
+       aasmtai,
        symconst,symtype,symdef;
 
     type
@@ -79,7 +79,7 @@ unit paramgr;
             @param(list Current assembler list)
             @param(loc Parameter location)
           }
-          procedure allocparaloc(list: taasmoutput; var loc: tparalocation); virtual;
+          procedure allocparaloc(list: taasmoutput; const loc: tparalocation); virtual;
 
           {# free a parameter location allocated with allocparaloc
 
@@ -88,10 +88,17 @@ unit paramgr;
           }
           procedure freeparaloc(list: taasmoutput; const loc: tparalocation); virtual;
 
-          {# This is used to populate the location information on all parameters
-             for the routine as seen in either the caller or the callee. This is used for normal call resolution.
+          { 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
+            the size allocated on the stack
           }
-          procedure create_paraloc_info(p : tabstractprocdef; side: tcallercallee);virtual;abstract;
+          function  create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;virtual;abstract;
+
+          { This is used to populate the location information on all parameters
+            for the routine when it is being inlined. It returns
+            the size allocated on the stack
+          }
+          function  create_inline_paraloc_info(p : tabstractprocdef):longint;virtual;
 
           { Return the location of the low and high part of a 64bit parameter }
           procedure splitparaloc64(const locpara:tparalocation;var loclopara,lochipara:tparalocation);virtual;
@@ -109,8 +116,8 @@ implementation
     uses
        cpuinfo,globals,systems,
        symbase,symsym,
-       rgobj,
-       defutil,cgbase,verbose;
+       rgobj,cgobj,
+       defutil,verbose;
 
     { true if uses a parameter as return value }
     function tparamanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean;
@@ -253,26 +260,15 @@ implementation
       end;
 
 
-    procedure tparamanager.allocparaloc(list: taasmoutput; var loc: tparalocation);
+    procedure tparamanager.allocparaloc(list: taasmoutput; const loc: tparalocation);
       begin
         case loc.loc of
           LOC_REGISTER, LOC_CREGISTER:
             begin
-              { NR_NO means we need to allocate imaginary registers.
-                This is used for inlining parameters (PFV) }
-              if loc.register=NR_NO then
-                begin
-{$ifndef cpu64bit}
-                  if (loc.size in [OS_64,OS_S64,OS_F64]) then
-                    begin
-                      loc.registerhigh:=rg.getregisterint(list,OS_32);
-                      loc.registerlow:=rg.getregisterint(list,OS_32);
-                    end
-                  else
-{$endif cpu64bit}
-                    loc.register:=rg.getregisterint(list,loc.size);
-                end
-              else
+              { NR_NO means we don't need to allocate the parameter.
+                This is used for inlining parameters which allocates
+                the parameters in gen_alloc_parast (PFV) }
+              if loc.register<>NR_NO then
                 begin
 {$ifndef cpu64bit}
                   if (loc.size in [OS_64,OS_S64,OS_F64]) then
@@ -287,9 +283,7 @@ implementation
             end;
           LOC_FPUREGISTER, LOC_CFPUREGISTER:
             begin
-              if loc.register=NR_NO then
-                loc.register:=rg.getregisterfpu(list,loc.size)
-              else
+              if loc.register<>NR_NO then
                 rg.getexplicitregisterfpu(list,loc.register);
             end;
           LOC_REFERENCE,LOC_CREFERENCE:
@@ -371,6 +365,43 @@ implementation
       end;
 
 
+    function tparamanager.create_inline_paraloc_info(p : tabstractprocdef):longint;
+      var
+        hp : tparaitem;
+        paraloc : tparalocation;
+        parasize : longint;
+      begin
+        parasize:=0;
+        hp:=tparaitem(p.para.first);
+        while assigned(hp) do
+          begin
+            if push_addr_param(hp.paratyp,hp.paratype.def,p.proccalloption) then
+              paraloc.size:=OS_ADDR
+            else
+              paraloc.size:=def_cgsize(hp.paratype.def);
+            if paraloc.size=OS_NO then
+              internalerror(200309301);
+            { Indicate parameter is loaded in register, the register
+              will be allocated when the allocpara is called }
+            paraloc.loc:=LOC_REGISTER;
+            paraloc.register:=NR_NO;
+(*
+                paraloc.loc:=LOC_REFERENCE;
+                paraloc.reference.index:=NR_FRAME_POINTER_REG;
+                l:=push_size(hp.paratyp,hp.paratype.def,p.proccalloption);
+                varalign:=size_2_align(l);
+                paraloc.reference.offset:=parasize+target_info.first_parm_offset;
+                varalign:=used_align(varalign,p.paraalign,p.paraalign);
+                parasize:=align(parasize+l,varalign);
+*)
+            hp.paraloc[callerside]:=paraloc;
+            hp.paraloc[calleeside]:=paraloc;
+            hp:=tparaitem(hp.next);
+          end;
+        { We need to return the size allocated }
+        result:=parasize;
+      end;
+
 
 initialization
   ;
@@ -380,7 +411,13 @@ end.
 
 {
    $Log$
-   Revision 1.57  2003-09-30 21:02:37  peter
+   Revision 1.58  2003-10-01 20:34:49  peter
+     * procinfo unit contains tprocinfo
+     * cginfo renamed to cgbase
+     * moved cgmessage to verbose
+     * fixed ppc and sparc compiles
+
+   Revision 1.57  2003/09/30 21:02:37  peter
      * updates for inlining
 
    Revision 1.56  2003/09/23 17:56:05  peter

+ 81 - 10
compiler/parser.pas

@@ -54,7 +54,8 @@ implementation
 {$endif GDB}
       comphook,
       scanner,scandir,
-      pbase,ptype,psystem,pmodules,psub,cresstr,cpuinfo;
+      pbase,ptype,psystem,pmodules,psub,
+      cresstr,cpuinfo,procinfo;
 
 
     procedure initparser;
@@ -236,6 +237,70 @@ implementation
 {$endif PREPROCWRITE}
 
 
+{*****************************************************************************
+                      Create information for a new module
+*****************************************************************************}
+
+    procedure init_module;
+      begin
+         { Create assembler output lists for CG }
+         exprasmlist:=taasmoutput.create;
+         datasegment:=taasmoutput.create;
+         codesegment:=taasmoutput.create;
+         bsssegment:=taasmoutput.create;
+         debuglist:=taasmoutput.create;
+         withdebuglist:=taasmoutput.create;
+         consts:=taasmoutput.create;
+         rttilist:=taasmoutput.create;
+         ResourceStringList:=Nil;
+         importssection:=nil;
+         exportssection:=nil;
+         resourcesection:=nil;
+         { Resource strings }
+         ResourceStrings:=TResourceStrings.Create;
+         { use the librarydata from current_module }
+         objectlibrary:=current_module.librarydata;
+      end;
+
+
+    procedure done_module;
+{$ifdef MEMDEBUG}
+      var
+        d : tmemdebug;
+{$endif}
+      begin
+{$ifdef MEMDEBUG}
+         d:=tmemdebug.create(current_module.modulename^+' - asmlists');
+{$endif}
+         exprasmlist.free;
+         codesegment.free;
+         bsssegment.free;
+         datasegment.free;
+         debuglist.free;
+         withdebuglist.free;
+         consts.free;
+         rttilist.free;
+         if assigned(ResourceStringList) then
+          ResourceStringList.free;
+         if assigned(importssection) then
+          importssection.free;
+         if assigned(exportssection) then
+          exportssection.free;
+         if assigned(resourcesection) then
+          resourcesection.free;
+{$ifdef MEMDEBUG}
+         d.free;
+{$endif}
+         { resource strings }
+         ResourceStrings.free;
+         objectlibrary:=nil;
+      end;
+
+
+{*****************************************************************************
+                             Compile a source file
+*****************************************************************************}
+
     procedure compile(const filename:string);
       type
         polddata=^tolddata;
@@ -420,17 +485,17 @@ implementation
          aktasmmode:=initasmmode;
          aktinterfacetype:=initinterfacetype;
 
-       { startup scanner and load the first file }
+         { startup scanner and load the first file }
          current_scanner:=tscannerfile.Create(filename);
          current_scanner.firstfile;
          current_module.scanner:=current_scanner;
-       { macros }
+         { macros }
          default_macros;
-       { read the first token }
+         { read the first token }
          current_scanner.readtoken;
 
-       { init code generator for a new module }
-         codegen_newmodule;
+         { init code generator for a new module }
+         init_module;
 
          { If the compile level > 1 we get a nice "unit expected" error
            message if we are trying to use a program as unit.}
@@ -468,9 +533,9 @@ implementation
            end;
 {$endif Splitheap}
 
-       { restore old state, close trees, > 0.99.5 has heapblocks, so
-         it's the default to release the trees }
-         codegen_donemodule;
+         { restore old state, close trees, > 0.99.5 has heapblocks, so
+           it's the default to release the trees }
+         done_module;
 
          if assigned(current_module) then
           begin
@@ -623,7 +688,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.56  2003-09-03 11:18:37  florian
+  Revision 1.57  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.56  2003/09/03 11:18:37  florian
     * fixed arm concatcopy
     + arm support in the common compiler sources added
     * moved some generic cg code around

+ 8 - 3
compiler/pass_1.pas

@@ -46,8 +46,7 @@ implementation
       cutils,globals,
       cgbase,symdef
 {$ifdef extdebug}
-      ,cginfo,verbose,
-      htypechk
+      ,verbose,htypechk
 {$endif extdebug}
 {$ifdef state_tracking}
       ,nstate
@@ -215,7 +214,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.31  2003-09-23 17:56:05  peter
+  Revision 1.32  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.31  2003/09/23 17:56:05  peter
     * locals and paras are allocated in the code generation
     * tvarsym.localloc contains the location of para/local when
       generating code for the current procedure

+ 9 - 5
compiler/pass_2.pas

@@ -56,7 +56,8 @@ implementation
      cclasses,globals,
      symconst,symbase,symtype,symsym,paramgr,
      aasmbase,aasmtai,
-     pass_1,cpubase,cginfo,cgbase,
+     pass_1,cpubase,cgbase,
+     procinfo,
 {$ifdef EXTDEBUG}
      cgobj,
 {$endif EXTDEBUG}
@@ -270,9 +271,6 @@ implementation
          { only do secondpass if there are no errors }
          if ErrorCount=0 then
            begin
-              { assign parameter locations }
-              current_procinfo.after_pass1;
-
               { caller paraloc info is also necessary in the stackframe_entry }
               { code of the ppc (and possibly other processors)               }
               if not current_procinfo.procdef.has_paraloc_info then
@@ -312,7 +310,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.66  2003-09-28 21:45:52  peter
+  Revision 1.67  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.66  2003/09/28 21:45:52  peter
     * fix register leak in with debug
 
   Revision 1.65  2003/09/28 17:55:04  peter

+ 8 - 2
compiler/pexpr.pas

@@ -76,7 +76,7 @@ implementation
        scanner,
        pbase,pinline,
        { codegen }
-       cgbase
+       cgbase,procinfo
        ;
 
     { sub_expr(opmultiply) is need to get -1 ** 4 to be
@@ -2416,7 +2416,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.129  2003-09-23 17:56:05  peter
+  Revision 1.130  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.129  2003/09/23 17:56:05  peter
     * locals and paras are allocated in the code generation
     * tvarsym.localloc contains the location of para/local when
       generating code for the current procedure

+ 8 - 2
compiler/pinline.pas

@@ -60,7 +60,7 @@ implementation
        scanner,
        pbase,pexpr,
        { codegen }
-       cginfo,cgbase
+       cgbase,procinfo
        ;
 
 
@@ -685,7 +685,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.18  2003-09-23 17:56:05  peter
+  Revision 1.19  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.18  2003/09/23 17:56:05  peter
     * locals and paras are allocated in the code generation
     * tvarsym.localloc contains the location of para/local when
       generating code for the current procedure

+ 8 - 2
compiler/pmodules.pas

@@ -43,7 +43,7 @@ implementation
        cgbase,cpuinfo,cgobj,
        nbas,ncgutil,
        link,assemble,import,export,gendef,ppu,comprsrc,
-       cresstr,cpubase,
+       cresstr,cpubase,procinfo,
 {$ifdef GDB}
        gdb,
 {$endif GDB}
@@ -1443,7 +1443,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.127  2003-09-30 08:39:50  michael
+  Revision 1.128  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.127  2003/09/30 08:39:50  michael
   + Patch from Wiktor Sywula for watcom support
 
   Revision 1.126  2003/09/23 18:03:08  peter

+ 8 - 2
compiler/powerpc/aasmcpu.pas

@@ -29,7 +29,7 @@ interface
 uses
   cclasses,aasmtai,
   aasmbase,globals,verbose,
-  cginfo,cpubase,cpuinfo;
+  cpubase,cpuinfo,cgbase;
 
     const
       { "mov reg,reg" source operand number }
@@ -466,7 +466,13 @@ uses cutils,rgobj;
 end.
 {
   $Log$
-  Revision 1.17  2003-09-03 19:35:24  peter
+  Revision 1.18  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.17  2003/09/03 19:35:24  peter
     * powerpc compiles again
 
   Revision 1.16  2003/09/03 15:55:01  peter

+ 8 - 2
compiler/powerpc/agppcgas.pas

@@ -46,7 +46,7 @@ unit agppcgas;
 
     uses
        cutils,globals,verbose,
-       cginfo,systems,
+       cgbase,systems,
        assemble,
        itppcgas,
        aasmcpu;
@@ -298,7 +298,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.30  2003-09-03 19:35:24  peter
+  Revision 1.31  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.30  2003/09/03 19:35:24  peter
     * powerpc compiles again
 
   Revision 1.29  2003/08/20 14:28:52  daniel

+ 8 - 2
compiler/powerpc/agppcmpw.pas

@@ -59,7 +59,7 @@ interface
 {$endif}
       cutils,globtype,systems,cclasses,
       verbose,finput,fmodule,script,cpuinfo,
-      cginfo,
+      cgbase,
       itppcgas
       ;
 
@@ -1337,7 +1337,13 @@ initialization
 end.
 {
   $Log$
-  Revision 1.25  2003-09-12 12:30:27  olle
+  Revision 1.26  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.25  2003/09/12 12:30:27  olle
     * max lenght of symbols increased to 255
     * emitted strings can now contain backslashes
 

+ 19 - 38
compiler/powerpc/cgcpu.pas

@@ -28,7 +28,7 @@ unit cgcpu;
 
     uses
        symtype,
-       cginfo,cgbase,cgobj,
+       cgbase,cgobj,
        aasmbase,aasmcpu,aasmtai,
        cpubase,cpuinfo,node,cg64f32;
 
@@ -50,7 +50,6 @@ unit cgcpu;
 
         procedure a_call_name(list : taasmoutput;const s : string);override;
         procedure a_call_reg(list : taasmoutput;reg: tregister); override;
-        procedure a_call_ref(list : taasmoutput;const ref : treference);override;
 
         procedure a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: AWord; reg: TRegister); override;
         procedure a_op_reg_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; src, dst: TRegister); override;
@@ -155,12 +154,18 @@ const
   implementation
 
     uses
-       globtype,globals,verbose,systems,cutils,symconst,symdef,symsym,rgobj,tgobj,cpupi, rgcpu;
+       globtype,globals,verbose,systems,cutils,
+       symconst,symdef,symsym,
+       rgobj,tgobj,cpupi,rgcpu,procinfo;
 
 
     procedure tcgppc.init_register_allocators;
       begin
-        rg := trgcpu.create(29,chr(ord(RS_R3))+chr(ord(RS_R4))+chr(ord(RS_R5))+chr(ord(RS_R6))+chr(ord(RS_R7))+chr(ord(RS_R8))+chr(ord(RS_R9))+chr(ord(RS_R10))+chr(ord(RS_R11))+chr(ord(RS_R12))+chr(ord(RS_R31))+chr(ord(RS_R30))+chr(ord(RS_R29))+chr(ord(RS_R28))+chr(ord(RS_R27))+chr(ord(RS_R26))+chr(ord(RS_R25))+chr(ord(RS_R24))+chr(ord(RS_R23))+chr(ord(RS_R22))+chr(ord(RS_R21))+chr(ord(RS_R20))+chr(ord(RS_R19))+chr(ord(RS_R18))+chr(ord(RS_R17))+chr(ord(RS_R16))+chr(ord(RS_R15))+chr(ord(RS_R14))+chr(ord(RS_R13)));
+        rg := trgcpu.create(29,chr(ord(RS_R3))+chr(ord(RS_R4))+chr(ord(RS_R5))+chr(ord(RS_R6))+chr(ord(RS_R7))+chr(ord(RS_R8))+
+           chr(ord(RS_R9))+chr(ord(RS_R10))+chr(ord(RS_R11))+chr(ord(RS_R12))+chr(ord(RS_R31))+chr(ord(RS_R30))+chr(ord(RS_R29))+
+           chr(ord(RS_R28))+chr(ord(RS_R27))+chr(ord(RS_R26))+chr(ord(RS_R25))+chr(ord(RS_R24))+chr(ord(RS_R23))+chr(ord(RS_R22))+
+           chr(ord(RS_R21))+chr(ord(RS_R20))+chr(ord(RS_R19))+chr(ord(RS_R18))+chr(ord(RS_R17))+chr(ord(RS_R16))+chr(ord(RS_R15))+
+           chr(ord(RS_R14))+chr(ord(RS_R13)));
       end;
 
 
@@ -301,38 +306,6 @@ const
       end;
 
 
-    { calling a procedure by address }
-    procedure tcgppc.a_call_ref(list : taasmoutput;const ref : treference);
-
-      var
-        tmpreg : tregister;
-        tmpref : treference;
-
-      begin
-        tmpreg := rg.getregisterint(list,OS_ADDR);
-        a_load_ref_reg(list,OS_ADDR,OS_ADDR,ref,tmpreg);
-        if target_info.system=system_powerpc_macos then
-          begin
-            {Generate instruction to load the procedure address from
-            the transition vector.}
-            //TODO: Support cross-TOC calls.
-            reference_reset(tmpref);
-            tmpref.offset := 0;
-            //tmpref.symaddr := refs_full;
-            tmpref.base:= tmpreg;
-            list.concat(taicpu.op_reg_ref(A_LWZ,tmpreg,tmpref));
-          end;
-        list.concat(taicpu.op_reg(A_MTCTR,tmpreg));
-        rg.ungetregisterint(list,tmpreg);
-        list.concat(taicpu.op_none(A_BCTRL));
-        //if target_info.system=system_powerpc_macos then
-        //  //NOP is not needed here.
-        //  list.concat(taicpu.op_none(A_NOP));
-        if not(pi_do_call in current_procinfo.flags) then
-          internalerror(2003060705);
-        //list.concat(tai_comment.create(strpnew('***** a_call_ref')));
-      end;
-
 {********************** load instructions ********************}
 
      procedure tcgppc.a_load_const_reg(list : taasmoutput; size: TCGSize; a : aword; reg : TRegister);
@@ -1107,7 +1080,9 @@ const
                   begin
                     if (hp.paraloc[calleeside].loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
                       begin
-                        reference_reset_base(href,current_procinfo.framepointer,tvarsym(hp.parasym).adjusted_address);
+                        if tvarsym(hp.parasym).localloc.loc<>LOC_REFERENCE then
+                          internalerror(200310011);
+                        reference_reset_base(href,tvarsym(hp.parasym).localloc.reference.index,tvarsym(hp.parasym).localloc.reference.offset);
                         reference_reset_base(href2,NR_R12,hp.paraloc[callerside].reference.offset);
                         cg.a_load_ref_ref(list,hp.paraloc[calleeside].size,hp.paraloc[calleeside].size,href2,href);
                       end
@@ -2396,7 +2371,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.126  2003-09-14 16:37:20  jonas
+  Revision 1.127  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.126  2003/09/14 16:37:20  jonas
     * fixed some ppc problems
 
   Revision 1.125  2003/09/03 21:04:14  peter

+ 8 - 19
compiler/powerpc/cpubase.pas

@@ -29,7 +29,7 @@ unit cpubase;
 interface
 
 uses
-  strings,cutils,cclasses,aasmbase,cpuinfo,cginfo;
+  strings,cutils,cclasses,aasmbase,cpuinfo,cgbase;
 
 
 {*****************************************************************************
@@ -278,23 +278,6 @@ uses
         global variables. Otherwise it contains pointers to global variables. }
       macos_direct_globals = false;
 
-{*****************************************************************************
-                                Operand
-*****************************************************************************}
-
-    type
-      toptype=(top_none,top_reg,top_ref,top_const,top_symbol,top_bool);
-
-      toper=record
-        case typ : toptype of
-         top_none   : ();
-         top_reg    : (reg:tregister);
-         top_ref    : (ref:preference);
-         top_const  : (val:aword);
-         top_symbol : (sym:tasmsymbol;symofs:longint);
-         top_bool  :  (b: boolean);
-      end;
-
 {*****************************************************************************
                                 Operand Sizes
 *****************************************************************************}
@@ -747,7 +730,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.68  2003-09-14 16:37:20  jonas
+  Revision 1.69  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.68  2003/09/14 16:37:20  jonas
     * fixed some ppc problems
 
   Revision 1.67  2003/09/03 21:04:14  peter

+ 31 - 17
compiler/powerpc/cpupara.pas

@@ -31,22 +31,22 @@ unit cpupara;
        globtype,
        aasmtai,
        cpubase,
-       symconst,symbase,symtype,symdef,paramgr, cginfo;
+       symconst,symbase,symtype,symdef,paramgr,cgbase;
 
     type
        tppcparamanager = class(tparamanager)
           function get_volatile_registers_int(calloption : tproccalloption):tsuperregisterset;override;
           function get_volatile_registers_fpu(calloption : tproccalloption):tsuperregisterset;override;
-          function push_addr_param(def : tdef;calloption : tproccalloption) : boolean;override;
+          function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
           function getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;override;
-          procedure create_paraloc_info(p : tabstractprocdef; side: tcallercallee);override;
+          function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
        end;
 
   implementation
 
     uses
        verbose,systems,
-       cpuinfo,cgbase,
+       cpuinfo,
        rgobj,
        defutil,symsym;
 
@@ -55,7 +55,7 @@ unit cpupara;
       begin
         result := [RS_R3..RS_R12];
       end;
-          
+
     function tppcparamanager.get_volatile_registers_fpu(calloption : tproccalloption):tsuperregisterset;
       begin
         case target_info.abi of
@@ -146,28 +146,34 @@ unit cpupara;
          end;
       end;
 
-    function tppcparamanager.push_addr_param(def : tdef;calloption : tproccalloption) : boolean;
+    function tppcparamanager.push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
       begin
+        { var,out always require address }
+        if varspez in [vs_var,vs_out] then
+          begin
+            result:=true;
+            exit;
+          end;
         case def.deftype of
           recorddef:
-            push_addr_param:=true;
+            result:=true;
           arraydef:
-            push_addr_param:=(tarraydef(def).highrange>=tarraydef(def).lowrange) or
+            result:=(tarraydef(def).highrange>=tarraydef(def).lowrange) or
                              is_open_array(def) or
                              is_array_of_const(def) or
                              is_array_constructor(def);
           setdef :
-            push_addr_param:=(tsetdef(def).settype<>smallset);
+            result:=(tsetdef(def).settype<>smallset);
           stringdef :
-            push_addr_param:=tstringdef(def).string_typ in [st_shortstring,st_longstring];
+            result:=tstringdef(def).string_typ in [st_shortstring,st_longstring];
           procvardef :
-            push_addr_param:=po_methodpointer in tprocvardef(def).procoptions;
+            result:=po_methodpointer in tprocvardef(def).procoptions;
           else
-            push_addr_param:=inherited push_addr_param(def,calloption);
+            result:=inherited push_addr_param(varspez,def,calloption);
         end;
       end;
 
-    procedure tppcparamanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee);
+    function tppcparamanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;
 
       var
          nextintreg,nextfloatreg,nextmmreg : tsuperregister;
@@ -199,6 +205,7 @@ unit cpupara;
         end;
 
       begin
+         result:=0;
          nextintreg:=RS_R3;
          nextfloatreg:=RS_F1;
          nextmmreg:=RS_M1;
@@ -289,7 +296,7 @@ unit cpupara;
                  LOC_REFERENCE:
                    begin
                       paraloc.size:=OS_ADDR;
-                      if push_addr_param(paradef,p.proccalloption) or
+                      if push_addr_param(hp.paratyp,paradef,p.proccalloption) or
                         is_open_array(paradef) or
                         is_array_of_const(paradef) then
                         assignintreg
@@ -306,8 +313,9 @@ unit cpupara;
               end;
               if side = calleeside then
                 begin
-                  if (paraloc.loc = LOC_REFERENCE) then
-                    paraloc.reference.offset := tvarsym(hp.parasym).adjusted_address;
+{$warning FIXME Calleeside offset needs to be calculated}
+                  {if (paraloc.loc = LOC_REFERENCE) then
+                    paraloc.reference.offset := tvarsym(hp.parasym).adjusted_address;}
                 end;
               hp.paraloc[side]:=paraloc;
               hp:=tparaitem(hp.next);
@@ -349,7 +357,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.46  2003-09-14 21:56:41  jonas
+  Revision 1.47  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.46  2003/09/14 21:56:41  jonas
     + implemented volatile register queries
 
   Revision 1.45  2003/09/14 16:37:20  jonas

+ 13 - 9
compiler/powerpc/cpupi.pas

@@ -30,7 +30,7 @@ unit cpupi;
 
     uses
        cutils,
-       cgbase,cpuinfo,psub;
+       procinfo,cpuinfo,psub;
 
     type
        tppcprocinfo = class(tcgprocinfo)
@@ -39,8 +39,7 @@ unit cpupi;
           { max. of space need for parameters, currently used by the PowerPC port only }
           maxpushedparasize : aword;
           constructor create(aparent:tprocinfo);override;
-          procedure handle_body_start;override;
-          procedure after_pass1;override;
+          procedure set_first_temp_offset;override;
           procedure allocate_push_parasize(size: longint);override;
           function calc_stackframe_size:longint;override;
        end;
@@ -63,7 +62,7 @@ unit cpupi;
       end;
 
 
-    procedure tppcprocinfo.handle_body_start;
+    procedure tppcprocinfo.set_first_temp_offset;
       var
          ofs : aword;
       begin
@@ -75,13 +74,12 @@ unit cpupi;
               abi_powerpc_sysv:
                 ofs:=align(maxpushedparasize+LinkageAreaSizeSYSV,16);
             end;
-            inc(procdef.parast.address_fixup,ofs);
-            procdef.localst.address_fixup:=procdef.parast.address_fixup+procdef.parast.datasize;
+            tg.setfirsttemp(ofs);
           end;
-        inherited handle_body_start;
       end;
 
 
+(*
     procedure tppcprocinfo.after_pass1;
       begin
          if not(po_assembler in procdef.procoptions) then
@@ -91,7 +89,6 @@ unit cpupi;
 
              if cs_asm_source in aktglobalswitches then
                aktproccode.insert(Tai_comment.Create(strpnew('Locals start at: r1+'+tostr(procdef.localst.address_fixup))));
-
              firsttemp_offset:=align(procdef.localst.address_fixup+procdef.localst.datasize,16);
              if cs_asm_source in aktglobalswitches then
                aktproccode.insert(Tai_comment.Create(strpnew('Temp. space start: r1+'+tostr(firsttemp_offset))));
@@ -102,6 +99,7 @@ unit cpupi;
              inherited after_pass1;
            end;
       end;
+*)
 
 
     procedure tppcprocinfo.allocate_push_parasize(size:longint);
@@ -126,7 +124,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.28  2003-09-28 17:55:04  peter
+  Revision 1.29  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.28  2003/09/28 17:55:04  peter
     * parent framepointer changed to hidden parameter
     * tloadparentfpnode added
 

+ 8 - 2
compiler/powerpc/itppcgas.pas

@@ -27,7 +27,7 @@ unit itppcgas;
 interface
 
     uses
-      cginfo,cpubase;
+      cpubase,cgbase;
 
     const
       gas_op2str : array[tasmop] of string[14] = ('<none>',
@@ -135,7 +135,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.1  2003-09-03 19:35:24  peter
+  Revision 1.2  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.1  2003/09/03 19:35:24  peter
     * powerpc compiles again
 
 }

+ 8 - 2
compiler/powerpc/nppcadd.pas

@@ -27,7 +27,7 @@ unit nppcadd;
 interface
 
     uses
-       node,nadd,ncgadd,cpubase,cginfo;
+       node,nadd,ncgadd,cpubase;
 
     type
        tppcaddnode = class(tcgaddnode)
@@ -1428,7 +1428,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.35  2003-09-03 19:39:16  peter
+  Revision 1.36  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.35  2003/09/03 19:39:16  peter
     * removed empty cga unit
 
   Revision 1.34  2003/09/03 19:35:24  peter

+ 11 - 69
compiler/powerpc/nppccal.pas

@@ -31,11 +31,9 @@ interface
 
     type
        tppccallnode = class(tcgcallnode)
-          function pass_1 : tnode;override;
-          procedure push_framepointer;override;
-          procedure free_pushed_framepointer;override;
        end;
 
+
 implementation
 
     uses
@@ -50,80 +48,24 @@ implementation
   {$endif}
       gdb,
 {$endif GDB}
-      cginfo,cgbase,pass_2,
+      cgbase,pass_2,
       cpuinfo,cpubase,aasmbase,aasmtai,aasmcpu,
       nmem,nld,ncnv,
-      ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu,cg64f32,cgcpu,cpupi;
-
-  function tppccallnode.pass_1 : tnode;
-
-    begin
-       result:=inherited pass_1;
-       if assigned(result) then
-         exit;
-       if procdefinition is tprocdef then
-         begin
-            if tprocdef(procdefinition).parast.datasize>tppcprocinfo(current_procinfo).maxpushedparasize then
-              tppcprocinfo(current_procinfo).maxpushedparasize:=tprocdef(procdefinition).parast.datasize;
-         end
-       else
-         begin
-            {!!!!}
-         end;
-    end;
-
-  procedure tppccallnode.push_framepointer;
-    var
-       href : treference;
-       hregister1 : tregister;
-       i : longint;
-    begin
-       if current_procinfo.procdef.parast.symtablelevel=(tprocdef(procdefinition).parast.symtablelevel) then
-         begin
-            { pass the same framepointer as the current procedure got }
-            reference_reset_base(href,current_procinfo.framepointer,PARENT_FRAMEPOINTER_OFFSET);
-            cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,NR_R11);
-            { it must be adjusted! }
-         end
-         { this is only true if the difference is one !!
-           but it cannot be more !! }
-       else if (current_procinfo.procdef.parast.symtablelevel=(tprocdef(procdefinition).parast.symtablelevel)-1) then
-         begin
-            { pass the same framepointer as the current procedure got }
-            cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,NR_R1,NR_R11);
-         end
-       else if (current_procinfo.procdef.parast.symtablelevel>(tprocdef(procdefinition).parast.symtablelevel)) then
-         begin
-            hregister1:=rg.getregisterint(exprasmlist,OS_ADDR);
-            reference_reset_base(href,current_procinfo.framepointer,PARENT_FRAMEPOINTER_OFFSET);
-            cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,hregister1);
-            { the previous frame pointer is always saved at }
-            { previous_framepointer+12 (in the link area)   }
-            reference_reset_base(href,hregister1,12);
-            i:=current_procinfo.procdef.parast.symtablelevel-1;
-            while (i>tprocdef(procdefinition).parast.symtablelevel) do
-              begin
-                 cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,href,hregister1);
-                 dec(i);
-              end;
-            cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,hregister1,NR_R11);
-            rg.ungetregisterint(exprasmlist,hregister1);
-         end
-       else
-         internalerror(2002081303);
-    end;
-
-
-  procedure tppccallnode.free_pushed_framepointer;
-    begin
-    end;
+      ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu,
+      cg64f32,cgcpu,cpupi,procinfo;
 
 begin
    ccallnode:=tppccallnode;
 end.
 {
   $Log$
-  Revision 1.21  2003-09-03 19:35:24  peter
+  Revision 1.22  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.21  2003/09/03 19:35:24  peter
     * powerpc compiles again
 
   Revision 1.20  2003/07/08 21:24:59  peter

+ 8 - 2
compiler/powerpc/nppccnv.pas

@@ -66,7 +66,7 @@ implementation
       ncon,ncal,
       ncgutil,
       cpubase,aasmcpu,
-      rgobj,tgobj,cgobj,cginfo;
+      rgobj,tgobj,cgobj;
 
 
 {*****************************************************************************
@@ -431,7 +431,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.42  2003-09-03 19:35:24  peter
+  Revision 1.43  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.42  2003/09/03 19:35:24  peter
     * powerpc compiles again
 
   Revision 1.41  2003/08/09 15:28:29  jonas

+ 9 - 2
compiler/powerpc/nppcinl.pas

@@ -49,7 +49,8 @@ implementation
       cutils,globals,
       aasmtai,aasmcpu,
       symconst,symdef,
-      cginfo,cgbase,pass_2,
+      defutil,
+      cgbase,pass_2,
       cpubase,ncgutil,
       cgobj,rgobj;
 
@@ -115,7 +116,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.9  2003-08-08 19:01:02  jonas
+  Revision 1.10  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.9  2003/08/08 19:01:02  jonas
     * fixed bug in load_fpu_location found by Olle
 
   Revision 1.8  2003/06/13 17:03:38  jonas

+ 8 - 2
compiler/powerpc/nppcmat.pas

@@ -58,7 +58,7 @@ implementation
       defutil,
       cgbase,cgobj,pass_1,pass_2,
       ncon,
-      cpubase,cpuinfo,cginfo,
+      cpubase,cpuinfo,
       ncgutil,cgcpu,cg64f32,rgobj;
 
 {*****************************************************************************
@@ -508,7 +508,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.33  2003-09-03 19:39:16  peter
+  Revision 1.34  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.33  2003/09/03 19:39:16  peter
     * removed empty cga unit
 
   Revision 1.32  2003/09/03 19:35:24  peter

+ 8 - 2
compiler/powerpc/nppcset.pas

@@ -27,7 +27,7 @@ unit nppcset;
 interface
 
     uses
-       node,nset,ncgset,cpubase,cginfo,cgbase,cgobj,aasmbase,aasmtai;
+       node,nset,ncgset,cpubase,cgbase,cgobj,aasmbase,aasmtai;
 
     type
 
@@ -158,7 +158,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.10  2003-09-03 19:39:16  peter
+  Revision 1.11  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.10  2003/09/03 19:39:16  peter
     * removed empty cga unit
 
   Revision 1.9  2003/09/03 19:35:24  peter

+ 13 - 15
compiler/powerpc/radirect.pas

@@ -51,9 +51,9 @@ interface
        { parser }
        scanner,
        { codegen }
-       cgbase,
+       cgbase,procinfo,
        { constants }
-       cginfo,cpubase,
+       cpubase,
        itppcgas
        ;
 
@@ -181,14 +181,10 @@ interface
                                                  hs:=tvarsym(sym).mangledname
                                                else
                                                  begin
-                                                    if (tvarsym(sym).reg<>NR_NO) then
-// until new regallocator stuff settles down
-//                                                      hs:=gas_reg2str[procinfo.framepointer.enum]
-                                                      hs:=gas_regname(framereg)
+                                                    if (tvarsym(sym).localloc.loc=LOC_REGISTER) then
+                                                      hs:=gas_regname(tvarsym(sym).localloc.register)
                                                     else
-                                                      hs:=tostr(tvarsym(sym).address)+
-//                                                        '('+gas_reg2str[procinfo.framepointer.enum]+')';
-                                                        '('+gas_regname(framereg)+')';
+                                                      hs:='%%'+tvarsym(sym).name;
                                                  end;
                                             end
                                           else
@@ -206,11 +202,7 @@ interface
                                             begin
                                                if sym.typ=varsym then
                                                  begin
-                                                    l:=tvarsym(sym).address;
-                                                    { set offset }
-                                                    inc(l,current_procinfo.procdef.parast.address_fixup);
-//                                                    hs:=tostr(l)+'('+gas_reg2str[procinfo.framepointer.enum]+')';
-                                                    hs:=tostr(l)+'('+gas_regname(framereg)+')';
+                                                    hs:='%%'+tvarsym(sym).name;
                                                     if pos(',',s) > 0 then
                                                       tvarsym(sym).varstate:=vs_used;
                                                  end;
@@ -340,7 +332,13 @@ initialization
 end.
 {
   $Log$
-  Revision 1.18  2003-09-04 00:15:29  florian
+  Revision 1.19  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.18  2003/09/04 00:15:29  florian
     * first bunch of adaptions of arm compiler for new register type
 
   Revision 1.17  2003/09/03 19:35:24  peter

+ 7 - 2
compiler/powerpc/rgcpu.pas

@@ -30,7 +30,6 @@ unit rgcpu;
 
      uses
        aasmbase,aasmtai,
-       cginfo,
        cpubase,
        rgobj;
 
@@ -133,7 +132,13 @@ end.
 
 {
   $Log$
-  Revision 1.15  2003-09-14 17:27:56  jonas
+  Revision 1.16  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.15  2003/09/14 17:27:56  jonas
     - removed initialization code
 
   Revision 1.14  2003/09/03 19:35:24  peter

+ 236 - 0
compiler/procinfo.pas

@@ -0,0 +1,236 @@
+{
+    $Id$
+    Copyright (c) 1998-2002 by Florian Klaempfl
+
+    Information about the current procedure that is being compiled
+
+    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.
+
+ ****************************************************************************
+}
+unit procinfo;
+
+{$i fpcdefs.inc}
+
+  interface
+
+    uses
+      { common }
+      cclasses,
+      { global }
+      globtype,globals,verbose,
+      { symtable }
+      symconst,symtype,symdef,symsym,
+      { aasm }
+      cpubase,cpuinfo,cgbase,
+      aasmbase,aasmtai
+      ;
+
+
+    type
+      tprocinfoflag=(
+        {# procedure uses asm }
+        pi_uses_asm,
+        {# procedure does a call }
+        pi_do_call,
+        {# procedure has a try statement = no register optimization }
+        pi_uses_exceptions,
+        {# procedure is declared as @var(assembler), don't optimize}
+        pi_is_assembler,
+        {# procedure contains data which needs to be finalized }
+        pi_needs_implicit_finally
+      );
+      tprocinfoflags=set of tprocinfoflag;
+
+    type
+       {# This object gives information on the current routine being
+          compiled.
+       }
+       tprocinfo = class(tlinkedlistitem)
+          { pointer to parent in nested procedures }
+          parent : tprocinfo;
+          {# the definition of the routine itself }
+          procdef : tprocdef;
+          { file location of begin of procedure }
+          entrypos  : tfileposinfo;
+          { file location of end of procedure }
+          exitpos   : tfileposinfo;
+          { local switches at begin of procedure }
+          entryswitches : tlocalswitches;
+          { local switches at end of procedure }
+          exitswitches  : tlocalswitches;
+
+          { Size of the parameters on the stack }
+          para_stack_size : longint;
+
+          {# some collected informations about the procedure
+             see pi_xxxx constants above
+          }
+          flags : tprocinfoflags;
+
+          { register used as frame pointer }
+          framepointer : tregister;
+
+          { Holds the reference used to store alll saved registers. }
+          save_regs_ref : treference;
+
+          { label to leave the sub routine }
+          aktexitlabel : tasmlabel;
+
+          {# The code for the routine itself, excluding entry and
+             exit code. This is a linked list of tai classes.
+          }
+          aktproccode : taasmoutput;
+          { Data (like jump tables) that belongs to this routine }
+          aktlocaldata : taasmoutput;
+
+          constructor create(aparent:tprocinfo);virtual;
+          destructor destroy;override;
+
+          { Allocate framepointer so it can not be used by the
+            register allocator }
+          procedure allocate_framepointer_reg;virtual;
+
+          procedure allocate_push_parasize(size:longint);virtual;
+
+          function calc_stackframe_size:longint;virtual;
+
+          { Set the address of the first temp, can be used to allocate
+            space for pushing parameters }
+          procedure set_first_temp_offset;virtual;
+
+          { Generate parameter information }
+          procedure generate_parameter_info;virtual;
+
+          { This procedure is called after the pass 1 of the subroutine body is done.
+            Here the address fix ups to generate code for the body must be done.
+          }
+          {procedure after_pass1;virtual;}
+       end;
+
+       pregvarinfo = ^tregvarinfo;
+       tregvarinfo = record
+          regvars : array[1..maxvarregs] of tvarsym;
+          regvars_para : array[1..maxvarregs] of boolean;
+          regvars_refs : array[1..maxvarregs] of longint;
+
+          fpuregvars : array[1..maxfpuvarregs] of tvarsym;
+          fpuregvars_para : array[1..maxfpuvarregs] of boolean;
+          fpuregvars_refs : array[1..maxfpuvarregs] of longint;
+       end;
+
+       tcprocinfo = class of tprocinfo;
+
+    var
+       cprocinfo : tcprocinfo;
+       { information about the current sub routine being parsed (@var(pprocinfo))}
+       current_procinfo : tprocinfo;
+
+       { save the size of pushed parameter, needed for aligning }
+       pushedparasize : longint;
+
+
+implementation
+
+     uses
+        cutils,systems,
+        cresstr,
+        tgobj,rgobj,
+        defutil,
+        fmodule
+        ,symbase,paramgr
+        ;
+
+
+{****************************************************************************
+                                 TProcInfo
+****************************************************************************}
+
+    constructor tprocinfo.create(aparent:tprocinfo);
+      begin
+        parent:=aparent;
+        procdef:=nil;
+        para_stack_size:=0;
+        flags:=[];
+        framepointer:=NR_FRAME_POINTER_REG;
+        { asmlists }
+        aktproccode:=Taasmoutput.Create;
+        aktlocaldata:=Taasmoutput.Create;
+        reference_reset(save_regs_ref);
+        { labels }
+        objectlibrary.getlabel(aktexitlabel);
+      end;
+
+
+    destructor tprocinfo.destroy;
+      begin
+         aktproccode.free;
+         aktlocaldata.free;
+      end;
+
+
+    procedure tprocinfo.allocate_framepointer_reg;
+      begin
+        if framepointer=NR_FRAME_POINTER_REG then
+          begin
+            { Make sure the register allocator won't allocate registers
+              into ebp }
+            include(rg.used_in_proc_int,RS_FRAME_POINTER_REG);
+            exclude(rg.unusedregsint,RS_FRAME_POINTER_REG);
+          end;
+      end;
+
+
+    procedure tprocinfo.allocate_push_parasize(size:longint);
+      begin
+      end;
+
+
+    function tprocinfo.calc_stackframe_size:longint;
+      var
+        _align : longint;
+      begin
+        { align to 4 bytes at least
+          otherwise all those subl $2,%esp are meaningless PM }
+        _align:=target_info.alignment.localalignmin;
+        if _align<4 then
+          _align:=4;
+        result:=Align(tg.direction*tg.lasttemp,_align);
+      end;
+
+
+    procedure tprocinfo.set_first_temp_offset;
+      begin
+      end;
+
+
+    procedure tprocinfo.generate_parameter_info;
+      begin
+        { generate callee paraloc register info, it returns the size that
+          is allocated on the stack }
+        para_stack_size:=paramanager.create_paraloc_info(procdef,calleeside);
+      end;
+
+
+end.
+{
+  $Log$
+  Revision 1.1  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+}

+ 9 - 3
compiler/pstatmnt.pas

@@ -45,7 +45,7 @@ implementation
        globtype,globals,verbose,
        systems,cpuinfo,
        { aasm }
-       cginfo,cpubase,aasmbase,aasmtai,aasmcpu,
+       cpubase,aasmbase,aasmtai,aasmcpu,
        { symtable }
        symconst,symbase,symtype,symdef,symsym,symtable,defutil,defcmp,
        paramgr,
@@ -56,7 +56,7 @@ implementation
        scanner,
        pbase,pexpr,
        { codegen }
-       tgobj,rgobj,cgbase
+       procinfo,tgobj,rgobj,cgbase
        ,ncgutil
        ,radirect
 {$ifdef i386}
@@ -1122,7 +1122,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.110  2003-09-23 17:56:05  peter
+  Revision 1.111  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.110  2003/09/23 17:56:05  peter
     * locals and paras are allocated in the code generation
     * tvarsym.localloc contains the location of para/local when
       generating code for the current procedure

+ 10 - 7
compiler/psub.pas

@@ -31,7 +31,7 @@ interface
     uses
       cclasses,globals,
       node,
-      symdef,cgbase;
+      symdef,procinfo;
 
     type
       tcgprocinfo=class(tprocinfo)
@@ -132,8 +132,6 @@ implementation
          { parse const,types and vars }
          read_declarations(islibrary);
 
-         current_procinfo.handle_body_start;
-
          { do we have an assembler block without the po_assembler?
            we should allow this for Delphi compatibility (PFV) }
          if (token=_ASM) and (m_delphi in aktmodeswitches) then
@@ -610,13 +608,12 @@ implementation
 
         { set the start offset to the start of the temp area in the stack }
         tg:=ttgobj.create;
-//        tg.setfirsttemp(firsttemp_offset);
 
         { Create register allocator }
         cg.init_register_allocators;
 
-        { generate callee paraloc register info }
-        paramanager.create_paraloc_info(current_procinfo.procdef,calleeside);
+        current_procinfo.set_first_temp_offset;
+        current_procinfo.generate_parameter_info;
 
         { Allocate space in temp/registers for parast and localst }
         aktfilepos:=entrypos;
@@ -1307,7 +1304,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.154  2003-09-29 20:58:56  peter
+  Revision 1.155  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.154  2003/09/29 20:58:56  peter
     * optimized releasing of registers
 
   Revision 1.153  2003/09/28 17:55:04  peter

+ 9 - 3
compiler/rautils.pas

@@ -28,7 +28,7 @@ Interface
 
 Uses
   cutils,cclasses,
-  globtype,aasmbase,aasmtai,cpubase,cpuinfo,cginfo,
+  globtype,aasmbase,aasmtai,cpubase,cpuinfo,cgbase,
   symconst,symbase,symtype,symdef,symsym;
 
 Const
@@ -218,7 +218,7 @@ uses
   defutil,systems,verbose,globals,
   symtable,paramgr,
   aasmcpu,
-  cgbase,tgobj;
+  tgobj,procinfo;
 
 {*************************************************************************
                               TExprParse
@@ -1502,7 +1502,13 @@ end;
 end.
 {
   $Log$
-  Revision 1.68  2003-09-25 14:57:36  peter
+  Revision 1.69  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.68  2003/09/25 14:57:36  peter
     * fix check for unreachable locals
 
   Revision 1.67  2003/09/23 17:56:06  peter

+ 9 - 3
compiler/regvars.pas

@@ -30,7 +30,7 @@ interface
        aasmbase,aasmtai,aasmcpu,
        node,
        symsym,
-       cpubase, cginfo, tgobj, rgobj;
+       cpubase, cgbase, tgobj, rgobj;
 
     procedure assign_regvars(p: tnode);
     procedure load_regvars(asml: TAAsmoutput; p: tnode);
@@ -56,7 +56,7 @@ implementation
       cutils,cclasses,verbose,globals,
       psub,
       symconst,symbase,symtype,symdef,paramgr,defutil,
-      cpuinfo,cgbase,cgobj,rgcpu;
+      cpuinfo,cgobj,rgcpu,procinfo;
 
 
     procedure searchregvars(p : tnamedindexitem;arg:pointer);
@@ -612,7 +612,13 @@ end.
 
 {
   $Log$
-  Revision 1.67  2003-09-25 13:13:32  florian
+  Revision 1.68  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.67  2003/09/25 13:13:32  florian
     * more x86-64 fixes
 
   Revision 1.66  2003/09/23 17:56:06  peter

+ 15 - 7
compiler/rgobj.pas

@@ -89,13 +89,14 @@ unit rgobj;
   interface
 
     uses
-      cutils, cpubase,
-      cpuinfo,
-      aasmbase,aasmtai,aasmcpu,
-      cclasses,globtype,cginfo,cgbase,node
 {$ifdef delphi}
-      ,dmisc
+      dmisc,
 {$endif}
+      cutils,cclasses,
+      globtype,
+      cpubase,cpuinfo,cgbase,
+      aasmbase,aasmtai,aasmcpu,
+      node
       ;
 
 
@@ -458,7 +459,8 @@ unit rgobj;
     uses
        systems,
        globals,verbose,
-       cgobj,tgobj;
+       cgobj,tgobj,
+       procinfo;
 
     constructor Trgobj.create(Acpu_registers:byte;const Ausable:string);
 
@@ -2298,7 +2300,13 @@ end.
 
 {
   $Log$
-  Revision 1.80  2003-09-30 19:54:42  peter
+  Revision 1.81  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.80  2003/09/30 19:54:42  peter
     * reuse registers with the least conflicts
 
   Revision 1.79  2003/09/29 20:58:56  peter

+ 8 - 2
compiler/sparc/aasmcpu.pas

@@ -29,7 +29,7 @@ interface
 uses
   cclasses,aasmtai,
   aasmbase,globals,verbose,
-  cginfo,cpubase,cpuinfo;
+  cgbase,cpubase,cpuinfo;
 
     const
       { "mov reg,reg" source operand number }
@@ -297,7 +297,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.33  2003-09-14 19:19:04  peter
+  Revision 1.34  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.33  2003/09/14 19:19:04  peter
     * updates for new ra
 
   Revision 1.32  2003/09/03 15:55:01  peter

+ 8 - 13
compiler/sparc/cgcpu.pas

@@ -27,7 +27,7 @@ unit cgcpu;
 interface
 
     uses
-       cginfo,cgbase,cgobj,cg64f32,
+       cgbase,cgobj,cg64f32,
        aasmbase,aasmtai,aasmcpu,
        cpubase,cpuinfo,
        node,symconst,SymType;
@@ -76,7 +76,6 @@ interface
         procedure a_jmp_flags(list:TAasmOutput;const f:TResFlags;l:tasmlabel);override;
         procedure g_flags2reg(list:TAasmOutput;Size:TCgSize;const f:tresflags;reg:TRegister);override;
         procedure g_overflowCheck(List:TAasmOutput;const Loc:TLocation;def:TDef);override;
-        procedure g_save_parent_framepointer_param(list:taasmoutput);override;
         procedure g_stackframe_entry(list:TAasmOutput;localsize:LongInt);override;
         procedure g_restore_all_registers(list:TAasmOutput;accused,acchiused:boolean);override;
         procedure g_restore_frame_pointer(list:TAasmOutput);override;
@@ -789,16 +788,6 @@ implementation
 
   { *********** entry/exit code and address loading ************ }
 
-    procedure tcgsparc.g_save_parent_framepointer_param(list:taasmoutput);
-      var
-        href : treference;
-      begin
-        reference_reset_base(href,current_procinfo.framepointer,PARENT_FRAMEPOINTER_OFFSET);
-        { Parent framepointer is always pushed the first parameter (%i0) }
-        a_load_reg_ref(list,OS_ADDR,OS_ADDR,NR_I0,href);
-      end;
-
-
     procedure TCgSparc.g_stackframe_entry(list:TAasmOutput;LocalSize:LongInt);
       begin
         { Althogh the SPARC architecture require only word alignment, software
@@ -1107,7 +1096,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.68  2003-09-14 21:35:52  peter
+  Revision 1.69  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.68  2003/09/14 21:35:52  peter
     * flags2reg fixed
     * fixed 64bit not
 

+ 8 - 18
compiler/sparc/cpubase.pas

@@ -29,7 +29,7 @@ unit cpubase;
 interface
 
 uses
-  strings,cutils,cclasses,aasmbase,cpuinfo,cginfo;
+  strings,cutils,cclasses,aasmbase,cpuinfo,cgbase;
 
 
 {*****************************************************************************
@@ -203,22 +203,6 @@ uses
       symaddr2str: array[trefsymaddr] of string[3] = ('','','%hi','%lo');
 
 
-{*****************************************************************************
-                                Operand
-*****************************************************************************}
-
-    type
-      toptype=(top_none,top_reg,top_ref,top_const,top_symbol);
-      toper=record
-        ot:LongInt;
-        case typ:toptype of
-          top_none:();
-          top_reg:(reg:tregister);
-          top_ref:(ref:preference);
-          top_const:(val:aword);
-          top_symbol:(sym:tasmsymbol;symofs:LongInt);
-      end;
-
 {*****************************************************************************
                                 Operand Sizes
 *****************************************************************************}
@@ -621,7 +605,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.51  2003-09-14 21:35:15  peter
+  Revision 1.52  2003-10-01 20:34:50  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.51  2003/09/14 21:35:15  peter
     * new volatile registers proc
 
   Revision 1.50  2003/09/14 19:19:05  peter

+ 32 - 18
compiler/sparc/cpupara.pas

@@ -25,23 +25,23 @@ unit cpupara;
 interface
 
     uses
-      cpubase,cginfo,
+      cpubase,cgbase,
       aasmtai,globtype,
       symconst,symbase,symtype,symdef,paramgr;
 
     type
       TSparcParaManager=class(TParaManager)
-        function copy_value_on_stack(def : tdef;calloption : tproccalloption) : boolean;override;
-        function push_addr_param(def : tdef;calloption : tproccalloption) : boolean;override;
-        function get_volatile_registers_int(calloption : tproccalloption):tsuperregisterset;override;
-        function get_volatile_registers_fpu(calloption : tproccalloption):tsuperregisterset;override;
+        function  copy_value_on_stack(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
+        function  push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
+        function  get_volatile_registers_int(calloption : tproccalloption):tsuperregisterset;override;
+        function  get_volatile_registers_fpu(calloption : tproccalloption):tsuperregisterset;override;
         {Returns a structure giving the information on the storage of the parameter
         (which must be an integer parameter)
         @param(nr Parameter number of routine, starting from 1)}
-        function getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;override;
+        function  getintparaloc(calloption : tproccalloption; nr : longint) : tparalocation;override;
         procedure allocparaloc(list: taasmoutput; const loc: tparalocation);override;
         procedure freeparaloc(list: taasmoutput; const loc: tparalocation);override;
-        procedure create_paraloc_info(p:TAbstractProcDef; side: tcallercallee);override;
+        function  create_paraloc_info(p:TAbstractProcDef; side: tcallercallee):longint;override;
         procedure splitparaloc64(const locpara:tparalocation;var loclopara,lochipara:tparalocation);override;
       end;
 
@@ -50,19 +50,25 @@ implementation
 
     uses
       verbose,
-      cpuinfo,cgbase,
+      cpuinfo,
       defutil,rgobj;
 
-    function tsparcparamanager.copy_value_on_stack(def : tdef;calloption : tproccalloption) : boolean;
+    function tsparcparamanager.copy_value_on_stack(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
       begin
         result:=false;
       end;
 
 
     { true if a parameter is too large to copy and only the address is pushed }
-    function tsparcparamanager.push_addr_param(def : tdef;calloption : tproccalloption) : boolean;
+    function tsparcparamanager.push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
       begin
-        push_addr_param:=false;
+        result:=false;
+        { var,out always require address }
+        if varspez in [vs_var,vs_out] then
+          begin
+            result:=true;
+            exit;
+          end;
         case def.deftype of
           recorddef,
           arraydef,
@@ -70,13 +76,13 @@ implementation
           formaldef :
             push_addr_param:=true;
           objectdef :
-            push_addr_param:=is_object(def);
+            result:=is_object(def);
           stringdef :
-            push_addr_param:=(tstringdef(def).string_typ in [st_shortstring,st_longstring]);
+            result:=(tstringdef(def).string_typ in [st_shortstring,st_longstring]);
           procvardef :
-            push_addr_param:=(po_methodpointer in tprocvardef(def).procoptions);
+            result:=(po_methodpointer in tprocvardef(def).procoptions);
           setdef :
-            push_addr_param:=(tsetdef(def).settype<>smallset);
+            result:=(tsetdef(def).settype<>smallset);
         end;
       end;
 
@@ -137,7 +143,7 @@ implementation
       end;
 
 
-    procedure TSparcParaManager.create_paraloc_info(p:TAbstractProcDef; side: tcallercallee);
+    function TSparcParaManager.create_paraloc_info(p:TAbstractProcDef; side: tcallercallee):longint;
       var
         nextintreg : tsuperregister;
         stack_offset : longint;
@@ -154,7 +160,7 @@ implementation
         while assigned(hp) do
           begin
             fillchar(paraloc,sizeof(tparalocation),0);
-            if push_addr_param(hp.paratype.def,p.proccalloption) or (hp.paratyp in [vs_var,vs_out]) then
+            if push_addr_param(hp.paratyp,hp.paratype.def,p.proccalloption) or (hp.paratyp in [vs_var,vs_out]) then
               paraloc.size:=OS_ADDR
             else
               begin
@@ -255,6 +261,8 @@ implementation
             paraloc.loc:=LOC_REFERENCE;
           end;
         p.funcret_paraloc[side]:=paraloc;
+        { Size on stack is not used }
+        result:=0;
       end;
 
 
@@ -285,7 +293,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.30  2003-09-14 21:35:15  peter
+  Revision 1.31  2003-10-01 20:34:50  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.30  2003/09/14 21:35:15  peter
     * new volatile registers proc
 
   Revision 1.29  2003/09/14 19:19:05  peter

+ 10 - 4
compiler/sparc/cpupi.pas

@@ -28,7 +28,7 @@ interface
 
   uses
     cutils,
-    cgbase,cpuinfo,
+    procinfo,cpuinfo,
     psub;
 
   type
@@ -66,7 +66,7 @@ implementation
         savearea : longint;
       begin
         { ABI requires at least space to save 6 arguments }
-        savearea:=procdef.parast.address_fixup+max(maxpushedparasize,6*4);
+        savearea:=max(maxpushedparasize,6*4);
         {
           Stackframe layout:
           %fp
@@ -77,7 +77,7 @@ implementation
             <register window save area for calling>
           %sp
         }
-        result:=Align(tg.direction*tg.lasttemp+savearea,4);
+        result:=Align(tg.direction*tg.lasttemp+savearea+target_info.first_parm_offset,4);
       end;
 
 
@@ -86,7 +86,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.21  2003-09-14 19:19:05  peter
+  Revision 1.22  2003-10-01 20:34:50  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.21  2003/09/14 19:19:05  peter
     * updates for new ra
 
   Revision 1.20  2003/09/03 15:55:01  peter

+ 8 - 2
compiler/sparc/ncpuadd.pas

@@ -27,7 +27,7 @@ unit ncpuadd;
 interface
 
     uses
-       node,ncgadd,cpubase,cginfo;
+       node,ncgadd,cpubase;
 
     type
        tsparcaddnode = class(tcgaddnode)
@@ -257,7 +257,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.19  2003-09-03 15:55:01  peter
+  Revision 1.20  2003-10-01 20:34:50  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.19  2003/09/03 15:55:01  peter
     * NEWRA branch merged
 
   Revision 1.18.2.1  2003/09/01 21:02:55  peter

+ 8 - 2
compiler/sparc/ncpucnv.pas

@@ -64,7 +64,7 @@ implementation
       ncon,ncal,
       ncgutil,
       cpubase,aasmcpu,
-      rgobj,tgobj,cgobj,cginfo;
+      rgobj,tgobj,cgobj;
 
 
 {*****************************************************************************
@@ -251,7 +251,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.18  2003-09-14 21:36:01  peter
+  Revision 1.19  2003-10-01 20:34:50  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.18  2003/09/14 21:36:01  peter
     * remove ppc code
 
   Revision 1.17  2003/06/04 20:59:37  mazen

+ 8 - 2
compiler/sparc/ncpuinln.pas

@@ -49,7 +49,7 @@ implementation
       cutils,verbose,globals,fmodule,
       symconst,symdef,
       aasmbase,aasmtai,aasmcpu,
-      cginfo,cgbase,pass_1,pass_2,
+      cgbase,pass_1,pass_2,
       cpubase,paramgr,
       nbas,ncon,ncal,ncnv,nld,
       tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu;
@@ -123,7 +123,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.5  2003-06-13 17:05:24  jonas
+  Revision 1.6  2003-10-01 20:34:50  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.5  2003/06/13 17:05:24  jonas
     * fixed small LOC_(C)FPUREGISTER bug
 
   Revision 1.4  2003/06/01 21:38:07  peter

+ 8 - 2
compiler/sparc/ncpumat.pas

@@ -54,7 +54,7 @@ implementation
       defutil,
       cgbase,cgobj,pass_1,pass_2,
       ncon,
-      cpubase,cpuinfo,cginfo,
+      cpubase,cpuinfo,
       ncgutil,cgcpu,cg64f32,rgobj;
 
 {*****************************************************************************
@@ -318,7 +318,13 @@ begin
 end.
 {
   $Log$
-  Revision 1.14  2003-09-03 15:55:01  peter
+  Revision 1.15  2003-10-01 20:34:50  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.14  2003/09/03 15:55:01  peter
     * NEWRA branch merged
 
   Revision 1.13  2003/09/03 11:18:37  florian

+ 13 - 24
compiler/sparc/radirect.pas

@@ -46,7 +46,7 @@ interface
        scanner,
        rautils,
        { codegen }
-       cginfo,cgbase,
+       procinfo,cgbase,
        { constants }
        aggas,cpubase,globtype
        ;
@@ -61,7 +61,6 @@ interface
          srsym,sym : tsym;
          srsymtable : tsymtable;
          code : TAAsmoutput;
-         framereg : tregister;
          i,l : longint;
 
        procedure writeasmline;
@@ -87,12 +86,6 @@ interface
        if assigned(current_procinfo.procdef.funcretsym) and
           is_fpu(current_procinfo.procdef.rettype.def) then
          tvarsym(current_procinfo.procdef.funcretsym).varstate:=vs_assigned;
-       framereg:=current_procinfo.framepointer;
-       if (not is_void(current_procinfo.procdef.rettype.def)) then
-         retstr:=upper(tostr(tvarsym(current_procinfo.procdef.funcretsym).adjusted_address)+'('+std_regname(framereg)+')')
-       else
-         retstr:='';
-
 
        c:=current_scanner.asmgetchar;
        code:=TAAsmoutput.Create;
@@ -138,11 +131,6 @@ interface
                            begin
                               { is the last written character an special }
                               { char ?                                   }
-                              if (s[length(s)]='%') and
-                                 (not paramanager.ret_in_param(current_procinfo.procdef.rettype.def,current_procinfo.procdef.proccalloption)) and
-                                 ((pos('AX',upper(hs))>0) or
-                                 (pos('AL',upper(hs))>0)) then
-                                tvarsym(current_procinfo.procdef.funcretsym).varstate:=vs_assigned;
                               if (s[length(s)]<>'%') and
                                 (s[length(s)]<>'$') and
                                 ((s[length(s)]<>'0') or (hs[1]<>'x')) then
@@ -170,8 +158,7 @@ interface
                                           if (vo_is_external in tvarsym(sym).varoptions) then
                                             hs:=tvarsym(sym).mangledname
                                           else
-                                            hs:='-'+tostr(tvarsym(sym).address)+
-                                                '('+std_regname(current_procinfo.framepointer)+')';
+                                            hs:='%%'+tvarsym(sym).name;
                                           end
                                         else
                                         { call to local function }
@@ -191,12 +178,9 @@ interface
                                           begin
                                              if sym.typ=varsym then
                                                begin
-                                                  l:=tvarsym(sym).address;
-                                                  { set offset }
-                                                  inc(l,current_procinfo.procdef.parast.address_fixup);
-                                                  hs:=tostr(l)+'('+std_regname(current_procinfo.framepointer)+')';
-                                                  if pos(',',s) > 0 then
-                                                    tvarsym(sym).varstate:=vs_used;
+                                                 hs:='%%'+tvarsym(sym).name;
+                                                 if pos(',',s) > 0 then
+                                                   tvarsym(sym).varstate:=vs_used;
                                                end;
                                           end
                                      end
@@ -281,8 +265,7 @@ interface
                                               case sym.typ of
                                                 varsym :
                                                   begin
-                                                    hs:=tostr(tvarsym(sym).adjusted_address)+
-                                                        '('+std_regname(framereg)+')';
+                                                    hs:='%%'+tvarsym(sym).name;
                                                     inc(tvarsym(sym).refs);
                                                   end;
                                                 typedconstsym :
@@ -339,7 +322,13 @@ initialization
 end.
 {
   $Log$
-  Revision 1.14  2003-09-03 15:55:01  peter
+  Revision 1.15  2003-10-01 20:34:50  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.14  2003/09/03 15:55:01  peter
     * NEWRA branch merged
 
   Revision 1.13.2.1  2003/09/01 21:02:55  peter

+ 8 - 2
compiler/sparc/rgcpu.pas

@@ -32,7 +32,7 @@ interface
       aasmcpu,
       aasmtai,
       cclasses,globtype,
-      cginfo,cgbase,aasmbase,rgobj;
+      cgbase,aasmbase,rgobj;
 
     type
       trgcpu=class(trgobj)
@@ -105,7 +105,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.18  2003-09-14 19:19:05  peter
+  Revision 1.19  2003-10-01 20:34:50  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.18  2003/09/14 19:19:05  peter
     * updates for new ra
 
   Revision 1.17  2003/09/03 15:55:01  peter

+ 10 - 2
compiler/symdef.pas

@@ -37,7 +37,9 @@ interface
        { node }
        node,
        { aasm }
-       aasmbase,aasmtai,cginfo,cpubase,cpuinfo
+       aasmbase,aasmtai,
+       cpubase,cpuinfo,
+       cgbase
 {$ifdef Delphi}
        ,dmisc
 {$endif}
@@ -5895,7 +5897,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.167  2003-10-01 16:49:05  florian
+  Revision 1.168  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.167  2003/10/01 16:49:05  florian
     * para items are now reversed for pascal calling conventions
 
   Revision 1.166  2003/10/01 15:32:58  florian

+ 12 - 5
compiler/symsym.pas

@@ -29,15 +29,15 @@ interface
        { common }
        cutils,
        { target }
-       cginfo,cpuinfo,globtype,
+       globtype,globals,
        { symtable }
        symconst,symbase,symtype,symdef,
        { ppu }
        ppu,symppu,
        cclasses,symnot,
        { aasm }
-       aasmbase,aasmtai,cpubase,
-       globals
+       aasmbase,aasmtai,
+       cpuinfo,cpubase,cgbase
        ;
 
     type
@@ -379,7 +379,8 @@ implementation
        { module }
        fmodule,
        { codegen }
-       tgobj,paramgr,cgbase,cresstr
+       tgobj,paramgr,cresstr,
+       procinfo
        ;
 
 {****************************************************************************
@@ -2677,7 +2678,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.121  2003-09-25 21:25:37  peter
+  Revision 1.122  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.121  2003/09/25 21:25:37  peter
     * has_local_copy gdb fix
 
   Revision 1.120  2003/09/25 16:18:54  peter

+ 14 - 7
compiler/tgobj.pas

@@ -33,10 +33,10 @@ unit tgobj;
   interface
 
     uses
-      globals,
-      cpubase,
-      cpuinfo,cginfo,
-      cclasses,globtype,cgbase,aasmbase,aasmtai,aasmcpu;
+      cclasses,
+      globals,globtype,
+      cpubase,cpuinfo,cgbase,
+      aasmbase,aasmtai,aasmcpu;
 
     type
       ptemprecord = ^ttemprecord;
@@ -109,8 +109,9 @@ unit tgobj;
     implementation
 
     uses
-       systems,
-       verbose,cutils
+       cutils,
+       systems,verbose,
+       procinfo
        ;
 
 
@@ -540,7 +541,13 @@ unit tgobj;
 end.
 {
   $Log$
-  Revision 1.39  2003-09-23 17:56:06  peter
+  Revision 1.40  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.39  2003/09/23 17:56:06  peter
     * locals and paras are allocated in the code generation
     * tvarsym.localloc contains the location of para/local when
       generating code for the current procedure

+ 183 - 61
compiler/verbose.pas

@@ -31,10 +31,10 @@ unit verbose;
 
 interface
 
-uses
-  cutils,
-  globals,finput,
-  cmsgs;
+    uses
+      cutils,
+      globals,finput,
+      cmsgs;
 
 {$ifndef EXTERN_MSG}
   {$i msgtxt.inc}
@@ -42,63 +42,73 @@ uses
 
 {$i msgidx.inc}
 
-Const
-  { Levels }
-  V_None         = $0;
-  V_Fatal        = $1;
-  V_Error        = $2;
-  V_Normal       = $4; { doesn't show a text like Error: }
-  V_Warning      = $8;
-  V_Note         = $10;
-  V_Hint         = $20;
-  V_LineInfoMask = $fff;
-  { From here by default no line info }
-  V_Info         = $1000;
-  V_Status       = $2000;
-  V_Used         = $4000;
-  V_Tried        = $8000;
-  V_Conditional  = $10000;
-  V_Debug        = $20000;
-  V_Executable   = $40000;
-  V_LevelMask    = $fffffff;
-  V_All          = V_LevelMask;
-  V_Default      = V_Fatal + V_Error + V_Normal;
-  { Flags }
-  V_LineInfo     = $10000000;
+    Const
+      { Levels }
+      V_None         = $0;
+      V_Fatal        = $1;
+      V_Error        = $2;
+      V_Normal       = $4; { doesn't show a text like Error: }
+      V_Warning      = $8;
+      V_Note         = $10;
+      V_Hint         = $20;
+      V_LineInfoMask = $fff;
+      { From here by default no line info }
+      V_Info         = $1000;
+      V_Status       = $2000;
+      V_Used         = $4000;
+      V_Tried        = $8000;
+      V_Conditional  = $10000;
+      V_Debug        = $20000;
+      V_Executable   = $40000;
+      V_LevelMask    = $fffffff;
+      V_All          = V_LevelMask;
+      V_Default      = V_Fatal + V_Error + V_Normal;
+      { Flags }
+      V_LineInfo     = $10000000;
+
+    var
+      msg : pmessage;
+
+    const
+      msgfilename : string = '';
 
-var
-  msg : pmessage;
-
-const
-  msgfilename : string = '';
-
-procedure SetRedirectFile(const fn:string);
-function  SetVerbosity(const s:string):boolean;
-procedure PrepareReport;
-
-function  CheckVerbosity(v:longint):boolean;
-procedure SetCompileModule(p:tmodulebase);
-procedure Stop;
-procedure ShowStatus;
-function  ErrorCount:longint;
-procedure SetErrorFlags(const s:string);
-procedure GenerateError;
-procedure Internalerror(i:longint);
-procedure Comment(l:longint;s:string);
-function  MessagePchar(w:longint):pchar;
-procedure Message(w:longint);
-procedure Message1(w:longint;const s1:string);
-procedure Message2(w:longint;const s1,s2:string);
-procedure Message3(w:longint;const s1,s2,s3:string);
-procedure Message4(w:longint;const s1,s2,s3,s4:string);
-procedure MessagePos(const pos:tfileposinfo;w:longint);
-procedure MessagePos1(const pos:tfileposinfo;w:longint;const s1:string);
-procedure MessagePos2(const pos:tfileposinfo;w:longint;const s1,s2:string);
-procedure MessagePos3(const pos:tfileposinfo;w:longint;const s1,s2,s3:string);
-procedure MessagePos4(const pos:tfileposinfo;w:longint;const s1,s2,s3,s4:string);
-
-procedure InitVerbose;
-procedure DoneVerbose;
+    procedure SetRedirectFile(const fn:string);
+    function  SetVerbosity(const s:string):boolean;
+    procedure PrepareReport;
+
+    function  CheckVerbosity(v:longint):boolean;
+    procedure SetCompileModule(p:tmodulebase);
+    procedure Stop;
+    procedure ShowStatus;
+    function  ErrorCount:longint;
+    procedure SetErrorFlags(const s:string);
+    procedure GenerateError;
+    procedure Internalerror(i:longint);
+    procedure Comment(l:longint;s:string);
+    function  MessagePchar(w:longint):pchar;
+    procedure Message(w:longint);
+    procedure Message1(w:longint;const s1:string);
+    procedure Message2(w:longint;const s1,s2:string);
+    procedure Message3(w:longint;const s1,s2,s3:string);
+    procedure Message4(w:longint;const s1,s2,s3,s4:string);
+    procedure MessagePos(const pos:tfileposinfo;w:longint);
+    procedure MessagePos1(const pos:tfileposinfo;w:longint;const s1:string);
+    procedure MessagePos2(const pos:tfileposinfo;w:longint;const s1,s2:string);
+    procedure MessagePos3(const pos:tfileposinfo;w:longint;const s1,s2,s3:string);
+    procedure MessagePos4(const pos:tfileposinfo;w:longint;const s1,s2,s3,s4:string);
+
+    { message calls with codegenerror support }
+    procedure cgmessage(t : longint);
+    procedure cgmessage1(t : longint;const s : string);
+    procedure cgmessage2(t : longint;const s1,s2 : string);
+    procedure cgmessage3(t : longint;const s1,s2,s3 : string);
+    procedure CGMessagePos(const pos:tfileposinfo;t:longint);
+    procedure CGMessagePos1(const pos:tfileposinfo;t:longint;const s1:string);
+    procedure CGMessagePos2(const pos:tfileposinfo;t:longint;const s1,s2:string);
+    procedure CGMessagePos3(const pos:tfileposinfo;t:longint;const s1,s2,s3:string);
+
+    procedure InitVerbose;
+    procedure DoneVerbose;
 
 
 implementation
@@ -660,6 +670,112 @@ var
       end;
 
 
+{*****************************************************************************
+            override the message calls to set codegenerror
+*****************************************************************************}
+
+    procedure cgmessage(t : longint);
+      var
+         olderrorcount : longint;
+      begin
+         if not(codegenerror) then
+           begin
+              olderrorcount:=Errorcount;
+              verbose.Message(t);
+              codegenerror:=olderrorcount<>Errorcount;
+           end;
+      end;
+
+    procedure cgmessage1(t : longint;const s : string);
+      var
+         olderrorcount : longint;
+      begin
+         if not(codegenerror) then
+           begin
+              olderrorcount:=Errorcount;
+              verbose.Message1(t,s);
+              codegenerror:=olderrorcount<>Errorcount;
+           end;
+      end;
+
+    procedure cgmessage2(t : longint;const s1,s2 : string);
+      var
+         olderrorcount : longint;
+      begin
+         if not(codegenerror) then
+           begin
+              olderrorcount:=Errorcount;
+              verbose.Message2(t,s1,s2);
+              codegenerror:=olderrorcount<>Errorcount;
+           end;
+      end;
+
+    procedure cgmessage3(t : longint;const s1,s2,s3 : string);
+      var
+         olderrorcount : longint;
+      begin
+         if not(codegenerror) then
+           begin
+              olderrorcount:=Errorcount;
+              verbose.Message3(t,s1,s2,s3);
+              codegenerror:=olderrorcount<>Errorcount;
+           end;
+      end;
+
+
+    procedure cgmessagepos(const pos:tfileposinfo;t : longint);
+      var
+         olderrorcount : longint;
+      begin
+         if not(codegenerror) then
+           begin
+              olderrorcount:=Errorcount;
+              verbose.MessagePos(pos,t);
+              codegenerror:=olderrorcount<>Errorcount;
+           end;
+      end;
+
+    procedure cgmessagepos1(const pos:tfileposinfo;t : longint;const s1 : string);
+      var
+         olderrorcount : longint;
+      begin
+         if not(codegenerror) then
+           begin
+              olderrorcount:=Errorcount;
+              verbose.MessagePos1(pos,t,s1);
+              codegenerror:=olderrorcount<>Errorcount;
+           end;
+      end;
+
+    procedure cgmessagepos2(const pos:tfileposinfo;t : longint;const s1,s2 : string);
+      var
+         olderrorcount : longint;
+      begin
+         if not(codegenerror) then
+           begin
+              olderrorcount:=Errorcount;
+              verbose.MessagePos2(pos,t,s1,s2);
+              codegenerror:=olderrorcount<>Errorcount;
+           end;
+      end;
+
+    procedure cgmessagepos3(const pos:tfileposinfo;t : longint;const s1,s2,s3 : string);
+      var
+         olderrorcount : longint;
+      begin
+         if not(codegenerror) then
+           begin
+              olderrorcount:=Errorcount;
+              verbose.MessagePos3(pos,t,s1,s2,s3);
+              codegenerror:=olderrorcount<>Errorcount;
+           end;
+      end;
+
+
+{*****************************************************************************
+                                Initialization
+*****************************************************************************}
+
     procedure InitVerbose;
       begin
       { Init }
@@ -705,7 +821,13 @@ finalization
 end.
 {
   $Log$
-  Revision 1.26  2003-04-25 20:59:35  peter
+  Revision 1.27  2003-10-01 20:34:49  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.26  2003/04/25 20:59:35  peter
     * removed funcretn,funcretsym, function result is now in varsym
       and aliases for result and function name are added using absolutesym
     * vs_hidden parameter for funcret passed in parameter

+ 9 - 2
compiler/x86/aasmcpu.pas

@@ -32,7 +32,8 @@ interface
 
     uses
       cclasses,globals,verbose,
-      cginfo,cpuinfo,cpubase,
+      cpuinfo,cpubase,
+      cgbase,
       symppu,symtype,symsym,
       aasmbase,aasmtai;
 
@@ -2317,7 +2318,13 @@ implementation
 end.
 {
   $Log$
-  Revision 1.29  2003-09-29 20:58:56  peter
+  Revision 1.30  2003-10-01 20:34:50  peter
+    * procinfo unit contains tprocinfo
+    * cginfo renamed to cgbase
+    * moved cgmessage to verbose
+    * fixed ppc and sparc compiles
+
+  Revision 1.29  2003/09/29 20:58:56  peter
     * optimized releasing of registers
 
   Revision 1.28  2003/09/28 21:49:30  peter

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio