diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 2000-08-05 00:50:02 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2000-08-05 00:50:02 +0000 |
commit | a36556a837f4d9e7e6cffa080f1d70567197a316 (patch) | |
tree | 18d113e290fbd64d849a1cab1dcb38ef98c1242a /gcc/fold-const.c | |
parent | 2ba7ba63a1279bd6e74c2c33a2a56ec42b374c7c (diff) | |
download | gcc-a36556a837f4d9e7e6cffa080f1d70567197a316.zip gcc-a36556a837f4d9e7e6cffa080f1d70567197a316.tar.gz gcc-a36556a837f4d9e7e6cffa080f1d70567197a316.tar.bz2 |
[multiple changes]
2000-08-04 Andreas Schwab <schwab@suse.de>
* cppmain.c (cb_def_pragma): Skip the first two tokens from the
token list, which are always `#' and `pragma'.
2000-08-04 Zack Weinberg <zack@wolery.cumb.org>
* tree.c (tree_expr_nonnegative_p): Move to...
* fold-const.c: ... here. Also handle BIND_EXPR and RTL_EXPR.
(rtl_expr_nonnegative_p): New.
* tree.h: Add prototype for rtl_expr_nonnegative_p.
* real.h (CONST_DOUBLE_LOW, CONST_DOUBLE_HIGH, CONST_DOUBLE_MEM,
CONST_DOUBLE_CHAIN: Move to...
* rtl.h: ...here. Use XCINT/XCEXP.
* Makefile.in: Remove toplev.o from OBJS. Add rule to make
libbackend.a; add libbackend.a to STAGESTUFF. Add BACKEND
variable. Use BACKEND when linking cc1, not OBJS. Add BACKEND
to VOL_FILES.
* objc/Make-lang.in (cc1obj): Link with $(BACKEND).
ch:
* Make-lang.in (cc1chill): Depend on $(BACKEND), not stamp-objlist.
* Makefile.in (cc1chill): Link with $(BACKEND). Define BACKEND,
eliminate C_OBJS (was commented out), OBJS, OBJDEPS.
cp:
* Make-lang.in (cc1plus): Depend on $(BACKEND), not stamp-objlist.
* Makefile.in: Add C_OBJS, BACKEND; delete OBJS, OBJDEPS.
(cc1plus): Link with $(BACKEND) and $(C_OBJS).
f:
* Make-lang.in (f771): Depend on $(BACKEND), not stamp-objlist.
* Makefile.in: Add BACKEND; delete OBJS, OBJDEPS.
(f771): Link with $(BACKEND).
java:
* Make-lang.in (jc1, jv-scan): Depend on $(BACKEND), not stamp-objlist.
* Makefile.in: Add BACKEND; delete OBJS, OBJDEPS.
(jc1): Link with $(BACKEND).
(jv-scan): Depend on version.o, not all of $(OBJS) or $(BACKEND).
From-SVN: r35501
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 73c7a47..09bc75f 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -7260,3 +7260,54 @@ multiple_of_p (type, top, bottom) return 0; } } + +/* Return true if `t' is known to be non-negative. */ + +int +tree_expr_nonnegative_p (t) + tree t; +{ + switch (TREE_CODE (t)) + { + case INTEGER_CST: + return tree_int_cst_sgn (t) >= 0; + case COND_EXPR: + return tree_expr_nonnegative_p (TREE_OPERAND (t, 1)) + && tree_expr_nonnegative_p (TREE_OPERAND (t, 2)); + case BIND_EXPR: + return tree_expr_nonnegative_p (TREE_OPERAND (t, 1)); + case RTL_EXPR: + return rtl_expr_nonnegative_p (RTL_EXPR_RTL (t)); + + default: + /* We don't know sign of `t', so be safe and return false. */ + return 0; + } +} + +/* Return true if `r' is known to be non-negative. + Only handles constants at the moment. */ + +int +rtl_expr_nonnegative_p (r) + rtx r; +{ + switch (GET_CODE (r)) + { + case CONST_INT: + return INTVAL (r) >= 0; + + case CONST_DOUBLE: + if (GET_MODE (r) == VOIDmode) + return CONST_DOUBLE_HIGH (r) >= 0; + return 0; + + case SYMBOL_REF: + case LABEL_REF: + /* These are always nonnegative. */ + return 1; + + default: + return 0; + } +} |