GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
+Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
for more details.
You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
rtx insn = DF_REF_INSN (use);
enum df_ref_type type = DF_REF_TYPE (use);
int flags = DF_REF_FLAGS (use);
+ rtx set = single_set (insn);
+ int old_cost = rtx_cost (SET_SRC (set), SET);
+ bool ok;
if (dump_file)
{
fprintf (dump_file, "\n");
}
- if (validate_change (insn, loc, new, false))
+ validate_unshare_change (insn, loc, new, true);
+ if (!verify_changes (0))
+ {
+ if (dump_file)
+ fprintf (dump_file, "Changes to insn %d not recognized\n",
+ INSN_UID (insn));
+ ok = false;
+ }
+
+ else if (DF_REF_TYPE (use) == DF_REF_REG_USE
+ && rtx_cost (SET_SRC (set), SET) > old_cost)
+ {
+ if (dump_file)
+ fprintf (dump_file, "Changes to insn %d not profitable\n",
+ INSN_UID (insn));
+ ok = false;
+ }
+
+ else
{
- num_changes++;
if (dump_file)
fprintf (dump_file, "Changed insn %d\n", INSN_UID (insn));
+ ok = true;
+ }
+
+ if (ok)
+ {
+ confirm_change_group ();
+ num_changes++;
df_ref_remove (use);
if (!CONSTANT_P (new))
update_df (insn, loc, DF_INSN_USES (def_insn), type, flags);
update_df (insn, loc, DF_INSN_EQ_USES (def_insn), type, flags);
}
- return true;
}
else
{
- if (dump_file)
- fprintf (dump_file, "Changes to insn %d not recognized\n",
- INSN_UID (insn));
+ cancel_changes (0);
/* Can also record a simplified value in a REG_EQUAL note, making a
new one if one does not already exist. */
type, DF_REF_IN_NOTE);
}
}
-
- return false;
}
+
+ return ok;
}
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- TODO_df_finish |
+ TODO_df_finish | TODO_verify_rtl_sharing |
TODO_dump_func, /* todo_flags_finish */
0 /* letter */
};
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
- TODO_df_finish |
+ TODO_df_finish | TODO_verify_rtl_sharing |
TODO_dump_func, /* todo_flags_finish */
0 /* letter */
};