aboutsummaryrefslogtreecommitdiff
path: root/gcc/combine.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2007-03-02 09:49:58 -0800
committerRichard Henderson <rth@gcc.gnu.org>2007-03-02 09:49:58 -0800
commit962f383322622d12393b4a5d1b4a5fade831d51d (patch)
tree837c31d1173819855617bf6c6639209cf7954025 /gcc/combine.c
parent1769232d2607e9219b1932090c1036a6ed334152 (diff)
downloadgcc-962f383322622d12393b4a5d1b4a5fade831d51d.zip
gcc-962f383322622d12393b4a5d1b4a5fade831d51d.tar.gz
gcc-962f383322622d12393b4a5d1b4a5fade831d51d.tar.bz2
expr.h (promoted_input_arg): Remove decl.
* expr.h (promoted_input_arg): Remove decl. * function.c (promoted_input_arg): Merge into ... * combine.c (setup_incoming_promotions): ... only caller. Rearrange to avoid double loop. From-SVN: r122479
Diffstat (limited to 'gcc/combine.c')
-rw-r--r--gcc/combine.c47
1 files changed, 28 insertions, 19 deletions
diff --git a/gcc/combine.c b/gcc/combine.c
index d1277d4..99da26d 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1014,27 +1014,36 @@ init_reg_last (void)
static void
setup_incoming_promotions (void)
{
- unsigned int regno;
- rtx reg;
- enum machine_mode mode;
- int unsignedp;
- rtx first = get_insns ();
+ rtx first;
+ tree arg;
+
+ if (!targetm.calls.promote_function_args (TREE_TYPE (cfun->decl)))
+ return;
- if (targetm.calls.promote_function_args (TREE_TYPE (cfun->decl)))
+ first = get_insns ();
+
+ for (arg = DECL_ARGUMENTS (current_function_decl); arg;
+ arg = TREE_CHAIN (arg))
{
- for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
- /* Check whether this register can hold an incoming pointer
- argument. FUNCTION_ARG_REGNO_P tests outgoing register
- numbers, so translate if necessary due to register windows. */
- if (FUNCTION_ARG_REGNO_P (OUTGOING_REGNO (regno))
- && (reg = promoted_input_arg (regno, &mode, &unsignedp)) != 0)
- {
- record_value_for_reg
- (reg, first, gen_rtx_fmt_e ((unsignedp ? ZERO_EXTEND
- : SIGN_EXTEND),
- GET_MODE (reg),
- gen_rtx_CLOBBER (mode, const0_rtx)));
- }
+ rtx reg = DECL_INCOMING_RTL (arg);
+
+ if (!REG_P (reg))
+ continue;
+
+ if (TYPE_MODE (DECL_ARG_TYPE (arg)) == TYPE_MODE (TREE_TYPE (arg)))
+ {
+ enum machine_mode mode = TYPE_MODE (TREE_TYPE (arg));
+ int uns = TYPE_UNSIGNED (TREE_TYPE (arg));
+
+ mode = promote_mode (TREE_TYPE (arg), mode, &uns, 1);
+ if (mode == GET_MODE (reg) && mode != DECL_MODE (arg))
+ {
+ rtx x;
+ x = gen_rtx_CLOBBER (DECL_MODE (arg), const0_rtx);
+ x = gen_rtx_fmt_e ((uns ? ZERO_EXTEND : SIGN_EXTEND), mode, x);
+ record_value_for_reg (reg, first, x);
+ }
+ }
}
}