aboutsummaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@gcc.gnu.org>1998-12-29 03:36:22 -0800
committerRichard Henderson <rth@gcc.gnu.org>1998-12-29 03:36:22 -0800
commit185ebd6c71d791ea2f333a23382589620e9bf848 (patch)
tree8baca97ed11c13d1b3be83dcd58d2863c4017a2a /gcc/cse.c
parenteb8da8684cfdf019f0b0edfd834a479ac366f1d4 (diff)
downloadgcc-185ebd6c71d791ea2f333a23382589620e9bf848.zip
gcc-185ebd6c71d791ea2f333a23382589620e9bf848.tar.gz
gcc-185ebd6c71d791ea2f333a23382589620e9bf848.tar.bz2
Richard Kenner <kenner@vlsi1.ultra.nyu.edu>:
* rtl.def (CONSTANT_P_RTX): Clarify commentary. * expr.c (expand_builtin, case BUILT_IN_CONSTANT_P): Rework to consider constant CONSTRUCTOR constant and to defer some cases to cse. * cse.c (fold_rtx, case CONST): Add handling for CONSTANT_P_RTX. * regclass.c (reg_scan_mark_refs, case CONST): Likewise. Richard Henderson <rth@cygnus.com> * expr.c (init_expr_once): Kill can_handle_constant_p recognition. * cse.c (fold_rtx, case 'x'): Remove standalone CONSTANT_P_RTX code. From-SVN: r24439
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 2ef26a5..9ca2931 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -4931,6 +4931,21 @@ fold_rtx (x, insn)
switch (code)
{
case CONST:
+ /* If the operand is a CONSTANT_P_RTX, see if what's inside it
+ is known to be constant and replace the whole thing with a
+ CONST_INT of either zero or one. Note that this code assumes
+ that an insn that recognizes a CONST will also recognize a
+ CONST_INT, but that seems to be a safe assumption. */
+ if (GET_CODE (XEXP (x, 0)) == CONSTANT_P_RTX)
+ {
+ x = equiv_constant (fold_rtx (XEXP (XEXP (x, 0), 0), 0));
+ return (x != 0 && (GET_CODE (x) == CONST_INT
+ || GET_CODE (x) == CONST_DOUBLE)
+ ? const1_rtx : const0_rtx);
+ }
+
+ /* ... fall through ... */
+
case CONST_INT:
case CONST_DOUBLE:
case SYMBOL_REF:
@@ -5850,12 +5865,6 @@ fold_rtx (x, insn)
const_arg1 ? const_arg1 : folded_arg1,
const_arg2 ? const_arg2 : XEXP (x, 2));
break;
-
- case 'x':
- /* Always eliminate CONSTANT_P_RTX at this stage. */
- if (code == CONSTANT_P_RTX)
- return (const_arg0 ? const1_rtx : const0_rtx);
- break;
}
return new ? new : x;