Browse Source

* new codegenerator compiles again

florian 26 năm trước cách đây
mục cha
commit
8b9633266b

+ 6 - 1
compiler/compiler.pas

@@ -289,7 +289,9 @@ begin
 {$ifdef FPC}
   Writeln('Memory Lost = '+tostr(system.HeapSize-MemAvail-EntryMemUsed));
 {$endif FPC}
+{$ifndef newcg}
   Writeln('Repetitive firstpass = '+tostr(firstpass_several)+'/'+tostr(total_of_firstpass));
+{$endif newcg}
 {$endif EXTDEBUG}
 
 end;
@@ -298,7 +300,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.35  1999-09-28 19:48:45  florian
+  Revision 1.36  1999-10-12 21:20:41  florian
+    * new codegenerator compiles again
+
+  Revision 1.35  1999/09/28 19:48:45  florian
     * bug 617 fixed
 
   Revision 1.34  1999/09/16 23:05:52  florian

+ 1 - 0
compiler/msgidx.inc

@@ -307,6 +307,7 @@ type tmsgconst=(
   cg_e_unable_inline_object_methods,
   cg_e_unable_inline_procvar,
   cg_e_no_code_for_inline_stored,
+  cg_e_no_call_to_interrupt,
   cg_e_can_access_element_zero,
   cg_e_include_not_implemented,
   cg_e_cannot_call_cons_dest_inside_with,

+ 105 - 104
compiler/msgtxt.inc

@@ -1,7 +1,7 @@
 {$ifdef Delphi}
-const msgtxt : array[0..000102] of string[240]=(
+const msgtxt : array[0..000103] of string[240]=(
 {$else Delphi}
-const msgtxt : array[0..000102,1..240] of char=(
+const msgtxt : array[0..000103,1..240] of char=(
 {$endif Delphi}
   'T_Compiler: $1'#000+
   'D_Compiler OS: $1'#000+
@@ -326,196 +326,197 @@ const msgtxt : array[0..000102,1..240] of char=(
   'E_Object or class me','thods can'#039't be inline.'#000+
   'E_Procvar calls can'#039't be inline.'#000+
   'E_No code for inline procedure stored'#000+
+  'E_Direct call of interrupt procedure $1 is not possible'#000+
   'E_Element zero of an ansi/wide- or longstring can'#039't be accessed, u'+
   'se (set)length instead'#000+
-  'E_Include and exclude not implemented in this case'#000+
-  'E_Cons','tructors or destructors can not be called inside a '#039'with'#039+
+  'E','_Include and exclude not implemented in this case'#000+
+  'E_Constructors or destructors can not be called inside a '#039'with'#039+
   ' clause'#000+
   'E_Cannot call message handler method directly'#000+
   'D_Starting $1 styled assembler parsing'#000+
-  'D_Finished $1 styled assembler parsing'#000+
+  'D_Finished $1 styled assembler par','sing'#000+
   'E_Non-label pattern contains @'#000+
-  'W_Override operator ','not supported'#000+
+  'W_Override operator not supported'#000+
   'E_Error building record offset'#000+
   'E_OFFSET used without identifier'#000+
   'E_TYPE used without identifier'#000+
   'E_Cannot use local variable or parameters here'#000+
   'E_need to use OFFSET here'#000+
-  'E_Cannot use multiple relocatable symbols'#000+
-  'E_Relocatable sy','mbol can only be added'#000+
+  'E_','Cannot use multiple relocatable symbols'#000+
+  'E_Relocatable symbol can only be added'#000+
   'E_Invalid constant expression'#000+
   'E_Relocatable symbol is not allowed'#000+
   'E_Invalid reference syntax'#000+
   'E_Local symbols/labels aren'#039't allowed as references'#000+
-  'E_Invalid base and index register usage'#000+
+  'E_Invalid base a','nd index register usage'#000+
   'E_Wrong scale factor specified'#000+
-  'E','_Multiple index register usage'#000+
+  'E_Multiple index register usage'#000+
   'E_Invalid operand type'#000+
   'E_Invalid string as opcode operand: $1'#000+
   'W_@CODE and @DATA not supported'#000+
   'E_Null label references are not allowed'#000+
-  'F_Divide by zero in asm evaluator'#000+
+  'F_Divide by zero in',' asm evaluator'#000+
   'F_Evaluator stack overflow'#000+
-  'F_Evaluator st','ack underflow'#000+
+  'F_Evaluator stack underflow'#000+
   'F_Invalid numeric format in asm evaluator'#000+
   'F_Invalid Operator in asm evaluator'#000+
   'E_escape sequence ignored: $1'#000+
   'E_Invalid symbol reference'#000+
-  'W_Fwait can cause emulation problems with emu387'#000+
-  'W_Calling an overload function in assemble','r'#000+
+  'W_Fwait can cause emulation problem','s with emu387'#000+
+  'W_Calling an overload function in assembler'#000+
   'E_Unsupported symbol type for operand'#000+
   'E_Constant value out of bounds'#000+
   'E_Error converting decimal $1'#000+
   'E_Error converting octal $1'#000+
   'E_Error converting binary $1'#000+
-  'E_Error converting hexadecimal $1'#000+
+  'E_Error converting hexadec','imal $1'#000+
   'H_$1 translated to $2'#000+
-  'W_$1 is associated to an o','verloaded function'#000+
+  'W_$1 is associated to an overloaded function'#000+
   'E_Cannot use SELF outside a method'#000+
   'E_Cannot use OLDEBP outside a nested procedure'#000+
   'W_Functions with void return value can'#039't return any value in asm c'+
   'ode'#000+
-  'E_SEG not supported'#000+
-  'E_Size suffix and destination or source size do n','ot match'#000+
+  'E_SEG not sup','ported'#000+
+  'E_Size suffix and destination or source size do not match'#000+
   'W_Size suffix and destination or source size do not match'#000+
   'E_Assembler syntax error'#000+
   'E_Invalid combination of opcode and operands'#000+
   'E_Assemler syntax error in operand'#000+
-  'E_Assemler syntax error in constant'#000+
+  'E_Assemler s','yntax error in constant'#000+
   'E_Invalid String expression'#000+
-  '32bi','t constant created for address'#000+
+  '32bit constant created for address'#000+
   'E_Invalid or missing opcode'#000+
   'E_Invalid combination of prefix and opcode: $1'#000+
   'E_Invalid combination of override and opcode: $1'#000+
   'E_Too many operands on line'#000+
-  'W_NEAR ignored'#000+
+  'W','_NEAR ignored'#000+
   'W_FAR ignored'#000+
-  'E_Duplicate local symbol $1'#000,
+  'E_Duplicate local symbol $1'#000+
   'E_Undefined local symbol $1'#000+
   'E_Unknown label identifier $1'#000+
   'E_Invalid floating point register name'#000+
   'E_NOR not supported'#000+
   'W_Modulo not supported'#000+
   'E_Invalid floating point constant $1'#000+
-  'E_Invalid floating point expression'#000+
+  'E_Inval','id floating point expression'#000+
   'E_Wrong symbol type'#000+
-  'E_Canno','t index a local var or parameter with a register'#000+
+  'E_Cannot index a local var or parameter with a register'#000+
   'E_Invalid segment override expression'#000+
   'W_Identifier $1 supposed external'#000+
   'E_Strings not allowed as constants'#000+
-  'No type of variable specified'#000+
+  'No type of variable specifie','d'#000+
   'E_assembler code not returned to text section'#000+
-  'E_Not a ','directive or local symbol $1'#000+
+  'E_Not a directive or local symbol $1'#000+
   'E_Using a defined name as a local label'#000+
   'E_Dollar token is used without an identifier'#000+
   'W_32bit constant created for address'#000+
-  'N_.align is target specific, use .balign or .p2align'#000+
-  'E_Can'#039't access fields directly for p','arameters'#000+
+  'N_.align is target specific, use ','.balign or .p2align'#000+
+  'E_Can'#039't access fields directly for parameters'#000+
   'E_Can'#039't access fields of objects/classes directly'#000+
   'F_Too many assembler files'#000+
   'F_Selected assembler output not supported'#000+
   'F_Comp not supported'#000+
-  'F_Direct not support for binary writers'#000+
-  'E_Allocating of data is only allowed in bss sectio','n'#000+
+  'F_Direct not support for binary wr','iters'#000+
+  'E_Allocating of data is only allowed in bss section'#000+
   'F_No binary writer selected'#000+
   'E_Asm: Opcode $1 not in table'#000+
   'E_Asm: $1 invalid combination of opcode and operands'#000+
   'E_Asm: 16 Bit references not supported'#000+
-  'E_Asm: Invalid effective address'#000+
+  'E_Asm: Invalid effective address',#000+
   'E_Asm: Immediate or reference expected'#000+
-  'E_Asm: $1 value ','exceeds bounds $2'#000+
+  'E_Asm: $1 value exceeds bounds $2'#000+
   'E_Asm: Short jump is out of range $1'#000+
   'W_Source operating system redefined'#000+
   'I_Assembling (pipe) $1'#000+
   'E_Can'#039't create assember file $1'#000+
-  'W_Assembler $1 not found, switching to external assembling'#000+
+  'W_Assembler $1 not found, switching to',' external assembling'#000+
   'T_Using assembler: $1'#000+
-  'W_Error while',' assembling exitcode $1'#000+
+  'W_Error while assembling exitcode $1'#000+
   'W_Can'#039't call the assembler, error $1 switching to external assembl'+
   'ing'#000+
   'I_Assembling $1'#000+
   'I_Assembling smartlink $1'#000+
-  'W_Linker $1 not found, switching to external linking'#000+
+  'W_Linker $1 not found, switching to external lin','king'#000+
   'T_Using linker: $1'#000+
-  'W_Object $1 not found, Linking m','ay fail !'#000+
+  'W_Object $1 not found, Linking may fail !'#000+
   'W_Library $1 not found, Linking may fail !'#000+
   'W_Error while linking'#000+
   'W_Can'#039't call the linker, switching to external linking'#000+
   'I_Linking $1'#000+
-  'W_binder not found, switching to external binding'#000+
+  'W_binder not found, switching to external',' binding'#000+
   'W_ar not found, switching to external ar'#000+
-  'E_Dyna','mic Libraries not supported'#000+
+  'E_Dynamic Libraries not supported'#000+
   'I_Closing script $1'#000+
   'W_resource compiler not found, switching to external mode'#000+
   'I_Compiling resource $1'#000+
   'F_Can'#039't post process executable $1'#000+
-  'F_Can'#039't open executable $1'#000+
+  'F_Can'#039't open execut','able $1'#000+
   'X_Size of Code: $1 bytes'#000+
-  'X_Size of initialized d','ata: $1 bytes'#000+
+  'X_Size of initialized data: $1 bytes'#000+
   'X_Size of uninitialized data: $1 bytes'#000+
   'X_Stack space reserved: $1 bytes'#000+
   'X_Stack space commited: $1 bytes'#000+
   'T_Unitsearch: $1'#000+
   'T_PPU Loading $1'#000+
   'U_PPU Name: $1'#000+
-  'U_PPU Flags: $1'#000+
+  'U_PPU Flags: $1'#000,
   'U_PPU Crc: $1'#000+
   'U_PPU Time: $1'#000+
   'U_PPU File too short'#000+
-  'U_PPU ','Invalid Header (no PPU at the begin)'#000+
+  'U_PPU Invalid Header (no PPU at the begin)'#000+
   'U_PPU Invalid Version $1'#000+
   'U_PPU is compiled for an other processor'#000+
   'U_PPU is compiled for an other target'#000+
   'U_PPU Source: $1'#000+
   'U_Writing $1'#000+
-  'F_Can'#039't Write PPU-File'#000+
+  'F_Can'#039't Write',' PPU-File'#000+
   'F_reading PPU-File'#000+
-  'F_unexpected end of PPU-Fil','e'#000+
+  'F_unexpected end of PPU-File'#000+
   'F_Invalid PPU-File entry: $1'#000+
   'F_PPU Dbx count problem'#000+
   'E_Illegal unit name: $1'#000+
   'F_Too much units'#000+
   'F_Circular unit reference between $1 and $2'#000+
-  'F_Can'#039't compile unit $1, no sources available'#000+
+  'F_Can'#039't compile unit $1, no sources availabl','e'#000+
   'F_Can'#039't find unit $1'#000+
-  'W_Unit $1 was not found but $2 ex','ists'#000+
+  'W_Unit $1 was not found but $2 exists'#000+
   'F_Unit $1 searched but $2 found'#000+
   'W_Compiling the system unit requires the -Us switch'#000+
   'F_There were $1 errors compiling module, stopping'#000+
   'U_Load from $1 ($2) unit $3'#000+
-  'U_Recompiling $1, checksum changed for $2'#000+
-  'U_Recompiling $1, source found ','only'#000+
+  'U_Recompiling $1,',' checksum changed for $2'#000+
+  'U_Recompiling $1, source found only'#000+
   'U_Recompiling unit, static lib is older than ppufile'#000+
   'U_Recompiling unit, shared lib is older than ppufile'#000+
   'U_Recompiling unit, obj and asm are older than ppufile'#000+
-  'U_Recompiling unit, obj is older than asm'#000+
+  'U_Recompiling unit',', obj is older than asm'#000+
   'U_Parsing interface of $1'#000+
-  'U_Pars','ing implementation of $1'#000+
+  'U_Parsing implementation of $1'#000+
   'U_Second load for unit $1'#000+
   'U_PPU Check file $1 time $2'#000+
   '$1 [options] <inputfile> [options]'#000+
   'W_Only one source file supported'#000+
-  'W_DEF file can be created only for OS/2'#000+
+  'W_DEF file can be created only for OS','/2'#000+
   'E_nested response files are not supported'#000+
-  'F_No source',' file name in command line'#000+
+  'F_No source file name in command line'#000+
   'E_Illegal parameter: $1'#000+
   'H_-? writes help pages'#000+
   'F_Too many config files nested'#000+
   'F_Unable to open file $1'#000+
   'N_Reading further options from $1'#000+
-  'W_Target is already set to: $1'#000+
-  'W_Shared libs not supported on DOS platform, ','reverting to static'#000+
+  'W_Target is already ','set to: $1'#000+
+  'W_Shared libs not supported on DOS platform, reverting to static'#000+
   'F_too many IF(N)DEFs'#000+
   'F_too many ENDIFs'#000+
   'F_open conditional at the end of the file'#000+
   'W_Debug information generation is not supported by this executable'#000+
-  'H_Try recompiling with -dGDB'#000+
+  'H_Try recompilin','g with -dGDB'#000+
   'E_You are using the obsolete switch $1'#000+
-  'E_Yo','u are using the obsolete switch $1, please use $2'#000+
+  'E_You are using the obsolete switch $1, please use $2'#000+
   'N_Switching assembler to default source writing assembler'#000+
   'Free Pascal Compiler version $FPCVER [$FPCDATE] for $FPCTARGET'#000+
-  'Copyright (c) 1993-1999 by Florian Klaempfl'#000+
-  'Free Pascal Compiler vers','ion $FPCVER'#000+
+  'Copyright (c)',' 1993-1999 by Florian Klaempfl'#000+
+  'Free Pascal Compiler version $FPCVER'#000+
   #000+
   'Compiler Date  : $FPCDATE'#000+
   'Compiler Target: $FPCTARGET'#000+
@@ -523,130 +524,130 @@ const msgtxt : array[0..000102,1..240] of char=(
   'This program comes under the GNU General Public Licence'#000+
   'For more information read COPYING.FPC'#000+
   #000+
-  'Report bugs,suggestions etc to:'#000+
-  '                 [email protected]','in.hu'#000+
+  'Report bugs,suggestio','ns etc to:'#000+
+  '                 [email protected]'#000+
   '**0*_put + after a boolean switch option to enable it, - to disable it'+
   #000+
   '**1a_the compiler doesn'#039't delete the generated assembler file'#000+
-  '**2al_list sourcecode lines in assembler file'#000+
-  '**2ar_list register allocation/release info in assemble','r file'#000+
+  '**2al_list sourcecode lines in assembler file',#000+
+  '**2ar_list register allocation/release info in assembler file'#000+
   '**2at_list temp allocation/release info in assembler file'#000+
   '**1b_generate browser info'#000+
   '**2bl_generate local symbol info'#000+
   '**1B_build all modules'#000+
   '**1C<x>_code generation options:'#000+
-  '3*2CD_create dynamic library'#000+
-  '**2Ch<n>_<n> bytes heap (betwe','en 1023 and 67107840)'#000+
+  '3*2','CD_create dynamic library'#000+
+  '**2Ch<n>_<n> bytes heap (between 1023 and 67107840)'#000+
   '**2Ci_IO-checking'#000+
   '**2Cn_omit linking stage'#000+
   '**2Co_check overflow of integer operations'#000+
   '**2Cr_range checking'#000+
   '**2Cs<n>_set stack size to <n>'#000+
   '**2Ct_stack checking'#000+
-  '**2CD_create also dynamic library (* doesn'#039't work yet *)'#000+
-  '**','2CX_create also smartlinked library'#000+
+  '**2','CD_create also dynamic library (* doesn'#039't work yet *)'#000+
+  '**2CX_create also smartlinked library'#000+
   '**1d<x>_defines the symbol <x>'#000+
   '*O1D_generate a DEF file'#000+
   '*O2Dd<x>_set description to <x>'#000+
   '*O2Dw_PM application'#000+
   '**1e<x>_set path to executable'#000+
-  '**1E_same as -Cn'#000+
+  '**1E_sam','e as -Cn'#000+
   '**1F<x>_set file names and paths:'#000+
-  '**2FD<x>_sets',' the directory where to search for compiler utilities'#000+
+  '**2FD<x>_sets the directory where to search for compiler utilities'#000+
   '**2Fe<x>_redirect error output to <x>'#000+
   '**2FE<x>_set exe/unit output path to <x>'#000+
   '**2Fi<x>_adds <x> to include path'#000+
-  '**2Fl<x>_adds <x> to library path'#000+
+  '**2Fl<x>_adds <x>',' to library path'#000+
   '*L2FL<x>_uses <x> as dynamic linker'#000+
-  '**2','Fo<x>_adds <x> to object path'#000+
+  '**2Fo<x>_adds <x> to object path'#000+
   '**2Fr<x>_load error message file <x>'#000+
   '**2Fu<x>_adds <x> to unit path'#000+
   '**2FU<x>_set unit output path to <x>, overrides -FE'#000+
-  '*g1g<x>_generate debugger information:'#000+
+  '*g1g<x>_generate debugger informat','ion:'#000+
   '*g2gg_use gsym'#000+
   '*g2gd_use dbx'#000+
-  '*g2gh_use heap trace u','nit'#000+
+  '*g2gh_use heap trace unit'#000+
   '*g2gc_generate checks for pointers'#000+
   '**1i_information'#000+
   '**2iD_return compiler date'#000+
   '**2iV_return compiler version'#000+
   '**2iSO_return compiler OS'#000+
   '**2iSP_return compiler processor'#000+
-  '**2iTO_return target OS'#000+
+  '**2iTO_retur','n target OS'#000+
   '**2iTP_return target processor'#000+
-  '**1I<x>_adds ','<x> to include path'#000+
+  '**1I<x>_adds <x> to include path'#000+
   '**1k<x>_Pass <x> to the linker'#000+
   '**1l_write logo'#000+
   '**1n_don'#039't read the default config file'#000+
   '**1o<x>_change the name of the executable produced to <x>'#000+
-  '**1pg_generate profile code for gprof (defines FPC_PROFILE)'#000+
-  '*L1P_use pipes ','instead of creating temporary assembler files'#000+
+  '**1pg_generate prof','ile code for gprof (defines FPC_PROFILE)'#000+
+  '*L1P_use pipes instead of creating temporary assembler files'#000+
   '**1S<x>_syntax options:'#000+
   '**2S2_switch some Delphi 2 extensions on'#000+
   '**2Sc_supports operators like C (*=,+=,/= and -=)'#000+
-  '**2Sd_tries to be Delphi compatible'#000+
-  '**2Se<x>_compiler stops after the <x> error','s (default is 1)'#000+
+  '**2Sd_tries to be Delph','i compatible'#000+
+  '**2Se<x>_compiler stops after the <x> errors (default is 1)'#000+
   '**2Sg_allow LABEL and GOTO'#000+
   '**2Sh_Use ansistrings'#000+
   '**2Si_support C++ styled INLINE'#000+
   '**2Sm_support macros like C (global)'#000+
   '**2So_tries to be TP/BP 7.0 compatible'#000+
-  '**2Sp_tries to be gpc compatible'#000+
-  '**2Ss_constructor name must be in','it (destructor must be done)'#000+
+  '**2Sp_trie','s to be gpc compatible'#000+
+  '**2Ss_constructor name must be init (destructor must be done)'#000+
   '**2St_allow static keyword in objects'#000+
   '**1s_don'#039't call assembler and linker (only with -a)'#000+
   '**1u<x>_undefines the symbol <x>'#000+
   '**1U_unit options:'#000+
-  '**2Un_don'#039't check the unit name'#000+
+  '**2Un_don'#039't c','heck the unit name'#000+
   '**2Us_compile a system unit'#000+
-  '**1v<x>_B','e verbose. <x> is a combination of the following letters:'#000+
+  '**1v<x>_Be verbose. <x> is a combination of the following letters:'#000+
   '**2*_e : Show errors (default)       d : Show debug info'#000+
   '**2*_w : Show warnings               u : Show unit info'#000+
-  '**2*_n : Show notes                  t : Show tried/used files'#000+
-  '**2*_h',' : Show hints                  m : Show defined macros'#000+
+  '**2*_n : Show',' notes                  t : Show tried/used files'#000+
+  '**2*_h : Show hints                  m : Show defined macros'#000+
   '**2*_i : Show general info           p : Show compiled procedures'#000+
   '**2*_l : Show linenumbers            c : Show conditionals'#000+
-  '**2*_a : Show everything             0 : Show nothing (excep','t errors'+
+  '**2*','_a : Show everything             0 : Show nothing (except errors'+
   ')'#000+
   '**2*_b : Show all procedure          r : Rhide/GCC compatibility mode'#000+
   '**2*_    declarations if an error    x : Executable info (Win32 only)'#000+
   '**2*_    occurs'#000+
-  '**1X_executable options:'#000+
+  '**1X_executable op','tions:'#000+
   '*L2Xc_link with the c library'#000+
-  '**2Xs_strip all sym','bols from executable'#000+
+  '**2Xs_strip all symbols from executable'#000+
   '**2XD_try to link dynamic          (defines FPC_LINK_DYNAMIC)'#000+
   '**2XS_try to link static (default) (defines FPC_LINK_STATIC)'#000+
-  '**2XX_try to link smart            (defines FPC_LINK_SMART)'#000+
+  '**2XX_try to link smart            (defi','nes FPC_LINK_SMART)'#000+
   '**0*_Processor specific options:'#000+
-  '3*1','A<x>_output format:'#000+
+  '3*1A<x>_output format:'#000+
   '3*2Aas_assemble using GNU AS'#000+
   '3*2Aasaout_assemble using GNU AS for aout (Go32v1)'#000+
   '3*2Anasmcoff_coff (Go32v2) file using Nasm'#000+
-  '3*2Anasmelf_elf32 (Linux) file using Nasm'#000+
+  '3*2Anasmelf_elf32 (Linux) file using Nasm',#000+
   '3*2Anasmobj_obj file using Nasm'#000+
-  '3*2Amasm_obj file using',' Masm (Microsoft)'#000+
+  '3*2Amasm_obj file using Masm (Microsoft)'#000+
   '3*2Atasm_obj file using Tasm (Borland)'#000+
   '3*2Acoff_coff (Go32v2) using internal writer'#000+
   '3*2Apecoff_pecoff (Win32) using internal writer'#000+
   '3*1R<x>_assembler reading style:'#000+
-  '3*2Ratt_read AT&T style assembler'#000+
-  '3*2Rintel_read Intel st','yle assembler'#000+
+  '3','*2Ratt_read AT&T style assembler'#000+
+  '3*2Rintel_read Intel style assembler'#000+
   '3*2Rdirect_copy assembler text directly to assembler file'#000+
   '3*1O<x>_optimizations:'#000+
   '3*2Og_generate smaller code'#000+
   '3*2OG_generate faster code (default)'#000+
-  '3*2Or_keep certain variables in registers (still BUGGY!!!)'#000+
-  '3*2Ou_enable uncertai','n optimizations (see docs)'#000+
+  '3*2Or_keep certain varia','bles in registers (still BUGGY!!!)'#000+
+  '3*2Ou_enable uncertain optimizations (see docs)'#000+
   '3*2O1_level 1 optimizations (quick optimizations)'#000+
   '3*2O2_level 2 optimizations (-O1 + slower optimizations)'#000+
   '3*2O3_level 3 optimizations (same as -O2u)'#000+
-  '3*2Op<x>_target processor:'#000+
-  '3*3Op1_set target processor to 386/4','86'#000+
+  '3*2Op<x','>_target processor:'#000+
+  '3*3Op1_set target processor to 386/486'#000+
   '3*3Op2_set target processor to Pentium/PentiumMMX (tm)'#000+
   '3*3Op3_set target processor to PPro/PII/c6x86/K6 (tm)'#000+
   '3*1T<x>_Target operating system:'#000+
-  '3*2TGO32V1_version 1 of DJ Delorie DOS extender'#000+
-  '3*2TGO32V2_version 2 of DJ Delorie DOS extender',#000+
+  '3*2TGO32V1_version 1 of DJ Delorie DOS ','extender'#000+
+  '3*2TGO32V2_version 2 of DJ Delorie DOS extender'#000+
   '3*2TLINUX_Linux'#000+
   '3*2TOS2_OS/2 2.x'#000+
   '3*2TWin32_Windows 32 Bit'#000+
@@ -654,21 +655,21 @@ const msgtxt : array[0..000102,1..240] of char=(
   '6*2Aas_Unix o-file using GNU AS'#000+
   '6*2Agas_GNU Motorola assembler'#000+
   '6*2Amit_MIT Syntax (old GAS)'#000+
-  '6*2Amot_Standard Motorola assembler'#000+
+  '6*2Amot_Sta','ndard Motorola assembler'#000+
   '6*1O_optimizations:'#000+
-  '6*2Oa_turn ','on the optimizer'#000+
+  '6*2Oa_turn on the optimizer'#000+
   '6*2Og_generate smaller code'#000+
   '6*2OG_generate faster code (default)'#000+
   '6*2Ox_optimize maximum (still BUGGY!!!)'#000+
   '6*2O2_set target processor to a MC68020+'#000+
-  '6*1R<x>_assembler reading style:'#000+
+  '6*1R<x>_assembler rea','ding style:'#000+
   '6*2RMOT_read motorola style assembler'#000+
-  '6*1T<x','>_Target operating system:'#000+
+  '6*1T<x>_Target operating system:'#000+
   '6*2TAMIGA_Commodore Amiga'#000+
   '6*2TATARI_Atari ST/STe/TT'#000+
   '6*2TMACOS_Macintosh m68k'#000+
   '6*2TLINUX_Linux-68k'#000+
   '**1*_'#000+
   '**1?_shows this help'#000+
-  '**1h_shows this help without waiting'#000
+  '**1h_shows this help without wait','ing'#000
 );

+ 12 - 3
compiler/new/Makefile

@@ -136,7 +136,7 @@ ifneq ($(findstring -di386,$(COMPILER)),)
 override COMPILER+=-dSUPPORT_MMX
 endif
 
-override COMPILER+=$(LOCALOPT) -Fu$(CPU)
+override COMPILER+=-Fu$(CPU) $(LOCALOPT)
 
 ifneq (,$(findstring -s ,$(LOCALOPT)))
 override EXECPPAS=@$(PPAS)
@@ -175,6 +175,12 @@ endif
 
 PPEXENAME=pp$(EXEEXT)
 EXENAME=ppc386$(EXEEXT)
+ifeq ($(CPU),powerpc)
+EXENAME=ppcppc$(EXEEXT)
+endif
+ifeq ($(CPU),alpha)
+EXENAME=ppcalpha$(EXEEXT)
+endif
 M68KEXENAME=ppc68k$(EXEEXT)
 TEMPNAME=ppc$(EXEEXT)
 TEMPNAME1=ppc1$(EXEEXT)
@@ -195,7 +201,7 @@ ifeq ($(MAKELEVEL),0)
 ifndef STARTTIME
 ifdef DATE
 STARTTIME:=$(shell $(DATE) +%T)
-else
+else         
 STARTTIME:=unknown
 endif
 endif
@@ -394,7 +400,10 @@ $(M68KEXENAME): $(PASFILES) $(INCFILES)
 
 #
 # $Log$
-# Revision 1.2  1999-08-02 17:16:41  michael
+# Revision 1.3  1999-10-12 21:20:46  florian
+#   * new codegenerator compiles again
+#
+# Revision 1.2  1999/08/02 17:16:41  michael
 # + Changes for alpha
 #
 # Revision 1.1  1999/08/01 23:19:58  florian

+ 16 - 11
compiler/new/cgbase.pas

@@ -130,7 +130,7 @@ unit cgbase;
 
     var
        { info about the current sub routine }
-       procinfo : tprocinfo;
+       procinfo : pprocinfo;
 
        { labels for BREAK and CONTINUE }
        aktbreaklabel,aktcontinuelabel : pasmlabel;
@@ -145,7 +145,7 @@ unit cgbase;
        aktexit2label : pasmlabel;
 
        { only used in constructor for fail or if getmem fails }
-       quickexitlabel : pasmlabel;
+       faillabel,quickexitlabel : pasmlabel;
 
        { Boolean, wenn eine loadn kein Assembler erzeugt hat }
        simple_loadn : boolean;
@@ -262,25 +262,27 @@ unit cgbase;
       begin
          aktbreaklabel:=nil;
          aktcontinuelabel:=nil;
+         new(procinfo);
          { aktexitlabel:=0; is store in oldaktexitlabel
            so it must not be reset to zero before this storage !}
          { the type of this lists isn't important }
          { because the code of this lists is      }
          { copied to the code segment             }
-         procinfo.aktentrycode:=new(paasmoutput,init);
-         procinfo.aktexitcode:=new(paasmoutput,init);
-         procinfo.aktproccode:=new(paasmoutput,init);
-         procinfo.aktlocaldata:=new(paasmoutput,init);
+         procinfo^.aktentrycode:=new(paasmoutput,init);
+         procinfo^.aktexitcode:=new(paasmoutput,init);
+         procinfo^.aktproccode:=new(paasmoutput,init);
+         procinfo^.aktlocaldata:=new(paasmoutput,init);
       end;
 
 
 
     procedure codegen_doneprocedure;
       begin
-         dispose(procinfo.aktentrycode,done);
-         dispose(procinfo.aktexitcode,done);
-         dispose(procinfo.aktproccode,done);
-         dispose(procinfo.aktlocaldata,done);
+         dispose(procinfo^.aktentrycode,done);
+         dispose(procinfo^.aktexitcode,done);
+         dispose(procinfo^.aktproccode,done);
+         dispose(procinfo^.aktlocaldata,done);
+         dispose(procinfo);
       end;
 
 
@@ -425,7 +427,10 @@ unit cgbase;
 end.
 {
   $Log$
-  Revision 1.9  1999-09-10 18:48:11  florian
+  Revision 1.10  1999-10-12 21:20:46  florian
+    * new codegenerator compiles again
+
+  Revision 1.9  1999/09/10 18:48:11  florian
     * some bug fixes (e.g. must_be_valid and procinfo.funcret_is_valid)
     * most things for stored properties fixed
 

+ 101 - 72
compiler/new/cgobj.pas

@@ -448,11 +448,11 @@ unit cgobj;
               pobjectdef(pvarsym(p)^.definition)^.is_class) and
             pvarsym(p)^.definition^.needs_inittable then
            begin
-              procinfo.flags:=procinfo.flags or pi_needs_implicit_finally;
+              procinfo^.flags:=procinfo^.flags or pi_needs_implicit_finally;
               reset_reference(hr);
               if psym(p)^.owner^.symtabletype=localsymtable then
                 begin
-                   hr.base:=procinfo.framepointer;
+                   hr.base:=procinfo^.framepointer;
                    hr.offset:=-pvarsym(p)^.address;
                 end
               else
@@ -477,13 +477,13 @@ unit cgobj;
             pvarsym(p)^.definition^.needs_inittable and
             ((pvarsym(p)^.varspez=vs_value)) then
            begin
-              procinfo.flags:=procinfo.flags or pi_needs_implicit_finally;
+              procinfo^.flags:=procinfo^.flags or pi_needs_implicit_finally;
               reset_reference(hr);
               hr.symbol:=pvarsym(p)^.definition^.get_inittable_label;
               a_param_ref_addr(list,hr,2);
               reset_reference(hr);
-              hr.base:=procinfo.framepointer;
-              hr.offset:=pvarsym(p)^.address+procinfo.call_offset;
+              hr.base:=procinfo^.framepointer;
+              hr.offset:=pvarsym(p)^.address+procinfo^.call_offset;
               a_param_ref_addr(list,hr,1);
               reset_reference(hr);
               a_call_name(list,'FPC_ADDREF',0);
@@ -510,18 +510,18 @@ unit cgobj;
                  (pvarsym(p)^.varspez=vs_const) { and
                  (dont_copy_const_param(pvarsym(p)^.definition)) } ) then
                 exit;
-              procinfo.flags:=procinfo.flags or pi_needs_implicit_finally;
+              procinfo^.flags:=procinfo^.flags or pi_needs_implicit_finally;
               reset_reference(hr);
               case psym(p)^.owner^.symtabletype of
                  localsymtable:
                    begin
-                      hr.base:=procinfo.framepointer;
+                      hr.base:=procinfo^.framepointer;
                       hr.offset:=-pvarsym(p)^.address;
                    end;
                  parasymtable:
                    begin
-                      hr.base:=procinfo.framepointer;
-                      hr.offset:=pvarsym(p)^.address+procinfo.call_offset;
+                      hr.base:=procinfo^.framepointer;
+                      hr.offset:=pvarsym(p)^.address+procinfo^.call_offset;
                    end;
                  else
                    hr.symbol:=newasmsymbol(pvarsym(p)^.mangledname);
@@ -561,9 +561,9 @@ unit cgobj;
            begin
               if hp^.temptype in [tt_ansistring,tt_freeansistring] then
                 begin
-                   procinfo.flags:=procinfo.flags or pi_needs_implicit_finally;
+                   procinfo^.flags:=procinfo^.flags or pi_needs_implicit_finally;
                    reset_reference(hr);
-                   hr.base:=procinfo.framepointer;
+                   hr.base:=procinfo^.framepointer;
                    hr.offset:=hp^.pos;
                    a_param_ref_addr(list,hr,1);
                    a_call_name(list,'FPC_ANSISTR_DECR_REF',0);
@@ -635,21 +635,21 @@ unit cgobj;
            end;
         { omit stack frame ? }
         if not inlined then
-          if procinfo.framepointer=stack_pointer then
+          if procinfo^.framepointer=stack_pointer then
             begin
                CGMessage(cg_d_stackframe_omited);
                nostackframe:=true;
                if (aktprocsym^.definition^.proctypeoption in [potype_unitinit,potype_proginit,potype_unitfinalize]) then
                  parasize:=0
                else
-                 parasize:=aktprocsym^.definition^.parast^.datasize+procinfo.call_offset-pointersize;
+                 parasize:=aktprocsym^.definition^.parast^.datasize+procinfo^.call_offset-pointersize;
             end
           else
             begin
                if (aktprocsym^.definition^.proctypeoption in [potype_unitinit,potype_proginit,potype_unitfinalize]) then
                  parasize:=0
                else
-                 parasize:=aktprocsym^.definition^.parast^.datasize+procinfo.call_offset-pointersize*2;
+                 parasize:=aktprocsym^.definition^.parast^.datasize+procinfo^.call_offset-pointersize*2;
                nostackframe:=false;
 
                if (po_interrupt in aktprocsym^.definition^.procoptions) then
@@ -693,7 +693,7 @@ unit cgobj;
          { a constructor needs a help procedure }
          if (aktprocsym^.definition^.options and poconstructor)<>0 then
            begin
-             if procinfo._class^.isclass then
+             if procinfo^._class^.isclass then
                begin
                  list^.concat(new(paicpu,op_sym(A_CALL,S_NO,newasmsymbol('FPC_NEW_CLASS'))));
                  list^.concat(new(paicpu,op_cond_sym(A_Jcc,C_Z,S_NO,quickexitlabel)));
@@ -704,7 +704,7 @@ unit cgobj;
                  list^.insert(new(pai_labeled,init(A_JZ,quickexitlabel)));
                  list^.insert(new(paicpu,op_csymbol(A_CALL,S_NO,
                    newcsymbol('FPC_HELP_CONSTRUCTOR',0))));
-                 list^.insert(new(paicpu,op_const_reg(A_MOV,S_L,procinfo._class^.vmt_offset,R_EDI)));
+                 list^.insert(new(paicpu,op_const_reg(A_MOV,S_L,procinfo^._class^.vmt_offset,R_EDI)));
                  concat_external('FPC_HELP_CONSTRUCTOR',EXT_NEAR);
                  }
                end;
@@ -716,12 +716,13 @@ unit cgobj;
   {$endif GDB}
 
          { initialize return value }
-         if is_ansistring(procinfo.retdef) or
-           is_widestring(procinfo.retdef) then
+         if assigned(procinfo^.retdef) and
+	   is_ansistring(procinfo^.retdef) or
+           is_widestring(procinfo^.retdef) then
            begin
               reset_reference(hr);
-              hr.offset:=procinfo.retoffset;
-              hr.base:=procinfo.framepointer;
+              hr.offset:=procinfo^.retoffset;
+              hr.base:=procinfo^.framepointer;
               a_load_const_ref(list,OS_32,0,hr);
            end;
 
@@ -737,7 +738,7 @@ unit cgobj;
 
          if (cs_profile in aktmoduleswitches) or
            (aktprocsym^.definition^.owner^.symtabletype=globalsymtable) or
-           (assigned(procinfo._class) and (procinfo._class^.owner^.symtabletype=globalsymtable)) then
+           (assigned(procinfo^._class) and (procinfo^._class^.owner^.symtabletype=globalsymtable)) then
            make_global:=true;
          if not inlined then
            begin
@@ -773,7 +774,7 @@ unit cgobj;
            begin
               if target_os.use_function_relative_addresses then
                   list^.insert(stab_function_name);
-              if make_global or ((procinfo.flags and pi_is_global) <> 0) then
+              if make_global or ((procinfo^.flags and pi_is_global) <> 0) then
                   aktprocsym^.is_global := True;
               list^.insert(new(pai_stabs,init(aktprocsym^.stabstring)));
               aktprocsym^.isstabwritten:=true;
@@ -788,7 +789,7 @@ unit cgobj;
          mangled_length : longint;
          p : pchar;
   {$endif GDB}
-         noreraiselabel : pasmlabel;
+         nofinal,noreraiselabel : pasmlabel;
          hr : treference;
          r : tregister;
 
@@ -799,16 +800,30 @@ unit cgobj;
          { call the destructor help procedure }
          if (aktprocsym^.definition^.proctypeoption=potype_destructor) then
            begin
-             if procinfo._class^.is_class then
+             if procinfo^._class^.is_class then
                a_call_name(list,'FPC_DISPOSE_CLASS',0)
              else
                begin
-                  we must do a finalize here for objects if
-                  necessary
+                  if procinfo^._class^.needs_inittable then
+                    begin
+                       getlabel(nofinal);
+                       {!!!!!!!!!!
+                       reset_reference(hr);
+                       hr.base:=R_EBP;
+                       hr.offset:=8;
+                       a_cmp_reg_const_label(list,OS_ADDR,OZ_EQ,
+                       }
+                       reset_reference(hr);
+                       hr.symbol:=procinfo^._class^.get_inittable_label;
+                       a_paramaddr_ref(list,hr,2);
+                       a_param_reg(list,OS_ADDR,self_pointer,1);
+                       a_call_name(list,'FPC_FINALIZE',0);
+                       a_label(list,nofinal);
+                    end;
                   { vmt_offset_reg can be a scratch register, }
                   { but it must be always the same            }
                   a_reg_alloc(list,vmt_offset_reg);
-                  a_load_const_reg(list,OS_32,procinfo._class^.vmt_offset,vmt_offset_reg);
+                  a_load_const_reg(list,OS_32,procinfo^._class^.vmt_offset,vmt_offset_reg);
                   a_call_name(list,'FPC_HELP_DESTRUCTOR',0);
                   a_reg_dealloc(list,vmt_offset_reg);
                end;
@@ -827,7 +842,7 @@ unit cgobj;
            aktprocsym^.definition^.parast^.foreach({$ifndef TP}@{$endif}_finalize_data);
 
          { do we need to handle exceptions because of ansi/widestrings ? }
-         if (procinfo.flags and pi_needs_implicit_finally)<>0 then
+         if (procinfo^.flags and pi_needs_implicit_finally)<>0 then
            begin
               getlabel(noreraiselabel);
 
@@ -838,15 +853,15 @@ unit cgobj;
               a_reg_dealloc(list,accumulator);
 
               { must be the return value finalized before reraising the exception? }
-              if (procinfo.retdef<>pdef(voiddef)) and
-                (procinfo.retdef^.needs_inittable) and
-                ((procinfo.retdef^.deftype<>objectdef) or
-                not(pobjectdef(procinfo.retdef)^.is_class)) then
+              if (procinfo^.retdef<>pdef(voiddef)) and
+                (procinfo^.retdef^.needs_inittable) and
+                ((procinfo^.retdef^.deftype<>objectdef) or
+                not(pobjectdef(procinfo^.retdef)^.is_class)) then
                 begin
                    reset_reference(hr);
-                   hr.offset:=procinfo.retoffset;
-                   hr.base:=procinfo.framepointer;
-                   g_finalize(list,procinfo.retdef,hr,ret_in_param(procinfo.retdef));
+                   hr.offset:=procinfo^.retoffset;
+                   hr.base:=procinfo^.framepointer;
+                   g_finalize(list,procinfo^.retdef,hr,ret_in_param(procinfo^.retdef));
                 end;
 
               a_call_name(list,'FPC_RERAISE',0);
@@ -912,42 +927,53 @@ unit cgobj;
     {$ifdef GDB}
          if (cs_debuginfo in aktmoduleswitches) and not inlined  then
              begin
-                 aktprocsym^.concatstabto(exprasmlist);
-                 if assigned(procinfo._class) then
-                   if (not assigned(procinfo.parent) or
-                      not assigned(procinfo.parent^._class)) then
-                     list^.concat(new(pai_stabs,init(strpnew(
-                      '"$t:v'+procinfo._class^.numberstring+'",'+
-                      tostr(N_PSYM)+',0,0,'+tostr(procinfo.selfpointer_offset)))))
-                   else
-                     list^.concat(new(pai_stabs,init(strpnew(
-                      '"$t:r'+procinfo._class^.numberstring+'",'+
-                      tostr(N_RSYM)+',0,0,'+tostr(GDB_i386index[R_ESI])))));
-
-                 if (pdef(aktprocsym^.definition^.retdef) <> pdef(voiddef)) then
-                   if ret_in_param(aktprocsym^.definition^.retdef) then
-                     list^.concat(new(pai_stabs,init(strpnew(
-                      '"'+aktprocsym^.name+':X*'+aktprocsym^.definition^.retdef^.numberstring+'",'+
-                      tostr(N_PSYM)+',0,0,'+tostr(procinfo.retoffset)))))
-                   else
-                     list^.concat(new(pai_stabs,init(strpnew(
-                      '"'+aktprocsym^.name+':X'+aktprocsym^.definition^.retdef^.numberstring+'",'+
-                      tostr(N_PSYM)+',0,0,'+tostr(procinfo.retoffset)))));
-
-                 mangled_length:=length(aktprocsym^.definition^.mangledname);
-                 getmem(p,mangled_length+50);
-                 strpcopy(p,'192,0,0,');
-                 strpcopy(strend(p),aktprocsym^.definition^.mangledname);
-                 exprasmlist^.concat(new(pai_stabn,init(strnew(p))));
-                 {list^.concat(new(pai_stabn,init(strpnew('192,0,0,'
-                  +aktprocsym^.definition^.mangledname))));
-                 p[0]:='2';p[1]:='2';p[2]:='4';
-                 strpcopy(strend(p),'_end');}
-                 freemem(p,mangled_length+50);
-                 exprasmlist^.concat(new(pai_stabn,init(
-                   strpnew('224,0,0,'+aktexit2label^.name))));
-                  { strpnew('224,0,0,'
-                  +aktprocsym^.definition^.mangledname+'_end'))));}
+                aktprocsym^.concatstabto(list);
+                if assigned(procinfo^._class) then
+                  if (not assigned(procinfo^.parent) or
+                     not assigned(procinfo^.parent^._class)) then
+                    list^.concat(new(pai_stabs,init(strpnew(
+                     '"$t:v'+procinfo^._class^.numberstring+'",'+
+                     tostr(N_PSYM)+',0,0,'+tostr(procinfo^.selfpointer_offset)))));
+                  {!!!!!!!!!!!!
+                  else
+                    list^.concat(new(pai_stabs,init(strpnew(
+                     '"$t:r'+procinfo^._class^.numberstring+'",'+
+                     tostr(N_RSYM)+',0,0,'+tostr(GDB_i386index[R_ESI])))));
+                  }
+                if (pdef(aktprocsym^.definition^.retdef) <> pdef(voiddef)) then
+                  begin
+                    if ret_in_param(aktprocsym^.definition^.retdef) then
+                      list^.concat(new(pai_stabs,init(strpnew(
+                       '"'+aktprocsym^.name+':X*'+aktprocsym^.definition^.retdef^.numberstring+'",'+
+                       tostr(N_PSYM)+',0,0,'+tostr(procinfo^.retoffset)))))
+                    else
+                      list^.concat(new(pai_stabs,init(strpnew(
+                       '"'+aktprocsym^.name+':X'+aktprocsym^.definition^.retdef^.numberstring+'",'+
+                       tostr(N_PSYM)+',0,0,'+tostr(procinfo^.retoffset)))));
+                    if (m_result in aktmodeswitches) then
+                      if ret_in_param(aktprocsym^.definition^.retdef) then
+                        list^.concat(new(pai_stabs,init(strpnew(
+                         '"RESULT:X*'+aktprocsym^.definition^.retdef^.numberstring+'",'+
+                         tostr(N_PSYM)+',0,0,'+tostr(procinfo^.retoffset)))))
+                      else
+                        list^.concat(new(pai_stabs,init(strpnew(
+                         '"RESULT:X'+aktprocsym^.definition^.retdef^.numberstring+'",'+
+                         tostr(N_PSYM)+',0,0,'+tostr(procinfo^.retoffset)))));
+                  end;
+                mangled_length:=length(aktprocsym^.definition^.mangledname);
+                getmem(p,mangled_length+50);
+                strpcopy(p,'192,0,0,');
+                strpcopy(strend(p),aktprocsym^.definition^.mangledname);
+                list^.concat(new(pai_stabn,init(strnew(p))));
+                {list^.concat(new(pai_stabn,init(strpnew('192,0,0,'
+                 +aktprocsym^.definition^.mangledname))));
+                p[0]:='2';p[1]:='2';p[2]:='4';
+                strpcopy(strend(p),'_end');}
+                freemem(p,mangled_length+50);
+                list^.concat(new(pai_stabn,init(
+                  strpnew('224,0,0,'+aktexit2label^.name))));
+                 { strpnew('224,0,0,'
+                 +aktprocsym^.definition^.mangledname+'_end'))));}
              end;
     {$endif GDB}
       end;
@@ -1082,7 +1108,10 @@ unit cgobj;
 end.
 {
   $Log$
-  Revision 1.27  1999-09-29 11:46:20  florian
+  Revision 1.28  1999-10-12 21:20:46  florian
+    * new codegenerator compiles again
+
+  Revision 1.27  1999/09/29 11:46:20  florian
     * fixed bug 292 from bugs directory
 
   Revision 1.26  1999/09/14 11:16:09  florian

+ 9 - 6
compiler/new/nmem.pas

@@ -190,8 +190,8 @@ unit nmem;
                                         hregister:=tg.getregisterint;
 
                                         { make a reference }
-                                        hp:=new_reference(procinfo.framepointer,
-                                          procinfo.framepointer_offset);
+                                        hp:=new_reference(procinfo^.framepointer,
+                                          procinfo^.framepointer_offset);
 
 
                                         exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOV,S_L,hp,hregister)));
