expr.c (get_subtarget): New function.

* expr.c (get_subtarget): New function.
	(force_operand, expand_expr, do_store_flag): Use it.

	* toplev.c (compile_file): Don't take strlen of NAME if null.

From-SVN: r33722
This commit is contained in:
Richard Kenner 2000-05-06 10:17:11 +00:00 committed by Richard Kenner
parent 593ca8d432
commit 296b4ed9cb
3 changed files with 35 additions and 17 deletions

View File

@ -1,3 +1,10 @@
Sat May 6 06:25:56 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* expr.c (get_subtarget): New function.
(force_operand, expand_expr, do_store_flag): Use it.
* toplev.c (compile_file): Don't take strlen of NAME if null.
2000-05-06 David Edelsohn <edelsohn@gnu.org>
* xcoffout.c (xcoff_current_include_file,

View File

@ -155,6 +155,7 @@ static void clear_by_pieces PARAMS ((rtx, int, unsigned int));
static void clear_by_pieces_1 PARAMS ((rtx (*) (rtx, ...),
enum machine_mode,
struct clear_by_pieces *));
static rtx get_subtarget PARAMS ((rtx));
static int is_zeros_p PARAMS ((tree));
static int mostly_zeros_p PARAMS ((tree));
static void store_constructor_field PARAMS ((rtx, unsigned HOST_WIDE_INT,
@ -335,6 +336,7 @@ free_expr_status (f)
}
/* Small sanity check that the queue is empty at the end of a function. */
void
finish_expr_for_function ()
{
@ -2177,7 +2179,6 @@ copy_blkmode_from_reg (tgtblk, srcreg, type)
return tgtblk;
}
/* Add a USE expression for REG to the (possibly empty) list pointed
to by CALL_FUSAGE. REG must denote a hard register. */
@ -3324,6 +3325,26 @@ emit_push_insn (x, mode, type, size, align, partial, reg, extra,
anti_adjust_stack (alignment_pad);
}
/* Return X if X can be used as a subtarget in a sequence of arithmetic
operations. */
static rtx
get_subtarget (x)
rtx x;
{
return ((x == 0
/* Only registers can be subtargets. */
|| GET_CODE (x) != REG
/* If the register is readonly, it can't be set more than once. */
|| RTX_UNCHANGING_P (x)
/* Don't use hard regs to avoid extending their life. */
|| REGNO (x) < FIRST_PSEUDO_REGISTER
/* Avoid subtargets inside loops,
since they hide some invariant expressions. */
|| preserve_subexpressions_p ())
? 0 : x);
}
/* Expand an assignment that stores the value of FROM into TO.
If WANT_VALUE is nonzero, return an rtx for the value of TO.
(This may contain a QUEUED rtx;
@ -5164,7 +5185,7 @@ force_operand (value, target)
rtx tmp;
register rtx op2;
/* Use subtarget as the target for operand 0 of a binary operation. */
register rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
register rtx subtarget = get_subtarget (target);
/* Check for a PIC address load. */
if (flag_pic
@ -5707,7 +5728,7 @@ expand_expr (exp, target, tmode, modifier)
mode = TYPE_MODE (type);
/* Use subtarget as the target for operand 0 of a binary operation. */
subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
subtarget = get_subtarget (target);
original_target = target;
ignore = (target == const0_rtx
|| ((code == NON_LVALUE_EXPR || code == NOP_EXPR
@ -5722,15 +5743,6 @@ expand_expr (exp, target, tmode, modifier)
else
ro_modifier = EXPAND_NORMAL;
/* Don't use hard regs as subtargets, because the combiner
can only handle pseudo regs. */
if (subtarget && REGNO (subtarget) < FIRST_PSEUDO_REGISTER)
subtarget = 0;
/* Avoid subtargets inside loops,
since they hide some invariant expressions. */
if (preserve_subexpressions_p ())
subtarget = 0;
/* If we are going to ignore this result, we need only do something
if there is a side-effect somewhere in the expression. If there
is, short-circuit the most common cases here. Note that we must
@ -10244,8 +10256,7 @@ do_store_flag (exp, target, mode, only_cheap)
#endif
);
if (subtarget == 0 || GET_CODE (subtarget) != REG
|| GET_MODE (subtarget) != operand_mode
if (! get_subtarget (subtarget)
|| ! safe_from_p (subtarget, inner, 1))
subtarget = 0;
@ -10295,8 +10306,7 @@ do_store_flag (exp, target, mode, only_cheap)
}
preexpand_calls (exp);
if (subtarget == 0 || GET_CODE (subtarget) != REG
|| GET_MODE (subtarget) != operand_mode
if (! get_subtarget (target)
|| ! safe_from_p (subtarget, arg1, 1))
subtarget = 0;

View File

@ -2124,8 +2124,9 @@ compile_file (name)
#endif
}
if (ggc_p)
if (ggc_p && name != 0)
name = ggc_alloc_string (name, strlen (name));
input_filename = name;
/* Put an entry on the input file stack for the main input file. */