Richard Henderson - Re: [PATCH] fix bad interaction between -pg and stack realignment on x86 (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

On Wed, Feb 28, 2007 at 11:53:08AM +0100, Olivier Hainque wrote:

gcc/

* config/i386/i386.h (PROFILE_COUNT_REGISTER): Turn into ...
(PROFILE_COUNT_REGNUM): New macro.
(MCOUNT_PRESERVES_ALL_REGS): New macro, tells whether mcount
preserves all regs.  Default to 1 here, to be redefined by subtarget
configurations as needed.  
* config/i386/i386.c (X86_SET_PROFILE_COUNTERS): New local macro,
always defined.  Conveys whether NO_PROFILE_COUNTERS is defined.
(x86_function_profiler): Split into ...
(x86_64_function_profiler): New function, and
(x86_32_function_profiler): New function.  Save/restore the
force_align_arg_pointer register when needed.
* config/i386/sol2.h (MCOUNT_PRESERVES_ALL_REGS): Redefine to 0.

testsuite/

* gcc.target/i386/force_align_mcount.c: New case.

Ok.

You might also save/restore the argument regisers, if any. E.g.

/* { dg-do run { target i?86-- } } / / { dg-options "-pg" } */

extern void abort (void);

void attribute ((regparm(3))) foo (int a, int b, int c) { if (a != 1 || b != 2 || c != 3) abort (); }

int main (int argc, char *argv[]) { foo (1, 2, 3); return 0; }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]