aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-06-23 16:32:59 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-06-23 16:32:59 +0200
commit7eb3f1f7cab7f8ffc75b8010f619a76fba2808c0 (patch)
treeab3aeb83121a88918bc7de4f030b190aa5e8dfae /gcc/rtl.c
parent8593e0b6b9f793572b91f36ad4e3f5bae4ea80d5 (diff)
downloadgcc-7eb3f1f7cab7f8ffc75b8010f619a76fba2808c0.zip
gcc-7eb3f1f7cab7f8ffc75b8010f619a76fba2808c0.tar.gz
gcc-7eb3f1f7cab7f8ffc75b8010f619a76fba2808c0.tar.bz2
var-tracking.c (unshare_variable): Force initialized to be VAR_INIT_STATUS_INITIALIZED unless flag_var_tracking_uninit.
* var-tracking.c (unshare_variable): Force initialized to be VAR_INIT_STATUS_INITIALIZED unless flag_var_tracking_uninit. (set_variable_part): Likewise. (struct variable_union_info): Remove pos_src field. (vui_vec, vui_allocated): New variables. (variable_union): Pass VAR_INIT_STATUS_UNKNOWN to unshare_variable unconditionally. Avoid XCVECNEW/free for every sorting, for dst_l == 1 use a simpler sorting algorithm. Compute pos field right away, don't fill in pos_src. For dst_l == 2 avoid qsort. Avoid quadratic comparison if !flag_var_tracking_uninit. (variable_canonicalize): Pass VAR_INIT_STATUS_UNKNOWN to unshare_variable unconditionally. (dataflow_set_different_2): Removed. (dataflow_set_different): Don't traverse second hash table. (compute_bb_dataflow): Pass VAR_INIT_STATUS_UNINITIALIZED unconditionally to var_reg_set or var_mem_set. (emit_notes_in_bb): Likewise. (delete_variable_part): Pass VAR_INIT_STATUS_UNKNOWN to unshare_variable. (emit_note_insn_var_location): Don't set initialized to VAR_INIT_STATUS_INITIALIZED early. (vt_finalize): Free vui_vec if needed, clear vui_vec and vui_allocated. * rtl.c (rtx_equal_p): Don't implement on top of rtx_equal_p_cb. From-SVN: r148852
Diffstat (limited to 'gcc/rtl.c')
-rw-r--r--gcc/rtl.c112
1 files changed, 109 insertions, 3 deletions
diff --git a/gcc/rtl.c b/gcc/rtl.c
index fa4dddd..6d68fe8 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -335,7 +335,9 @@ int currently_expanding_to_rtl;
/* Same as rtx_equal_p, but call CB on each pair of rtx if CB is not NULL.
- When the callback returns true, we continue with the new pair. */
+ When the callback returns true, we continue with the new pair.
+ Whenever changing this function check if rtx_equal_p below doesn't need
+ changing as well. */
int
rtx_equal_p_cb (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
@@ -453,12 +455,116 @@ rtx_equal_p_cb (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
}
/* Return 1 if X and Y are identical-looking rtx's.
- This is the Lisp function EQUAL for rtx arguments. */
+ This is the Lisp function EQUAL for rtx arguments.
+ Whenever changing this function check if rtx_equal_p_cb above doesn't need
+ changing as well. */
int
rtx_equal_p (const_rtx x, const_rtx y)
{
- return rtx_equal_p_cb (x, y, NULL);
+ int i;
+ int j;
+ enum rtx_code code;
+ const char *fmt;
+
+ if (x == y)
+ return 1;
+ if (x == 0 || y == 0)
+ return 0;
+
+ code = GET_CODE (x);
+ /* Rtx's of different codes cannot be equal. */
+ if (code != GET_CODE (y))
+ return 0;
+
+ /* (MULT:SI x y) and (MULT:HI x y) are NOT equivalent.
+ (REG:SI x) and (REG:HI x) are NOT equivalent. */
+
+ if (GET_MODE (x) != GET_MODE (y))
+ return 0;
+
+ /* Some RTL can be compared nonrecursively. */
+ switch (code)
+ {
+ case REG:
+ return (REGNO (x) == REGNO (y));
+
+ case LABEL_REF:
+ return XEXP (x, 0) == XEXP (y, 0);
+
+ case SYMBOL_REF:
+ return XSTR (x, 0) == XSTR (y, 0);
+
+ case SCRATCH:
+ case CONST_DOUBLE:
+ case CONST_INT:
+ case CONST_FIXED:
+ return 0;
+
+ default:
+ break;
+ }
+
+ /* Compare the elements. If any pair of corresponding elements
+ fail to match, return 0 for the whole thing. */
+
+ fmt = GET_RTX_FORMAT (code);
+ for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)
+ {
+ switch (fmt[i])
+ {
+ case 'w':
+ if (XWINT (x, i) != XWINT (y, i))
+ return 0;
+ break;
+
+ case 'n':
+ case 'i':
+ if (XINT (x, i) != XINT (y, i))
+ return 0;
+ break;
+
+ case 'V':
+ case 'E':
+ /* Two vectors must have the same length. */
+ if (XVECLEN (x, i) != XVECLEN (y, i))
+ return 0;
+
+ /* And the corresponding elements must match. */
+ for (j = 0; j < XVECLEN (x, i); j++)
+ if (rtx_equal_p (XVECEXP (x, i, j), XVECEXP (y, i, j)) == 0)
+ return 0;
+ break;
+
+ case 'e':
+ if (rtx_equal_p (XEXP (x, i), XEXP (y, i)) == 0)
+ return 0;
+ break;
+
+ case 'S':
+ case 's':
+ if ((XSTR (x, i) || XSTR (y, i))
+ && (! XSTR (x, i) || ! XSTR (y, i)
+ || strcmp (XSTR (x, i), XSTR (y, i))))
+ return 0;
+ break;
+
+ case 'u':
+ /* These are just backpointers, so they don't matter. */
+ break;
+
+ case '0':
+ case 't':
+ break;
+
+ /* It is believed that rtx's at this level will never
+ contain anything but integers and other rtx's,
+ except for within LABEL_REFs and SYMBOL_REFs. */
+ default:
+ gcc_unreachable ();
+ }
+ }
+ return 1;
}
void