@@ -216,7 +216,7 @@ unit nmem;
                                                     end;
                                    stt_exceptsymtable:
                                      begin
-                                        location.reference.base:=procinfo.framepointer;
+                                        location.reference.base:=procinfo^.framepointer;
                                         location.reference.offset:=pvarsym(symtableentry)^.address;
                                      end;
                                    objectsymtable:
@@ -239,7 +239,7 @@ unit nmem;
                                         { symtable datasize field
                                           contains the offset of the temp
                                           stored }
-                                        hp:=new_reference(procinfo.framepointer,
+                                        hp:=new_reference(procinfo^.framepointer,
                                           symtable^.datasize);
 
                                         exprasmlist^.concat(new(paicpu,op_ref_reg(A_MOV,S_L,hp,hregister)));
@@ -262,7 +262,7 @@ unit nmem;
                               if is_open_array(pvarsym(symtableentry)^.definition) or
                                  is_open_string(pvarsym(symtableentry)^.definition) then
                                 begin
-                                   if (location.reference.base=procinfo.framepointer) then
+                                   if (location.reference.base=procinfo^.framepointer) then
                                      begin
                                         highframepointer:=location.reference.base;
                                         highoffset:=location.reference.offset;
@@ -711,7 +711,10 @@ unit nmem;
 end.
 {
   $Log$
-  Revision 1.13  1999-09-15 20:35:46  florian
+  Revision 1.14  1999-10-12 21:20:46  florian
+    * new codegenerator compiles again
+
+  Revision 1.13  1999/09/15 20:35:46  florian
     * small fix to operator overloading when in MMX mode
     + the compiler uses now fldz and fld1 if possible
     + some fixes to floating point registers

+ 5 - 55
compiler/new/pass_1.pas

@@ -106,7 +106,7 @@ implementation
     procedure firstasm(var p : ptree);
 
       begin
-        procinfo.flags:=procinfo.flags or pi_uses_asm;
+        procinfo.flags:=procinfo^.flags or pi_uses_asm;
       end;
 
 {$endif dummy}
@@ -123,35 +123,9 @@ implementation
          not_first : boolean;
 {$endif extdebug}
       begin
-{$ifdef extdebug}
-         inc(total_of_firstpass);
-         if (p^.firstpasscount>0) and only_one_pass then
-           exit;
-{$endif extdebug}
          oldcodegenerror:=codegenerror;
          oldpos:=aktfilepos;
          oldlocalswitches:=aktlocalswitches;
-{$ifdef extdebug}
-         if p^.firstpasscount>0 then
-           begin
-              move(p^,str1[1],sizeof(ttree));
-       {$ifndef TP}
-         {$ifopt H+}
-           SetLength(str1,sizeof(ttree));
-         {$else}
-              str1[0]:=char(sizeof(ttree));
-         {$endif}
-       {$else}
-              str1[0]:=char(sizeof(ttree));
-       {$endif}
-              new(oldp);
-              oldp^:=p^;
-              not_first:=true;
-              inc(firstpass_several);
-           end
-         else
-           not_first:=false;
-{$endif extdebug}
 
          if not p^.error then
            begin
@@ -166,33 +140,6 @@ implementation
            end
          else
            codegenerror:=true;
-{$ifdef extdebug}
-         if not_first then
-           begin
-              { dirty trick to compare two ttree's (PM) }
-              move(p^,str2[1],sizeof(ttree));
-       {$ifndef TP}
-         {$ifopt H+}
-           SetLength(str2,sizeof(ttree));
-         {$else}
-              str2[0]:=char(sizeof(ttree));
-         {$endif}
-       {$else}
-              str2[0]:=char(sizeof(ttree));
-       {$endif}
-              if str1<>str2 then
-                begin
-                   comment(v_debug,'tree changed after first counting pass '
-                     +tostr(longint(p^.treetype)));
-                   {!!!!!!! compare_trees(oldp,p); }
-                end;
-              dispose(oldp);
-           end;
-         {!!!!!!!
-         if count_ref then
-           inc(p^.firstpasscount);
-         }
-{$endif extdebug}
       end;
 
 
@@ -221,7 +168,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.5  1999-08-04 00:23:57  florian
+  Revision 1.6  1999-10-12 21:20:47  florian
+    * new codegenerator compiles again
+
+  Revision 1.5  1999/08/04 00:23:57  florian
     * renamed i386asm and i386base to cpuasm and cpubase
 
   Revision 1.4  1999/08/01 18:22:36  florian

+ 19 - 16
compiler/new/pass_2.pas

@@ -288,7 +288,7 @@ implementation
               { only if no asm is used }
               { and no try statement   }
               if (cs_regalloc in aktglobalswitches) and
-                ((procinfo.flags and (pi_uses_asm or pi_uses_exceptions))=0) then
+                ((procinfo^.flags and (pi_uses_asm or pi_uses_exceptions))=0) then
                 begin
                    { can we omit the stack frame ? }
                    { conditions:
@@ -301,25 +301,25 @@ implementation
                      begin
                        if not(aktprocsym^.definition^.proctypeoption in [potype_constructor,potype_destructor]) and
                           not(po_interrupt in aktprocsym^.definition^.procoptions) and
-                          ((procinfo.flags and pi_do_call)=0) and
+                          ((procinfo^.flags and pi_do_call)=0) and
                           (lexlevel>=normal_function_level) then
                        begin
                          { use ESP as frame pointer }
-                         procinfo.framepointer:=stack_pointer;
+                         procinfo^.framepointer:=stack_pointer;
                          use_esp_stackframe:=true;
 
                          { calc parameter distance new }
-                         dec(procinfo.framepointer_offset,pointersize);
-                         dec(procinfo.selfpointer_offset,pointersize);
+                         dec(procinfo^.framepointer_offset,pointersize);
+                         dec(procinfo^.selfpointer_offset,pointersize);
 
                          { is this correct ???}
                          { retoffset can be negativ for results in eax !! }
                          { the value should be decreased only if positive }
-                         if procinfo.retoffset>=0 then
-                           dec(procinfo.retoffset,4);
+                         if procinfo^.retoffset>=0 then
+                           dec(procinfo^.retoffset,4);
 
-                         dec(procinfo.call_offset,4);
-                         aktprocsym^.definition^.parast^.address_fixup:=procinfo.call_offset;
+                         dec(procinfo^.call_offset,4);
+                         aktprocsym^.definition^.parast^.address_fixup:=procinfo^.call_offset;
                        end;
                      end;
                    if (p^.registersint<maxvarregs) then
@@ -413,10 +413,10 @@ implementation
                                        { when loading parameter to reg  }
                                        new(hr);
                                        reset_reference(hr^);
-                                       hr^.offset:=pvarsym(regvars[i])^.address+procinfo.call_offset;
-                                       hr^.base:=procinfo.framepointer;
+                                       hr^.offset:=pvarsym(regvars[i])^.address+procinfo^.call_offset;
+                                       hr^.base:=procinfo^.framepointer;
 {$ifdef i386}
-                                       procinfo.aktentrycode^.concat(new(paicpu,op_ref_reg(A_MOV,regsize,
+                                       procinfo^.aktentrycode^.concat(new(paicpu,op_ref_reg(A_MOV,regsize,
                                          hr,regvars[i]^.reg)));
 {$endif i386}
 {$ifdef m68k}
@@ -451,20 +451,23 @@ implementation
 
               do_secondpass(p);
 
-              if assigned(procinfo.def) then
-                procinfo.def^.fpu_used:=p^.registersfpu;
+              if assigned(procinfo^.def) then
+                procinfo^.def^.fpu_used:=p^.registersfpu;
 
               { all registers can be used again }
               tg.resetusableregisters;
            end;
-         procinfo.aktproccode^.concatlist(exprasmlist);
+         procinfo^.aktproccode^.concatlist(exprasmlist);
          make_const_global:=false;
       end;
 
 end.
 {
   $Log$
-  Revision 1.7  1999-08-25 12:00:13  jonas
+  Revision 1.8  1999-10-12 21:20:47  florian
+    * new codegenerator compiles again
+
+  Revision 1.7  1999/08/25 12:00:13  jonas
     * changed pai386, paippc and paiapha (same for tai*) to paicpu (taicpu)
 
   Revision 1.6  1999/08/05 14:58:15  florian

+ 4 - 4
compiler/new/pp.pas

@@ -267,9 +267,6 @@ end;
 begin
   oldexit:=exitproc;
   exitproc:=@myexit;
-{$ifdef fpc}
-  heapblocks:=true;
-{$endif}
 {$ifdef UseOverlay}
   InitOverlay;
 {$endif}
@@ -279,7 +276,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.6  1999-08-04 12:59:22  jonas
+  Revision 1.7  1999-10-12 21:20:47  florian
+    * new codegenerator compiles again
+
+  Revision 1.6  1999/08/04 12:59:22  jonas
     * all tokes now start with an underscore
     * PowerPC compiles!!
 

+ 7 - 4
compiler/new/tgobj.pas

@@ -326,7 +326,7 @@ unit tgobj;
          { do a reset, because the reference isn't used }
          reset_reference(ref);
          ref.offset:=gettempofsize(l);
-         ref.base:=procinfo.framepointer;
+         ref.base:=procinfo^.framepointer;
       end;
 
 
@@ -336,7 +336,7 @@ unit tgobj;
       begin
          { do a reset, because the reference isn't used }
          reset_reference(ref);
-         ref.base:=procinfo.framepointer;
+         ref.base:=procinfo^.framepointer;
          { Reuse old ansi slot ? }
          foundslot:=nil;
          tl:=templist;
@@ -406,7 +406,7 @@ unit tgobj;
     function ttgobj.istemp(const ref : treference) : boolean;
 
       begin
-         istemp:=((ref.base=procinfo.framepointer) and
+         istemp:=((ref.base=procinfo^.framepointer) and
                   (ref.offset<firsttemp));
       end;
 
@@ -692,7 +692,10 @@ unit tgobj;
 end.
 {
   $Log$
-  Revision 1.6  1999-09-10 18:48:11  florian
+  Revision 1.7  1999-10-12 21:20:47  florian
+    * new codegenerator compiles again
+
+  Revision 1.6  1999/09/10 18:48:11  florian
     * some bug fixes (e.g. must_be_valid and procinfo.funcret_is_valid)
     * most things for stored properties fixed
 

+ 5 - 2
compiler/new/transn.pas

@@ -44,7 +44,7 @@ blockn:
                    { Funktionsresultate an exit anh„ngen }
                    { this is wrong for string or other complex
                      result types !!! }
-                   if ret_in_acc(procinfo.retdef) and
+                   if ret_in_acc(procinfo^.retdef) and
                       assigned(hp^.left) and
                       (hp^.left^.right^.treetype=exitn) and
                       (hp^.right^.treetype=assignn) and
@@ -82,7 +82,10 @@ end.
 
 {
   $Log$
-  Revision 1.1  1999-01-23 23:35:02  florian
+  Revision 1.2  1999-10-12 21:20:47  florian
+    * new codegenerator compiles again
+
+  Revision 1.1  1999/01/23 23:35:02  florian
     + first versions
 
 }

+ 33 - 5
compiler/new/tree.pas

@@ -116,7 +116,8 @@ unit tree;
           arrayconstructrangen, {Range element to allow sets in array construction tree}
           { added for optimizations where we cannot suppress }
           nothingn,
-          loadvmtn
+          loadvmtn,
+          pointerconstn
        );
 
        tconverttype = (
@@ -133,8 +134,9 @@ unit tree;
           tc_array_2_pointer,
           tc_pointer_2_array,
           tc_int_2_int,
-          tc_bool_2_int,
           tc_int_2_bool,
+          tc_bool_2_bool,
+          tc_bool_2_int,
           tc_real_2_real,
           tc_int_2_real,
           tc_int_2_fix,
@@ -143,7 +145,7 @@ unit tree;
           tc_proc_2_procvar,
           tc_arrayconstructor_2_set,
           tc_load_smallset,
-          tc_bool_2_bool
+          tc_cord_2_pointer
        );
 
       { different assignment types }
@@ -358,6 +360,7 @@ unit tree;
     function gensubscriptnode(varsym : pvarsym;l : ptree) : ptree;
     function genordinalconstnode(v : longint;def : pdef) : ptree;
     function genfixconstnode(v : longint;def : pdef) : ptree;
+    function genpointerconstnode(v : longint;def : pdef) : ptree;
     function gentypeconvnode(node : ptree;t : pdef) : ptree;
     function gentypenode(t : pdef;sym:ptypesym) : ptree;
     function gencallparanode(expr,next : ptree) : ptree;
@@ -601,7 +604,8 @@ unit tree;
           'arrayconstructn',
           'arrayconstructrangen',
           'nothingn',
-          'loadvmtn');
+          'loadvmtn',
+	  'pointerconstn');
 
       begin
          write(indention,'(',treetype2str[treetype]);
@@ -1277,6 +1281,27 @@ unit tree;
       end;
 
 
+    function genpointerconstnode(v : longint;def : pdef) : ptree;
+
+      var
+         p : ptree;
+
+      begin
+         p:=getnode;
+         p^.disposetyp:=dt_nothing;
+         p^.treetype:=pointerconstn;
+         p^.registers32:=0;
+         { p^.registers16:=0;
+         p^.registers8:=0; }
+         p^.registersfpu:=0;
+{$ifdef SUPPORT_MMX}
+         p^.registersmmx:=0;
+{$endif SUPPORT_MMX}
+         p^.resulttype:=def;
+         p^.value:=v;
+         genpointerconstnode:=p;
+      end;
+
     function gensinglenode(t : ttreetyp;l : ptree) : ptree;
 
       var
@@ -2018,7 +2043,10 @@ unit tree;
 end.
 {
   $Log$
-  Revision 1.14  1999-09-14 11:16:09  florian
+  Revision 1.15  1999-10-12 21:20:47  florian
+    * new codegenerator compiles again
+
+  Revision 1.14  1999/09/14 11:16:09  florian
     * only small updates to work with the current compiler
 
   Revision 1.13  1999/08/06 18:05:55  florian

+ 10 - 2
compiler/parser.pas

@@ -47,7 +47,10 @@ unit parser;
     uses
       globtype,version,tokens,systems,
       cobjects,globals,verbose,
-      symtable,files,aasm,hcodegen,
+      symtable,files,aasm,
+{$ifndef newcg}
+      hcodegen,
+{$endif newcg}
       assemble,link,script,gendef,
 {$ifdef BrowserLog}
       browlog,
@@ -61,6 +64,8 @@ unit parser;
 {$ifdef newcg}
       cgobj,
       cgcpu,
+      { cgbase must be after hcodegen to use the correct procinfo !!! }
+      cgbase,
 {$endif newcg}
       comphook,tree,scanner,pbase,pdecl,psystem,pmodules,cresstr;
 
@@ -482,7 +487,10 @@ unit parser;
 end.
 {
   $Log$
-  Revision 1.87  1999-10-03 19:44:41  peter
+  Revision 1.88  1999-10-12 21:20:45  florian
+    * new codegenerator compiles again
+
+  Revision 1.87  1999/10/03 19:44:41  peter
     * removed objpasunit reference, tvarrec is now searched in systemunit
       where it already was located
 

+ 10 - 2
compiler/pmodules.pas

@@ -43,7 +43,12 @@ unit pmodules;
     uses
        globtype,version,systems,tokens,
        cobjects,comphook,globals,verbose,files,
-       symconst,symtable,aasm,hcodegen,
+       symconst,symtable,aasm,
+{$ifdef newcg}
+       cgbase,
+{$else newcg}
+       hcodegen,
+{$endif newcg}
        link,assemble,import,export,gendef,ppu,comprsrc,
        cresstr,cpubase,cpuasm,
        scanner,pbase,psystem,pdecl,psub,parser;
@@ -1455,7 +1460,10 @@ unit pmodules;
 end.
 {
   $Log$
-  Revision 1.158  1999-10-03 19:44:42  peter
+  Revision 1.159  1999-10-12 21:20:45  florian
+    * new codegenerator compiles again
+
+  Revision 1.158  1999/10/03 19:44:42  peter
     * removed objpasunit reference, tvarrec is now searched in systemunit
       where it already was located
 

+ 18 - 2
compiler/psub.pas

@@ -53,7 +53,12 @@ uses
   strings,globals,verbose,files,
   scanner,aasm,tree,types,
   import,gendef,
-  hcodegen,temp_gen,pass_1,cpubase,cpuasm
+{$ifdef newcg}
+  cgbase,
+{$else newcg}
+  hcodegen,
+{$endif newcg}
+  temp_gen,pass_1,cpubase,cpuasm
 {$ifndef NOPASS2}
   ,pass_2
 {$endif}
@@ -130,7 +135,11 @@ begin
 {$else}
             aktprocsym^.definition^.procoptions:=aktprocsym^.definition^.procoptions+[po_containsself];
 {$endif}
+{$ifdef newcg}
+            inc(procinfo^.selfpointer_offset,vs^.address);
+{$else newcg}
             inc(procinfo^.ESI_offset,vs^.address);
+{$endif newcg}
             consume(idtoken);
             consume(_COLON);
             p:=single_type(hs1,false);
@@ -473,7 +482,11 @@ begin
   { self isn't pushed in nested procedure of methods }
   if assigned(procinfo^._class) and (lexlevel=normal_function_level) then
     begin
+{$ifdef newcg}
+      procinfo^.selfpointer_offset:=paramoffset;
+{$else newcg}
       procinfo^.ESI_offset:=paramoffset;
+{$endif newcg}
       if assigned(aktprocsym^.definition) and
          not(po_containsself in aktprocsym^.definition^.procoptions) then
         inc(paramoffset,target_os.size_of_pointer);
@@ -2078,7 +2091,10 @@ end.
 
 {
   $Log$
-  Revision 1.26  1999-10-03 19:38:39  peter
+  Revision 1.27  1999-10-12 21:20:46  florian
+    * new codegenerator compiles again
+
+  Revision 1.26  1999/10/03 19:38:39  peter
     * fixed forward decl check for tp7/delphi
 
   Revision 1.25  1999/10/01 10:05:44  peter