Commit 034e84c4 by Michael Meissner Committed by Michael Meissner

Fix System V profiling.

From-SVN: r16756
parent 92dcf4c8
Wed Nov 26 15:47:30 1997 Michael Meissner <meissner@cygnus.com>
* rs6000.c (output_function_profiler): Put label address in r0, and
store LR in 4(sp) for System V/eabi.
* rs6000.h (ASM_OUTPUT_REG_{PUSH,POP}): Keep stack aligned to 16
byte boundary, and maintain stack backchain.
Wed Nov 26 11:12:26 1997 Jason Merrill <jason@yorick.cygnus.com>
* toplev.c (main): Complain about -gdwarfn.
......
......@@ -4436,28 +4436,33 @@ output_function_profiler (file, labelno)
if (flag_pic == 1)
{
fprintf (file, "\tbl _GLOBAL_OFFSET_TABLE_@local-4\n");
fprintf (file, "\t%s %s,4(%s)\n",
(TARGET_NEW_MNEMONICS) ? "stw" : "st",
reg_names[0], reg_names[1]);
fprintf (file, "\tmflr %s\n", reg_names[11]);
fprintf (file, "\t%s %s,", (TARGET_NEW_MNEMONICS) ? "lwz" : "l",
reg_names[11]);
reg_names[0]);
assemble_name (file, buf);
fprintf (file, "@got(%s)\n", reg_names[11]);
}
#if TARGET_ELF
else if (flag_pic > 1 || TARGET_RELOCATABLE)
{
fprintf (file, "\tstw %s,4(%s)\n", reg_names[0], reg_names[1]);
fprintf (file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
assemble_name (file, buf);
fprintf (file, "X = .-.LCTOC1\n");
fprintf (file, "\t.long ");
assemble_name (file, buf);
fputs ("\n\t.previous\n", file);
fprintf (file, "\t%s %s,4(%s)\n",
(TARGET_NEW_MNEMONICS) ? "stw" : "st",
reg_names[0], reg_names[1]);
rs6000_pic_func_labelno = rs6000_pic_labelno;
rs6000_output_load_toc_table (file, 11);
fprintf (file, "\t%s %s,", (TARGET_NEW_MNEMONICS) ? "lwz" : "l",
reg_names[11]);
assemble_name (file, buf);
fprintf (file, "X(%s)\n", reg_names[11]);
fprintf (file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
assemble_name (file, buf);
fprintf (file, "X = .-.LCTOC1\n");
fprintf (file, "\t.long ");
assemble_name (file, buf);
fputs ("\n\t.previous\n", file);
}
#endif
else if (TARGET_NEW_MNEMONICS)
......@@ -4466,7 +4471,7 @@ output_function_profiler (file, labelno)
assemble_name (file, buf);
fprintf (file, "@ha\n");
fprintf (file, "\tstw %s,4(%s)\n", reg_names[0], reg_names[1]);
fprintf (file, "\taddi %s,%s,", reg_names[11], reg_names[11]);
fprintf (file, "\taddi %s,%s,", reg_names[0], reg_names[11]);
assemble_name (file, buf);
fputs ("@l\n", file);
}
......
......@@ -2904,12 +2904,17 @@ do { \
#define ASM_OUTPUT_ASCII(FILE, P, N) output_ascii ((FILE), (P), (N))
/* This is how to output code to push a register on the stack.
It need not be very fast code. */
It need not be very fast code.
On the rs6000, we must keep the backchain up to date. In order
to simplify things, always allocate 16 bytes for a push (System V
wants to keep stack aligned to a 16 byte boundary). */
#define ASM_OUTPUT_REG_PUSH(FILE,REGNO) \
do { \
extern char *reg_names[]; \
asm_fprintf (FILE, "\{tstu|stwu} %s,-4(%s)\n", reg_names[REGNO], \
asm_fprintf (FILE, "\t{stu|stwu} %s,-16(%s)\n\t{st|stw} %s,8(%s)\n", \
reg_names[1], reg_names[1], reg_names[REGNO], \
reg_names[1]); \
} while (0)
......@@ -2919,7 +2924,7 @@ do { \
#define ASM_OUTPUT_REG_POP(FILE,REGNO) \
do { \
extern char *reg_names[]; \
asm_fprintf (FILE, "\t{l|lwz} %s,0(%s)\n\t{ai|addic} %s,%s,4\n", \
asm_fprintf (FILE, "\t{l|lwz} %s,8(%s)\n\t{ai|addic} %s,%s,16\n", \
reg_names[REGNO], reg_names[1], reg_names[1], \
reg_names[1]); \
} while (0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment