Make ASM_OUTPUT_MI_THUNK ELF only for now and always use jump
authorMichael Meissner <meissner@cygnus.com>
Mon, 28 Sep 1998 14:40:27 +0000 (14:40 +0000)
committerMichael Meissner <meissner@gcc.gnu.org>
Mon, 28 Sep 1998 14:40:27 +0000 (14:40 +0000)
From-SVN: r22628

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.h

index d4c2f869d0b47a590e1a537e818c9b8b486ae66b..d452b4df5b82f75648a275d127d47915afdfb52f 100644 (file)
@@ -1,3 +1,8 @@
+Mon Sep 28 17:34:35 1998  Michael Meissner  <meissner@cygnus.com>
+
+       * rs6000.h (ASM_OUTPUT_MI_THUNK): Only define on ELF systems.
+       * rs6000.c (output_mi_thunk): Always use a raw jump for now.
+
 Mon Sep 28 14:24:03 1998  Mark Mitchell  <mark@markmitchell.com>
 
        * tree.h (TYPE_BINFO): Document.
index bc307c40fa5d0daf8d1afc775c16acb482f6fe8c..f4f47ed2ea838eb131b9d3bfde7ea5d3b0cd5022 100644 (file)
@@ -4557,6 +4557,15 @@ output_mi_thunk (file, thunk_fndecl, delta, function)
      Otherwise, load up its address and jump to it.  */
 
   fname = XSTR (XEXP (DECL_RTL (function), 0), 0);
+#if 1
+  /* For now, just emit a branch always, until we can figure out better when we
+     need to load the address into the count register and emit the slower bctr
+     instruction.  */
+  fprintf (file, "\tb %s", prefix);
+  assemble_name (file, fname);
+  fprintf (file, "\n");
+
+#else
   if (TREE_ASM_WRITTEN (function)
       && !lookup_attribute ("longcall", TYPE_ATTRIBUTES (TREE_TYPE (function))))
     {
@@ -4620,6 +4629,8 @@ output_mi_thunk (file, thunk_fndecl, delta, function)
              asm_fprintf (file, "\t{l|lwz} %s,", r0);
              assemble_name (file, fname);
              asm_fprintf (file, "@got(%s)\n", r12);
+             asm_fprintf (file, "\tmtctr %s\n", r0);
+             asm_fprintf (file, "\tbctr\n");
            }
 #if TARGET_ELF
          else if (flag_pic > 1 || TARGET_RELOCATABLE)
@@ -4635,6 +4646,8 @@ output_mi_thunk (file, thunk_fndecl, delta, function)
              asm_fprintf (file, "(%s)\n", r12);
              asm_fprintf (file, "\t{l|lwz} %s,4(%s)\n", r12, sp);
              asm_fprintf (file, "\tmtlr %s\n", r12);
+             asm_fprintf (file, "\tmtctr %s\n", r0);
+             asm_fprintf (file, "\tbctr\n");
              asm_fprintf (file, "%s\n", MINIMAL_TOC_SECTION_ASM_OP);
              assemble_name (file, buf);
              fputs (" = .-.LCTOC1\n", file);
@@ -4642,22 +4655,24 @@ output_mi_thunk (file, thunk_fndecl, delta, function)
              assemble_name (file, fname);
              fputs ("\n\t.previous\n", file);
            }
-#endif
+#endif /* TARGET_ELF */
+
          else
            {
-             asm_fprintf (file, "\t{liu|lis} %s,", r0);
+             asm_fprintf (file, "\t{liu|lis} %s,", r12);
              assemble_name (file, fname);
              asm_fprintf (file, "@ha\n");
-             asm_fprintf (file, "\t{cal|la} %s,", r0);
+             asm_fprintf (file, "\t{cal|la} %s,", r12);
              assemble_name (file, fname);
-             asm_fprintf (file, "@l(%s)\n", r0);
+             asm_fprintf (file, "@l(%s)\n", r12);
+             asm_fprintf (file, "\tmtctr %s\n", r12);
+             asm_fprintf (file, "\tbctr\n");
            }
 
-         asm_fprintf (file, "\tmtctr %s\n", r0);
-         asm_fprintf (file, "\tbctr\n");
          break;
        }
     }
+#endif /* #if 0 out code to use bctr for far away jumps */
 }
 
 \f
index 0e10ad671606622ac795144616009a3f4cc13a66..1ceef9571c681d3270d151a782833959c1eb8bbe 100644 (file)
@@ -1617,8 +1617,10 @@ typedef struct rs6000_args
    frontend will generate a less efficient heavyweight thunk that calls
    FUNCTION instead of jumping to it.  The generic approach does not support
    varargs.  */
+#if TARGET_ELF
 #define ASM_OUTPUT_MI_THUNK(FILE, THUNK_FNDECL, DELTA, FUNCTION) \
   output_mi_thunk (FILE, THUNK_FNDECL, DELTA, FUNCTION)
+#endif
 \f
 /* TRAMPOLINE_TEMPLATE deleted */