/* To be used by skip_prologue. */
struct rs6000_framedata {
- int offset; /* # of bytes in gpr's and fpr's are saved */
+ int offset; /* total size of frame --- the distance
+ by which we decrement sp to allocate
+ the frame */
int saved_gpr; /* smallest # of saved gpr */
int saved_fpr; /* smallest # of saved fpr */
int alloca_reg; /* alloca register number (frame ptr) */
char frameless; /* true if frameless functions. */
char nosavedpc; /* true if pc not saved. */
- int gpr_offset; /* offset of saved gprs */
- int fpr_offset; /* offset of saved fprs */
+ int gpr_offset; /* offset of saved gprs from prev sp */
+ int fpr_offset; /* offset of saved fprs from prev sp */
int lr_offset; /* offset of saved lr */
int cr_offset; /* offset of saved cr */
};
/* Stack grows downward. */
-#define INNER_THAN <
+#define INNER_THAN(lhs,rhs) ((lhs) < (rhs))
/* This is how arguments pushed onto stack or passed in registers.
Stack must be aligned on 64-bit boundaries when synthesizing
/* return pc value after skipping a function prologue and also return
information about a function frame.
- in struct rs6000_frameinfo fdata:
+ in struct rs6000_framedata fdata:
- frameless is TRUE, if function does not have a frame.
- nosavedpc is TRUE, if function does not save %pc value in its frame.
- - offset is the number of bytes used in the frame to save registers.
+ - offset is the initial size of this stack frame --- the amount by
+ which we decrement the sp to allocate the frame.
- saved_gpr is the number of the first saved gpr.
- saved_fpr is the number of the first saved fpr.
- alloca_reg is the number of the register used for alloca() handling.
Otherwise -1.
- - gpr_offset is the offset of the saved gprs
- - fpr_offset is the offset of the saved fprs
+ - gpr_offset is the offset of the first saved gpr from the previous frame.
+ - fpr_offset is the offset of the first saved fpr from the previous frame.
- lr_offset is the offset of the saved lr
- cr_offset is the offset of the saved cr
- */
+*/
#define SIGNED_SHORT(x) \
((sizeof (short) == 2) \
write_register (PC_REGNUM, lr);
/* reset register values if any was saved earlier. */
- addr = prev_sp - fdata.offset;
if (fdata.saved_gpr != -1)
- for (ii = fdata.saved_gpr; ii <= 31; ++ii) {
- read_memory (addr, ®isters [REGISTER_BYTE (ii)], 4);
- addr += 4;
+ {
+ addr = prev_sp + fdata.gpr_offset;
+ for (ii = fdata.saved_gpr; ii <= 31; ++ii) {
+ read_memory (addr, ®isters [REGISTER_BYTE (ii)], 4);
+ addr += 4;
+ }
}
if (fdata.saved_fpr != -1)
- for (ii = fdata.saved_fpr; ii <= 31; ++ii) {
- read_memory (addr, ®isters [REGISTER_BYTE (ii+FP0_REGNUM)], 8);
- addr += 8;
- }
+ {
+ addr = prev_sp + fdata.fpr_offset;
+ for (ii = fdata.saved_fpr; ii <= 31; ++ii) {
+ read_memory (addr, ®isters [REGISTER_BYTE (ii+FP0_REGNUM)], 8);
+ addr += 8;
+ }
+ }
write_register (SP_REGNUM, prev_sp);
target_store_registers (-1);