| 1 | macdefs.h ; machine-dependent definitions
|
|---|
| 2 | code.c ; machine-dependent code for prologs, switches (pass 1)
|
|---|
| 3 | local.c ; machine-dependent code for prologs, switches (pass 1)
|
|---|
| 4 | local2.c ; misc routines and tables of register names (pass 2)
|
|---|
| 5 | order.c ; machine-dependent code-generation strategy (pass 2)
|
|---|
| 6 | table.c ; code templates (pass 2)
|
|---|
| 7 |
|
|---|
| 8 | On OS X, binaries are not ELF and all binaries are compiled PIC. To use pcc
|
|---|
| 9 | on OS X while linking against the system libraries, use the -k option.
|
|---|
| 10 |
|
|---|
| 11 | Current 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 |
|
|---|
| 25 | The way most modern CPUs create the stack is to allocate the frame
|
|---|
| 26 | to contain room for the temporaries, to save the permanent registers
|
|---|
| 27 | and to store the arguments to functions invoked from within the function.
|
|---|
| 28 | To achieve this, all the information must be known when the prologue
|
|---|
| 29 | is generated. Currently we only know the size of the temporaries -
|
|---|
| 30 | we don't know the size of the argument space for each function that
|
|---|
| 31 | gets invoked from this function. Even if we did know this information,
|
|---|
| 32 | we create ops to save the register arguments (R3-R10), early in pass1
|
|---|
| 33 | and don't know the position of the stack pointer, and the size of the
|
|---|
| 34 | argument space required to "step over".
|
|---|
| 35 |
|
|---|
| 36 | One solution is to have two pointers to the stack. One for the top
|
|---|
| 37 | of the stack and the other pointing just below the temporaries but above
|
|---|
| 38 | the argument space. Then our function arguments and the permanent registers can
|
|---|
| 39 | be saved fixed-relative to this register. If we don't know the size of
|
|---|
| 40 | argument space, we cannot "dynamically" alter the stack (like we do with mips),
|
|---|
| 41 | since the powerpc ABI specifies that the "lowest" address
|
|---|
| 42 | in the stack frame is the saved stack pointer (pointing to the previous
|
|---|
| 43 | stack frame). While this is a nice feature for tracking back through the
|
|---|
| 44 | stack frames (which mips has always had problems with), it makes it
|
|---|
| 45 | next-to-impossible to increase the strack frame dynamically.
|
|---|
| 46 |
|
|---|
| 47 | I guess the best approach is to determine the size of the argument stack
|
|---|
| 48 | and have a second frame pointer.
|
|---|