is used properly in the presence of recursion. */
rtx *global_const_equiv_map;
+int global_const_equiv_map_size;
\f
#define FIXED_BASE_PLUS_P(X) \
(GET_CODE (X) == PLUS && GET_CODE (XEXP (X, 1)) == CONST_INT \
if (GET_CODE (copy) != REG)
{
temp = copy_addr_to_reg (copy);
- if (CONSTANT_P (copy) || FIXED_BASE_PLUS_P (copy))
+ if ((CONSTANT_P (copy) || FIXED_BASE_PLUS_P (copy))
+ && REGNO (temp) < map->const_equiv_map_size)
{
map->const_equiv_map[REGNO (temp)] = copy;
map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
{
temp = copy_to_mode_reg (GET_MODE (loc), copy);
REG_USERVAR_P (temp) = REG_USERVAR_P (loc);
- if (CONSTANT_P (copy) || FIXED_BASE_PLUS_P (copy))
+ if ((CONSTANT_P (copy) || FIXED_BASE_PLUS_P (copy))
+ && REGNO (temp) < map->const_equiv_map_size)
{
map->const_equiv_map[REGNO (temp)] = copy;
map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
{
temp = copy_to_mode_reg (GET_MODE (locreal), copyreal);
REG_USERVAR_P (temp) = REG_USERVAR_P (locreal);
- if (CONSTANT_P (copyreal) || FIXED_BASE_PLUS_P (copyreal))
+ if ((CONSTANT_P (copyreal) || FIXED_BASE_PLUS_P (copyreal))
+ && REGNO (temp) < map->const_equiv_map_size)
{
map->const_equiv_map[REGNO (temp)] = copyreal;
map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
{
temp = copy_to_mode_reg (GET_MODE (locimag), copyimag);
REG_USERVAR_P (temp) = REG_USERVAR_P (locimag);
- if (CONSTANT_P (copyimag) || FIXED_BASE_PLUS_P (copyimag))
+ if ((CONSTANT_P (copyimag) || FIXED_BASE_PLUS_P (copyimag))
+ && REGNO (temp) < map->const_equiv_map_size)
{
map->const_equiv_map[REGNO (temp)] = copyimag;
map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
{
temp = force_reg (Pmode, structure_value_addr);
map->reg_map[REGNO (XEXP (loc, 0))] = temp;
- if (CONSTANT_P (structure_value_addr)
- || (GET_CODE (structure_value_addr) == PLUS
- && XEXP (structure_value_addr, 0) == virtual_stack_vars_rtx
- && GET_CODE (XEXP (structure_value_addr, 1)) == CONST_INT))
+ if ((CONSTANT_P (structure_value_addr)
+ || (GET_CODE (structure_value_addr) == PLUS
+ && XEXP (structure_value_addr, 0) == virtual_stack_vars_rtx
+ && GET_CODE (XEXP (structure_value_addr, 1)) == CONST_INT))
+ && REGNO (temp) < map->const_equiv_map_size)
{
map->const_equiv_map[REGNO (temp)] = structure_value_addr;
map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
/* Save a copy of the location of const_equiv_map for mark_stores, called
via note_stores. */
global_const_equiv_map = map->const_equiv_map;
+ global_const_equiv_map_size = map->const_equiv_map_size;
/* Now copy the insns one by one. Do this in two passes, first the insns and
then their REG_NOTES, just like save_for_inline. */
#endif
map->reg_map[regno] = temp
= force_reg (Pmode, force_operand (loc, NULL_RTX));
- map->const_equiv_map[REGNO (temp)] = loc;
- map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
+
+ if (REGNO (temp) < map->const_equiv_map_size)
+ {
+ map->const_equiv_map[REGNO (temp)] = loc;
+ map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
+ }
seq = gen_sequence ();
end_sequence ();
#endif
map->reg_map[regno] = temp
= force_reg (Pmode, force_operand (loc, NULL_RTX));
- map->const_equiv_map[REGNO (temp)] = loc;
- map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
+
+ if (REGNO (temp) < map->const_equiv_map_size)
+ {
+ map->const_equiv_map[REGNO (temp)] = loc;
+ map->const_age_map[REGNO (temp)] = CONST_AGE_PARM;
+ }
seq = gen_sequence ();
end_sequence ();
{
int regno = REGNO (map->equiv_sets[i].dest);
- if (map->const_equiv_map[regno] == 0
- /* Following clause is a hack to make case work where GNU C++
- reassigns a variable to make cse work right. */
- || ! rtx_equal_p (map->const_equiv_map[regno],
- map->equiv_sets[i].equiv))
+ if (regno < map->const_equiv_map_size
+ && (map->const_equiv_map[regno] == 0
+ /* Following clause is a hack to make case work where GNU C++
+ reassigns a variable to make cse work right. */
+ || ! rtx_equal_p (map->const_equiv_map[regno],
+ map->equiv_sets[i].equiv)))
{
map->const_equiv_map[regno] = map->equiv_sets[i].equiv;
map->const_age_map[regno] = map->const_age;
int i;
for (i = regno; i <= last_reg; i++)
- global_const_equiv_map[i] = 0;
+ if (i < global_const_equiv_map_size)
+ global_const_equiv_map[i] = 0;
}
}
\f