Commit 60550c0c by Kazu Hirata Committed by Kazu Hirata

global.c (earlyclobber_regclass): Change the type to VEC(int,heap).

	* global.c (earlyclobber_regclass): Change the type to
	VEC(int,heap).
	(check_earlyclobber): Update uses of earlyclobber_regclass.
	(mark_reg_use_for_earlyclobber): Likewise.
	(calculate_local_reg_bb_info): Allocate and free
	earlyclobber_regclass using the VEC API.

From-SVN: r98922
parent 781e1004
2005-04-28 Kazu Hirata <kazu@cs.umass.edu>
* global.c (earlyclobber_regclass): Change the type to
VEC(int,heap).
(check_earlyclobber): Update uses of earlyclobber_regclass.
(mark_reg_use_for_earlyclobber): Likewise.
(calculate_local_reg_bb_info): Allocate and free
earlyclobber_regclass using the VEC API.
2005-04-28 Nathan Sidwell <nathan@codesourcery.com> 2005-04-28 Nathan Sidwell <nathan@codesourcery.com>
* tree-ssa-alias.c (push_fields_onto_fieldstack): Remove bogus * tree-ssa-alias.c (push_fields_onto_fieldstack): Remove bogus
......
...@@ -2098,7 +2098,10 @@ mark_reg_change (rtx reg, rtx setter, void *data) ...@@ -2098,7 +2098,10 @@ mark_reg_change (rtx reg, rtx setter, void *data)
/* Classes of registers which could be early clobbered in the current /* Classes of registers which could be early clobbered in the current
insn. */ insn. */
static varray_type earlyclobber_regclass; DEF_VEC_P(int);
DEF_VEC_ALLOC_P(int,heap);
static VEC(int,heap) *earlyclobber_regclass;
/* This function finds and stores register classes that could be early /* This function finds and stores register classes that could be early
clobbered in INSN. If any earlyclobber classes are found, the function clobbered in INSN. If any earlyclobber classes are found, the function
...@@ -2112,7 +2115,7 @@ check_earlyclobber (rtx insn) ...@@ -2112,7 +2115,7 @@ check_earlyclobber (rtx insn)
extract_insn (insn); extract_insn (insn);
VARRAY_POP_ALL (earlyclobber_regclass); VEC_truncate (int, earlyclobber_regclass, 0);
for (opno = 0; opno < recog_data.n_operands; opno++) for (opno = 0; opno < recog_data.n_operands; opno++)
{ {
char c; char c;
...@@ -2149,13 +2152,23 @@ check_earlyclobber (rtx insn) ...@@ -2149,13 +2152,23 @@ check_earlyclobber (rtx insn)
case ',': case ',':
if (amp_p && class != NO_REGS) if (amp_p && class != NO_REGS)
{ {
int rc;
found = true; found = true;
for (i = VARRAY_ACTIVE_SIZE (earlyclobber_regclass) - 1; for (i = 0;
i >= 0; i--) VEC_iterate (int, earlyclobber_regclass, i, rc);
if (VARRAY_INT (earlyclobber_regclass, i) == (int) class) i++)
break; {
if (i < 0) if (rc == (int) class)
VARRAY_PUSH_INT (earlyclobber_regclass, (int) class); goto found_rc;
}
/* We use VEC_quick_push here because
earlyclobber_regclass holds no more than
N_REG_CLASSES elements. */
VEC_quick_push (int, earlyclobber_regclass, (int) class);
found_rc:
;
} }
amp_p = false; amp_p = false;
...@@ -2194,24 +2207,25 @@ mark_reg_use_for_earlyclobber (rtx *x, void *data ATTRIBUTE_UNUSED) ...@@ -2194,24 +2207,25 @@ mark_reg_use_for_earlyclobber (rtx *x, void *data ATTRIBUTE_UNUSED)
if (REG_P (*x) && REGNO (*x) >= FIRST_PSEUDO_REGISTER) if (REG_P (*x) && REGNO (*x) >= FIRST_PSEUDO_REGISTER)
{ {
int rc;
regno = REGNO (*x); regno = REGNO (*x);
if (bitmap_bit_p (bb_info->killed, regno) if (bitmap_bit_p (bb_info->killed, regno)
|| bitmap_bit_p (bb_info->avloc, regno)) || bitmap_bit_p (bb_info->avloc, regno))
return 0; return 0;
pref_class = reg_preferred_class (regno); pref_class = reg_preferred_class (regno);
alt_class = reg_alternate_class (regno); alt_class = reg_alternate_class (regno);
for (i = VARRAY_ACTIVE_SIZE (earlyclobber_regclass) - 1; i >= 0; i--) for (i = 0; VEC_iterate (int, earlyclobber_regclass, i, rc); i++)
if (reg_classes_intersect_p (VARRAY_INT (earlyclobber_regclass, i), {
pref_class) if (reg_classes_intersect_p (rc, pref_class)
|| (VARRAY_INT (earlyclobber_regclass, i) != NO_REGS || (rc != NO_REGS
&& reg_classes_intersect_p (VARRAY_INT (earlyclobber_regclass, && reg_classes_intersect_p (rc, alt_class)))
i),
alt_class)))
{ {
bitmap_set_bit (bb_info->earlyclobber, regno); bitmap_set_bit (bb_info->earlyclobber, regno);
break; break;
} }
} }
}
return 0; return 0;
} }
...@@ -2232,8 +2246,9 @@ calculate_local_reg_bb_info (void) ...@@ -2232,8 +2246,9 @@ calculate_local_reg_bb_info (void)
basic_block bb; basic_block bb;
rtx insn, bound; rtx insn, bound;
VARRAY_INT_INIT (earlyclobber_regclass, 20, /* We know that earlyclobber_regclass holds no more than
"classes of registers early clobbered in an insn"); N_REG_CLASSES elements. See check_earlyclobber. */
earlyclobber_regclass = VEC_alloc (int, heap, N_REG_CLASSES);
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
{ {
bound = NEXT_INSN (BB_END (bb)); bound = NEXT_INSN (BB_END (bb));
...@@ -2245,6 +2260,7 @@ calculate_local_reg_bb_info (void) ...@@ -2245,6 +2260,7 @@ calculate_local_reg_bb_info (void)
note_uses (&PATTERN (insn), mark_reg_use_for_earlyclobber_1, bb); note_uses (&PATTERN (insn), mark_reg_use_for_earlyclobber_1, bb);
} }
} }
VEC_free (int, heap, earlyclobber_regclass);
} }
/* The function sets up reverse post-order number of each basic /* The function sets up reverse post-order number of each basic
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment