stor-layout.c (is_pending_size, [...]): New functions.

* stor-layout.c (is_pending_size, put_pending_size): New functions.
	(variable_size): Call put_pending_size.
	* tree.h (is_pending_size, put_pending_size): Add prototypes.
	* fold-const.c (extract_muldiv): If SAVE_EXPR is on the pending
	sizes list, put newly created SAVE_EXPR there as well.

	* gcc.c-torture/execute/20010209-1.c: New test.

	* config/ia64/ia64.c (last_group): Only 2 entries are needed.
	(errata_find_address_regs): load_group has only 2 entries.
	(errata_emit_nops): Likewise.  shladd is not problematic.
	Clear last_group if nop was emitted.
	(fixup_errata): load_group has only 2 entries.
	Optimize.

From-SVN: r39663
This commit is contained in:
Jakub Jelinek 2001-02-14 08:57:49 +01:00
parent ceeaadbb78
commit fe375cf108
7 changed files with 105 additions and 20 deletions

View File

@ -1,16 +1,33 @@
2001-02-14 Jakub Jelinek <jakub@redhat.com>
* stor-layout.c (is_pending_size, put_pending_size): New functions.
(variable_size): Call put_pending_size.
* tree.h (is_pending_size, put_pending_size): Add prototypes.
* fold-const.c (extract_muldiv): If SAVE_EXPR is on the pending
sizes list, put newly created SAVE_EXPR there as well.
2001-02-14 Jakub Jelinek <jakub@redhat.com>
* config/ia64/ia64.c (last_group): Only 2 entries are needed.
(errata_find_address_regs): load_group has only 2 entries.
(errata_emit_nops): Likewise. shladd is not problematic.
Clear last_group if nop was emitted.
(fixup_errata): load_group has only 2 entries.
Optimize.
2001-02-14 Neil Booth <neil@daikokuya.demon.co.uk>
* c-lex.c (lex_number): Only warn traditionally for U suffix
outside system macros.
* cppexp.c (parse_number): Similarly.
* cpplib.h (NODE_SYSHDR, cpp_sys_objmacro_p): New.
* cppmacro.c (struct cpp_macro): New member node.
(parse_args): Only warn about missing rest args if not
a system macro.
(funlike_invocation_p): Similarly for uninvoked funlike macros.
(cpp_sys_objmacro_p): New.
(_cpp_create_definition): Store the node with the macro defn.
Remember if the macro is defined in a system header.
* c-lex.c (lex_number): Only warn traditionally for U suffix
outside system macros.
* cppexp.c (parse_number): Similarly.
* cpplib.h (NODE_SYSHDR, cpp_sys_objmacro_p): New.
* cppmacro.c (struct cpp_macro): New member node.
(parse_args): Only warn about missing rest args if not
a system macro.
(funlike_invocation_p): Similarly for uninvoked funlike macros.
(cpp_sys_objmacro_p): New.
(_cpp_create_definition): Store the node with the macro defn.
Remember if the macro is defined in a system header.
2001-02-13 DJ Delorie <dj@redhat.com>

View File

