diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-15 17:09:56 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-07-15 17:09:56 +0000 |
commit | 8ee59e4e45f5f44634eb79b5ca771e429bd78c28 (patch) | |
tree | 50c59d144fb0377196004267e3d65142ab7825c9 /gcc/cfgexpand.c | |
parent | 075bad58c8c7f215fce1f2fa8851cb79f6aa2b1c (diff) | |
download | gcc-8ee59e4e45f5f44634eb79b5ca771e429bd78c28.tar.gz |
PR target/48220
* doc/md.texi (Standard Names): Document window_save.
* cfgexpand.c (expand_debug_parm_decl): New function extracted from
expand_debug_expr and expand_debug_source_expr. If the target has
a window_save instruction, adjust the ENTRY_VALUE_EXP.
(expand_debug_expr) <SSA_NAME>: Call expand_debug_parm_decl if the
SSA_NAME_VAR is a parameter.
(expand_debug_source_expr) <PARM_DECL>: Call expand_debug_parm_decl.
* var-tracking.c (parm_reg_t): New type and associated vector type.
(windowed_parm_regs): New variable.
(adjust_insn): If the target has a window_save instruction and this
is the instruction, make its effect on parameter registers explicit.
(next_non_note_insn_var_location): New function.
(emit_notes_in_bb): Use it instead of NEXT_INSN throughout.
(vt_add_function_parameter): If the target has a window_save insn,
adjust the incoming RTL and record that in windowed_parm_regs.
(vt_finalize): Free windowed_parm_regs.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176318 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r-- | gcc/cfgexpand.c | 120 |
1 files changed, 63 insertions, 57 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 60e57523ea1..f87308c72a0 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -2358,8 +2358,60 @@ convert_debug_memory_address (enum machine_mode mode, rtx x, return x; } -/* Return an RTX equivalent to the value of the tree expression - EXP. */ +/* Return an RTX equivalent to the value of the parameter DECL. */ + +static rtx +expand_debug_parm_decl (tree decl) +{ + rtx incoming = DECL_INCOMING_RTL (decl); + + if (incoming + && GET_MODE (incoming) != BLKmode + && ((REG_P (incoming) && HARD_REGISTER_P (incoming)) + || (MEM_P (incoming) + && REG_P (XEXP (incoming, 0)) + && HARD_REGISTER_P (XEXP (incoming, 0))))) + { + rtx rtl = gen_rtx_ENTRY_VALUE (GET_MODE (incoming)); + +#ifdef HAVE_window_save + /* DECL_INCOMING_RTL uses the INCOMING_REGNO of parameter registers. + If the target machine has an explicit window save instruction, the + actual entry value is the corresponding OUTGOING_REGNO instead. */ + if (REG_P (incoming) + && OUTGOING_REGNO (REGNO (incoming)) != REGNO (incoming)) + incoming + = gen_rtx_REG_offset (incoming, GET_MODE (incoming), + OUTGOING_REGNO (REGNO (incoming)), 0); + else if (MEM_P (incoming)) + { + rtx reg = XEXP (incoming, 0); + if (OUTGOING_REGNO (REGNO (reg)) != REGNO (reg)) + { + reg = gen_raw_REG (GET_MODE (reg), OUTGOING_REGNO (REGNO (reg))); + incoming = replace_equiv_address_nv (incoming, reg); + } + } +#endif + + ENTRY_VALUE_EXP (rtl) = incoming; + return rtl; + } + + if (incoming + && GET_MODE (incoming) != BLKmode + && !TREE_ADDRESSABLE (decl) + && MEM_P (incoming) + && (XEXP (incoming, 0) == virtual_incoming_args_rtx + || (GET_CODE (XEXP (incoming, 0)) == PLUS + && XEXP (XEXP (incoming, 0), 0) == virtual_incoming_args_rtx + && CONST_INT_P (XEXP (XEXP (incoming, 0), 1))))) + return incoming; + + return NULL_RTX; +} + +/* Return an RTX equivalent to the value of the tree expression EXP. */ static rtx expand_debug_expr (tree exp) @@ -3169,36 +3221,12 @@ expand_debug_expr (tree exp) if (SSA_NAME_IS_DEFAULT_DEF (exp) && TREE_CODE (SSA_NAME_VAR (exp)) == PARM_DECL) { - rtx incoming = DECL_INCOMING_RTL (SSA_NAME_VAR (exp)); - if (incoming - && GET_MODE (incoming) != BLKmode - && ((REG_P (incoming) && HARD_REGISTER_P (incoming)) - || (MEM_P (incoming) - && REG_P (XEXP (incoming, 0)) - && HARD_REGISTER_P (XEXP (incoming, 0))))) - { - op0 = gen_rtx_ENTRY_VALUE (GET_MODE (incoming)); - ENTRY_VALUE_EXP (op0) = incoming; - goto adjust_mode; - } - if (incoming - && MEM_P (incoming) - && !TREE_ADDRESSABLE (SSA_NAME_VAR (exp)) - && GET_MODE (incoming) != BLKmode - && (XEXP (incoming, 0) == virtual_incoming_args_rtx - || (GET_CODE (XEXP (incoming, 0)) == PLUS - && XEXP (XEXP (incoming, 0), 0) - == virtual_incoming_args_rtx - && CONST_INT_P (XEXP (XEXP (incoming, 0), - 1))))) - { - op0 = incoming; - goto adjust_mode; - } + op0 = expand_debug_parm_decl (SSA_NAME_VAR (exp)); + if (op0) + goto adjust_mode; op0 = expand_debug_expr (SSA_NAME_VAR (exp)); - if (!op0) - return NULL; - goto adjust_mode; + if (op0) + goto adjust_mode; } return NULL; } @@ -3327,36 +3355,14 @@ expand_debug_source_expr (tree exp) { case PARM_DECL: { - rtx incoming = DECL_INCOMING_RTL (exp); mode = DECL_MODE (exp); - if (incoming - && GET_MODE (incoming) != BLKmode - && ((REG_P (incoming) && HARD_REGISTER_P (incoming)) - || (MEM_P (incoming) - && REG_P (XEXP (incoming, 0)) - && HARD_REGISTER_P (XEXP (incoming, 0))))) - { - op0 = gen_rtx_ENTRY_VALUE (GET_MODE (incoming)); - ENTRY_VALUE_EXP (op0) = incoming; - break; - } - if (incoming - && MEM_P (incoming) - && !TREE_ADDRESSABLE (exp) - && GET_MODE (incoming) != BLKmode - && (XEXP (incoming, 0) == virtual_incoming_args_rtx - || (GET_CODE (XEXP (incoming, 0)) == PLUS - && XEXP (XEXP (incoming, 0), 0) - == virtual_incoming_args_rtx - && CONST_INT_P (XEXP (XEXP (incoming, 0), 1))))) - { - op0 = incoming; - break; - } + op0 = expand_debug_parm_decl (exp); + if (op0) + break; /* See if this isn't an argument that has been completely optimized out. */ if (!DECL_RTL_SET_P (exp) - && incoming == NULL_RTX + && !DECL_INCOMING_RTL (exp) && DECL_ABSTRACT_ORIGIN (current_function_decl)) { tree aexp = exp; |