+Tue Jun 30 16:01:01 1998 Richard Henderson <rth@cygnus.com>
+
+ * rtl.def (CONSTANT_P_RTX): New.
+ * rtl.h (CONSTANT_P): Recognize it.
+ * cse.c (fold_rtx): Eliminate it.
+ * expr.c (can_handle_constant_p): New variable.
+ (init_expr_once): Initialize it.
+ (expand_builtin): Generate CONSTANT_P_RTX if the expression is not
+ immediately recognizable as a constant.
+
+ * alpha.c (reg_or_6bit_operand): Recognize CONSTANT_P_RTX.
+ (reg_or_8bit_operand, cint8_operand, add_operand): Likewise.
+ (sext_add_operand, and_operand, or_operand): Likewise.
+ (reg_or_cint_operand, some_operand, input_operand): Likewise.
+ * alpha.h (PREDICATE_CODES): Add CONSTANT_P_RTX where needed.
+
1998-06-30 Benjamin Kosnik <bkoz@bliss.nabi.net>
* dbxout.c (dbxout_type_methods): Remove warn_template_debugging.
/* Similarly for __builtin_apply_args. */
static rtx apply_args_value;
+/* Nonzero if the machine description has been fixed to accept
+ CONSTANT_P_RTX patterns. We will emit a warning and continue
+ if we find we must actually use such a beast. */
+static int can_handle_constant_p;
+
/* Don't check memory usage, since code is being emitted to check a memory
usage. Used when flag_check_memory_usage is true, to avoid infinite
recursion. */
{
rtx insn, pat;
enum machine_mode mode;
+ int num_clobbers;
rtx mem, mem1;
char *free_point;
{
int regno;
rtx reg;
- int num_clobbers;
direct_load[(int) mode] = direct_store[(int) mode] = 0;
PUT_MODE (mem, mode);
}
}
+ /* Find out if CONSTANT_P_RTX is accepted. */
+ SET_DEST (pat) = gen_rtx_REG (TYPE_MODE (integer_type_node),
+ FIRST_PSEUDO_REGISTER);
+ SET_SRC (pat) = gen_rtx_CONSTANT_P_RTX (TYPE_MODE (integer_type_node),
+ SET_DEST (pat));
+ if (recog (pat, insn, &num_clobbers) >= 0)
+ can_handle_constant_p = 1;
+
end_sequence ();
obfree (free_point);
}
-
+
/* This is run at the start of compiling a function. */
void
tree arg = TREE_VALUE (arglist);
STRIP_NOPS (arg);
- return (TREE_CODE_CLASS (TREE_CODE (arg)) == 'c'
- || (TREE_CODE (arg) == ADDR_EXPR
- && TREE_CODE (TREE_OPERAND (arg, 0)) == STRING_CST)
- ? const1_rtx : const0_rtx);
+ if (really_constant_p (arg)
+ || (TREE_CODE (arg) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (arg, 0)) == STRING_CST))
+ return const1_rtx;
+
+ /* Only emit CONSTANT_P_RTX if CSE will be run.
+ Moreover, we don't want to expand trees that have side effects,
+ as the original __builtin_constant_p did not evaluate its
+ argument at all, and we would break existing usage by changing
+ this. This quirk was generally useful, eliminating a bit of hair
+ in the writing of the macros that use this function. Now the
+ same thing can be better accomplished in an inline function. */
+
+ if (! cse_not_expected && ! TREE_SIDE_EFFECTS (arg))
+ {
+ /* Lazy fixup of old code: issue a warning and fail the test. */
+ if (! can_handle_constant_p)
+ {
+ warning ("Delayed evaluation of __builtin_constant_p not supported on this target.");
+ warning ("Please report this as a bug to egcs-bugs@cygnus.com.");
+ return const0_rtx;
+ }
+ return gen_rtx_CONSTANT_P_RTX (TYPE_MODE (integer_type_node),
+ expand_expr (arg, NULL_RTX,
+ VOIDmode, 0));
+ }
+
+ return const0_rtx;
}
case BUILT_IN_FRAME_ADDRESS:
0 is the live bitmap. Operand 1 is the original block number. */
DEF_RTL_EXPR(RANGE_LIVE, "range_live", "bi", 'x')
+/* A unary `__builtin_constant_p' expression. These are only emitted
+ during RTL generation, and then only if optimize > 0. They are
+ eliminated by the first CSE pass. */
+DEF_RTL_EXPR(CONSTANT_P_RTX, "constant_p", "e", 'x')
+
/*
Local variables:
mode:c