From 1cf1665d7352d475aab63dbe8b96e5164b2581b4 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 3 Aug 1999 17:09:34 +0000 Subject: [PATCH] * the alpha compiler can be compiled now --- compiler/export.pas | 9 ++++++++- compiler/globals.pas | 19 +++++++++---------- compiler/new/alpha/cpubase.pas | 29 ++++++++++++++++++++++------- compiler/new/alpha/cpuinfo.pas | 8 ++++++-- compiler/new/i386/tgcpu.pas | 7 ++++--- compiler/new/nmem.pas | 8 ++++++-- compiler/new/pass_2.pas | 9 +++++++-- compiler/new/tempgen.inc | 2 +- compiler/options.pas | 26 ++++++++++++++++++-------- compiler/parser.pas | 10 +++++++--- compiler/pmodules.pas | 25 ++++++++++++++++++++----- compiler/pstatmnt.pas | 9 ++++++++- compiler/psub.pas | 10 ++++++++-- compiler/systems.pas | 8 +++++++- 14 files changed, 131 insertions(+), 48 deletions(-) diff --git a/compiler/export.pas b/compiler/export.pas index 39b8a15817..f899f48634 100644 --- a/compiler/export.pas +++ b/compiler/export.pas @@ -150,6 +150,10 @@ begin {$ifdef m68k} target_m68k_Linux : exportlib:=new(pexportlib,Init); +{$endif m68k} +{$ifdef alpha} + target_m68k_Linux : + exportlib:=new(pexportlib,Init); {$endif m68k} else exportlib:=new(pexportlib,Init); @@ -160,7 +164,10 @@ end; end. { $Log$ - Revision 1.4 1998-11-30 09:43:09 pierre + Revision 1.5 1999-08-03 17:09:34 florian + * the alpha compiler can be compiled now + + Revision 1.4 1998/11/30 09:43:09 pierre * some range check bugs fixed (still not working !) + added DLL writing support for win32 (also accepts variables) + TempAnsi for code that could be used for Temporary ansi strings diff --git a/compiler/globals.pas b/compiler/globals.pas index d3bd137a98..83982006b7 100644 --- a/compiler/globals.pas +++ b/compiler/globals.pas @@ -1165,31 +1165,27 @@ unit globals; description:='Compiled by FPC '+version_string+' - '+target_cpu_string; { Init values } -{$ifdef i386} - initoptprocessor:=Class386; + initmodeswitches:=fpcmodeswitches; initlocalswitches:=[]; initmoduleswitches:=[cs_extsyntax,cs_browser]; initglobalswitches:=[cs_check_unit_name,cs_link_static]; - initmodeswitches:=fpcmodeswitches; +{$ifdef i386} + initoptprocessor:=Class386; initpackenum:=4; initpackrecords:=packrecord_2; initoutputformat:=target_asm.id; initasmmode:=asmmode_i386_att; - initdefines.init; {$else not i386} {$ifdef m68k} initoptprocessor:=MC68000; - initlocalswitches:=[]; - initmoduleswitches:=[cs_extsyntax,cs_browser,cs_fp_emulation]; - initglobalswitches:=[cs_check_unit_name,cs_link_static]; - initmodeswitches:=fpcmodeswitches; + include(initmoduleswitches,cs_fp_emulation); initpackenum:=4; initpackrecords:=packrecord_2; initoutputformat:=as_m68k_as; initasmmode:=asmmode_m68k_mot; - initdefines.init; {$endif m68k} {$endif i386} + initdefines.init; { memory sizes, will be overriden by parameter or default for target in options or init_parser } @@ -1210,7 +1206,10 @@ begin end. { $Log$ - Revision 1.14 1999-07-23 16:05:19 peter + Revision 1.15 1999-08-03 17:09:35 florian + * the alpha compiler can be compiled now + + Revision 1.14 1999/07/23 16:05:19 peter * alignment is now saved in the symtable * C alignment added for records * PPU version increased to solve .12 <-> .13 probs diff --git a/compiler/new/alpha/cpubase.pas b/compiler/new/alpha/cpubase.pas index 7f3fa7fb12..4d018f8893 100644 --- a/compiler/new/alpha/cpubase.pas +++ b/compiler/new/alpha/cpubase.pas @@ -90,13 +90,13 @@ Type R_F30,R_F31); TRegisterset = Set of TRegister; - + { Constants describing the registers } -Const +Const Firstreg = R_0; LastReg = R_F31; - + stack_pointer = R_30; frame_pointer = R_15; self_pointer = R_16; @@ -167,8 +167,6 @@ Type top_symbol : (sym:pasmsymbol;symofs:longint); end; - - Const { offsets for the integer and floating point registers } INT_REG = 0; @@ -178,7 +176,7 @@ Const OQ_CHOPPED_ROUNDING = $01; { /C } OQ_ROUNDING_MODE_DYNAMIC = $02; { /D } OQ_ROUND_TOWARD_MINUS_INFINITY = $04; { /M } - OQ_INEXACT_RSULT_ENABLE = $08; { /I } + OQ_INEXACT_RESULT_ENABLE = $08; { /I } OQ_SOFTWARE_COMPLETION_ENABLE = $10; { /S } OQ_FLOATING_UNDERFLOW_ENABLE = $20; { /U } OQ_INTEGER_OVERFLOW_ENABLE = $40; { /V } @@ -189,9 +187,23 @@ procedure reset_reference(var ref : treference); function new_reference(base : tregister;offset : longint) : preference; procedure disposereference(var r : preference); +function reg2str(r : tregister) : string; implementation +uses + verbose; + +function reg2str(r : tregister) : string; + + begin + if r in [R_0..R_31] then + reg2str:='R'+tostr(longint(r)-longint(R_0)) + else if r in [R_F0..R_F31] then + reg2str:='F'+tostr(longint(r)-longint(R_F0)) + else internalerror(38991); + end; + procedure reset_reference(var ref : treference); begin FillChar(ref,sizeof(treference),0); @@ -219,7 +231,10 @@ end; end. { $Log$ - Revision 1.4 1999-08-03 15:52:40 michael + Revision 1.5 1999-08-03 17:09:48 florian + * the alpha compiler can be compiled now + + Revision 1.4 1999/08/03 15:52:40 michael * Additional changes Revision 1.3 1999/08/03 00:35:54 michael diff --git a/compiler/new/alpha/cpuinfo.pas b/compiler/new/alpha/cpuinfo.pas index d3336652f8..2c7023945c 100644 --- a/compiler/new/alpha/cpuinfo.pas +++ b/compiler/new/alpha/cpuinfo.pas @@ -4,7 +4,7 @@ Copyright (c) 1999 by the Free Pascal development team Basic Processor information - + See the file COPYING.FPC, included in this distribution, for details about the copyright. @@ -20,8 +20,12 @@ Interface Type { Architecture word - Native unsigned type } +{$ifdef FPC} AWord = Qword; - +{$else FPC} + AWord = Longint; +{$endif FPC} + Const { Size of native extended type } extended_size = 16; diff --git a/compiler/new/i386/tgcpu.pas b/compiler/new/i386/tgcpu.pas index 4c24e6eb29..21856dca06 100644 --- a/compiler/new/i386/tgcpu.pas +++ b/compiler/new/i386/tgcpu.pas @@ -48,8 +48,6 @@ unit tgcpu; var tg : ttgobji386; - reg_pushes : array[R_EAX..R_MM6] of longint; - is_reg_var : array[R_EAX..R_MM6] of boolean; implementation @@ -74,7 +72,10 @@ begin end. { $Log$ - Revision 1.2 1999-08-02 23:13:24 florian + Revision 1.3 1999-08-03 17:09:50 florian + * the alpha compiler can be compiled now + + Revision 1.2 1999/08/02 23:13:24 florian * more changes to compile for the Alpha Revision 1.1 1999/08/02 17:14:14 florian diff --git a/compiler/new/nmem.pas b/compiler/new/nmem.pas index 7c1beabe72..260054f79d 100644 --- a/compiler/new/nmem.pas +++ b/compiler/new/nmem.pas @@ -48,7 +48,6 @@ unit nmem; uses cobjects,aasm,cgbase,cgobj,types,verbose,tgobj,tgcpu {$I cpuunit.inc} -{$I tempgen.inc} ; {**************************************************************************** @@ -131,6 +130,7 @@ unit nmem; {$endif i386} else begin +{$ifdef i386} symtabletype:=symtable^.symtabletype; { in case it is a register variable: } if pvarsym(symtableentry)^.reg<>R_NO then @@ -254,6 +254,7 @@ unit nmem; reset_reference(location.reference); location.reference.base:=hregister; end; +{$endif i386} end; end; procsym: @@ -271,7 +272,10 @@ unit nmem; end. { $Log$ - Revision 1.3 1999-08-02 17:14:08 florian + Revision 1.4 1999-08-03 17:09:45 florian + * the alpha compiler can be compiled now + + Revision 1.3 1999/08/02 17:14:08 florian + changed the temp. generator to an object Revision 1.2 1999/08/01 18:22:35 florian diff --git a/compiler/new/pass_2.pas b/compiler/new/pass_2.pas index 1d2accce9a..3952ea589c 100644 --- a/compiler/new/pass_2.pas +++ b/compiler/new/pass_2.pas @@ -391,15 +391,17 @@ implementation include(tg.usedinproc,varregs[i]); end; nextreg: +{$ifdef i386} { dummy } regsize:=S_W; +{$endif i386} end; if (status.verbosity and v_debug)=v_debug then begin for i:=1 to maxvarregs do begin if assigned(regvars[i]) then - Message3(cg_d_register_weight,reg2str(regvars[i]^.reg), + Message3(cg_d_register_weight,reg2str(regvars[i]^.reg), tostr(regvars[i]^.refs),regvars[i]^.name); end; end; @@ -423,7 +425,10 @@ implementation end. { $Log$ - Revision 1.3 1999-08-03 00:30:36 florian + Revision 1.4 1999-08-03 17:09:46 florian + * the alpha compiler can be compiled now + + Revision 1.3 1999/08/03 00:30:36 florian * again a fix for the alpha Revision 1.2 1999/08/03 00:28:03 florian diff --git a/compiler/new/tempgen.inc b/compiler/new/tempgen.inc index 7fd9833230..c6a17fcc38 100644 --- a/compiler/new/tempgen.inc +++ b/compiler/new/tempgen.inc @@ -25,5 +25,5 @@ {$ifdef i386} ,tgeni386 {$else} -,tgencpu +,tgcpu {$endif i386} diff --git a/compiler/options.pas b/compiler/options.pas index a92017b920..587a147965 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -964,12 +964,12 @@ begin {$endif Delphi} {$ifdef i386} option:=new(poption386,Init); -{$else} - {$ifdef m68k} - option:=new(poption68k,Init); - {$else} - option:=new(poption,Init); - {$endif} +{$endif} +{$ifdef m68k} + option:=new(poption68k,Init); +{$endif} +{$ifdef alpha} + option:=new(poption,Init); {$endif} { Load messages } if (cmd='') and (paramcount=0) then @@ -999,6 +999,9 @@ begin {$ifdef m68k} def_symbol('CPU68'); {$endif} +{$ifdef ALPHA} + def_symbol('ALPHA'); +{$endif} { get default messagefile } {$ifdef Delphi} @@ -1016,8 +1019,12 @@ begin begin {$ifdef i386} ppccfg:='ppc386.cfg'; -{$else} +{$endif i386} +{$ifdef m68k} ppccfg:='ppc.cfg'; +{$endif} +{$ifdef alpha} + ppccfg:='ppcalpha.cfg'; {$endif} end; @@ -1144,7 +1151,10 @@ end; end. { $Log$ - Revision 1.7 1999-08-02 23:13:19 florian + Revision 1.8 1999-08-03 17:09:36 florian + * the alpha compiler can be compiled now + + Revision 1.7 1999/08/02 23:13:19 florian * more changes to compile for the Alpha Revision 1.6 1999/07/23 22:56:27 michael diff --git a/compiler/parser.pas b/compiler/parser.pas index 504b59fe1b..fe5b6a78e4 100644 --- a/compiler/parser.pas +++ b/compiler/parser.pas @@ -60,9 +60,7 @@ unit parser; {$endif UseExcept} {$ifdef newcg} cgobj, - {$ifdef i386} cgcpu, - {$endif i386} {$endif newcg} comphook,tree,scanner,pbase,pdecl,psystem,pmodules,cresstr; @@ -298,6 +296,9 @@ unit parser; {$ifdef i386} cg:=new(pcg386,init); {$endif i386} +{$ifdef alpha} + cg:=new(pcgalpha,init); +{$endif alpha} {$endif newcg} { If the compile level > 1 we get a nice "unit expected" error @@ -471,7 +472,10 @@ unit parser; end. { $Log$ - Revision 1.79 1999-08-01 23:36:40 florian + Revision 1.80 1999-08-03 17:09:37 florian + * the alpha compiler can be compiled now + + Revision 1.79 1999/08/01 23:36:40 florian * some changes to compile the new code generator Revision 1.78 1999/07/24 16:22:18 michael diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index d1e16194ac..c1670c0c7e 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -44,6 +44,11 @@ unit pmodules; {$ifdef m68k} ,m68k {$endif} +{$ifdef newcg} +{$ifndef i386} + ,cpubase +{$endif} +{$endif newcg} ,scanner,pbase,psystem,pdecl,psub,parser; @@ -178,6 +183,10 @@ unit pmodules; target_i386_OS2: ; {$endif i386} +{$ifdef alpha} + target_alpha_linux: + ; +{$endif alpha} {$ifdef m68k} target_m68k_Mac: bsssegment^.concat(new(pai_datablock,init_global('HEAP',4))); @@ -187,16 +196,15 @@ unit pmodules; else bsssegment^.concat(new(pai_datablock,init_global('HEAP',heapsize))); end; -{$ifdef i386} - datasegment^.concat(new(pai_symbol,initname_global('HEAPSIZE',4))); - datasegment^.concat(new(pai_const,init_32bit(heapsize))); -{$endif i386} {$ifdef m68k} if target_info.target<>target_m68k_PalmOS then begin datasegment^.concat(new(pai_symbol,init_global('HEAP_SIZE'))); datasegment^.concat(new(pai_const,init_32bit(heapsize))); end; +{$else m68k} + datasegment^.concat(new(pai_symbol,initname_global('HEAPSIZE',4))); + datasegment^.concat(new(pai_const,init_32bit(heapsize))); {$endif m68k} end; @@ -204,6 +212,10 @@ unit pmodules; procedure inserttargetspecific; begin case target_info.target of +{$ifdef alpha} + target_alpha_linux: + ; +{$endif alpha} {$ifdef i386} target_i386_GO32V2 : begin @@ -1352,7 +1364,10 @@ unit pmodules; end. { $Log$ - Revision 1.136 1999-08-02 17:17:10 florian + Revision 1.137 1999-08-03 17:09:38 florian + * the alpha compiler can be compiled now + + Revision 1.136 1999/08/02 17:17:10 florian * small changes for the new code generator Revision 1.135 1999/07/29 20:54:04 peter diff --git a/compiler/pstatmnt.pas b/compiler/pstatmnt.pas index 356394a1c3..7051f08f60 100644 --- a/compiler/pstatmnt.pas +++ b/compiler/pstatmnt.pas @@ -62,6 +62,10 @@ unit pstatmnt; ,ra68kmot {$endif NoRa68kMot} {$endif m68k} +{$ifdef alpha} + ,cpubase,cpuasm + ,tgeni386 +{$endif alpha} ; @@ -1284,7 +1288,10 @@ unit pstatmnt; end. { $Log$ - Revision 1.93 1999-08-02 21:28:59 florian + Revision 1.94 1999-08-03 17:09:39 florian + * the alpha compiler can be compiled now + + Revision 1.93 1999/08/02 21:28:59 florian * the main branch psub.pas is now used for newcg compiler diff --git a/compiler/psub.pas b/compiler/psub.pas index b1ad34b3f6..152daf3630 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -76,7 +76,10 @@ uses { parser specific stuff } ,pbase,pdecl,pexpr,pstatmnt {$ifdef newcg} - ,tgcpu,convtree,cgobj + ,tgcpu,convtree,cgobj,tgeni386 { for the new code generator tgeni386 is only a dummy } +{$ifndef i386} + ,cpubase +{$endif i386} {$endif newcg} ; @@ -1904,7 +1907,10 @@ end. { $Log$ - Revision 1.7 1999-08-02 21:29:01 florian + Revision 1.8 1999-08-03 17:09:42 florian + * the alpha compiler can be compiled now + + Revision 1.7 1999/08/02 21:29:01 florian * the main branch psub.pas is now used for newcg compiler diff --git a/compiler/systems.pas b/compiler/systems.pas index 74fe691f0a..a42962c11a 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -1613,6 +1613,9 @@ begin {$endif atari} {$endif amiga} {$endif m68k} +{$ifdef alpha} + default_os(target_alpha_linux); +{$endif i386} end; @@ -1621,7 +1624,10 @@ begin end. { $Log$ - Revision 1.86 1999-08-03 15:52:00 michael + Revision 1.87 1999-08-03 17:09:43 florian + * the alpha compiler can be compiled now + + Revision 1.86 1999/08/03 15:52:00 michael * changed shortname for linux alpha Revision 1.85 1999/08/03 13:50:19 michael