Commit 941cc05a by Richard Kenner Committed by Richard Kenner

alpha.c (alpha_fnname): New static variable.

	* 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.

From-SVN: r34097
parent 421844e7
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> Mon May 22 11:30:48 2000 Clinton Popetz <cpopetz@cygnus.com>
* jump.c (jump_optimize_1): Don't increment LABEL_NUSES * jump.c (jump_optimize_1): Don't increment LABEL_NUSES
...@@ -97,6 +97,10 @@ static int alpha_function_needs_gp; ...@@ -97,6 +97,10 @@ static int alpha_function_needs_gp;
static int alpha_sr_alias_set; static int alpha_sr_alias_set;
/* The assembler name of the current function. */
static const char *alpha_fnname;
/* Declarations of static functions. */ /* Declarations of static functions. */
static void alpha_set_memflags_1 static void alpha_set_memflags_1
PARAMS ((rtx, int, int, int)); PARAMS ((rtx, int, int, int));
...@@ -3243,6 +3247,11 @@ print_operand (file, x, code) ...@@ -3243,6 +3247,11 @@ print_operand (file, x, code)
switch (code) switch (code)
{ {
case '~':
/* Print the assembler name of the current function. */
assemble_name (file, alpha_fnname);
break;
case '&': case '&':
/* Generates fp-rounding mode suffix: nothing for normal, 'c' for /* Generates fp-rounding mode suffix: nothing for normal, 'c' for
chopped, 'm' for minus-infinity, and 'd' for dynamic rounding chopped, 'm' for minus-infinity, and 'd' for dynamic rounding
...@@ -4144,6 +4153,14 @@ alpha_expand_prologue () ...@@ -4144,6 +4153,14 @@ alpha_expand_prologue ()
alpha_sa_mask (&imask, &fmask); 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 /* 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 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 4096 bytes (we can probably get away without the latter test) and
...@@ -4369,6 +4386,7 @@ alpha_start_function (file, fnname, decl) ...@@ -4369,6 +4386,7 @@ alpha_start_function (file, fnname, decl)
char *entry_label = (char *) alloca (strlen (fnname) + 6); char *entry_label = (char *) alloca (strlen (fnname) + 6);
int i; int i;
alpha_fnname = fnname;
sa_size = alpha_sa_size (); sa_size = alpha_sa_size ();
frame_size = get_frame_size (); frame_size = get_frame_size ();
...@@ -4413,6 +4431,15 @@ alpha_start_function (file, fnname, decl) ...@@ -4413,6 +4431,15 @@ alpha_start_function (file, fnname, decl)
fputs ("\t.ent ", file); fputs ("\t.ent ", file);
assemble_name (file, fnname); assemble_name (file, fnname);
putc ('\n', file); 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); strcpy (entry_label, fnname);
...@@ -4494,20 +4521,6 @@ alpha_start_function (file, fnname, decl) ...@@ -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 OPEN_VMS
/* Ifdef'ed cause readonly_section and link_section are only /* Ifdef'ed cause readonly_section and link_section are only
available then. */ available then. */
......
...@@ -2270,9 +2270,9 @@ do { \ ...@@ -2270,9 +2270,9 @@ do { \
#define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE) #define PRINT_OPERAND(FILE, X, CODE) print_operand (FILE, X, CODE)
/* Determine which codes are valid without a following integer. These must /* Determine which codes are valid without a following integer. These must
not be alphabetic (the characters are chosen so that not be alphabetic.
PRINT_OPERAND_PUNCT_VALID_P translates into a simple range change when
using ASCII). ~ Generates the name of the current function.
& Generates fp-rounding mode suffix: nothing for normal, 'c' for & Generates fp-rounding mode suffix: nothing for normal, 'c' for
chopped, 'm' for minus-infinity, and 'd' for dynamic rounding chopped, 'm' for minus-infinity, and 'd' for dynamic rounding
...@@ -2304,7 +2304,8 @@ do { \ ...@@ -2304,7 +2304,8 @@ do { \
#define PRINT_OPERAND_PUNCT_VALID_P(CODE) \ #define PRINT_OPERAND_PUNCT_VALID_P(CODE) \
((CODE) == '&' || (CODE) == '`' || (CODE) == '\'' || (CODE) == '(' \ ((CODE) == '&' || (CODE) == '`' || (CODE) == '\'' || (CODE) == '(' \
|| (CODE) == ')' || (CODE) == '+' || (CODE) == ',' || (CODE) == '-') || (CODE) == ')' || (CODE) == '+' || (CODE) == ',' || (CODE) == '-' \
|| (CODE) == '~')
/* Print a memory address as an operand to reference that memory location. */ /* Print a memory address as an operand to reference that memory location. */
......
...@@ -5487,7 +5487,16 @@ ...@@ -5487,7 +5487,16 @@
(define_expand "prologue" (define_expand "prologue"
[(clobber (const_int 0))] [(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" (define_insn "init_fp"
[(set (match_operand:DI 0 "register_operand" "=r") [(set (match_operand:DI 0 "register_operand" "=r")
......
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