aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@bitmover.com>1999-08-19 22:33:38 +0000
committerZack Weinberg <zack@gcc.gnu.org>1999-08-19 22:33:38 +0000
commit8f985ec4c7de63e524197f1728a2c056f9af6554 (patch)
tree7d2c04e895a06940acfa67236fcbdb23966207b9 /gcc/tree.c
parent02af3af6514c82ca3bc75aa75b2774073f0ce602 (diff)
downloadgcc-8f985ec4c7de63e524197f1728a2c056f9af6554.zip
gcc-8f985ec4c7de63e524197f1728a2c056f9af6554.tar.gz
gcc-8f985ec4c7de63e524197f1728a2c056f9af6554.tar.bz2
rtl.def (NOTE): Change format to "iuu0n".
1999-08-19 14:44 -0700 Zack Weinberg <zack@bitmover.com> * rtl.def (NOTE): Change format to "iuu0n". (ADDR_DIFF_VEC): Change format to "eEee0". (ADDRESSOF): Change format to "eit". * rtl.h (rtvec): Make "elem" an array of rtx, not rtunion. (RTVEC_ELT): Change to match. (XVECEXP): Use XVEC and RTVEC_ELT. (INSN_UID, INSN_CODE, CODE_LABEL_NUMBER, NOTE_LINE_NUMBER, ADDRESSOF_REGNO, REGNO, SUBREG_WORD): Use XINT. (PREV_INSN, NEXT_INSN, PATTERN, REG_NOTES, CALL_INSN_FUNCTION_USAGE, SUBREG_REG, SET_SRC, SET_DEST, TRAP_CONDITION, TRAP_CODE): Use XEXP. (INTVAL): Use XWINT. (ADDRESSOF_DECL): Use XTREE. (SET_ADDRESSOF_DECL): Delete. (NOTE_DECL_NAME, NOTE_DECL_CODE, NOTE_DECL_RTL, NOTE_DECL_IDENTIFIER, NOTE_DECL_TYPE): Kill. These have been ifdefed out since 2.6 at least. (gen_rtvec_vv): Delete prototype. * rtl.h (rtvec_alloc): rt->elem is now an array of rtx, not rtunion. (copy_most_rtx): Handle 't' format letter. * emit-rtl.c (gen_rtvec_v): rt_val->elem is an array of rtx. (gen_rtvec_vv): Delete function. All callers changed to use gen_rtvec_v instead. * print-rtl.c (print_rtx): Move special casing of NOTEs to the '0' format letter. * function.c (gen_mem_addressof): Don't use SET_ADDRESSOF_DECL; provide `decl' to gen_rtx_ADDRESSOF instead. * integrate.c (copy_rtx_and_substitute): Likewise. Copy 't' slots with XTREE. (subst_constants): Treat 't' slots like '[swi]' slots. * cse.c (canon_hash, exp_equiv_p): Treat 't' slots like '0' slots. * jump.c (rtx_equal_for_thread_p): Likewise. * rtlanal.c (rtx_equal_p): Likewise. * stmt.c (expand_end_case): gen_rtx_ADDR_DIFF_VEC now takes only four arguments. * gengenrtl.c (type_from_format): Provide correct types for 'b' and 't' slots. * tree.h [ENABLE_CHECKING] (TREE_CHECK, TREE_CLASS_CHECK): If a recent gcc is in use (always in stage2 and beyond), use statement expressions, so we don't make a function call unless the check fails. Evaluate arguments exactly once. (CHAIN_CHECK, DO_CHECK, DO_CHECK1, TREE_CHECK1, TREE_CLASS_CHECK1, TYPE_CHECK1, DECL_CHECK1, CST_CHECK1): Delete. (CST_OR_CONSTRUCTOR_CHECK, EXPR_CHECK): Redefine such that they evaluate their arguments exactly once, irrespective of the compiler in use. * tree.c [ENABLE_CHECKING]: Define whichever set of functions is used by the currently-enabled check macros. This is: (tree_check_failed, tree_class_check_failed): For gcc. (tree_check, tree_class_check, cst_or_constructor_check, expr_check): For other compilers. * gencheck.c: Do not define any *_CHECK1 macros. From-SVN: r28769
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c133
1 files changed, 82 insertions, 51 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index c688dfc..123a3ce 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5077,81 +5077,112 @@ get_set_constructor_bytes (init, buffer, wd_size)
#ifdef ENABLE_CHECKING
-/* Complain if the tree code does not match the expected one.
- NODE is the tree node in question, CODE is the expected tree code,
- and FILE and LINE are the filename and line number, respectively,
- of the line on which the check was done. If NONFATAL is nonzero,
- don't abort if the reference is invalid; instead, return 0.
- If the reference is valid, return NODE. */
+#if defined __GNUC__ && (__GNUC__ > 2 || __GNUC_MINOR__ > 6)
-tree
-tree_check (node, code, file, line, nofatal)
- tree node;
+/* Complain that the tree code of NODE does not match the expected CODE.
+ FILE, LINE, and FUNCTION are of the caller.
+
+ FIXME: should print the blather about reporting the bug. */
+void
+tree_check_failed (node, code, file, line, function)
+ const tree node;
enum tree_code code;
const char *file;
int line;
- int nofatal;
+ const char *function;
{
- if (TREE_CODE (node) == code)
- return node;
- else if (nofatal)
- return 0;
- else
- fatal ("%s:%d: Expect %s, have %s\n", file, line,
- tree_code_name[code], tree_code_name[TREE_CODE (node)]);
+ fatal ("Internal compiler error in `%s', at %s:%d:\n\
+\texpected %s, have %s\n",
+ function, trim_filename (file), line,
+ tree_code_name[code], tree_code_name[TREE_CODE (node)]);
}
/* Similar to above, except that we check for a class of tree
code, given in CL. */
-
-tree
-tree_class_check (node, cl, file, line, nofatal)
- tree node;
+void
+tree_class_check_failed (node, cl, file, line, function)
+ const tree node;
char cl;
const char *file;
int line;
- int nofatal;
+ const char *function;
{
- if (TREE_CODE_CLASS (TREE_CODE (node)) == cl)
+ fatal ("Internal compiler error in `%s', at %s:%d:\n\
+\texpected '%c', have '%c' (%s)\n",
+ function, trim_filename (file), line, cl,
+ TREE_CODE_CLASS (TREE_CODE (node)),
+ tree_code_name[TREE_CODE (node)]);
+}
+
+#else /* not gcc or old gcc */
+
+/* These functions are just like the above, but they have to
+ do the check as well as report the error. */
+tree
+tree_check (node, code, file, line)
+ const tree node;
+ enum tree_code code;
+ const char *file;
+ int line;
+{
+ if (TREE_CODE (node) == code)
return node;
- else if (nofatal)
- return 0;
- else
- fatal ("%s:%d: Expect '%c', have '%s'\n", file, line,
- cl, tree_code_name[TREE_CODE (node)]);
+
+ fatal ("Internal compiler error at %s:%d:\n\texpected %s, have %s\n",
+ file, trim_filename (file), tree_code_name[code], tree_code_name[TREE_CODE(node)]);
}
-/* Likewise, but complain if the tree node is not an expression. */
+tree
+tree_class_check (node, class, file, line)
+ const tree node;
+ char class;
+ const char *file;
+ int line;
+{
+ if (TREE_CODE_CLASS (TREE_CODE (node)) == class)
+ return node;
+
+ fatal ("Internal compiler error at %s:%d:\n\
+\texpected '%c', have '%c' (%s)\n",
+ file, trim_filename (file), class, TREE_CODE_CLASS (TREE_CODE (node)),
+ tree_code_name[TREE_CODE(node)]);
+}
tree
-expr_check (node, ignored, file, line, nofatal)
- tree node;
- int ignored;
+cst_or_constructor_check (node, file, line)
+ const tree node;
const char *file;
int line;
- int nofatal;
{
- switch (TREE_CODE_CLASS (TREE_CODE (node)))
- {
- case 'r':
- case 's':
- case 'e':
- case '<':
- case '1':
- case '2':
- break;
+ enum tree_code code = TREE_CODE (node);
+
+ if (code == CONSTRUCTOR || TREE_CODE_CLASS (code) == 'c')
+ return node;
- default:
- if (nofatal)
- return 0;
- else
- fatal ("%s:%d: Expect expression, have '%s'\n", file, line,
- tree_code_name[TREE_CODE (node)]);
- }
+ fatal ("Internal compiler error at %s:%d:\n\
+\texpected constructor, have %s\n",
+ file, line, tree_code_name[code]);
+}
- return node;
+tree
+cst_or_constructor_check (node, file, line)
+ const tree node;
+ const char *file;
+ int line;
+{
+ char c = TREE_CODE_CLASS (TREE_CODE (node));
+
+ if (c == 'r' || c == 's' || c == '<'
+ || c == '1' || c == '2' || c == 'e')
+ return node;
+
+ fatal ("Internal compiler error at %s:%d:\n\
+\texpected 'e', have '%c' (%s)\n",
+ file, trim_filename (file), c, tree_code_name[TREE_CODE (node)]);
}
-#endif
+
+#endif /* not gcc or old gcc */
+#endif /* ENABLE_CHECKING */
/* Return the alias set for T, which may be either a type or an
expression. */