diff options
Diffstat (limited to 'gcc/config/xtensa')
-rw-r--r-- | gcc/config/xtensa/xtensa-protos.h | 2 | ||||
-rw-r--r-- | gcc/config/xtensa/xtensa.c | 41 | ||||
-rw-r--r-- | gcc/config/xtensa/xtensa.h | 18 |
3 files changed, 33 insertions, 28 deletions
diff --git a/gcc/config/xtensa/xtensa-protos.h b/gcc/config/xtensa/xtensa-protos.h index 73176f6f8f6..6bd1e565fe7 100644 --- a/gcc/config/xtensa/xtensa-protos.h +++ b/gcc/config/xtensa/xtensa-protos.h @@ -70,7 +70,6 @@ struct secondary_reload_info; extern enum reg_class xtensa_secondary_reload (bool, rtx, enum reg_class, enum machine_mode, struct secondary_reload_info *); -extern void xtensa_initialize_trampoline (rtx, rtx, rtx); #endif /* RTX_CODE */ #ifdef TREE_CODE @@ -86,6 +85,5 @@ extern void override_options (void); extern long compute_frame_size (int); extern void xtensa_expand_prologue (void); extern void order_regs_for_local_alloc (void); -extern void xtensa_trampoline_template (FILE *); #endif /* !__XTENSA_PROTOS_H__ */ diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c index 77ba2d9d017..f7b73748b76 100644 --- a/gcc/config/xtensa/xtensa.c +++ b/gcc/config/xtensa/xtensa.c @@ -146,6 +146,9 @@ 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); static const int reg_nonleaf_alloc_order[FIRST_PSEUDO_REGISTER] = REG_ALLOC_ORDER; @@ -229,6 +232,13 @@ 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 +#define TARGET_TRAMPOLINE_INIT xtensa_trampoline_init + struct gcc_target targetm = TARGET_INITIALIZER; @@ -3427,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 @@ -3435,8 +3456,8 @@ xtensa_function_value (const_tree valtype, const_tree func ATTRIBUTE_UNUSED, control to the instruction following the ENTRY at the target. Note: this assumes that the target begins with an ENTRY instruction. */ -void -xtensa_trampoline_template (FILE *stream) +static void +xtensa_asm_trampoline_template (FILE *stream) { bool use_call0 = (TARGET_CONST16 || TARGET_ABSOLUTE_LITERALS); @@ -3503,17 +3524,21 @@ xtensa_trampoline_template (FILE *stream) fprintf (stream, "\t.end no-transform\n"); } - -void -xtensa_initialize_trampoline (rtx addr, rtx func, rtx chain) +static void +xtensa_trampoline_init (rtx m_tramp, tree fndecl, rtx chain) { + rtx func = XEXP (DECL_RTL (fndecl), 0); bool use_call0 = (TARGET_CONST16 || TARGET_ABSOLUTE_LITERALS); int chain_off = use_call0 ? 12 : 8; int func_off = use_call0 ? 16 : 12; - emit_move_insn (gen_rtx_MEM (SImode, plus_constant (addr, chain_off)), chain); - emit_move_insn (gen_rtx_MEM (SImode, plus_constant (addr, func_off)), func); + + emit_block_move (m_tramp, assemble_trampoline_template (), + GEN_INT (TRAMPOLINE_SIZE), BLOCK_OP_NORMAL); + + emit_move_insn (adjust_address (m_tramp, SImode, chain_off), chain); + emit_move_insn (adjust_address (m_tramp, SImode, func_off), func); emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__xtensa_sync_caches"), - 0, VOIDmode, 1, addr, Pmode); + 0, VOIDmode, 1, XEXP (m_tramp, 0), Pmode); } diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h index 84d320bc95b..b9d896a9510 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. */ @@ -677,8 +666,6 @@ typedef struct xtensa_args /* Stack pointer value doesn't matter at exit. */ #define EXIT_IGNORE_STACK 1 -#define TRAMPOLINE_TEMPLATE(STREAM) xtensa_trampoline_template (STREAM) - /* Size in bytes of the trampoline, as an integer. Make sure this is a multiple of TRAMPOLINE_ALIGNMENT to avoid -Wpadded warnings. */ #define TRAMPOLINE_SIZE (TARGET_CONST16 || TARGET_ABSOLUTE_LITERALS ? 60 : 52) @@ -686,11 +673,6 @@ typedef struct xtensa_args /* Alignment required for trampolines, in bits. */ #define TRAMPOLINE_ALIGNMENT 32 -/* A C statement to initialize the variable parts of a trampoline. */ -#define INITIALIZE_TRAMPOLINE(ADDR, FUNC, CHAIN) \ - xtensa_initialize_trampoline (ADDR, FUNC, CHAIN) - - /* If defined, a C expression that produces the machine-specific code to setup the stack so that arbitrary frames can be accessed. |