1macdefs.h ; machine-dependent definitions 2code.c ; machine-dependent code for prologs, switches (pass 1) 3local.c ; machine-dependent code for prologs, switches (pass 1) 4local2.c ; misc routines and tables of register names (pass 2) 5order.c ; machine-dependent code-generation strategy (pass 2) 6table.c ; code templates (pass 2) 7 8On OS X, binaries are not ELF and all binaries are compiled PIC. To use pcc 9on OS X while linking against the system libraries, use the -k option. 10 11Current issues: 12 13- no floating point (need mickey's patches to support >64 registers) 14- mod/div on longlong not supported 15- the stack frame is always 200 bytes - need to calculate size and patch 16 OREGs to temporaries and arguments [see discussion below] 17- function arguments are always saved to the stack [need to change MI code] 18- permanent registers >R13 are not saved [need to change MI code] 19- structure arguments don't work 20- return of structure doesn't work 21- function pointers don't work for PIC 22- constant structure assignment doesn't work properly for PIC 23- no built-in vararg support [shouldn't be too hard to add] 24 25The way most modern CPUs create the stack is to allocate the frame 26to contain room for the temporaries, to save the permanent registers 27and to store the arguments to functions invoked from within the function. 28To achieve this, all the information must be known when the prologue 29is generated. Currently we only know the size of the temporaries - 30we don't know the size of the argument space for each function that 31gets invoked from this function. Even if we did know this information, 32we create ops to save the register arguments (R3-R10), early in pass1 33and don't know the position of the stack pointer, and the size of the 34argument space required to "step over". 35 36One solution is to have two pointers to the stack. One for the top 37of the stack and the other pointing just below the temporaries but above 38the argument space. Then our function arguments and the permanent registers can 39be saved fixed-relative to this register. If we don't know the size of 40argument space, we cannot "dynamically" alter the stack (like we do with mips), 41since the powerpc ABI specifies that the "lowest" address 42in the stack frame is the saved stack pointer (pointing to the previous 43stack frame). While this is a nice feature for tracking back through the 44stack frames (which mips has always had problems with), it makes it 45next-to-impossible to increase the strack frame dynamically. 46 47I guess the best approach is to determine the size of the argument stack 48and have a second frame pointer. 49