diff options
author | meissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-11-26 21:04:33 +0000 |
---|---|---|
committer | meissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1997-11-26 21:04:33 +0000 |
commit | 0dc80f603bdd6b7df81ec0899370d1655fef8401 (patch) | |
tree | 8ea4615fbf99f6f7bf6c8d2c69055862d592ac44 /gcc/config/rs6000 | |
parent | a3c228aa8af7a0da80178e3293857c1a058df7dc (diff) | |
download | gcc-0dc80f603bdd6b7df81ec0899370d1655fef8401.tar.gz |
Fix System V profiling.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@16756 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/rs6000')
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 23 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.h | 11 |
2 files changed, 22 insertions, 12 deletions
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 4af7a75f803..ef627e87b49 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -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); } diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 91242a8c35a..3e7b932ffb2 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -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) |