diff options
Diffstat (limited to 'gcc/rtl.c')
-rw-r--r-- | gcc/rtl.c | 27 |
1 files changed, 22 insertions, 5 deletions
@@ -333,22 +333,29 @@ int generating_concat_p; int currently_expanding_to_rtl; -/* Return 1 if X and Y are identical-looking rtx's. - This is the Lisp function EQUAL for rtx arguments. */ + +/* 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. */ int -rtx_equal_p (const_rtx x, const_rtx y) +rtx_equal_p_cb (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb) { int i; int j; enum rtx_code code; const char *fmt; + rtx nx, ny; if (x == y) return 1; if (x == 0 || y == 0) return 0; + /* Invoke the callback first. */ + if (cb != NULL + && ((*cb) (&x, &y, &nx, &ny))) + return rtx_equal_p_cb (nx, ny, cb); + code = GET_CODE (x); /* Rtx's of different codes cannot be equal. */ if (code != GET_CODE (y)) @@ -409,12 +416,13 @@ rtx_equal_p (const_rtx x, const_rtx y) /* 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) + if (rtx_equal_p_cb (XVECEXP (x, i, j), + XVECEXP (y, i, j), cb) == 0) return 0; break; case 'e': - if (rtx_equal_p (XEXP (x, i), XEXP (y, i)) == 0) + if (rtx_equal_p_cb (XEXP (x, i), XEXP (y, i), cb) == 0) return 0; break; @@ -444,6 +452,15 @@ rtx_equal_p (const_rtx x, const_rtx y) return 1; } +/* Return 1 if X and Y are identical-looking rtx's. + This is the Lisp function EQUAL for rtx arguments. */ + +int +rtx_equal_p (const_rtx x, const_rtx y) +{ + return rtx_equal_p_cb (x, y, NULL); +} + void dump_rtx_statistics (void) { |