@ -4560,7 +4560,7 @@ static struct group
{
HARD_REG_SET p_reg_set;
HARD_REG_SET gr_reg_conditionally_set;
} last_group[3];
} last_group[2];
/* Index into the last_group array. */
static int group_idx;
@ -4581,7 +4581,7 @@ errata_find_address_regs (xp, data)
x = XEXP (x, 0);
if (GET_CODE (x) == REG)
{
struct group *prev_group = last_group + (group_idx + 2) % 3;
struct group *prev_group = last_group + (group_idx ^ 1);
if (TEST_HARD_REG_BIT (prev_group->gr_reg_conditionally_set,
REGNO (x)))
return 1;
@ -4598,7 +4598,7 @@ errata_emit_nops (insn)
rtx insn;
{
struct group *this_group = last_group + group_idx;
struct group *prev_group = last_group + (group_idx + 2) % 3;
struct group *prev_group = last_group + (group_idx ^ 1);
rtx pat = PATTERN (insn);
rtx cond = GET_CODE (pat) == COND_EXEC ? COND_EXEC_TEST (pat) : 0;
rtx real_pat = cond ? COND_EXEC_CODE (pat) : pat;
@ -4642,6 +4642,8 @@ errata_emit_nops (insn)
&& REG_P (SET_DEST (set))
&& GET_CODE (SET_SRC (set)) != PLUS
&& GET_CODE (SET_SRC (set)) != MINUS
&& (GET_CODE (SET_SRC (set)) != ASHIFT
|| !shladd_operand (XEXP (SET_SRC (set), 1)))
&& (GET_CODE (SET_SRC (set)) != MEM
|| GET_CODE (XEXP (SET_SRC (set), 0)) != POST_MODIFY)
&& GENERAL_REGNO_P (REGNO (SET_DEST (set))))
@ -4658,6 +4660,8 @@ errata_emit_nops (insn)
emit_insn_before (gen_insn_group_barrier (GEN_INT (3)), insn);
emit_insn_before (gen_nop (), insn);
emit_insn_before (gen_insn_group_barrier (GEN_INT (3)), insn);
group_idx = 0;
memset (last_group, 0, sizeof last_group);
}
}
@ -4668,17 +4672,23 @@ fixup_errata ()
{
rtx insn;
if (! TARGET_B_STEP)
return;
group_idx = 0;
memset (last_group, 0, sizeof last_group);
for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
{
if (INSN_P (insn) && ia64_safe_type (insn) == TYPE_S)
if (!INSN_P (insn))
continue;
if (ia64_safe_type (insn) == TYPE_S)
{
group_idx = (group_idx + 1) % 3;
group_idx ^= 1;
memset (last_group + group_idx, 0, sizeof last_group[group_idx]);
}
if (TARGET_B_STEP && INSN_P (insn))
else
errata_emit_nops (insn);
}
}

View File

@ -4449,7 +4449,14 @@ extract_muldiv (t, c, code, wide_type)
if (SAVE_EXPR_RTL (t) == 0 && ! TREE_SIDE_EFFECTS (TREE_OPERAND (t, 0))
&& 0 != (t1 = extract_muldiv (TREE_OPERAND (t, 0), c, code,
wide_type)))
return save_expr (t1);
{
t1 = save_expr (t1);
if (SAVE_EXPR_PERSISTENT_P (t) && TREE_CODE (t1) == SAVE_EXPR)
SAVE_EXPR_PERSISTENT_P (t1) = 1;
if (is_pending_size (t))
put_pending_size (t1);
return t1;
}
break;
case LSHIFT_EXPR: case RSHIFT_EXPR:

View File

@ -94,6 +94,30 @@ get_pending_sizes ()
return chain;
}
/* Return non-zero if EXPR is present on the pending sizes list. */
int
is_pending_size (expr)
tree expr;
{
tree t;
for (t = pending_sizes; t; t = TREE_CHAIN (t))
if (TREE_VALUE (t) == expr)
return 1;
return 0;
}
/* Add EXPR to the pending sizes list. */
void
put_pending_size (expr)
tree expr;
{
if (TREE_CODE (expr) == SAVE_EXPR)
pending_sizes = tree_cons (NULL_TREE, expr, pending_sizes);
}
/* Put a chain of objects into the pending sizes list, which must be
empty. */
@ -153,8 +177,8 @@ variable_size (size)
/* The front-end doesn't want us to keep a list of the expressions
that determine sizes for variable size objects. */
;
else if (TREE_CODE (size) == SAVE_EXPR)
pending_sizes = tree_cons (NULL_TREE, size, pending_sizes);
else
put_pending_size (size);
return size;
}

View File

@ -1,3 +1,7 @@
2001-02-14 Jakub Jelinek <jakub@redhat.com>
* gcc.c-torture/execute/20010209-1.c: New test.
2001-02-14 Neil Booth <neil@daikokuya.demon.co.uk>
* gcc.dg/cpp/sysmac1.c, sysmac2.c: New tests.

View File

@ -0,0 +1,21 @@
int b;
int foo (void)
{
int x[b];
int bar (int t[b])
{
int i;
for (i = 0; i < b; i++)
t[i] = i + (i > 0 ? t[i-1] : 0);
return t[b-1];
}
return bar (x);
}
int main ()
{
b = 6;
if (foo () != 15)
abort ();
exit (0);
}

View File

@ -2165,6 +2165,8 @@ extern tree size_int_type_wide PARAMS ((HOST_WIDE_INT, tree));
extern tree round_up PARAMS ((tree, int));
extern tree round_down PARAMS ((tree, int));
extern tree get_pending_sizes PARAMS ((void));
extern int is_pending_size PARAMS ((tree));
extern void put_pending_size PARAMS ((tree));
extern void put_pending_sizes PARAMS ((tree));
/* Type for sizes of data-type. */