diff --git a/compiler/aasm.pas b/compiler/aasm.pas index d4c94ebca0..f8b41976c8 100644 --- a/compiler/aasm.pas +++ b/compiler/aasm.pas @@ -195,8 +195,13 @@ unit aasm; { alignment for operator } +{$ifdef i386} pai_align_abstract = ^tai_align_abstract; tai_align_abstract = object(tai) +{$else i386} + pai_align = ^tai_align; + tai_align = object(tai) +{$endif i386} buf : array[0..63] of char; { buf used for fill } aligntype : byte; { 1 = no align, 2 = word align, 4 = dword align } fillsize : byte; { real size to fill } @@ -715,7 +720,11 @@ uses TAI_ALIGN ****************************************************************************} +{$ifdef i386} constructor tai_align_abstract.init(b: byte); +{$else i386} + constructor tai_align.init(b: byte); +{$endif i386} begin inherited init; typ:=ait_align; @@ -729,7 +738,11 @@ uses end; +{$ifdef i386} constructor tai_align_abstract.init_op(b: byte; _op: byte); +{$else i386} + constructor tai_align.init_op(b: byte; _op: byte); +{$endif i386} begin inherited init; typ:=ait_align; @@ -744,7 +757,11 @@ uses end; +{$ifdef i386} function tai_align_abstract.getfillbuf:pchar; +{$else i386} + function tai_align.getfillbuf:pchar; +{$endif i386} begin getfillbuf:=@buf; end; @@ -1050,7 +1067,14 @@ uses end. { $Log$ - Revision 1.81 2000-04-10 12:21:33 jonas + Revision 1.82 2000-04-22 14:25:03 jonas + * aasm.pas: pai_align instead of pai_align_abstract if cpu <> i386 + + systems.pas: info for macos/ppc + * new/cgobj.pas: compiles again without newst define + * new/powerpc/cgcpu: generate different entry/exit code depending on + whether target_os is MacOs or Linux + + Revision 1.81 2000/04/10 12:21:33 jonas * added ait_symbol_end to SkipInstr Revision 1.80 2000/02/29 23:55:53 pierre diff --git a/compiler/new/cgobj.pas b/compiler/new/cgobj.pas index 8de6ac08fd..cd409eca59 100644 --- a/compiler/new/cgobj.pas +++ b/compiler/new/cgobj.pas @@ -759,7 +759,7 @@ unit cgobj; else parasize:=aktprocdef^.localst^.paramdatasize+procinfo^.para_offset-pointersize; {$ELSE} - if (aktproc^.proctypeoption in [potype_unitinit,potype_proginit,potype_unitfinalize]) then + if (aktprocsym^.definition^.proctypeoption in [potype_unitinit,potype_proginit,potype_unitfinalize]) then parasize:=0 else parasize:=aktprocsym^.definition^.parast^.datasize+procinfo^.para_offset-pointersize; @@ -773,7 +773,7 @@ unit cgobj; else parasize:=aktprocdef^.localst^.paramdatasize+procinfo^.para_offset-pointersize*2; {$ELSE} - if (aktprocdef^.proctypeoption in [potype_unitinit,potype_proginit,potype_unitfinalize]) then + if (aktprocsym^.definition^.proctypeoption in [potype_unitinit,potype_proginit,potype_unitfinalize]) then parasize:=0 else parasize:=aktprocsym^.definition^.parast^.datasize+procinfo^.para_offset-pointersize*2; @@ -783,7 +783,7 @@ unit cgobj; if (pointerrupt in aktprocdef^.options) then g_interrupt_stackframe_entry(list); {$ELSE} - if (po_interrupt in aktprocdef^.procoptions) then + if (po_interrupt in aktprocsym^.definition^.procoptions) then g_interrupt_stackframe_entry(list); {$ENDIF NEWST} @@ -1020,7 +1020,7 @@ unit cgobj; {$IFNDEF NEWST} { finalize paras data } - if assigned(aktprocdef^.parast) then + if assigned(aktprocsym^.definition^.parast) then aktprocsym^.definition^.parast^.foreach({$ifndef TP}@{$endif}_finalize_data); {$ENDIF NEWST} @@ -1329,7 +1329,14 @@ unit cgobj; end. { $Log$ - Revision 1.36 2000-03-11 21:11:24 daniel + Revision 1.37 2000-04-22 14:25:03 jonas + * aasm.pas: pai_align instead of pai_align_abstract if cpu <> i386 + + systems.pas: info for macos/ppc + * new/cgobj.pas: compiles again without newst define + * new/powerpc/cgcpu: generate different entry/exit code depending on + whether target_os is MacOs or Linux + + Revision 1.36 2000/03/11 21:11:24 daniel * Ported hcgdata to new symtable. * Alignment code changed as suggested by Peter + Usage of my is operator replacement, is_object diff --git a/compiler/new/powerpc/cgcpu.pas b/compiler/new/powerpc/cgcpu.pas index ccf37be3b8..99c90f0cac 100644 --- a/compiler/new/powerpc/cgcpu.pas +++ b/compiler/new/powerpc/cgcpu.pas @@ -62,11 +62,11 @@ unit cgcpu; procedure g_stackframe_entry_sysv(list : paasmoutput;localsize : longint); procedure g_stackframe_entry_mac(list : paasmoutput;localsize : longint); -{ procedure g_stackframe_entry(list : paasmoutput;localsize : longint);virtual;} + procedure g_stackframe_entry(list : paasmoutput;localsize : longint);virtual; procedure g_restore_frame_pointer(list : paasmoutput);virtual; -{ procedure g_return_from_proc(list : paasmoutput;parasize : aword); virtual;} - procedure g_return_from_proc_sysv(list : paasmoutput;parasize : aword); virtual; - procedure g_return_from_proc_mac(list : paasmoutput;parasize : aword); virtual; + procedure g_return_from_proc(list : paasmoutput;parasize : aword); virtual; + procedure g_return_from_proc_sysv(list : paasmoutput;parasize : aword); + procedure g_return_from_proc_mac(list : paasmoutput;parasize : aword); procedure a_loadaddress_ref_reg(list : paasmoutput;const ref2 : treference;r : tregister);virtual; @@ -123,7 +123,7 @@ const implementation uses - globtype,globals,verbose; + globtype,globals,verbose,systems; { parameter passing... Still needs extra support from the processor } { independent code generator } @@ -365,6 +365,19 @@ const { *********** entry/exit code and address loading ************ } + procedure tcgppc.g_stackframe_entry(list : paasmoutput;localsize : longint); + begin + case target_os.id of + os_powerpc_macos: + g_stackframe_entry_mac(list,localsize); + os_powerpc_linux: + g_stackframe_entry_sysv(list,localsize) + else + internalerror(2204001); + end; + end; + + procedure tcgppc.g_stackframe_entry_sysv(list : paasmoutput;localsize : longint); { generated the entry code of a procedure/function. Note: localsize is the } { sum of the size necessary for local variables and the maximum possible } @@ -481,6 +494,19 @@ const { no frame pointer on the PowerPC (maybe there is one in the SystemV ABI?)} end; + procedure tcgppc.g_return_from_proc(list : paasmoutput;parasize : aword); + begin + case target_os.id of + os_powerpc_macos: + g_return_from_proc_mac(list,parasize); + os_powerpc_linux: + g_return_from_proc_sysv(list,parasize) + else + internalerror(2204001); + end; + end; + + procedure tcgppc.g_return_from_proc_sysv(list : paasmoutput;parasize : aword); var regcounter: TRegister; @@ -491,7 +517,7 @@ const a_reg_dealloc(list,regcounter); { AltiVec context restore, not yet implemented !!! } - { address if gpr save area to r11 } + { address of gpr save area to r11 } list^.concat(new(paicpu,op_reg_reg_const(A_ADDI,R_11,R_31,-144))); { restore gprs } list^.concat(new(paicpu,op_sym_ofs(A_BL,newasmsymbol('_restgpr_14'),0))); @@ -719,7 +745,14 @@ const end. { $Log$ - Revision 1.11 2000-01-07 01:14:57 peter + Revision 1.12 2000-04-22 14:25:04 jonas + * aasm.pas: pai_align instead of pai_align_abstract if cpu <> i386 + + systems.pas: info for macos/ppc + * new/cgobj.pas: compiles again without newst define + * new/powerpc/cgcpu: generate different entry/exit code depending on + whether target_os is MacOs or Linux + + Revision 1.11 2000/01/07 01:14:57 peter * updated copyright to 2000 Revision 1.10 1999/12/24 22:48:10 jonas diff --git a/compiler/systems.pas b/compiler/systems.pas index 6fe1af32eb..b7bcc6ccfe 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -61,7 +61,7 @@ unit systems; target_i386_OS2,target_i386_Win32 ,target_m68k_Amiga,target_m68k_Atari,target_m68k_Mac, target_m68k_linux,target_m68k_PalmOS,target_alpha_linux, - target_powerpc_linux + target_powerpc_linux,target_powerpc_macos ); ttargetflags = (tf_none, @@ -72,7 +72,7 @@ unit systems; {$ifdef i386} i386targetcnt=5; {$else} i386targetcnt=0; {$endif} {$ifdef m68k} m68ktargetcnt=5; {$else} m68ktargetcnt=0; {$endif} {$ifdef alpha} alphatargetcnt=1; {$else} alphatargetcnt=0; {$endif} - {$ifdef powerpc} powerpctargetcnt=1; {$else} powerpctargetcnt=0; {$endif} + {$ifdef powerpc} powerpctargetcnt=2; {$else} powerpctargetcnt=0; {$endif} targetcnt=i386targetcnt+m68ktargetcnt+alphatargetcnt+powerpctargetcnt+1; type @@ -83,14 +83,14 @@ unit systems; as_i386_tasm,as_i386_masm, as_i386_dbg,as_i386_coff,as_i386_pecoff ,as_m68k_as,as_m68k_gas,as_m68k_mit,as_m68k_mot,as_m68k_mpw, - as_alpha_as,as_powerpc_as + as_alpha_as,as_powerpc_as,as_powerpc_mpw ); { binary assembler writers, needed to test for -a } const {$ifdef i386} i386asmcnt=12; {$else} i386asmcnt=0; {$endif} {$ifdef m68k} m68kasmcnt=5; {$else} m68kasmcnt=0; {$endif} {$ifdef alpha} alphaasmcnt=1; {$else} alphaasmcnt=0; {$endif} - {$ifdef powerpc} powerpcasmcnt=1; {$else} powerpcasmcnt=0; {$endif} + {$ifdef powerpc} powerpcasmcnt=2; {$else} powerpcasmcnt=0; {$endif} asmcnt=i386asmcnt+m68kasmcnt+alphaasmcnt+powerpcasmcnt+1; binassem : set of tasm = [ @@ -111,13 +111,13 @@ unit systems; type tres = (res_none - ,res_i386_windres + ,res_i386_windres,res_m68k_mpw,res_powerpc_mpw ); const {$ifdef i386} i386rescnt=1; {$else} i386rescnt=0; {$endif} - {$ifdef m68k} m68krescnt=0; {$else} m68krescnt=0; {$endif} + {$ifdef m68k} m68krescnt=1; {$else} m68krescnt=0; {$endif} {$ifdef alpha} alpharescnt=0; {$else} alpharescnt=0; {$endif} - {$ifdef powerpc} powerpcrescnt=0; {$else} powerpcrescnt=0; {$endif} + {$ifdef powerpc} powerpcrescnt=1; {$else} powerpcrescnt=0; {$endif} rescnt=i386rescnt+m68krescnt+alpharescnt+powerpcrescnt+1; type @@ -125,13 +125,13 @@ unit systems; os_i386_GO32V1,os_i386_GO32V2,os_i386_Linux,os_i386_OS2, os_i386_Win32, os_m68k_Amiga,os_m68k_Atari,os_m68k_Mac,os_m68k_Linux, - os_m68k_PalmOS,os_alpha_linux,os_powerpc_linux + os_m68k_PalmOS,os_alpha_linux,os_powerpc_linux,os_powerpc_macos ); const i386oscnt=5; m68koscnt=5; alphaoscnt=1; - powerpcoscnt=1; + powerpcoscnt=2; oscnt=i386oscnt+m68koscnt+alphaoscnt+powerpcoscnt+1; type @@ -398,11 +398,11 @@ implementation id : os_m68k_mac; name : 'Macintosh m68k'; shortname : 'mac'; - sharedlibext : '.dll'; - staticlibext : '.a'; + sharedlibext : 'Lib'; + staticlibext : 'Lib'; sourceext : '.pp'; pasext : '.pas'; - exeext : '.tpp'; + exeext : ''; defext : ''; scriptext : ''; libprefix : ''; @@ -483,7 +483,7 @@ implementation name : 'Linux for PowerPC'; shortname : 'linuxppc'; sharedlibext : '.so'; - staticlibext : '.a'; + staticlibext : '.s'; sourceext : '.pp'; pasext : '.pas'; exeext : ''; @@ -498,6 +498,27 @@ implementation size_of_longint : 4; use_bound_instruction : false; use_function_relative_addresses : true + ), + ( + id : os_powerpc_macos; + name : 'MacOs (PowerPC)'; + shortname : 'MacOs/PPC'; + sharedlibext : 'Lib'; + staticlibext : 'Lib'; + sourceext : '.pp'; + pasext : '.pas'; + exeext : ''; + defext : ''; + scriptext : ''; + libprefix : ''; + Cprefix : ''; + newline : #13; + endian : endian_big; + stackalignment : 8; + size_of_pointer : 4; + size_of_longint : 4; + use_bound_instruction : false; + use_function_relative_addresses : true ) ); @@ -764,7 +785,7 @@ implementation externals : false; needar : true; labelprefix : '__L'; - comment : '| '; + comment : '* '; secnames : ('', '.text','.data','.bss', '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata', @@ -804,6 +825,21 @@ implementation '','','','','','', '.stab','.stabstr') ) + ,( + id : as_powerpc_mpw; + idtxt : 'PPCAsm'; + asmbin : 'PPCAsm'; + asmcmd : '-o $OBJ $ASM'; + allowdirect : true; + externals : false; + needar : true; + labelprefix : '.L'; + comment : '; '; + secnames : ('', + '.text','.data','.bss', + '','','','','','', + '.stab','.stabstr') + ) {$endif} ); @@ -860,6 +896,20 @@ implementation rescmd : '--include $INC -O coff -o $OBJ $RES' ) {$endif i386} +{$ifdef m68k} + ,( + id : res_m68k_mpw; + resbin : 'rez'; + rescmd : '-i $INC -o $OBJ $RES' + ) +{$endif m68} +{$ifdef powerpc} + ,( + id : res_powerpc_mpw; + resbin : 'rez'; + rescmd : '-i $INC -o $OBJ $RES' + ) +{$endif powerpc} ); @@ -1147,9 +1197,9 @@ implementation ,( target : target_powerpc_LINUX; flags : []; - cpu : alpha; + cpu : powerpc; short_name : 'LINUX'; - unit_env : 'LINUXUNITS'; + unit_env : ''; system_unit : 'syslinux'; smartext : '.sl'; unitext : '.ppu'; @@ -1167,6 +1217,30 @@ implementation heapsize : 256*1024; maxheapsize : 32768*1024; stacksize : 8192 + ), + ( + target : target_powerpc_MACOS; + flags : []; + cpu : powerpc; + short_name : 'MACOS'; + unit_env : ''; + system_unit : 'sysmac'; + smartext : '.sl'; + unitext : '.ppt'; + unitlibext : '.ppl'; + asmext : '.a'; + objext : '.o'; + resext : '.res'; + resobjext : '.or'; + exeext : ''; + os : os_powerpc_macos; + assem : as_powerpc_mpw; + assemsrc : as_powerpc_mpw; + ar : ar_powerpc_ar; + res : res_powerpc_mpw; + heapsize : 256*1024; + maxheapsize : 32768*1024; + stacksize : 8192 ) {$endif} ); @@ -1525,7 +1599,14 @@ begin end. { $Log$ - Revision 1.101 2000-04-04 14:18:15 pierre + Revision 1.102 2000-04-22 14:25:03 jonas + * aasm.pas: pai_align instead of pai_align_abstract if cpu <> i386 + + systems.pas: info for macos/ppc + * new/cgobj.pas: compiles again without newst define + * new/powerpc/cgcpu: generate different entry/exit code depending on + whether target_os is MacOs or Linux + + Revision 1.101 2000/04/04 14:18:15 pierre * nasmwin32 is 9 chars long, idtxt changed accordingly Revision 1.100 2000/04/04 13:54:58 pierre