From: vmakarov Date: Fri, 12 Nov 1999 20:26:29 +0000 (+0000) Subject: Fri Nov 12 15:14:19 1999 Vladimir Makarov X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=094129e64b443c590effb69b58953d8d40c56be4;p=platform%2Fupstream%2Flinaro-gcc.git Fri Nov 12 15:14:19 1999 Vladimir Makarov * i960.h (CAN_DEBUG_WITHOUT_FP): Don't define it. (FRAME_POINTER_REQUIRED): Don't worry about nonlocal goto. (ELIMINABLE_REGS, CAN_ELIMINATE, INITIAL_ELIMINATION_OFFSET): New. (INITIAL_FRAME_POINTER_OFFSET): Remove it. * i960.c (i960_function_prologue): Don't allocate space for g8-g11 saved on the stack. Output more accurate stack frame statistics into assembler file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30511 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2e57cc6..865fd39 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +Fri Nov 12 15:14:19 1999 Vladimir Makarov + + * i960.h (CAN_DEBUG_WITHOUT_FP): Don't define it. + (FRAME_POINTER_REQUIRED): Don't worry about nonlocal goto. + (ELIMINABLE_REGS, CAN_ELIMINATE, INITIAL_ELIMINATION_OFFSET): New. + (INITIAL_FRAME_POINTER_OFFSET): Remove it. + + * i960.c (i960_function_prologue): Don't allocate space for g8-g11 + saved on the stack. Output more accurate stack frame statistics + into assembler file. + 1999-11-12 11:47 -0800 Zack Weinberg * genextract.c (record_insn_name): New function. diff --git a/gcc/config/i960/i960.c b/gcc/config/i960/i960.c index 2dd17ae..c7dc008 100644 --- a/gcc/config/i960/i960.c +++ b/gcc/config/i960/i960.c @@ -1333,8 +1333,9 @@ i960_function_prologue (file, size) unsigned int size; { register int i, j, nr; - int n_iregs = 0; - int rsize = 0; + int n_saved_regs = 0; + int n_remaining_saved_regs; + int lvar_size; int actual_fsize, offset; int gnw, lnw; struct reg_group *g, *l; @@ -1357,11 +1358,13 @@ i960_function_prologue (file, size) regs[i] = -1; /* Count global registers that need saving. */ if (i < 16) - n_iregs++; + n_saved_regs++; } else regs[i] = 0; + n_remaining_saved_regs = n_saved_regs; + epilogue_string[0] = '\0'; if (profile_flag || profile_block_flag) @@ -1397,7 +1400,7 @@ i960_function_prologue (file, size) (g->length == 2) ? "l" : ""), reg_names[l->start_reg], reg_names[g->start_reg]); strcat (epilogue_string, tmpstr); - n_iregs -= g->length; + n_remaining_saved_regs -= g->length; for (i = 0; i < g->length; i++) { regs [i + g->start_reg] = 1; @@ -1415,11 +1418,7 @@ i960_function_prologue (file, size) lnw = i960_split_reg_group (l, lnw, g->length); } - /* N_iregs is now the number of global registers that haven't been saved - yet. */ - - rsize = (n_iregs * 4); - actual_fsize = compute_frame_size (size) + rsize; + actual_fsize = compute_frame_size (size); #if 0 /* ??? The 1.2.1 compiler does this also. This is meant to round the frame size up to the nearest multiple of 16. I don't know whether this is @@ -1443,11 +1442,12 @@ i960_function_prologue (file, size) /* Take hardware register save area created by the call instruction into account, but store them before the argument block area. */ - offset = 64 + actual_fsize - compute_frame_size (0) - rsize; + lvar_size = actual_fsize - compute_frame_size (0) - n_saved_regs * 4; + offset = 64 + lvar_size; /* Save registers on stack if needed. */ /* ??? Is it worth to use the same algorithm as one for saving global registers in local registers? */ - for (i = 0, j = n_iregs; j > 0 && i < 16; i++) + for (i = 0, j = n_remaining_saved_regs; j > 0 && i < 16; i++) { if (regs[i] != -1) continue; @@ -1480,17 +1480,17 @@ i960_function_prologue (file, size) offset += nr * 4; } - if (actual_fsize == 0 && size == 0 && rsize == 0) + if (actual_fsize == 0) return; fprintf (file, "\t#Prologue stats:\n"); fprintf (file, "\t# Total Frame Size: %d bytes\n", actual_fsize); - if (size) - fprintf (file, "\t# Local Variable Size: %d bytes\n", size); - if (rsize) + if (lvar_size) + fprintf (file, "\t# Local Variable Size: %d bytes\n", lvar_size); + if (n_saved_regs) fprintf (file, "\t# Register Save Size: %d regs, %d bytes\n", - n_iregs, rsize); + n_saved_regs, n_saved_regs * 4); fprintf (file, "\t#End Prologue#\n"); } diff --git a/gcc/config/i960/i960.h b/gcc/config/i960/i960.h index 63be254..5f29336 100644 --- a/gcc/config/i960/i960.h +++ b/gcc/config/i960/i960.h @@ -94,8 +94,13 @@ Boston, MA 02111-1307, USA. */ #define LIB_SPEC "%{!nostdlib:-lcg %{p:-lprof}%{pg:-lgprof}\ %{mka:-lfpg}%{msa:-lfpg}%{mca:-lfpg}%{mcf:-lfpg} -lgnu}" -/* Show we can debug even without a frame pointer. */ -#define CAN_DEBUG_WITHOUT_FP +/* Defining the macro shows we can debug even without a frame pointer. + Actually, we can debug without FP. But defining the macro results in + that -O means FP elimination. Addressing through sp requires + negative offset and more one word addressing in the most cases + (offsets except for 0-4095 require one more word). Therefore we've + not defined the macro. */ +/*#define CAN_DEBUG_WITHOUT_FP*/ /* Do leaf procedure and tail call optimizations for -O2 and higher. */ #define OPTIMIZATION_OPTIONS(LEVEL,SIZE) \ @@ -611,18 +616,30 @@ extern int hard_regno_mode_ok (); elimination messes up nonlocal goto sequences. I think this works for other targets because they use indirect jumps for the return which disables fp elimination. */ -#define FRAME_POINTER_REQUIRED \ - (! leaf_function_p () || current_function_has_nonlocal_goto) +#define FRAME_POINTER_REQUIRED (! leaf_function_p ()) -/* C statement to store the difference between the frame pointer - and the stack pointer values immediately after the function prologue. +/* Definitions for register eliminations. + + This is an array of structures. Each structure initializes one pair + of eliminable registers. The "from" register number is given first, + followed by "to". Eliminations of the same "from" register are listed + in order of preference.. */ + +#define ELIMINABLE_REGS {{FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}} + +/* Given FROM and TO register numbers, say whether this elimination is allowed. + Frame pointer elimination is automatically handled. */ +#define CAN_ELIMINATE(FROM, TO) 1 + +/* Define the offset between two registers, one to be eliminated, and + the other its replacement, at the start of a routine. Since the stack grows upward on the i960, this must be a negative number. This includes the 64 byte hardware register save area and the size of the frame. */ -#define INITIAL_FRAME_POINTER_OFFSET(VAR) \ - do { (VAR) = - (64 + compute_frame_size (get_frame_size ())); } while (0) +#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \ + do { (OFFSET) = - (64 + compute_frame_size (get_frame_size ())); } while (0) /* Base register for access to arguments of the function. */ #define ARG_POINTER_REGNUM 14