diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b9b10ca681c..ab84d2460a8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +Mon May 22 21:49:00 2000 Richard Kenner + + * 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 * jump.c (jump_optimize_1): Don't increment LABEL_NUSES diff --git a/gcc/config/alpha/alpha.c b/gcc/config/alpha/alpha.c index f7030d1dd91..483ae69274c 100644 --- a/gcc/config/alpha/alpha.c +++ b/gcc/config/alpha/alpha.c @@ -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. */ diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 31ad3bb968e..2d9be06f17f 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -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) == '~') /* Print a memory address as an operand to reference that memory location. */ diff --git a/gcc/config/alpha/alpha.md b/gcc/config/alpha/alpha.md index 5b9dd8e9459..835ffee14f2 100644 --- a/gcc/config/alpha/alpha.md +++ b/gcc/config/alpha/alpha.md @@ -5487,7 +5487,16 @@ (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")