diff options
author | Richard Henderson <rth@redhat.com> | 2009-09-23 15:24:42 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2009-09-23 15:24:42 -0700 |
commit | 2b4fa409a97f9d398698dff291e4e7176747d6b4 (patch) | |
tree | 321b9eb874c077b9b7674eb07850055b8825fc48 | |
parent | 9193312a099c192f134768d0567fb5d29107a796 (diff) | |
download | gcc-2b4fa409a97f9d398698dff291e4e7176747d6b4.zip gcc-2b4fa409a97f9d398698dff291e4e7176747d6b4.tar.gz gcc-2b4fa409a97f9d398698dff291e4e7176747d6b4.tar.bz2 |
tm.texi (STATIC_CHAIN, [...]): Remove.
* doc/tm.texi (STATIC_CHAIN, STATIC_CHAIN_INCOMING): Remove.
(TARGET_STATIC_CHAIN): Mention that this hook must be used for
static chain passed in memory.
* system.h (STATIC_CHAIN, STATIC_CHAIN_INCOMING): Poison.
* targhooks.c (default_static_chain): Don't handle STATIC_CHAIN,
STATIC_CHAIN_INCOMING. Issue a sorry if there's no
STATIC_CHAIN_REGNUM defined.
* config/picochip/picochip-protos.h: s/class/klass/.
* config/picochip/picochip.c (TARGET_STATIC_CHAIN): New.
(picochip_static_chain): New.
* config/picochip/picochip.h (STATIC_CHAIN): Remove.
(STATIC_CHAIN_INCOMING): Remove.
* config/xtensa/xtensa.c (TARGET_STATIC_CHAIN): New.
(xtensa_static_chain): New.
* config/xtensa/xtensa.h (STATIC_CHAIN, STATIC_CHAIN_INCOMING):
* Remove.
From-SVN: r152104
-rw-r--r-- | gcc/ChangeLog | 20 | ||||
-rw-r--r-- | gcc/config/picochip/picochip-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/picochip/picochip.c | 16 | ||||
-rw-r--r-- | gcc/config/picochip/picochip.h | 14 | ||||
-rw-r--r-- | gcc/config/xtensa/xtensa.c | 14 | ||||
-rw-r--r-- | gcc/config/xtensa/xtensa.h | 11 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 34 | ||||
-rw-r--r-- | gcc/system.h | 2 | ||||
-rw-r--r-- | gcc/targhooks.c | 19 |
9 files changed, 77 insertions, 55 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index acca4cc..862f4bf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2009-09-23 Richard Henderson <rth@redhat.com> + + * doc/tm.texi (STATIC_CHAIN, STATIC_CHAIN_INCOMING): Remove. + (TARGET_STATIC_CHAIN): Mention that this hook must be used for + static chain passed in memory. + * system.h (STATIC_CHAIN, STATIC_CHAIN_INCOMING): Poison. + * targhooks.c (default_static_chain): Don't handle STATIC_CHAIN, + STATIC_CHAIN_INCOMING. Issue a sorry if there's no + STATIC_CHAIN_REGNUM defined. + + * config/picochip/picochip-protos.h: s/class/klass/. + * config/picochip/picochip.c (TARGET_STATIC_CHAIN): New. + (picochip_static_chain): New. + * config/picochip/picochip.h (STATIC_CHAIN): Remove. + (STATIC_CHAIN_INCOMING): Remove. + + * config/xtensa/xtensa.c (TARGET_STATIC_CHAIN): New. + (xtensa_static_chain): New. + * config/xtensa/xtensa.h (STATIC_CHAIN, STATIC_CHAIN_INCOMING): Remove. + 2009-09-23 Anatoly Sokolov <aesok@post.ru> * config/pa/pa.h (FUNCTION_VALUE): Remove macro. diff --git a/gcc/config/picochip/picochip-protos.h b/gcc/config/picochip/picochip-protos.h index 7a2a07b..de68c81 100644 --- a/gcc/config/picochip/picochip-protos.h +++ b/gcc/config/picochip/picochip-protos.h @@ -60,7 +60,7 @@ extern CUMULATIVE_ARGS picochip_arg_advance (CUMULATIVE_ARGS cum, int mode, tree type, int named); extern int picochip_regno_nregs (int regno, int mode); -extern int picochip_class_max_nregs (int class, int mode); +extern int picochip_class_max_nregs (int klass, int mode); extern void picochip_order_regs_for_local_alloc (void); diff --git a/gcc/config/picochip/picochip.c b/gcc/config/picochip/picochip.c index 5155e76..bf6d263 100644 --- a/gcc/config/picochip/picochip.c +++ b/gcc/config/picochip/picochip.c @@ -111,6 +111,8 @@ picochip_asm_named_section (const char *name, unsigned int flags ATTRIBUTE_UNUSED, tree decl ATTRIBUTE_UNUSED); +static rtx picochip_static_chain (const_tree, bool); + /* Lookup table mapping a register number to the earliest containing class. Used by REGNO_REG_CLASS. */ const enum reg_class picochip_regno_reg_class[FIRST_PSEUDO_REGISTER] = @@ -289,6 +291,9 @@ static char picochip_get_vliw_alu_id (void); #undef TARGET_RETURN_IN_MEMORY #define TARGET_RETURN_IN_MEMORY picochip_return_in_memory +#undef TARGET_STATIC_CHAIN +#define TARGET_STATIC_CHAIN picochip_static_chain + struct gcc_target targetm = TARGET_INITIALIZER; @@ -4402,3 +4407,14 @@ picochip_check_conditional_copy (rtx * operands) } + +static rtx +picochip_static_chain (const_tree ARG_UNUSED (fndecl), bool incoming_p) +{ + rtx addr; + if (incoming_p) + addr = arg_pointer_rtx; + else + addr = plus_constant (stack_pointer_rtx, -2 * UNITS_PER_WORD); + return gen_frame_mem (Pmode, addr); +} diff --git a/gcc/config/picochip/picochip.h b/gcc/config/picochip/picochip.h index 35c66d2..44559f2 100644 --- a/gcc/config/picochip/picochip.h +++ b/gcc/config/picochip/picochip.h @@ -391,20 +391,6 @@ extern const enum reg_class picochip_regno_reg_class[FIRST_PSEUDO_REGISTER]; #define FRAME_POINTER_REGNUM 18 #define ARG_POINTER_REGNUM 19 -/* Static chain is used to pass the local variables of the enclosing function. - The static chain is passed in memory. The first long-word location - beneath the stack pointer is used. In the presence of pretend - arguments, which are written into that location, this mechanism - complicates matters. */ - -/* Location seen by the caller. */ -#define STATIC_CHAIN \ - gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, -2 * UNITS_PER_WORD)) - -/* Location seen by the callee. */ -#define STATIC_CHAIN_INCOMING \ - gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, 0)) - /* Eliminating Frame Pointer and Arg Pointer. The frame and argument pointers are eliminated wherever possible, by replacing them with offsets from the stack pointer. */ diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 0264868..f7b7374 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -146,6 +146,7 @@ static tree xtensa_fold_builtin (tree, tree, bool); static rtx xtensa_expand_builtin (tree, rtx, rtx, enum machine_mode, int); static void xtensa_va_start (tree, rtx); static bool xtensa_frame_pointer_required (void); +static rtx xtensa_static_chain (const_tree, bool); static void xtensa_asm_trampoline_template (FILE *); static void xtensa_trampoline_init (rtx, tree, rtx); @@ -231,6 +232,8 @@ static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] = #undef TARGET_FRAME_POINTER_REQUIRED #define TARGET_FRAME_POINTER_REQUIRED xtensa_frame_pointer_required +#undef TARGET_STATIC_CHAIN +#define TARGET_STATIC_CHAIN xtensa_static_chain #undef TARGET_ASM_TRAMPOLINE_TEMPLATE #define TARGET_ASM_TRAMPOLINE_TEMPLATE xtensa_asm_trampoline_template #undef TARGET_TRAMPOLINE_INIT @@ -3434,6 +3437,17 @@ xtensa_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED, outgoing ? GP_OUTGOING_RETURN : GP_RETURN); } +/* The static chain is passed in memory. Provide rtx giving 'mem' + expressions that denote where they are stored. */ + +static rtx +xtensa_static_chain (const_tree ARG_UNUSED (fndecl), bool incoming_p) +{ + rtx base = incoming_p ? arg_pointer_rtx : stack_pointer_rtx; + return gen_frame_mem (Pmode, plus_constant (base, -5 * UNITS_PER_WORD)); +} + + /* TRAMPOLINE_TEMPLATE: For Xtensa, the trampoline must perform an ENTRY instruction with a minimal stack frame in order to get some free registers. Once the actual call target is known, the proper stack frame diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 4fefbfd..b9d896a 100644 --- a/gcc/config/xtensa/xtensa.h +++ b/gcc/config/xtensa/xtensa.h @@ -383,17 +383,6 @@ extern char xtensa_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER]; /* Base register for access to arguments of the function. */ #define ARG_POINTER_REGNUM (GP_REG_FIRST + 17) -/* If the static chain is passed in memory, these macros provide rtx - giving 'mem' expressions that denote where they are stored. - 'STATIC_CHAIN' and 'STATIC_CHAIN_INCOMING' give the locations as - seen by the calling and called functions, respectively. */ - -#define STATIC_CHAIN \ - gen_rtx_MEM (Pmode, plus_constant (stack_pointer_rtx, -5 * UNITS_PER_WORD)) - -#define STATIC_CHAIN_INCOMING \ - gen_rtx_MEM (Pmode, plus_constant (arg_pointer_rtx, -5 * UNITS_PER_WORD)) - /* For now we don't try to use the full set of boolean registers. Without software pipelining of FP operations, there's not much to gain and it's a real pain to get them reloaded. */ diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 8a51a9f..27263d9 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -3661,27 +3661,7 @@ not be defined. The static chain register need not be a fixed register. If the static chain is passed in memory, these macros should not be -defined; instead, the next two macros should be defined. -@end defmac - -@defmac STATIC_CHAIN -@defmacx STATIC_CHAIN_INCOMING -If the static chain is passed in memory, these macros provide rtx giving -@code{mem} expressions that denote where they are stored. -@code{STATIC_CHAIN} and @code{STATIC_CHAIN_INCOMING} give the locations -as seen by the calling and called functions, respectively. Often the former -will be at an offset from the stack pointer and the latter at an offset from -the frame pointer. - -@findex stack_pointer_rtx -@findex frame_pointer_rtx -@findex arg_pointer_rtx -The variables @code{stack_pointer_rtx}, @code{frame_pointer_rtx}, and -@code{arg_pointer_rtx} will have been initialized prior to the use of these -macros and should be used to refer to those items. - -If the static chain is passed in a register, the two previous macros should -be defined instead. +defined; instead, the @code{TARGET_STATIC_CHAIN} hook should be used. @end defmac @deftypefn {Target Hook} rtx TARGET_STATIC_CHAIN (const_tree @var{fndecl}, bool @var{incoming_p}) @@ -3692,6 +3672,18 @@ attributes that affect the calling conventions of the function and those calling conventions use different static chain locations. The default version of this hook uses @code{STATIC_CHAIN_REGNUM} et al. + +If the static chain is passed in memory, this hook should be used to +provide rtx giving @code{mem} expressions that denote where they are stored. +Often the @code{mem} expression as seen by the caller will be at an offset +from the stack pointer and the @code{mem} expression as seen by the callee +will be at an offset from the frame pointer. +@findex stack_pointer_rtx +@findex frame_pointer_rtx +@findex arg_pointer_rtx +The variables @code{stack_pointer_rtx}, @code{frame_pointer_rtx}, and +@code{arg_pointer_rtx} will have been initialized and should be used +to refer to those items. @end deftypefn @defmac DWARF_FRAME_REGISTERS diff --git a/gcc/system.h b/gcc/system.h index 37fbdc1..0c846cf 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -708,7 +708,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; FUNCTION_ARG_PARTIAL_NREGS ASM_OUTPUT_DWARF_DTPREL \ ALLOCATE_INITIAL_VALUE LEGITIMIZE_ADDRESS FRAME_POINTER_REQUIRED \ CAN_ELIMINATE TRAMPOLINE_TEMPLATE INITIALIZE_TRAMPOLINE \ - TRAMPOLINE_ADJUST_ADDRESS + TRAMPOLINE_ADJUST_ADDRESS STATIC_CHAIN STATIC_CHAIN_INCOMING /* Other obsolete target macros, or macros that used to be in target headers and were not used, and may be obsolete or may never have diff --git a/gcc/targhooks.c b/gcc/targhooks.c index 16f481e..8a2e56b 100644 --- a/gcc/targhooks.c +++ b/gcc/targhooks.c @@ -636,22 +636,27 @@ default_static_chain (const_tree fndecl, bool incoming_p) if (incoming_p) { -#ifdef STATIC_CHAIN_INCOMING - return STATIC_CHAIN_INCOMING; -#endif #ifdef STATIC_CHAIN_INCOMING_REGNUM return gen_rtx_REG (Pmode, STATIC_CHAIN_INCOMING_REGNUM); #endif } -#ifdef STATIC_CHAIN - return STATIC_CHAIN; -#endif #ifdef STATIC_CHAIN_REGNUM return gen_rtx_REG (Pmode, STATIC_CHAIN_REGNUM); #endif - gcc_unreachable (); + { + static bool issued_error; + if (!issued_error) + { + issued_error = true; + sorry ("nested functions not supported on this target"); + } + + /* It really doesn't matter what we return here, so long at it + doesn't cause the rest of the compiler to crash. */ + return gen_rtx_MEM (Pmode, stack_pointer_rtx); + } } void |