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