OSDN Git Service

* config/alpha/alpha.c (alpha_fnname): New static variable.
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 23 May 2000 01:44:05 +0000 (01:44 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 23 May 2000 01:44:05 +0000 (01:44 +0000)
(print_operand, case '~'): New case.
(alpha_expand_prologue): Emit prologue_ldgp insn if needed.
(alpha_start_function): Set alpha_fnname.
Write "ng" label if no ldgp; don't write ldgp insn.
* config/alpha/alpha.h (PRINT_OPERAND_PUNCT_VALID_P): New case '~'.
* config/alpha/alpha.md (prologue_ldgp): New define_insn.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34097 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/config/alpha/alpha.h
gcc/config/alpha/alpha.md

index b9b10ca..ab84d24 100644 (file)
@@ -1,3 +1,13 @@
+Mon May 22 21:49:00 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * config/alpha/alpha.c (alpha_fnname): New static variable.
+       (print_operand, case '~'): New case.
+       (alpha_expand_prologue): Emit prologue_ldgp insn if needed.
+       (alpha_start_function): Set alpha_fnname.
+       Write "ng" label if no ldgp; don't write ldgp insn.
+       * config/alpha/alpha.h (PRINT_OPERAND_PUNCT_VALID_P): New case '~'.
+       * config/alpha/alpha.md (prologue_ldgp): New define_insn.
+
 Mon May 22 11:30:48 2000  Clinton Popetz  <cpopetz@cygnus.com>
 
        * jump.c (jump_optimize_1): Don't increment LABEL_NUSES
index f7030d1..483ae69 100644 (file)
@@ -97,6 +97,10 @@ static int alpha_function_needs_gp;
 
 static int alpha_sr_alias_set;
 
+/* The assembler name of the current function.  */
+
+static const char *alpha_fnname;
+
 /* Declarations of static functions.  */
 static void alpha_set_memflags_1
   PARAMS ((rtx, int, int, int));
@@ -3243,6 +3247,11 @@ print_operand (file, x, code)
 
   switch (code)
     {
+    case '~':
+      /* Print the assembler name of the current function.  */
+      assemble_name (file, alpha_fnname);
+      break;
+
     case '&':
       /* Generates fp-rounding mode suffix: nothing for normal, 'c' for
         chopped, 'm' for minus-infinity, and 'd' for dynamic rounding
@@ -4144,6 +4153,14 @@ alpha_expand_prologue ()
 
   alpha_sa_mask (&imask, &fmask);
 
+  /* Emit an insn to reload GP, if needed.  */
+  if (!TARGET_OPEN_VMS && !TARGET_WINDOWS_NT)
+    {
+      alpha_function_needs_gp = alpha_does_function_need_gp ();
+      if (alpha_function_needs_gp)
+       emit_insn (gen_prologue_ldgp ());
+    }
+
   /* Adjust the stack by the frame size.  If the frame size is > 4096
      bytes, we need to be sure we probe somewhere in the first and last
      4096 bytes (we can probably get away without the latter test) and
@@ -4369,6 +4386,7 @@ alpha_start_function (file, fnname, decl)
   char *entry_label = (char *) alloca (strlen (fnname) + 6);
   int i;
 
+  alpha_fnname = fnname;
   sa_size = alpha_sa_size ();
 
   frame_size = get_frame_size ();
@@ -4413,6 +4431,15 @@ alpha_start_function (file, fnname, decl)
       fputs ("\t.ent ", file);
       assemble_name (file, fnname);
       putc ('\n', file);
+
+      /* If the function needs GP, we'll write the "..ng" label there.
+        Otherwise, do it here.  */
+      if (! alpha_function_needs_gp)
+       {
+         putc ('$', file);
+         assemble_name (file, fnname);
+         fputs ("..ng:\n", file);
+       }
     }
 
   strcpy (entry_label, fnname);
@@ -4494,20 +4521,6 @@ alpha_start_function (file, fnname, decl)
        }
     }
 
-  /* Emit GP related things.  It is rather unfortunate about the alignment
-     issues surrounding a CODE_LABEL that forces us to do the label in 
-     plain text.  */
-  if (!TARGET_OPEN_VMS && !TARGET_WINDOWS_NT)
-    {
-      alpha_function_needs_gp = alpha_does_function_need_gp ();
-      if (alpha_function_needs_gp)
-       fputs ("\tldgp $29,0($27)\n", file);
-
-      putc ('$', file);
-      assemble_name (file, fnname);
-      fputs ("..ng:\n", file);
-    }
-
 #ifdef OPEN_VMS
   /* Ifdef'ed cause readonly_section and link_section are only
      available then.  */
index 31ad3bb..2d9be06 100644 (file)
@@ -2270,9 +2270,9 @@ do {                                                                      \
 #define PRINT_OPERAND(FILE, X, CODE)  print_operand (FILE, X, CODE)
 
 /* Determine which codes are valid without a following integer.  These must
-   not be alphabetic (the characters are chosen so that
-   PRINT_OPERAND_PUNCT_VALID_P translates into a simple range change when
-   using ASCII).
+   not be alphabetic.
+
+   ~    Generates the name of the current function.
 
    &   Generates fp-rounding mode suffix: nothing for normal, 'c' for
        chopped, 'm' for minus-infinity, and 'd' for dynamic rounding
@@ -2304,7 +2304,8 @@ do {                                                                      \
 
 #define PRINT_OPERAND_PUNCT_VALID_P(CODE)                              \
   ((CODE) == '&' || (CODE) == '`' || (CODE) == '\'' || (CODE) == '('   \
-   || (CODE) == ')' || (CODE) == '+' || (CODE) == ',' || (CODE) == '-')
+   || (CODE) == ')' || (CODE) == '+' || (CODE) == ',' || (CODE) == '-' \
+   || (CODE) == '~')
 \f
 /* Print a memory address as an operand to reference that memory location.  */
 
index 5b9dd8e..835ffee 100644 (file)
 (define_expand "prologue"
   [(clobber (const_int 0))]
   ""
-  "alpha_expand_prologue (); DONE;")
+  "
+{
+  alpha_expand_prologue ();
+  DONE;
+}")
+
+(define_insn "prologue_ldgp"
+  [(unspec_volatile [(const_int 0)] 9)]
+  ""
+  "ldgp $29,0($27)\\n$%~..ng:")
 
 (define_insn "init_fp"
   [(set (match_operand:DI 0 "register_operand" "=r")