summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-17 21:55:02 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-17 21:55:02 +0000
commitce45a448519f33c37b3ab6819fed86b28c267ab8 (patch)
treeb888315cd5fd9c69beb9093c01225e1f84fa5bf1 /gcc
parent8141f7d041fe04427d56c29ecbfc450c335ff292 (diff)
downloadgcc-ce45a448519f33c37b3ab6819fed86b28c267ab8.tar.gz
2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com>
Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87675 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog63
-rw-r--r--gcc/LANGUAGES12
-rw-r--r--gcc/ada/ChangeLog30
-rw-r--r--gcc/ada/ada-tree.def23
-rw-r--r--gcc/ada/ada-tree.h2
-rw-r--r--gcc/ada/decl.c7
-rw-r--r--gcc/ada/misc.c4
-rw-r--r--gcc/ada/trans.c24
-rw-r--r--gcc/ada/utils.c20
-rw-r--r--gcc/ada/utils2.c7
-rw-r--r--gcc/alias.c23
-rw-r--r--gcc/builtins.c6
-rw-r--r--gcc/c-common.c59
-rw-r--r--gcc/c-common.def24
-rw-r--r--gcc/c-format.c2
-rw-r--r--gcc/c-lang.c4
-rw-r--r--gcc/c-pragma.c2
-rw-r--r--gcc/c-typeck.c43
-rw-r--r--gcc/cgraphunit.c14
-rw-r--r--gcc/config/arm/arm.c2
-rw-r--r--gcc/config/i386/winnt.c3
-rw-r--r--gcc/config/pa/pa.c3
-rw-r--r--gcc/config/pa/pa.h2
-rw-r--r--gcc/config/sh/sh.c2
-rw-r--r--gcc/config/sol2-c.c6
-rw-r--r--gcc/convert.c2
-rw-r--r--gcc/cp/ChangeLog17
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/cp/class.c4
-rw-r--r--gcc/cp/cp-gimplify.c2
-rw-r--r--gcc/cp/cp-lang.c6
-rw-r--r--gcc/cp/cp-tree.def95
-rw-r--r--gcc/cp/cxx-pretty-print.c5
-rw-r--r--gcc/cp/mangle.c4
-rw-r--r--gcc/cp/pt.c27
-rw-r--r--gcc/cp/semantics.c2
-rw-r--r--gcc/cp/tree.c21
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/dbxout.c8
-rw-r--r--gcc/dwarf2out.c7
-rw-r--r--gcc/emit-rtl.c2
-rw-r--r--gcc/expr.c34
-rw-r--r--gcc/fold-const.c167
-rw-r--r--gcc/fortran/ChangeLog136
-rw-r--r--gcc/fortran/f95-lang.c4
-rw-r--r--gcc/fortran/trans-expr.c2
-rw-r--r--gcc/fortran/trans.c2
-rw-r--r--gcc/gimplify.c28
-rw-r--r--gcc/java/ChangeLog14
-rw-r--r--gcc/java/java-gimplify.c3
-rw-r--r--gcc/java/java-tree.def44
-rw-r--r--gcc/java/jcf-write.c3
-rw-r--r--gcc/java/lang.c10
-rw-r--r--gcc/java/parse.y10
-rw-r--r--gcc/lambda-code.c2
-rw-r--r--gcc/langhooks.c6
-rw-r--r--gcc/langhooks.h15
-rw-r--r--gcc/objc/objc-lang.c6
-rw-r--r--gcc/objc/objc-tree.def24
-rw-r--r--gcc/predict.c2
-rw-r--r--gcc/print-tree.c36
-rw-r--r--gcc/reload1.c2
-rw-r--r--gcc/stmt.c6
-rw-r--r--gcc/tree-browser.c46
-rw-r--r--gcc/tree-cfg.c15
-rw-r--r--gcc/tree-chrec.c2
-rw-r--r--gcc/tree-complex.c8
-rw-r--r--gcc/tree-dfa.c4
-rw-r--r--gcc/tree-dump.c18
-rw-r--r--gcc/tree-eh.c8
-rw-r--r--gcc/tree-gimple.c23
-rw-r--r--gcc/tree-inline.c11
-rw-r--r--gcc/tree-nested.c6
-rw-r--r--gcc/tree-outof-ssa.c2
-rw-r--r--gcc/tree-pretty-print.c14
-rw-r--r--gcc/tree-sra.c4
-rw-r--r--gcc/tree-ssa-alias.c2
-rw-r--r--gcc/tree-ssa-ccp.c11
-rw-r--r--gcc/tree-ssa-dce.c2
-rw-r--r--gcc/tree-ssa-dom.c24
-rw-r--r--gcc/tree-ssa-forwprop.c10
-rw-r--r--gcc/tree-ssa-live.c4
-rw-r--r--gcc/tree-ssa-loop-im.c22
-rw-r--r--gcc/tree-ssa-loop-ivopts.c19
-rw-r--r--gcc/tree-ssa-operands.c10
-rw-r--r--gcc/tree-ssa-phiopt.c2
-rw-r--r--gcc/tree-ssa-pre.c99
-rw-r--r--gcc/tree-ssa-propagate.c4
-rw-r--r--gcc/tree-ssa.c2
-rw-r--r--gcc/tree-ssanames.c6
-rw-r--r--gcc/tree-tailcall.c4
-rw-r--r--gcc/tree.c242
-rw-r--r--gcc/tree.def332
-rw-r--r--gcc/tree.h131
-rw-r--r--gcc/treelang/ChangeLog5
-rw-r--r--gcc/treelang/treetree.c4
-rw-r--r--gcc/varasm.c5
97 files changed, 1212 insertions, 1038 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ad206dea5da..f61c75b08de 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,44 @@
+2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com>
+ Zack Weinberg <zack@codesourcery.com>
+
+ * alias.c (find_base_decl): Remove unreachable case '3' block.
+ * expr.c (safe_from_p): Abort if passed a type.
+ * tree-gimple.c (recalculate_side_effects): Abort if passed
+ anything other than an expression.
+ * tree-ssa-pre.c (phi_translate): Return expr immediately if
+ is_gimple_min_invariant is true for it. Reorder cases for clarity.
+ Abort on un-handled tree classes.
+ (valid_in_set): Likewise.
+ * tree.c (tree_code_class_strings): New static data.
+
+ * tree.h (enum tree_code_class): New.
+ (tree_code_class_strings): Declare.
+ (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P)
+ (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P)
+ (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros.
+ (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS)
+ (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update.
+
+ * tree.def, c-common.def, objc/objc-tree.def: Use
+ tree_code_class enumeration constants instead of code letters.
+
+ * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c
+ * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c
+ * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c
+ * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c
+ * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c
+ * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c
+ * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c
+ * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c
+ * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c
+ * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c
+ * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c
+ * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c
+ * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c
+ Update to match.
+
+ * LANGUAGES: Add note about change.
+
2004-09-17 Diego Novillo <dnovillo@redhat.com>
PR tree-optimization/17319
@@ -33,7 +74,7 @@
(dbxout_init): Include lang number in N_SO stab.
* dbxout.h (N_SO_AS, N_SO_C, N_SO_ANSI_C, N_SO_CC, N_SO_FORTRAN,
N_SO_PASCAL, N_SO_FORTRAN90, N_SO_OBJC, N_SO_OBJCPLUS): New #define.
-
+
2004-09-17 Diego Novillo <dnovillo@redhat.com>
PR tree-optimization/17273
@@ -63,7 +104,7 @@
2004-09-17 Sylvain Pion <Sylvain.Pion@sophia.inria.fr>
- * doc/extend.texi: Fix duplicated word.
+ * doc/extend.texi: Fix duplicated word.
2004-09-17 Toon Moene <toon@moene.indiv.nluug.nl>
@@ -115,7 +156,7 @@
2004-09-17 Steven Bosscher <stevenb@suse.de>
- PR tree-optimization/17513
+ PR tree-optimization/17513
* cfgexpand.c (construct_init_block): Clear EDGE_EXECUTABLE
for successors of the entry block.
@@ -208,11 +249,11 @@
2004-09-16 Andrew MacLeod <amacleod@redhat.com>
PR tree-optimization/17517
- * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Don't
+ * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Don't
coalesce same-root variables without checking for abnormal PHI usage.
2004-09-16 Daniel Berlin <dberlin@dberlin.org>
-
+
* cfgloop.h (duplicate_loop): Add prototype.
* cfgloopmanip.c (duplicate_loop): Make non-static.
* lambda-code.c (perfect_nestify): Factor out test whether
@@ -229,7 +270,7 @@
loop invariant as well.
(perfect_nestify): new function.
(gcc_loop_to_lambda_loop): New parameters to track lower bounds,
- upper bounds, and steps.
+ upper bounds, and steps.
Set outerinductionvar properly.
(gcc_loopnest_to_lambda_loopnest): Add loops and need_perfect
parameters.
@@ -254,9 +295,9 @@
2004-09-16 Sebastian Pop <pop@cri.ensmp.fr>
* tree-loop-linear.c (gather_interchange_stats): Add more comments.
- Gather also strides of accessed data. Pass in the data references
+ Gather also strides of accessed data. Pass in the data references
array.
- (try_interchange_loops): Add a new heuristic for handling the temporal
+ (try_interchange_loops): Add a new heuristic for handling the temporal
locality. Pass in the data references array.
(linear_transform_loops): Pass the data references array to
try_interchange_loops.
@@ -369,7 +410,7 @@
* Makefile.in (tree-ssa-dom.o): Depend on tree-ssa-propagate.h.
* tree-ssa-dom.c (cprop_into_stmt): Recompute TREE_INVARIANT
- after propagating into an ADDR_EXPR.
+ after propagating into an ADDR_EXPR.
2004-09-15 Andrew Pinski <apinski@apple.com>
@@ -587,7 +628,7 @@
2004-09-14 Jeff Law <law@redhat.com>
* tree-ssa-dom.c (stmts_to_rescan): Move from a block-local
- to a global varray.
+ to a global varray.
(tree_ssa_dominator_optimize): Allocate stmts_to_rescan.
(dom_opt_initialize_block_local_data): No longer test state
of stmts_to_rescan.
@@ -824,7 +865,7 @@
PR tree-optimization/17400
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Don't
coalesce partitions when one occurs in an abnormal PHI.
-
+
2004-09-13 Andrew Pinski <apinski@apple.com>
* config/rs6000/darwin.h (ASM_OUTPUT_COMMON): Change variable size's
diff --git a/gcc/LANGUAGES b/gcc/LANGUAGES
index ed1e0b4ab2b..5f20d9c24e9 100644
--- a/gcc/LANGUAGES
+++ b/gcc/LANGUAGES
@@ -6,6 +6,18 @@ time as we can formally start documenting the interface this file will
serve as a repository for information on these interface and any incompatable
changes we've made.
+2004-09-09:
+ In an effort to decrease execution time, single char tree code
+ classes were changed to enumerated values.
+
+ Old way:
+
+ DEFTREECODE (CLASS_METHOD_DECL, "class_method_decl", 'd', 0)
+
+ New way:
+
+ DEFTREECODE (CLASS_METHOD_DECL, "class_method_decl", tcc_declaration, 0)
+
2001-02-26:
A DECL_INITIAL of NULL_TREE or error_mark_node in a VAR_DECL is no longer
taken to signify a tentative definition which should not be emitted until
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index babbc34f0dd..92560a9641c 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,11 @@
+2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com>
+ Zack Weinberg <zack@codesourcery.com>
+
+ * ada-tree.def: Use tree_code_class enumeration constants
+ instead of code letters.
+ * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c:
+ Update for new tree-class enumeration constants.
+
2004-09-17 Vincent Celier <celier@gnat.com>
* prj-attr-pm.ads, prj-attr-pm.adb: New files, to split some private
@@ -456,7 +464,7 @@
2004-08-25 Nathan Sidwell <nathan@codesourcery.com>
Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
-
+
* ada-tree.h (TYPE_RM_SIZE_INT): Use TYPE_LANG_SLOT_1.
2004-08-25 Nathan Sidwell <nathan@codesourcery.com>
@@ -465,7 +473,7 @@
* trans.c (Exception_Handler_to_gnu_sjlj, gnat_to_gnu): Likewise.
* utils.c (init_gigi_decls): Likewise.
* utils2.c (build_call_raise, build_allocator): Likewise.
-
+
2004-08-24 Nathan Sidwell <nathan@codesourcery.com>
* utils.c (gnat_init_decl_processing): Adjust
@@ -589,7 +597,7 @@
GNAT.Sockets.Thin.Is_Socket_In_Set to account for new specification
and test explicitly for non-zero return value.
- * g-socthi-vms.ads, g-socthi-mingw.ads, g-socthi-vxworks.ads:
+ * g-socthi-vms.ads, g-socthi-mingw.ads, g-socthi-vxworks.ads:
(Is_Socket_In_Set): Declare imported function as returning C.int, to
avoid using a derived boolean type.
@@ -1264,7 +1272,7 @@
(gnat_to_gnu, case N_Compilation_Unit): Just handle nested case here.
(add_stmt): Force walking of sizes and DECL_INITIAL for DECL_EXPR.
(mark_visited): Don't mark dummy type.
- (tree_transform <N_Procedure_Call_Statement>): Unless this is an In
+ (tree_transform <N_Procedure_Call_Statement>): Unless this is an In
parameter, we must remove any LJM building from GNU_NAME.
(gnat_to_gnu, case N_String_Literal): Fill in indices in CONSTRUCTOR.
(pos_to_constructor): Use int_const_binop.
@@ -1471,7 +1479,7 @@
(gnat_to_gnu): If statement and not in procedure, go into elab proc.
Delete calls to add_decl_expr; add arg to create_*_decl.
(gnat_to_gnu, case N_Loop): Recalculate side effects on COND_EXPR.
- (gnat_to_gnu, case N_Subprogram_Body): Move some code to
+ (gnat_to_gnu, case N_Subprogram_Body): Move some code to
begin_subprog_body and call it.
Don't push and pop ggc context.
(gnat_to_gnu, case N_Compilation_Unit): Rework to support elab proc.
@@ -1497,7 +1505,7 @@
(function_nesting_depth): Deleted.
(begin_subprog_body): Delete obsolete code.
* utils2.c (build_call_alloc_dealloc): Add new arg to create_var_decl.
-
+
2004-06-28 Robert Dewar <dewar@gnat.com>
* mlib-tgt-tru64.adb, mlib-tgt-aix.adb, mlib-tgt-irix.adb,
@@ -1629,8 +1637,8 @@
Lib_Address and Relocatable.
(Default_DLL_Address): Removed.
- * mlib-tgt-tru64.adb, mlib-tgt-aix.adb, mlib-tgt-irix.adb,
- mlib-tgt-hpux.adb, mlib-tgt-linux.adb, mlib-tgt-solaris.adb,
+ * mlib-tgt-tru64.adb, mlib-tgt-aix.adb, mlib-tgt-irix.adb,
+ mlib-tgt-hpux.adb, mlib-tgt-linux.adb, mlib-tgt-solaris.adb,
mlib-tgt-vms-alpha.adb, mlib-tgt-vms-ia64.adb, mlib-tgt-vxworks.adb:
(Build_Dynamic_Library): Remove parameter Lib_Address and Relocatable.
(Default_DLL_Address): Removed.
@@ -1827,7 +1835,7 @@
(Compile_Sources.Compile): Add switch -gnatez as the last option
(Display): Never display -gnatez
- * Makefile.generic:
+ * Makefile.generic:
When using $(MAIN_OBJECT), always use $(OBJ_DIR)/$(MAIN_OBJECT)
* gnatcmd.adb (Check_Project): New function
@@ -2402,7 +2410,7 @@
opt.adb, par.adb, opt.ads, par-ch11.adb, par-ch3.adb, par-ch4.adb,
par-ch5.adb, par-ch6.adb, par-ch8.adb, par-ch9.adb, par-prag.adb,
par-util.adb, scng.adb, sem_aggr.adb, sem_attr.adb, sem_cat.adb,
- sem_ch10.adb, sem_ch10.adb, sem_ch11.adb, sem_ch12.adb, sem_ch2.adb,
+ sem_ch10.adb, sem_ch10.adb, sem_ch11.adb, sem_ch12.adb, sem_ch2.adb,
sem_ch3.adb, sem_ch3.ads, sem_ch4.adb, sem_ch5.adb, sem_ch6.adb,
sem_ch7.adb, sem_ch8.adb, sem_ch9.adb, sem_eval.adb, sem_prag.adb,
sem_res.adb, sem_type.adb, sem_util.adb, sinfo.ads, snames.adb,
@@ -3027,7 +3035,7 @@
Renaming of target specific files for clarity
- * Makefile.in: Rename GNAT target specific files.
+ * Makefile.in: Rename GNAT target specific files.
* 31soccon.ads, 31soliop.ads 35soccon.ads, 3asoccon.ads,
3bsoccon.ads, 3gsoccon.ads, 3hsoccon.ads, 3psoccon.ads,
diff --git a/gcc/ada/ada-tree.def b/gcc/ada/ada-tree.def
index fe68c633f2c..25ea95ef6ce 100644
--- a/gcc/ada/ada-tree.def
+++ b/gcc/ada/ada-tree.def
@@ -6,7 +6,7 @@
* *
* Specification *
* *
- * Copyright (C) 1992-2003 Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2004 Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -28,23 +28,24 @@
to GCC. TREE_TYPE is the type of the fat pointer and TYPE_OBJECT_RECORD_TYPE
is the type of a record containing the template and data. */
-DEFTREECODE (UNCONSTRAINED_ARRAY_TYPE, "unconstrained_array_type", 't', 0)
+DEFTREECODE (UNCONSTRAINED_ARRAY_TYPE, "unconstrained_array_type", tcc_type, 0)
/* A reference to an unconstrained array. This node only exists as an
intermediate node during the translation of a GNAT tree to a GCC tree;
it is never passed to GCC. The only field used is operand 0, which
is the fat pointer object. */
-DEFTREECODE (UNCONSTRAINED_ARRAY_REF, "unconstrained_array_ref", 'r', 1)
+DEFTREECODE (UNCONSTRAINED_ARRAY_REF, "unconstrained_array_ref",
+ tcc_reference, 1)
/* An expression that returns an RTL suitable for its type. Operand 0
is an expression to be evaluated for side effects only. */
-DEFTREECODE (NULL_EXPR, "null_expr", 'e', 1)
+DEFTREECODE (NULL_EXPR, "null_expr", tcc_expression, 1)
/* Same as ADDR_EXPR, except that if the operand represents a bit field,
return the address of the byte containing the bit. This is used
for the 'Address attribute and never shows up in the tree. */
-DEFTREECODE (ATTR_ADDR_EXPR, "attr_addr_expr", 'r', 1)
+DEFTREECODE (ATTR_ADDR_EXPR, "attr_addr_expr", tcc_reference, 1)
/* Here are the tree codes for the statement types known to Ada. These
must be at the end of this file to allow IS_ADA_STMT to work. */
@@ -53,32 +54,32 @@ DEFTREECODE (ATTR_ADDR_EXPR, "attr_addr_expr", 'r', 1)
makes this tree node, whose operand is a statement. The latter inserts
the actual statements into this node. Gimplification consists of
just returning the inner statement. */
-DEFTREECODE (STMT_STMT, "stmt_stmt", 's', 1)
+DEFTREECODE (STMT_STMT, "stmt_stmt", tcc_statement, 1)
/* A loop. LOOP_STMT_TOP_COND and LOOP_STMT_BOT_COND are the tests to exit a
loop at the top and bottom, respectively. LOOP_STMT_UPDATE is the statement
to update the loop iterator at the continue point. LOOP_STMT_BODY are the
statements in the body of the loop. LOOP_STMT_LABEL points to the LABEL_DECL
of the end label of the loop. */
-DEFTREECODE (LOOP_STMT, "loop_stmt", 's', 5)
+DEFTREECODE (LOOP_STMT, "loop_stmt", tcc_statement, 5)
/* Conditionally exit a loop. EXIT_STMT_COND is the condition, which, if
true, will cause the loop to be exited. If no condition is specified,
the loop is unconditionally exited. EXIT_STMT_LABEL is the end label
corresponding to the loop to exit. */
-DEFTREECODE (EXIT_STMT, "exit_stmt", 's', 2)
+DEFTREECODE (EXIT_STMT, "exit_stmt", tcc_statement, 2)
/* A exception region. REGION_STMT_BODY is the statement to be executed
inside the region. REGION_STMT_HANDLE is a statement that represents
the exception handlers (usually a BLOCK_STMT of HANDLE_STMTs).
REGION_STMT_BLOCK is the BLOCK node for the declarative region, if any. */
-DEFTREECODE (REGION_STMT, "region_stmt", 's', 3)
+DEFTREECODE (REGION_STMT, "region_stmt", tcc_statement, 3)
/* An exception handler. HANDLER_STMT_ARG is the value to pass to
expand_start_catch, HANDLER_STMT_LIST is the list of statements for the
handler itself, and HANDLER_STMT_BLOCK is the BLOCK node for this
binding. */
-DEFTREECODE (HANDLER_STMT, "handler_stmt", 's', 3)
+DEFTREECODE (HANDLER_STMT, "handler_stmt", tcc_statement, 3)
/* A statement that emits a USE for its single operand. */
-DEFTREECODE (USE_STMT, "use_expr", 's', 1)
+DEFTREECODE (USE_STMT, "use_expr", tcc_statement, 1)
diff --git a/gcc/ada/ada-tree.h b/gcc/ada/ada-tree.h
index 21f1cafb2ca..7d4a756a725 100644
--- a/gcc/ada/ada-tree.h
+++ b/gcc/ada/ada-tree.h
@@ -273,7 +273,7 @@ struct lang_type GTY(()) {tree t; };
/* Define fields and macros for statements.
Start by defining which tree codes are used for statements. */
-#define IS_STMT(NODE) (TREE_CODE_CLASS (TREE_CODE (NODE)) == 's')
+#define IS_STMT(NODE) (STATEMENT_CLASS_P (NODE))
#define IS_ADA_STMT(NODE) (IS_STMT (NODE) \
&& TREE_CODE (NODE) >= STMT_STMT)
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index 604c47151d1..08b5176afde 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -761,7 +761,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
just use that declaration or reference as this entity unless
the latter has to be materialized. */
else if ((DECL_P (gnu_expr)
- || TREE_CODE_CLASS (TREE_CODE (gnu_expr)) == 'r')
+ || (REFERENCE_CLASS_P (gnu_expr) == tcc_reference))
&& !Materialize_Entity (gnat_entity)
&& (!global_bindings_p ()
|| (staticp (gnu_expr)
@@ -4553,7 +4553,7 @@ elaborate_expression_1 (Node_Id gnat_expr, Entity_Id gnat_entity,
rely here on the fact that an expression cannot contain both the
discriminant and some other variable. */
- expr_variable = (TREE_CODE_CLASS (TREE_CODE (gnu_expr)) != 'c'
+ expr_variable = (!CONSTANT_CLASS_P (gnu_expr)
&& !(TREE_CODE (gnu_inner_expr) == VAR_DECL
&& TREE_READONLY (gnu_inner_expr))
&& !CONTAINS_PLACEHOLDER_P (gnu_expr));
@@ -5565,8 +5565,7 @@ annotate_value (tree gnu_size)
return No_Uint;
/* See if we've already saved the value for this node. */
- if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (gnu_size)))
- && TREE_COMPLEXITY (gnu_size))
+ if (EXPR_P (gnu_size) && TREE_COMPLEXITY (gnu_size))
return (Node_Ref_Or_Val) TREE_COMPLEXITY (gnu_size);
/* If we do not return inside this switch, TCODE will be set to the
diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c
index cdaa862bd75..d1631cdb463 100644
--- a/gcc/ada/misc.c
+++ b/gcc/ada/misc.c
@@ -173,9 +173,9 @@ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-const char tree_code_type[] = {
+const enum tree_code_class tree_code_type[] = {
#include "tree.def"
- 'x',
+ tcc_exceptional,
#include "ada-tree.def"
};
#undef DEFTREECODE
diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c
index eb25be383f9..4defe553e62 100644
--- a/gcc/ada/trans.c
+++ b/gcc/ada/trans.c
@@ -3219,7 +3219,7 @@ gnat_to_gnu (Node_Id gnat_node)
/* If this is a comparison operator, convert any references to
an unconstrained array value into a reference to the
actual array. */
- if (TREE_CODE_CLASS (code) == '<')
+ if (TREE_CODE_CLASS (code) == tcc_comparison)
{
gnu_lhs = maybe_unconstrained_array (gnu_lhs);
gnu_rhs = maybe_unconstrained_array (gnu_rhs);
@@ -4035,7 +4035,7 @@ gnat_to_gnu (Node_Id gnat_node)
/* Set the location information into the result. If we're supposed to
return something of void_type, it means we have something we're
elaborating for effect, so just return. */
- if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (gnu_result))))
+ if (EXPR_P (gnu_result))
annotate_with_node (gnu_result, gnat_node);
if (TREE_CODE (gnu_result_type) == VOID_TYPE)
@@ -5712,13 +5712,13 @@ gnat_stabilize_reference_1 (tree e, bool force)
switch (TREE_CODE_CLASS (code))
{
- case 'x':
- case 't':
- case 'd':
- case '<':
- case 's':
- case 'e':
- case 'r':
+ case tcc_exceptional:
+ case tcc_type:
+ case tcc_declaration:
+ case tcc_comparison:
+ case tcc_statement:
+ case tcc_expression:
+ case tcc_reference:
/* If this is a COMPONENT_REF of a fat pointer, save the entire
fat pointer. This may be more efficient, but will also allow
us to more easily find the match for the PLACEHOLDER_EXPR. */
@@ -5734,12 +5734,12 @@ gnat_stabilize_reference_1 (tree e, bool force)
return e;
break;
- case 'c':
+ case tcc_constant:
/* Constants need no processing. In fact, we should never reach
here. */
return e;
- case '2':
+ case tcc_binary:
/* Recursively stabilize each operand. */
result = build2 (code, type,
gnat_stabilize_reference_1 (TREE_OPERAND (e, 0), force),
@@ -5747,7 +5747,7 @@ gnat_stabilize_reference_1 (tree e, bool force)
force));
break;
- case '1':
+ case tcc_unary:
/* Recursively stabilize each operand. */
result = build1 (code, type,
gnat_stabilize_reference_1 (TREE_OPERAND (e, 0),
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index 2b5bad74092..1a5afb3d9b1 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -2009,11 +2009,11 @@ max_size (tree exp, bool max_p)
switch (TREE_CODE_CLASS (code))
{
- case 'd':
- case 'c':
+ case tcc_declaration:
+ case tcc_constant:
return exp;
- case 'x':
+ case tcc_exceptional:
if (code == TREE_LIST)
return tree_cons (TREE_PURPOSE (exp),
max_size (TREE_VALUE (exp), max_p),
@@ -2021,7 +2021,7 @@ max_size (tree exp, bool max_p)
? max_size (TREE_CHAIN (exp), max_p) : NULL_TREE);
break;
- case 'r':
+ case tcc_reference:
/* If this contains a PLACEHOLDER_EXPR, it is the thing we want to
modify. Otherwise, we treat it like a variable. */
if (!CONTAINS_PLACEHOLDER_P (exp))
@@ -2031,12 +2031,12 @@ max_size (tree exp, bool max_p)
return
max_size (max_p ? TYPE_MAX_VALUE (type) : TYPE_MIN_VALUE (type), true);
- case '<':
+ case tcc_comparison:
return max_p ? size_one_node : size_zero_node;
- case '1':
- case '2':
- case 'e':
+ case tcc_unary:
+ case tcc_binary:
+ case tcc_expression:
switch (TREE_CODE_LENGTH (code))
{
case 1:
@@ -2087,6 +2087,10 @@ max_size (tree exp, bool max_p)
return build3 (CALL_EXPR, type, TREE_OPERAND (exp, 0),
max_size (TREE_OPERAND (exp, 1), max_p), NULL);
}
+
+ /* Other tree classes cannot happen. */
+ default:
+ break;
}
abort ();
diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c
index 6341863f061..4611fc8e904 100644
--- a/gcc/ada/utils2.c
+++ b/gcc/ada/utils2.c
@@ -290,17 +290,18 @@ contains_null_expr (tree exp)
switch (TREE_CODE_CLASS (TREE_CODE (exp)))
{
- case '1':
+ case tcc_unary:
return contains_null_expr (TREE_OPERAND (exp, 0));
- case '<': case '2':
+ case tcc_comparison:
+ case tcc_binary:
tem = contains_null_expr (TREE_OPERAND (exp, 0));
if (tem)
return tem;
return contains_null_expr (TREE_OPERAND (exp, 1));
- case 'e':
+ case tcc_expression:
switch (TREE_CODE (exp))
{
case SAVE_EXPR:
diff --git a/gcc/alias.c b/gcc/alias.c
index 24b4605822d..cc74ee8a187 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -342,13 +342,13 @@ objects_must_conflict_p (tree t1, tree t2)
static tree
find_base_decl (tree t)
{
- tree d0, d1, d2;
+ tree d0, d1;
if (t == 0 || t == error_mark_node || ! POINTER_TYPE_P (TREE_TYPE (t)))
return 0;
/* If this is a declaration, return it. */
- if (TREE_CODE_CLASS (TREE_CODE (t)) == 'd')
+ if (DECL_P (t))
return t;
/* Handle general expressions. It would be nice to deal with
@@ -356,10 +356,10 @@ find_base_decl (tree t)
same, then `a->f' and `b->f' are also the same. */
switch (TREE_CODE_CLASS (TREE_CODE (t)))
{
- case '1':
+ case tcc_unary:
return find_base_decl (TREE_OPERAND (t, 0));
- case '2':
+ case tcc_binary:
/* Return 0 if found in neither or both are the same. */
d0 = find_base_decl (TREE_OPERAND (t, 0));
d1 = find_base_decl (TREE_OPERAND (t, 1));
@@ -372,21 +372,6 @@ find_base_decl (tree t)
else
return 0;
- case '3':
- d0 = find_base_decl (TREE_OPERAND (t, 0));
- d1 = find_base_decl (TREE_OPERAND (t, 1));
- d2 = find_base_decl (TREE_OPERAND (t, 2));
-
- /* Set any nonzero values from the last, then from the first. */
- if (d1 == 0) d1 = d2;
- if (d0 == 0) d0 = d1;
- if (d1 == 0) d1 = d0;
- if (d2 == 0) d2 = d1;
-
- /* At this point all are nonzero or all are zero. If all three are the
- same, return it. Otherwise, return zero. */
- return (d0 == d1 && d1 == d2) ? d0 : 0;
-
default:
return 0;
}
diff --git a/gcc/builtins.c b/gcc/builtins.c
index a95f11db9ec..8502087cc77 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -248,7 +248,7 @@ get_pointer_alignment (tree exp, unsigned int max_align)
else if (DECL_P (exp))
align = DECL_ALIGN (exp);
#ifdef CONSTANT_ALIGNMENT
- else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c')
+ else if (CONSTANT_CLASS_P (exp))
align = CONSTANT_ALIGNMENT (exp, align);
#endif
return MIN (align, max_align);
@@ -6205,7 +6205,7 @@ fold_builtin_constant_p (tree arglist)
STRIP_NOPS (arglist);
/* If we know this is a constant, emit the constant of one. */
- if (TREE_CODE_CLASS (TREE_CODE (arglist)) == 'c'
+ if (CONSTANT_CLASS_P (arglist)
|| (TREE_CODE (arglist) == CONSTRUCTOR
&& TREE_CONSTANT (arglist))
|| (TREE_CODE (arglist) == ADDR_EXPR
@@ -8513,7 +8513,7 @@ fold_builtin (tree exp, bool ignore)
if (exp)
{
/* ??? Don't clobber shared nodes such as integer_zero_node. */
- if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c')
+ if (CONSTANT_CLASS_P (exp))
exp = build1 (NOP_EXPR, TREE_TYPE (exp), exp);
TREE_NO_WARNING (exp) = 1;
}
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 47494106824..2b8ad801e9a 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -1196,7 +1196,7 @@ verify_tree (tree x, struct tlist **pbefore_sp, struct tlist **pno_sp,
{
struct tlist *tmp_before, *tmp_nosp, *tmp_list2, *tmp_list3;
enum tree_code code;
- char cl;
+ enum tree_code_class cl;
/* X may be NULL if it is the operand of an empty statement expression
({ }). */
@@ -1345,39 +1345,32 @@ verify_tree (tree x, struct tlist **pbefore_sp, struct tlist **pno_sp,
add_tlist (pno_sp, t->cache_after_sp, NULL_TREE, 1);
return;
}
- default:
- break;
- }
- if (cl == '1')
- {
- if (first_rtl_op (code) == 0)
- return;
- x = TREE_OPERAND (x, 0);
- writer = 0;
- goto restart;
- }
-
- switch (cl)
- {
- case 'r':
- case '<':
- case '2':
- case 'e':
- case 's':
- case 'x':
- {
- int lp;
- int max = first_rtl_op (TREE_CODE (x));
- for (lp = 0; lp < max; lp++)
- {
- tmp_before = tmp_nosp = 0;
- verify_tree (TREE_OPERAND (x, lp), &tmp_before, &tmp_nosp, NULL_TREE);
- merge_tlist (&tmp_nosp, tmp_before, 0);
- add_tlist (pno_sp, tmp_nosp, NULL_TREE, 0);
- }
- break;
- }
+ default:
+ /* For other expressions, simply recurse on their operands.
+ Manual tail recursion for unary expressions.
+ Other non-expressions need not be processed. */
+ if (cl == tcc_unary)
+ {
+ if (first_rtl_op (code) == 0)
+ return;
+ x = TREE_OPERAND (x, 0);
+ writer = 0;
+ goto restart;
+ }
+ else if (IS_EXPR_CODE_CLASS (cl))
+ {
+ int lp;
+ int max = first_rtl_op (TREE_CODE (x));
+ for (lp = 0; lp < max; lp++)
+ {
+ tmp_before = tmp_nosp = 0;
+ verify_tree (TREE_OPERAND (x, lp), &tmp_before, &tmp_nosp, 0);
+ merge_tlist (&tmp_nosp, tmp_before, 0);
+ add_tlist (pno_sp, tmp_nosp, NULL_TREE, 0);
+ }
+ }
+ return;
}
}
diff --git a/gcc/c-common.def b/gcc/c-common.def
index fa45ad0526a..adca88f4700 100644
--- a/gcc/c-common.def
+++ b/gcc/c-common.def
@@ -25,46 +25,46 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* Tree nodes relevant to both C and C++. These were originally in
cp-tree.def in the cp subdir. */
-DEFTREECODE (SIZEOF_EXPR, "sizeof_expr", '1', 1)
-DEFTREECODE (ARROW_EXPR, "arrow_expr", 'e', 1)
-DEFTREECODE (ALIGNOF_EXPR, "alignof_expr", '1', 1)
+DEFTREECODE (SIZEOF_EXPR, "sizeof_expr", tcc_unary, 1)
+DEFTREECODE (ARROW_EXPR, "arrow_expr", tcc_expression, 1)
+DEFTREECODE (ALIGNOF_EXPR, "alignof_expr", tcc_unary, 1)
/* Used to represent an expression statement. Use `EXPR_STMT_EXPR' to
obtain the expression. */
-DEFTREECODE (EXPR_STMT, "expr_stmt", 'e', 1)
+DEFTREECODE (EXPR_STMT, "expr_stmt", tcc_expression, 1)
/* Used to represent a `for' statement. The operands are
FOR_INIT_STMT, FOR_COND, FOR_EXPR, and FOR_BODY, respectively. */
-DEFTREECODE (FOR_STMT, "for_stmt", 'e', 4)
+DEFTREECODE (FOR_STMT, "for_stmt", tcc_expression, 4)
/* Used to represent a 'while' statement. The operands are WHILE_COND
and WHILE_BODY, respectively. */
-DEFTREECODE (WHILE_STMT, "while_stmt", 'e', 2)
+DEFTREECODE (WHILE_STMT, "while_stmt", tcc_expression, 2)
/* Used to represent a 'do' statement. The operands are DO_BODY and
DO_COND, respectively. */
-DEFTREECODE (DO_STMT, "do_stmt", 'e', 2)
+DEFTREECODE (DO_STMT, "do_stmt", tcc_expression, 2)
/* Used to represent a 'break' statement. */
-DEFTREECODE (BREAK_STMT, "break_stmt", 'e', 0)
+DEFTREECODE (BREAK_STMT, "break_stmt", tcc_expression, 0)
/* Used to represent a 'continue' statement. */
-DEFTREECODE (CONTINUE_STMT, "continue_stmt", 'e', 0)
+DEFTREECODE (CONTINUE_STMT, "continue_stmt", tcc_expression, 0)
/* Used to represent a 'switch' statement. The operands are
SWITCH_COND, SWITCH_BODY and SWITCH_TYPE, respectively. */
-DEFTREECODE (SWITCH_STMT, "switch_stmt", 'e', 3)
+DEFTREECODE (SWITCH_STMT, "switch_stmt", tcc_expression, 3)
/* A STMT_EXPR represents a statement-expression. The
STMT_EXPR_STMT is the statement given by the expression. */
-DEFTREECODE (STMT_EXPR, "stmt_expr", 'e', 1)
+DEFTREECODE (STMT_EXPR, "stmt_expr", tcc_expression, 1)
/* A COMPOUND_LITERAL_EXPR represents a C99 compound literal. The
COMPOUND_LITERAL_EXPR_DECL_STMT is the a DECL_STMT containing the decl
for the anonymous object represented by the COMPOUND_LITERAL;
the DECL_INITIAL of that decl is the CONSTRUCTOR that initializes
the compound literal. */
-DEFTREECODE (COMPOUND_LITERAL_EXPR, "compound_literal_expr", 'e', 1)
+DEFTREECODE (COMPOUND_LITERAL_EXPR, "compound_literal_expr", tcc_expression, 1)
/*
Local variables:
diff --git a/gcc/c-format.c b/gcc/c-format.c
index bb730f3acda..341eb59c7c2 100644
--- a/gcc/c-format.c
+++ b/gcc/c-format.c
@@ -2094,7 +2094,7 @@ check_format_types (format_wanted_type *types, const char *format_start,
&& i == 0
&& (TYPE_READONLY (cur_type)
|| (cur_param != 0
- && (TREE_CODE_CLASS (TREE_CODE (cur_param)) == 'c'
+ && (CONSTANT_CLASS_P (cur_param)
|| (DECL_P (cur_param)
&& TREE_READONLY (cur_param))))))
warning ("writing into constant object (arg %d)", arg_num);
diff --git a/gcc/c-lang.c b/gcc/c-lang.c
index af4932a83ce..ca0173e333a 100644
--- a/gcc/c-lang.c
+++ b/gcc/c-lang.c
@@ -54,9 +54,9 @@ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-const char tree_code_type[] = {
+const enum tree_code_class tree_code_type[] = {
#include "tree.def"
- 'x',
+ tcc_exceptional,
#include "c-common.def"
};
#undef DEFTREECODE
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c
index 0b169cf5bd1..fd2f7f714ad 100644
--- a/gcc/c-pragma.c
+++ b/gcc/c-pragma.c
@@ -316,7 +316,7 @@ handle_pragma_weak (cpp_reader * ARG_UNUSED (dummy))
warning ("junk at end of #pragma weak");
decl = identifier_global_value (name);
- if (decl && TREE_CODE_CLASS (TREE_CODE (decl)) == 'd')
+ if (decl && DECL_P (decl))
{
apply_pragma_weak (decl, value);
if (value)
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index dd842852cc7..5ec00aa4250 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -744,18 +744,24 @@ same_translation_unit_p (tree t1, tree t2)
while (t1 && TREE_CODE (t1) != TRANSLATION_UNIT_DECL)
switch (TREE_CODE_CLASS (TREE_CODE (t1)))
{
- case 'd': t1 = DECL_CONTEXT (t1); break;
- case 't': t1 = TYPE_CONTEXT (t1); break;
- case 'x': t1 = BLOCK_SUPERCONTEXT (t1); break; /* assume block */
+ case tcc_declaration:
+ t1 = DECL_CONTEXT (t1); break;
+ case tcc_type:
+ t1 = TYPE_CONTEXT (t1); break;
+ case tcc_exceptional:
+ t1 = BLOCK_SUPERCONTEXT (t1); break; /* assume block */
default: gcc_unreachable ();
}
while (t2 && TREE_CODE (t2) != TRANSLATION_UNIT_DECL)
switch (TREE_CODE_CLASS (TREE_CODE (t2)))
{
- case 'd': t2 = DECL_CONTEXT (t2); break;
- case 't': t2 = TYPE_CONTEXT (t2); break;
- case 'x': t2 = BLOCK_SUPERCONTEXT (t2); break; /* assume block */
+ case tcc_declaration:
+ t2 = DECL_CONTEXT (t2); break;
+ case tcc_type:
+ t2 = TYPE_CONTEXT (t2); break;
+ case tcc_exceptional:
+ t2 = BLOCK_SUPERCONTEXT (t2); break; /* assume block */
default: gcc_unreachable ();
}
@@ -1200,7 +1206,7 @@ default_function_array_conversion (tree exp)
int volatilep = 0;
int lvalue_array_p;
- if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'r' || DECL_P (exp))
+ if (REFERENCE_CLASS_P (exp) || DECL_P (exp))
{
constp = TREE_READONLY (exp);
volatilep = TREE_THIS_VOLATILE (exp);
@@ -2232,7 +2238,8 @@ parser_build_binary_op (enum tree_code code, struct c_expr arg1,
|| code2 == PLUS_EXPR || code2 == MINUS_EXPR)
warning ("suggest parentheses around arithmetic in operand of |");
/* Check cases like x|y==z */
- if (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<')
+ if (TREE_CODE_CLASS (code1) == tcc_comparison
+ || TREE_CODE_CLASS (code2) == tcc_comparison)
warning ("suggest parentheses around comparison in operand of |");
}
@@ -2244,7 +2251,8 @@ parser_build_binary_op (enum tree_code code, struct c_expr arg1,
|| code2 == PLUS_EXPR || code2 == MINUS_EXPR)
warning ("suggest parentheses around arithmetic in operand of ^");
/* Check cases like x^y==z */
- if (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<')
+ if (TREE_CODE_CLASS (code1) == tcc_comparison
+ || TREE_CODE_CLASS (code2) == tcc_comparison)
warning ("suggest parentheses around comparison in operand of ^");
}
@@ -2254,13 +2262,14 @@ parser_build_binary_op (enum tree_code code, struct c_expr arg1,
|| code2 == PLUS_EXPR || code2 == MINUS_EXPR)
warning ("suggest parentheses around + or - in operand of &");
/* Check cases like x&y==z */
- if (TREE_CODE_CLASS (code1) == '<' || TREE_CODE_CLASS (code2) == '<')
+ if (TREE_CODE_CLASS (code1) == tcc_comparison
+ || TREE_CODE_CLASS (code2) == tcc_comparison)
warning ("suggest parentheses around comparison in operand of &");
}
/* Similarly, check for cases like 1<=i<=10 that are probably errors. */
- if (TREE_CODE_CLASS (code) == '<'
- && (TREE_CODE_CLASS (code1) == '<'
- || TREE_CODE_CLASS (code2) == '<'))
+ if (TREE_CODE_CLASS (code) == tcc_comparison
+ && (TREE_CODE_CLASS (code1) == tcc_comparison
+ || TREE_CODE_CLASS (code2) == tcc_comparison))
warning ("comparisons like X<=Y<=Z do not have their mathematical meaning");
}
@@ -2604,7 +2613,7 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
to which the address will point. Note that you can't get a
restricted pointer by taking the address of something, so we
only have to deal with `const' and `volatile' here. */
- if ((DECL_P (arg) || TREE_CODE_CLASS (TREE_CODE (arg)) == 'r')
+ if ((DECL_P (arg) || REFERENCE_CLASS_P (arg))
&& (TREE_READONLY (arg) || TREE_THIS_VOLATILE (arg)))
argtype = c_build_type_variant (argtype,
TREE_READONLY (arg),
@@ -3208,7 +3217,7 @@ build_c_cast (tree type, tree expr)
else
TREE_OVERFLOW (value) = 0;
- if (TREE_CODE_CLASS (TREE_CODE (ovalue)) == 'c')
+ if (CONSTANT_CLASS_P (ovalue))
/* Similarly, constant_overflow cannot have become
cleared. */
TREE_CONSTANT_OVERFLOW (value) = TREE_CONSTANT_OVERFLOW (ovalue);
@@ -6396,7 +6405,7 @@ c_finish_return (tree retval)
case ADDR_EXPR:
inner = TREE_OPERAND (inner, 0);
- while (TREE_CODE_CLASS (TREE_CODE (inner)) == 'r'
+ while (REFERENCE_CLASS_P (inner)
&& TREE_CODE (inner) != INDIRECT_REF)
inner = TREE_OPERAND (inner, 0);
@@ -6744,7 +6753,7 @@ c_process_expr_stmt (tree expr)
/* If the expression is not of a type to which we cannot assign a line
number, wrap the thing in a no-op NOP_EXPR. */
- if (DECL_P (expr) || TREE_CODE_CLASS (TREE_CODE (expr)) == 'c')
+ if (DECL_P (expr) || CONSTANT_CLASS_P (expr))
expr = build1 (NOP_EXPR, TREE_TYPE (expr), expr);
if (EXPR_P (expr))
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 4153504e38e..e4348ca8b83 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -671,7 +671,7 @@ record_call_1 (tree *tp, int *walk_subtrees, void *data)
default:
/* Save some cycles by not walking types and declaration as we
won't find anything useful there anyway. */
- if (DECL_P (*tp) || TYPE_P (*tp))
+ if (IS_TYPE_OR_DECL_P (*tp))
{
*walk_subtrees = 0;
break;
@@ -740,7 +740,7 @@ verify_cgraph_node_1 (tree *tp, int *walk_subtrees, void *data)
/* Save some cycles by not walking types and declaration as we
won't find anything useful there anyway. */
- if (DECL_P (*tp) || TYPE_P (*tp))
+ if (IS_TYPE_OR_DECL_P (*tp))
*walk_subtrees = 0;
return NULL_TREE;
@@ -2225,18 +2225,18 @@ scan_for_static_refs (tree *tp,
check_lhs_var (fn, TREE_OPERAND (t, 0));
/* Next check the operands on the rhs to see if they are ok. */
switch (TREE_CODE_CLASS (TREE_CODE (rhs))) {
- case '2':
+ case tcc_binary:
check_rhs_var (fn, TREE_OPERAND (rhs, 0));
check_rhs_var (fn, TREE_OPERAND (rhs, 1));
break;
- case '1':
- case 'r':
+ case tcc_unary:
+ case tcc_reference:
check_rhs_var (fn, TREE_OPERAND (rhs, 0));
break;
- case 'd':
+ case tcc_declaration:
check_rhs_var (fn, rhs);
break;
- case 'e':
+ case tcc_expression:
switch (TREE_CODE (rhs)) {
case ADDR_EXPR:
check_rhs_var (fn, rhs);
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index ee334dff1b2..a838372b486 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -13788,7 +13788,7 @@ arm_encode_section_info (tree decl, rtx rtl, int first)
/* If we are referencing a function that is weak then encode a long call
flag in the function name, otherwise if the function is static or
or known to be defined in this file then encode a short call flag. */
- if (first && TREE_CODE_CLASS (TREE_CODE (decl)) == 'd')
+ if (first && DECL_P (decl))
{
if (TREE_CODE (decl) == FUNCTION_DECL && DECL_WEAK (decl))
arm_encode_call_attribute (decl, LONG_CALL_FLAG_CHAR);
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index 676a34af429..a2a7a3076c6 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -99,8 +99,7 @@ associated_type (tree decl)
t = TYPE_MAIN_VARIANT
(TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)))));
}
- else if (DECL_CONTEXT (decl)
- && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')
+ else if (DECL_CONTEXT (decl) && TYPE_P (DECL_CONTEXT (decl)))
t = DECL_CONTEXT (decl);
return t;
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 7c875817b40..4cefce56b3b 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -9342,8 +9342,7 @@ pa_select_section (tree exp, int reloc,
else
readonly_data_section ();
}
- else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c'
- && !reloc)
+ else if (CONSTANT_CLASS_P (exp) && !reloc)
readonly_data_section ();
else if (TARGET_SOM
&& TREE_CODE (exp) == VAR_DECL
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 7e4e1fd9fcf..5c5d8bf39f0 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -1770,7 +1770,7 @@ forget_section (void) \
&& TREE_READONLY (DECL) && ! TREE_SIDE_EFFECTS (DECL) \
&& (! DECL_INITIAL (DECL) || ! reloc_needed (DECL_INITIAL (DECL))) \
&& !flag_pic) \
- || (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'c'))
+ || CONSTANT_CLASS_P (DECL))
#define FUNCTION_NAME_P(NAME) (*(NAME) == '@')
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 8dc017c3fd4..ce4ee857a89 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -7065,7 +7065,7 @@ sh_insert_attributes (tree node, tree *attributes)
return;
/* We are only interested in fields. */
- if (TREE_CODE_CLASS (TREE_CODE (node)) != 'd')
+ if (!DECL_P (node))
return;
/* Add a 'handle_interrupt' attribute. */
diff --git a/gcc/config/sol2-c.c b/gcc/config/sol2-c.c
index ee017ebbd46..17628a03ffa 100644
--- a/gcc/config/sol2-c.c
+++ b/gcc/config/sol2-c.c
@@ -113,7 +113,7 @@ solaris_pragma_align (cpp_reader *pfile ATTRIBUTE_UNUSED)
while (1)
{
tree decl = identifier_global_value (t);
- if (decl && TREE_CODE_CLASS (TREE_CODE (decl)) == 'd')
+ if (decl && DECL_P (decl))
warning ("%<#pragma align%> must appear before the declaration of "
"%D, ignoring", decl);
else
@@ -168,7 +168,7 @@ solaris_pragma_init (cpp_reader *pfile ATTRIBUTE_UNUSED)
while (1)
{
tree decl = identifier_global_value (t);
- if (decl && TREE_CODE_CLASS (TREE_CODE (decl)) == 'd')
+ if (decl && DECL_P (decl))
{
tree init_list = build_tree_list (get_identifier ("init"),
NULL);
@@ -226,7 +226,7 @@ solaris_pragma_fini (cpp_reader *pfile ATTRIBUTE_UNUSED)
while (1)
{
tree decl = identifier_global_value (t);
- if (decl && TREE_CODE_CLASS (TREE_CODE (decl)) == 'd')
+ if (decl && DECL_P (decl))
{
tree fini_list = build_tree_list (get_identifier ("fini"),
NULL);
diff --git a/gcc/convert.c b/gcc/convert.c
index 36bae1c7793..d9c0c129d7c 100644
--- a/gcc/convert.c
+++ b/gcc/convert.c
@@ -401,7 +401,7 @@ convert_to_integer (tree type, tree expr)
we must also change the types of the operands to maintain type
correctness. */
- if (TREE_CODE_CLASS (ex_form) == '<')
+ if (TREE_CODE_CLASS (ex_form) == tcc_comparison)
{
expr = copy_node (expr);
TREE_TYPE (expr) = type;
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1a862ad9c66..be9b0d33688 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com>
+ Zack Weinberg <zack@codesourcery.com>
+
+ * cp-tree.def: Use tree_code_class enumeration constants
+ instead of code letters.
+ * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c
+ * mangle.c, pt.c, semantics.c, tree.c, typeck.c:
+ Update for new tree-class enumeration constants.
+
2004-09-16 Mark Mitchell <mark@codesourcery.com>
PR c++/16002
@@ -16,7 +25,7 @@
2004-09-16 Andrew MacLeod <amacleod@redhat.com>
- * error.c (dump_decl): Make sure there is lang_specific info before
+ * error.c (dump_decl): Make sure there is lang_specific info before
checking for DTOR and CTOR decls.
2004-09-16 Nathan Sidwell <nathan@codesourcery.com>
@@ -106,9 +115,9 @@
2004-09-11 Richard Henderson <rth@redhat.com>
PR c++/17404
- * pt.c (cur_stmt_expr): Move from tsubst_expr.
- (tsubst_expr) <case STMT_EXPR>: Move ...
- (tsubst_copy_and_build): ... here.
+ * pt.c (cur_stmt_expr): Move from tsubst_expr.
+ (tsubst_expr) <case STMT_EXPR>: Move ...
+ (tsubst_copy_and_build): ... here.
2004-09-10 Zack Weinberg <zack@codesourcery.com>
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index f7701abb563..4f2a80c2922 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5867,7 +5867,7 @@ joust (struct z_candidate *cand1, struct z_candidate *cand2, bool warn)
/* If we have two pseudo-candidates for conversions to the same type,
or two candidates for the same function, arbitrarily pick one. */
if (cand1->fn == cand2->fn
- && (TYPE_P (cand1->fn) || DECL_P (cand1->fn)))
+ && (IS_TYPE_OR_DECL_P (cand1->fn)))
return 1;
/* a viable function F1
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index c16b872a9d8..5a065209849 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -6272,11 +6272,11 @@ get_enclosing_class (tree type)
{
switch (TREE_CODE_CLASS (TREE_CODE (node)))
{
- case 'd':
+ case tcc_declaration:
node = DECL_CONTEXT (node);
break;
- case 't':
+ case tcc_type:
if (node != type)
return node;
node = TYPE_CONTEXT (node);
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index c937a1149d3..d6a2f18ff05 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -303,7 +303,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
&& is_invisiref_parm (TREE_OPERAND (stmt, 0)))
/* Don't dereference an invisiref RESULT_DECL inside a RETURN_EXPR. */
*walk_subtrees = 0;
- else if (DECL_P (stmt) || TYPE_P (stmt))
+ else if (IS_TYPE_OR_DECL_P (stmt))
*walk_subtrees = 0;
/* Due to the way voidify_wrapper_expr is written, we don't get a chance
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index ac89be0f682..3b2590cd498 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -57,11 +57,11 @@ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-const char tree_code_type[] = {
+const enum tree_code_class tree_code_type[] = {
#include "tree.def"
- 'x',
+ tcc_exceptional,
#include "c-common.def"
- 'x',
+ tcc_exceptional,
#include "cp-tree.def"
};
#undef DEFTREECODE
diff --git a/gcc/cp/cp-tree.def b/gcc/cp/cp-tree.def
index 02afea97a50..2335e2f7043 100644
--- a/gcc/cp/cp-tree.def
+++ b/gcc/cp/cp-tree.def
@@ -42,56 +42,56 @@ Boston, MA 02111-1307, USA. */
2. An expression of the form `x.*p'. In this case, operand 0 will
be an expression corresponding to `x' and operand 1 will be an
expression with pointer-to-member type. */
-DEFTREECODE (OFFSET_REF, "offset_ref", 'r', 2)
+DEFTREECODE (OFFSET_REF, "offset_ref", tcc_reference, 2)
/* A pointer-to-member constant. For a pointer-to-member constant
`X::Y' The PTRMEM_CST_CLASS is the RECORD_TYPE for `X' and the
PTRMEM_CST_MEMBER is the _DECL for `Y'. */
-DEFTREECODE (PTRMEM_CST, "ptrmem_cst", 'c', 0)
+DEFTREECODE (PTRMEM_CST, "ptrmem_cst", tcc_constant, 0)
/* For NEW_EXPR, operand 0 is the placement list.
Operand 1 is the new-declarator.
Operand 2 is the number of elements in the array.
Operand 3 is the initializer. */
-DEFTREECODE (NEW_EXPR, "nw_expr", 'e', 4)
-DEFTREECODE (VEC_NEW_EXPR, "vec_nw_expr", 'e', 3)
+DEFTREECODE (NEW_EXPR, "nw_expr", tcc_expression, 4)
+DEFTREECODE (VEC_NEW_EXPR, "vec_nw_expr", tcc_expression, 3)
/* For DELETE_EXPR, operand 0 is the store to be destroyed.
Operand 1 is the value to pass to the destroying function
saying whether the store should be deallocated as well. */
-DEFTREECODE (DELETE_EXPR, "dl_expr", 'e', 2)
-DEFTREECODE (VEC_DELETE_EXPR, "vec_dl_expr", 'e', 2)
+DEFTREECODE (DELETE_EXPR, "dl_expr", tcc_expression, 2)
+DEFTREECODE (VEC_DELETE_EXPR, "vec_dl_expr", tcc_expression, 2)
/* Value is reference to particular overloaded class method.
Operand 0 is the class, operand 1 is the field
The COMPLEXITY field holds the class level (usually 0). */
-DEFTREECODE (SCOPE_REF, "scope_ref", 'r', 2)
+DEFTREECODE (SCOPE_REF, "scope_ref", tcc_reference, 2)
/* When composing an object with a member, this is the result.
Operand 0 is the object. Operand 1 is the member (usually
a dereferenced pointer to member). */
-DEFTREECODE (MEMBER_REF, "member_ref", 'r', 2)
+DEFTREECODE (MEMBER_REF, "member_ref", tcc_reference, 2)
/* Type conversion operator in C++. TREE_TYPE is type that this
operator converts to. Operand is expression to be converted. */
-DEFTREECODE (TYPE_EXPR, "type_expr", 'e', 1)
+DEFTREECODE (TYPE_EXPR, "type_expr", tcc_expression, 1)
/* For AGGR_INIT_EXPR, operand 0 is function which performs initialization,
operand 1 is argument list to initialization function,
and operand 2 is the slot which was allocated for this expression. */
-DEFTREECODE (AGGR_INIT_EXPR, "aggr_init_expr", 'e', 3)
+DEFTREECODE (AGGR_INIT_EXPR, "aggr_init_expr", tcc_expression, 3)
/* A throw expression. operand 0 is the expression, if there was one,
else it is NULL_TREE. */
-DEFTREECODE (THROW_EXPR, "throw_expr", 'e', 1)
+DEFTREECODE (THROW_EXPR, "throw_expr", tcc_expression, 1)
/* An empty class object. The TREE_TYPE gives the class type. We use
these to avoid actually creating instances of the empty classes. */
-DEFTREECODE (EMPTY_CLASS_EXPR, "empty_class_expr", 'e', 0)
+DEFTREECODE (EMPTY_CLASS_EXPR, "empty_class_expr", tcc_expression, 0)
/* A DECL which is really just a placeholder for an expression. Used to
implement non-class scope anonymous unions. */
-DEFTREECODE (ALIAS_DECL, "alias_decl", 'd', 0)
+DEFTREECODE (ALIAS_DECL, "alias_decl", tcc_declaration, 0)
/* A reference to a member function or member functions from a base
class. BASELINK_FUNCTIONS gives the FUNCTION_DECL,
@@ -105,7 +105,7 @@ DEFTREECODE (ALIAS_DECL, "alias_decl", 'd', 0)
the type of the expression. This type is either a FUNCTION_TYPE,
METHOD_TYPE, or `unknown_type_node' indicating that the function is
overloaded. */
-DEFTREECODE (BASELINK, "baselink", 'x', 0)
+DEFTREECODE (BASELINK, "baselink", tcc_exceptional, 0)
/* Template definition. The following fields have the specified uses,
although there are other macros in cp-tree.h that should be used for
@@ -122,7 +122,7 @@ DEFTREECODE (BASELINK, "baselink", 'x', 0)
DECL_TEMPLATE_RESULT decl for object to be created
(e.g., FUNCTION_DECL with tmpl parms used)
*/
-DEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0)
+DEFTREECODE (TEMPLATE_DECL, "template_decl", tcc_declaration, 0)
/* Index into a template parameter list. The TEMPLATE_PARM_IDX gives
the index (from 0) of the parameter, while the TEMPLATE_PARM_LEVEL
@@ -157,11 +157,11 @@ DEFTREECODE (TEMPLATE_DECL, "template_decl", 'd', 0)
The LEVEL is the level of the parameter when we are worrying about
the types of things; the ORIG_LEVEL is the level when we are
worrying about instantiating things. */
-DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", 'x', 0)
+DEFTREECODE (TEMPLATE_PARM_INDEX, "template_parm_index", tcc_exceptional, 0)
/* Index into a template parameter list. This parameter must be a type.
The type.value field will be a TEMPLATE_PARM_INDEX. */
-DEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", 't', 0)
+DEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", tcc_type, 0)
/* Index into a template parameter list for template template parameters.
This parameter must be a type. The TYPE_FIELDS value will be a
@@ -170,13 +170,14 @@ DEFTREECODE (TEMPLATE_TYPE_PARM, "template_type_parm", 't', 0)
It is used without template arguments like TT in C<TT>,
TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO is NULL_TREE
and TYPE_NAME is a TEMPLATE_DECL. */
-DEFTREECODE (TEMPLATE_TEMPLATE_PARM, "template_template_parm", 't', 0)
+DEFTREECODE (TEMPLATE_TEMPLATE_PARM, "template_template_parm", tcc_type, 0)
/* Like TEMPLATE_TEMPLATE_PARM it is used with bound template arguments
like TT<int>.
In this case, TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO contains the
template name and its bound arguments. TYPE_NAME is a TYPE_DECL. */
-DEFTREECODE (BOUND_TEMPLATE_TEMPLATE_PARM, "bound_template_template_parm", 't', 0)
+DEFTREECODE (BOUND_TEMPLATE_TEMPLATE_PARM, "bound_template_template_parm",
+ tcc_type, 0)
/* A type designated by `typename T::t'. TYPE_CONTEXT is `T',
TYPE_NAME is an IDENTIFIER_NODE for `t'. If the type was named via
@@ -184,51 +185,51 @@ DEFTREECODE (BOUND_TEMPLATE_TEMPLATE_PARM, "bound_template_template_parm", 't',
If TREE_TYPE is present, this type was generated by the implicit
typename extension, and the TREE_TYPE is a _TYPE from a baseclass
of `T'. */
-DEFTREECODE (TYPENAME_TYPE, "typename_type", 't', 0)
+DEFTREECODE (TYPENAME_TYPE, "typename_type", tcc_type, 0)
/* For template template argument of the form `T::template C'.
TYPE_CONTEXT is `T', the template parameter dependent object.
TYPE_NAME is an IDENTIFIER_NODE for `C', the member class template. */
-DEFTREECODE (UNBOUND_CLASS_TEMPLATE, "unbound_class_template", 't', 0)
+DEFTREECODE (UNBOUND_CLASS_TEMPLATE, "unbound_class_template", tcc_type, 0)
/* A type designated by `__typeof (expr)'. TYPEOF_TYPE_EXPR is the
expression in question. */
-DEFTREECODE (TYPEOF_TYPE, "typeof_type", 't', 0)
+DEFTREECODE (TYPEOF_TYPE, "typeof_type", tcc_type, 0)
/* A using declaration. DECL_INITIAL contains the specified scope.
This is not an alias, but is later expanded into multiple aliases.
The decl will have a NULL_TYPE iff the scope is a dependent scope,
otherwise it will have a void type. */
-DEFTREECODE (USING_DECL, "using_decl", 'd', 0)
+DEFTREECODE (USING_DECL, "using_decl", tcc_declaration, 0)
/* A using directive. The operand is USING_STMT_NAMESPACE. */
-DEFTREECODE (USING_STMT, "using_directive", 'e', 1)
+DEFTREECODE (USING_STMT, "using_directive", tcc_expression, 1)
/* An un-parsed default argument. Looks like an IDENTIFIER_NODE. */
-DEFTREECODE (DEFAULT_ARG, "default_arg", 'x', 0)
+DEFTREECODE (DEFAULT_ARG, "default_arg", tcc_exceptional, 0)
/* A template-id, like foo<int>. The first operand is the template.
The second is NULL if there are no explicit arguments, or a
TREE_VEC of arguments. The template will be a FUNCTION_DECL,
TEMPLATE_DECL, or an OVERLOAD. If the template-id refers to a
member template, the template may be an IDENTIFIER_NODE. */
-DEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", 'e', 2)
+DEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", tcc_expression, 2)
/* A list-like node for chaining overloading candidates. TREE_TYPE is
the original name, and the parameter is the FUNCTION_DECL. */
-DEFTREECODE (OVERLOAD, "overload", 'x', 0)
+DEFTREECODE (OVERLOAD, "overload", tcc_exceptional, 0)
/* A whole bunch of tree codes for the initial, superficial parsing of
templates. */
-DEFTREECODE (MODOP_EXPR, "modop_expr", 'e', 3)
-DEFTREECODE (CAST_EXPR, "cast_expr", '1', 1)
-DEFTREECODE (REINTERPRET_CAST_EXPR, "reinterpret_cast_expr", '1', 1)
-DEFTREECODE (CONST_CAST_EXPR, "const_cast_expr", '1', 1)
-DEFTREECODE (STATIC_CAST_EXPR, "static_cast_expr", '1', 1)
-DEFTREECODE (DYNAMIC_CAST_EXPR, "dynamic_cast_expr", '1', 1)
-DEFTREECODE (DOTSTAR_EXPR, "dotstar_expr", 'e', 2)
-DEFTREECODE (TYPEID_EXPR, "typeid_expr", 'e', 1)
-DEFTREECODE (PSEUDO_DTOR_EXPR, "pseudo_dtor_expr", 'e', 3)
+DEFTREECODE (MODOP_EXPR, "modop_expr", tcc_expression, 3)
+DEFTREECODE (CAST_EXPR, "cast_expr", tcc_unary, 1)
+DEFTREECODE (REINTERPRET_CAST_EXPR, "reinterpret_cast_expr", tcc_unary, 1)
+DEFTREECODE (CONST_CAST_EXPR, "const_cast_expr", tcc_unary, 1)
+DEFTREECODE (STATIC_CAST_EXPR, "static_cast_expr", tcc_unary, 1)
+DEFTREECODE (DYNAMIC_CAST_EXPR, "dynamic_cast_expr", tcc_unary, 1)
+DEFTREECODE (DOTSTAR_EXPR, "dotstar_expr", tcc_expression, 2)
+DEFTREECODE (TYPEID_EXPR, "typeid_expr", tcc_expression, 1)
+DEFTREECODE (PSEUDO_DTOR_EXPR, "pseudo_dtor_expr", tcc_expression, 3)
/* A placeholder for an expression that is not type-dependent, but
does occur in a template. When an expression that is not
@@ -239,38 +240,38 @@ DEFTREECODE (PSEUDO_DTOR_EXPR, "pseudo_dtor_expr", 'e', 3)
that situation, we create a NON_DEPENDENT_EXPR to take the place of
the original expression. The expression is the only operand -- it
is only needed for diagnostics. */
-DEFTREECODE (NON_DEPENDENT_EXPR, "non_dependent_expr", 'e', 1)
+DEFTREECODE (NON_DEPENDENT_EXPR, "non_dependent_expr", tcc_expression, 1)
/* CTOR_INITIALIZER is a placeholder in template code for a call to
setup_vtbl_pointer (and appears in all functions, not just ctors). */
-DEFTREECODE (CTOR_INITIALIZER, "ctor_initializer", 'e', 1)
+DEFTREECODE (CTOR_INITIALIZER, "ctor_initializer", tcc_expression, 1)
-DEFTREECODE (TRY_BLOCK, "try_block", 'e', 2)
+DEFTREECODE (TRY_BLOCK, "try_block", tcc_expression, 2)
-DEFTREECODE (EH_SPEC_BLOCK, "eh_spec_block", 'e', 2)
+DEFTREECODE (EH_SPEC_BLOCK, "eh_spec_block", tcc_expression, 2)
/* A HANDLER wraps a catch handler for the HANDLER_TYPE. If this is
CATCH_ALL_TYPE, then the handler catches all types. The declaration of
the catch variable is in HANDLER_PARMS, and the body block in
HANDLER_BODY. */
-DEFTREECODE (HANDLER, "handler", 'e', 2)
+DEFTREECODE (HANDLER, "handler", tcc_expression, 2)
/* A MUST_NOT_THROW_EXPR wraps an expression that may not
throw, and must call terminate if it does. */
-DEFTREECODE (MUST_NOT_THROW_EXPR, "must_not_throw_expr", 'e', 1)
+DEFTREECODE (MUST_NOT_THROW_EXPR, "must_not_throw_expr", tcc_expression, 1)
/* A CLEANUP_STMT marks the point at which a declaration is fully
constructed. The CLEANUP_EXPR is run on behalf of CLEANUP_DECL
when CLEANUP_BODY completes. */
-DEFTREECODE (CLEANUP_STMT, "cleanup_stmt", 'e', 3)
+DEFTREECODE (CLEANUP_STMT, "cleanup_stmt", tcc_expression, 3)
/* Represents an 'if' statement. The operands are IF_COND,
THEN_CLAUSE, and ELSE_CLAUSE, respectively. */
/* ??? It is currently still necessary to distinguish between IF_STMT
and COND_EXPR for the benefit of templates. */
-DEFTREECODE (IF_STMT, "if_stmt", 'e', 3)
+DEFTREECODE (IF_STMT, "if_stmt", tcc_expression, 3)
-DEFTREECODE (TAG_DEFN, "tag_defn", 'e', 0)
+DEFTREECODE (TAG_DEFN, "tag_defn", tcc_expression, 0)
/* Template instantiation level node.
@@ -280,10 +281,10 @@ DEFTREECODE (TAG_DEFN, "tag_defn", 'e', 0)
A stack of template instantiation nodes is kept through the TREE_CHAIN
fields of these nodes. */
-DEFTREECODE (TINST_LEVEL, "TINST_LEVEL", 'x', 0)
+DEFTREECODE (TINST_LEVEL, "TINST_LEVEL", tcc_exceptional, 0)
/* Represents an 'offsetof' expression during template expansion. */
-DEFTREECODE (OFFSETOF_EXPR, "offsetof_expr", 'e', 1)
+DEFTREECODE (OFFSETOF_EXPR, "offsetof_expr", tcc_expression, 1)
/*
Local variables:
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 1c84e161f5d..ca2a29f08b1 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -1154,7 +1154,8 @@ static void
pp_cxx_parameter_declaration_clause (cxx_pretty_printer *pp, tree t)
{
tree args = TYPE_P (t) ? NULL : FUNCTION_FIRST_USER_PARM (t);
- tree types = TYPE_P (t) ? TYPE_ARG_TYPES (t) : FUNCTION_FIRST_USER_PARMTYPE (t);
+ tree types =
+ TYPE_P (t) ? TYPE_ARG_TYPES (t) : FUNCTION_FIRST_USER_PARMTYPE (t);
const bool abstract = args == NULL
|| pp_c_base (pp)->flags & pp_c_flag_abstract;
bool first = true;
@@ -1441,7 +1442,7 @@ pp_cxx_template_argument_list (cxx_pretty_printer *pp, tree t)
if (i != 0)
pp_cxx_separate_with (pp, ',');
if (TYPE_P (arg) || (TREE_CODE (arg) == TEMPLATE_DECL
- && TYPE_P (DECL_TEMPLATE_RESULT (arg))))
+ && TYPE_P (DECL_TEMPLATE_RESULT (arg))))
pp_cxx_type_id (pp, arg);
else
pp_cxx_expression (pp, arg);
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 41c381d45c1..5d9995faa32 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1997,7 +1997,7 @@ write_expression (tree expr)
|| code == TEMPLATE_PARM_INDEX)
write_template_param (expr);
/* Handle literals. */
- else if (TREE_CODE_CLASS (code) == 'c'
+ else if (TREE_CODE_CLASS (code) == tcc_constant
|| (abi_version_at_least (2) && code == CONST_DECL))
write_template_arg_literal (expr);
else if (DECL_P (expr))
@@ -2260,7 +2260,7 @@ write_template_arg (tree node)
else if (code == TEMPLATE_DECL)
/* A template appearing as a template arg is a template template arg. */
write_template_template_arg (node);
- else if ((TREE_CODE_CLASS (code) == 'c' && code != PTRMEM_CST)
+ else if ((TREE_CODE_CLASS (code) == tcc_constant && code != PTRMEM_CST)
|| (abi_version_at_least (2) && code == CONST_DECL))
write_template_arg_literal (node);
else if (DECL_P (node))
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e7d44f2ae70..d7e59039ce4 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -4891,7 +4891,7 @@ uses_template_parms (tree t)
|| TREE_CODE (t) == TEMPLATE_PARM_INDEX
|| TREE_CODE (t) == OVERLOAD
|| TREE_CODE (t) == BASELINK
- || TREE_CODE_CLASS (TREE_CODE (t)) == 'c')
+ || CONSTANT_CLASS_P (t))
dependent_p = (type_dependent_expression_p (t)
|| value_dependent_expression_p (t));
else
@@ -10109,7 +10109,7 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict)
return 1;
default:
- gcc_assert (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (parm))));
+ gcc_assert (EXPR_P (parm));
/* We must be looking at an expression. This can happen with
something like:
@@ -11586,9 +11586,9 @@ dependent_type_p_r (tree type)
A type is dependent if it is:
- -- a template parameter. Template template parameters are
- types for us (since TYPE_P holds true for them) so we
- handle them here. */
+ -- a template parameter. Template template parameters are types
+ for us (since TYPE_P holds true for them) so we handle
+ them here. */
if (TREE_CODE (type) == TEMPLATE_TYPE_PARM
|| TREE_CODE (type) == TEMPLATE_TEMPLATE_PARM)
return true;
@@ -11819,20 +11819,20 @@ value_dependent_expression_p (tree expression)
|| value_dependent_expression_p (TREE_OPERAND (expression, 1)));
/* A constant expression is value-dependent if any subexpression is
value-dependent. */
- if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expression))))
+ if (EXPR_P (expression))
{
switch (TREE_CODE_CLASS (TREE_CODE (expression)))
{
- case '1':
+ case tcc_unary:
return (value_dependent_expression_p
(TREE_OPERAND (expression, 0)));
- case '<':
- case '2':
+ case tcc_comparison:
+ case tcc_binary:
return ((value_dependent_expression_p
(TREE_OPERAND (expression, 0)))
|| (value_dependent_expression_p
(TREE_OPERAND (expression, 1))));
- case 'e':
+ case tcc_expression:
{
int i;
for (i = 0; i < first_rtl_op (TREE_CODE (expression)); ++i)
@@ -11846,6 +11846,13 @@ value_dependent_expression_p (tree expression)
return true;
return false;
}
+ case tcc_reference:
+ case tcc_statement:
+ /* These cannot be value dependent. */
+ return false;
+
+ default:
+ gcc_unreachable ();
}
}
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 1ea97a0aa86..2f1d0e8f3da 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -1239,7 +1239,7 @@ finish_mem_initializers (tree mem_inits)
tree
finish_parenthesized_expr (tree expr)
{
- if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (expr))))
+ if (EXPR_P (expr))
/* This inhibits warnings in c_common_truthvalue_conversion. */
TREE_NO_WARNING (expr) = 1;
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 2038b058aca..28bb512da75 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1,6 +1,6 @@
/* Language-dependent node constructors for parse phase of GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GCC.
@@ -1554,12 +1554,12 @@ cp_tree_equal (tree t1, tree t2)
switch (TREE_CODE_CLASS (code1))
{
- case '1':
- case '2':
- case '<':
- case 'e':
- case 'r':
- case 's':
+ case tcc_unary:
+ case tcc_binary:
+ case tcc_comparison:
+ case tcc_expression:
+ case tcc_reference:
+ case tcc_statement:
{
int i;
@@ -1570,11 +1570,12 @@ cp_tree_equal (tree t1, tree t2)
return true;
}
- case 't':
+ case tcc_type:
return same_type_p (t1, t2);
+ default:
+ gcc_unreachable ();
}
-
- gcc_unreachable ();
+ /* We can get here with --disable-checking. */
return false;
}
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 2169bad472f..990352d492d 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -4956,7 +4956,7 @@ build_c_cast (tree type, tree expr)
{
TREE_OVERFLOW (value) = TREE_OVERFLOW (ovalue);
- if (TREE_CODE_CLASS (TREE_CODE (ovalue)) == 'c')
+ if (CONSTANT_CLASS_P (ovalue))
TREE_CONSTANT_OVERFLOW (value) = TREE_CONSTANT_OVERFLOW (ovalue);
}
}
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 452a62d8cb7..62f3102fd1d 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -1318,7 +1318,7 @@ dbxout_type (tree type, int full)
|| TREE_CODE (type) == QUAL_UNION_TYPE
|| TREE_CODE (type) == ENUMERAL_TYPE)
&& TYPE_STUB_DECL (type)
- && TREE_CODE_CLASS (TREE_CODE (TYPE_STUB_DECL (type))) == 'd'
+ && DECL_P (TYPE_STUB_DECL (type))
&& ! DECL_IGNORED_P (TYPE_STUB_DECL (type)))
debug_queue_symbol (TYPE_STUB_DECL (type));
else if (TYPE_NAME (type)
@@ -2179,19 +2179,19 @@ dbxout_symbol (tree decl, int local ATTRIBUTE_UNUSED)
|| TREE_CODE (t) == ENUMERAL_TYPE)
&& TYPE_STUB_DECL (t)
&& TYPE_STUB_DECL (t) != decl
- && TREE_CODE_CLASS (TREE_CODE (TYPE_STUB_DECL (t))) == 'd'
+ && DECL_P (TYPE_STUB_DECL (t))
&& ! DECL_IGNORED_P (TYPE_STUB_DECL (t)))
{
debug_queue_symbol (TYPE_STUB_DECL (t));
if (TYPE_NAME (t)
&& TYPE_NAME (t) != TYPE_STUB_DECL (t)
&& TYPE_NAME (t) != decl
- && TREE_CODE_CLASS (TREE_CODE (TYPE_NAME (t))) == 'd')
+ && DECL_P (TYPE_NAME (t)))
debug_queue_symbol (TYPE_NAME (t));
}
else if (TYPE_NAME (t)
&& TYPE_NAME (t) != decl
- && TREE_CODE_CLASS (TREE_CODE (TYPE_NAME (t))) == 'd')
+ && DECL_P (TYPE_NAME (t)))
debug_queue_symbol (TYPE_NAME (t));
}
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 25f4b2523da..51b3681a0bf 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -10918,7 +10918,7 @@ gen_formal_parameter_die (tree node, dw_die_ref context_die)
switch (TREE_CODE_CLASS (TREE_CODE (node)))
{
- case 'd':
+ case tcc_declaration:
origin = decl_ultimate_origin (node);
if (origin != NULL)
add_abstract_origin_attribute (parm_die, origin);
@@ -10939,7 +10939,7 @@ gen_formal_parameter_die (tree node, dw_die_ref context_die)
break;
- case 't':
+ case tcc_type:
/* We were called with some kind of a ..._TYPE node. */
add_type_attribute (parm_die, node, 0, 0, context_die);
break;
@@ -12417,7 +12417,8 @@ force_type_die (tree type)
static dw_die_ref
setup_namespace_context (tree thing, dw_die_ref context_die)
{
- tree context = DECL_P (thing) ? DECL_CONTEXT (thing) : TYPE_CONTEXT (thing);
+ tree context = (DECL_P (thing)
+ ? DECL_CONTEXT (thing) : TYPE_CONTEXT (thing));
if (context && TREE_CODE (context) == NAMESPACE_DECL)
/* Force out the namespace. */
context_die = force_decl_die (context);
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 1dcda2c0403..ce597b086e6 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -1592,7 +1592,7 @@ set_mem_attributes_minus_bitpos (rtx ref, tree t, int objectp,
}
/* If this is a constant, we know the alignment. */
- else if (TREE_CODE_CLASS (TREE_CODE (t)) == 'c')
+ else if (CONSTANT_CLASS_P (t))
{
align = TYPE_ALIGN (type);
#ifdef CONSTANT_ALIGNMENT
diff --git a/gcc/expr.c b/gcc/expr.c
index e5ed2f654c5..da8304a9708 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -3527,7 +3527,7 @@ expand_assignment (tree to, tree from, int want_value)
src = from;
STRIP_NOPS (src);
if (TREE_CODE (TREE_TYPE (src)) != INTEGER_TYPE
- || TREE_CODE_CLASS (TREE_CODE (src)) != '2')
+ || !BINARY_CLASS_P (src))
break;
op0 = TREE_OPERAND (src, 0);
@@ -5755,14 +5755,14 @@ safe_from_p (rtx x, tree exp, int top_p)
/* Now look at our tree code and possibly recurse. */
switch (TREE_CODE_CLASS (TREE_CODE (exp)))
{
- case 'd':
+ case tcc_declaration:
exp_rtl = DECL_RTL_IF_SET (exp);
break;
- case 'c':
+ case tcc_constant:
return 1;
- case 'x':
+ case tcc_exceptional:
if (TREE_CODE (exp) == TREE_LIST)
{
while (1)
@@ -5781,7 +5781,7 @@ safe_from_p (rtx x, tree exp, int top_p)
else
return 0;
- case 's':
+ case tcc_statement:
/* The only case we look at here is the DECL_INITIAL inside a
DECL_EXPR. */
return (TREE_CODE (exp) != DECL_EXPR
@@ -5789,17 +5789,17 @@ safe_from_p (rtx x, tree exp, int top_p)
|| !DECL_INITIAL (DECL_EXPR_DECL (exp))
|| safe_from_p (x, DECL_INITIAL (DECL_EXPR_DECL (exp)), 0));
- case '2':
- case '<':
+ case tcc_binary:
+ case tcc_comparison:
if (!safe_from_p (x, TREE_OPERAND (exp, 1), 0))
return 0;
/* Fall through. */
- case '1':
+ case tcc_unary:
return safe_from_p (x, TREE_OPERAND (exp, 0), 0);
- case 'e':
- case 'r':
+ case tcc_expression:
+ case tcc_reference:
/* Now do code-specific tests. EXP_RTL is set to any rtx we find in
the expression. If it is set, we conflict iff we are that rtx or
both are in memory. Otherwise, we check all operands of the
@@ -5872,6 +5872,11 @@ safe_from_p (rtx x, tree exp, int top_p)
>= (unsigned int) LAST_AND_UNUSED_TREE_CODE
&& !lang_hooks.safe_from_p (x, exp))
return 0;
+ break;
+
+ case tcc_type:
+ /* Should never get a type here. */
+ gcc_unreachable ();
}
/* If we have an rtl, find any enclosed object. Then see if we conflict
@@ -6068,7 +6073,7 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
generating ADDR_EXPR of something that isn't an LVALUE. The only
exception here is STRING_CST. */
if (TREE_CODE (exp) == CONSTRUCTOR
- || TREE_CODE_CLASS (TREE_CODE (exp)) == 'c')
+ || CONSTANT_CLASS_P (exp))
return XEXP (output_constant_def (exp, 0), 0);
/* Everything must be something allowed by is_gimple_addressable. */
@@ -6400,12 +6405,13 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
return const0_rtx;
}
- if (TREE_CODE_CLASS (code) == '1' || code == COMPONENT_REF
- || code == INDIRECT_REF)
+ if (TREE_CODE_CLASS (code) == tcc_unary
+ || code == COMPONENT_REF || code == INDIRECT_REF)
return expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode,
modifier);
- else if (TREE_CODE_CLASS (code) == '2' || TREE_CODE_CLASS (code) == '<'
+ else if (TREE_CODE_CLASS (code) == tcc_binary
+ || TREE_CODE_CLASS (code) == tcc_comparison
|| code == ARRAY_REF || code == ARRAY_RANGE_REF)
{
expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, modifier);
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 7d8fff9d9ee..25c84a45914 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2281,7 +2281,7 @@ combine_comparisons (enum tree_code code, enum tree_code lcode,
static int
truth_value_p (enum tree_code code)
{
- return (TREE_CODE_CLASS (code) == '<'
+ return (TREE_CODE_CLASS (code) == tcc_comparison
|| code == TRUTH_AND_EXPR || code == TRUTH_ANDIF_EXPR
|| code == TRUTH_OR_EXPR || code == TRUTH_ORIF_EXPR
|| code == TRUTH_XOR_EXPR || code == TRUTH_NOT_EXPR);
@@ -2420,7 +2420,7 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags)
switch (TREE_CODE_CLASS (TREE_CODE (arg0)))
{
- case '1':
+ case tcc_unary:
/* Two conversions are equal only if signedness and modes match. */
switch (TREE_CODE (arg0))
{
@@ -2441,8 +2441,8 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags)
return operand_equal_p (TREE_OPERAND (arg0, 0),
TREE_OPERAND (arg1, 0), flags);
- case '<':
- case '2':
+ case tcc_comparison:
+ case tcc_binary:
if (operand_equal_p (TREE_OPERAND (arg0, 0),
TREE_OPERAND (arg1, 0), flags)
&& operand_equal_p (TREE_OPERAND (arg0, 1),
@@ -2456,7 +2456,7 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags)
&& operand_equal_p (TREE_OPERAND (arg0, 1),
TREE_OPERAND (arg1, 0), flags));
- case 'r':
+ case tcc_reference:
/* If either of the pointer (or reference) expressions we are
dereferencing contain a side effect, these cannot be equal. */
if (TREE_SIDE_EFFECTS (arg0)
@@ -2503,7 +2503,7 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags)
return 0;
}
- case 'e':
+ case tcc_expression:
switch (TREE_CODE (arg0))
{
case ADDR_EXPR:
@@ -2570,7 +2570,7 @@ operand_equal_p (tree arg0, tree arg1, unsigned int flags)
return 0;
}
- case 'd':
+ case tcc_declaration:
/* Consider __builtin_sqrt equal to sqrt. */
return (TREE_CODE (arg0) == FUNCTION_DECL
&& DECL_BUILT_IN (arg0) && DECL_BUILT_IN (arg1)
@@ -2652,17 +2652,17 @@ static int
twoval_comparison_p (tree arg, tree *cval1, tree *cval2, int *save_p)
{
enum tree_code code = TREE_CODE (arg);
- char class = TREE_CODE_CLASS (code);
+ enum tree_code_class class = TREE_CODE_CLASS (code);
- /* We can handle some of the 'e' cases here. */
- if (class == 'e' && code == TRUTH_NOT_EXPR)
- class = '1';
- else if (class == 'e'
+ /* We can handle some of the tcc_expression cases here. */
+ if (class == tcc_expression && code == TRUTH_NOT_EXPR)
+ class = tcc_unary;
+ else if (class == tcc_expression
&& (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR
|| code == COMPOUND_EXPR))
- class = '2';
+ class = tcc_binary;
- else if (class == 'e' && code == SAVE_EXPR
+ else if (class == tcc_expression && code == SAVE_EXPR
&& ! TREE_SIDE_EFFECTS (TREE_OPERAND (arg, 0)))
{
/* If we've already found a CVAL1 or CVAL2, this expression is
@@ -2670,24 +2670,24 @@ twoval_comparison_p (tree arg, tree *cval1, tree *cval2, int *save_p)
if (*cval1 || *cval2)
return 0;
- class = '1';
+ class = tcc_unary;
*save_p = 1;
}
switch (class)
{
- case '1':
+ case tcc_unary:
return twoval_comparison_p (TREE_OPERAND (arg, 0), cval1, cval2, save_p);
- case '2':
+ case tcc_binary:
return (twoval_comparison_p (TREE_OPERAND (arg, 0), cval1, cval2, save_p)
&& twoval_comparison_p (TREE_OPERAND (arg, 1),
cval1, cval2, save_p));
- case 'c':
+ case tcc_constant:
return 1;
- case 'e':
+ case tcc_expression:
if (code == COND_EXPR)
return (twoval_comparison_p (TREE_OPERAND (arg, 0),
cval1, cval2, save_p)
@@ -2697,7 +2697,7 @@ twoval_comparison_p (tree arg, tree *cval1, tree *cval2, int *save_p)
cval1, cval2, save_p));
return 0;
- case '<':
+ case tcc_comparison:
/* First see if we can handle the first operand, then the second. For
the second operand, we know *CVAL1 can't be zero. It must be that
one side of the comparison is each of the values; test for the
@@ -2745,30 +2745,30 @@ eval_subst (tree arg, tree old0, tree new0, tree old1, tree new1)
{
tree type = TREE_TYPE (arg);
enum tree_code code = TREE_CODE (arg);
- char class = TREE_CODE_CLASS (code);
+ enum tree_code_class class = TREE_CODE_CLASS (code);
- /* We can handle some of the 'e' cases here. */
- if (class == 'e' && code == TRUTH_NOT_EXPR)
- class = '1';
- else if (class == 'e'
+ /* We can handle some of the tcc_expression cases here. */
+ if (class == tcc_expression && code == TRUTH_NOT_EXPR)
+ class = tcc_unary;
+ else if (class == tcc_expression
&& (code == TRUTH_ANDIF_EXPR || code == TRUTH_ORIF_EXPR))
- class = '2';
+ class = tcc_binary;
switch (class)
{
- case '1':
+ case tcc_unary:
return fold (build1 (code, type,
eval_subst (TREE_OPERAND (arg, 0),
old0, new0, old1, new1)));
- case '2':
+ case tcc_binary:
return fold (build2 (code, type,
eval_subst (TREE_OPERAND (arg, 0),
old0, new0, old1, new1),
eval_subst (TREE_OPERAND (arg, 1),
old0, new0, old1, new1)));
- case 'e':
+ case tcc_expression:
switch (code)
{
case SAVE_EXPR:
@@ -2790,7 +2790,7 @@ eval_subst (tree arg, tree old0, tree new0, tree old1, tree new1)
}
/* Fall through - ??? */
- case '<':
+ case tcc_comparison:
{
tree arg0 = TREE_OPERAND (arg, 0);
tree arg1 = TREE_OPERAND (arg, 1);
@@ -2890,7 +2890,7 @@ invert_truthvalue (tree arg)
floating-point non-equality comparisons, in which case we just
enclose a TRUTH_NOT_EXPR around what we have. */
- if (TREE_CODE_CLASS (code) == '<')
+ if (TREE_CODE_CLASS (code) == tcc_comparison)
{
tree op_type = TREE_TYPE (TREE_OPERAND (arg, 0));
if (FLOAT_TYPE_P (op_type)
@@ -3413,7 +3413,7 @@ simple_operand_p (tree exp)
== TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
exp = TREE_OPERAND (exp, 0);
- return (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c'
+ return (CONSTANT_CLASS_P (exp)
|| (DECL_P (exp)
&& ! TREE_ADDRESSABLE (exp)
&& ! TREE_THIS_VOLATILE (exp)
@@ -3484,7 +3484,7 @@ range_binop (enum tree_code code, tree type, tree arg0, int upper0_p,
return TREE_CODE (tem) == INTEGER_CST ? tem : 0;
}
- if (TREE_CODE_CLASS (code) != '<')
+ if (TREE_CODE_CLASS (code) != tcc_comparison)
return 0;
/* Set SGN[01] to -1 if ARG[01] is a lower bound, 1 for upper, and 0
@@ -3555,13 +3555,13 @@ make_range (tree exp, int *pin_p, tree *plow, tree *phigh)
{
if (first_rtl_op (code) > 0)
arg0 = TREE_OPERAND (exp, 0);
- if (TREE_CODE_CLASS (code) == '<'
- || TREE_CODE_CLASS (code) == '1'
- || TREE_CODE_CLASS (code) == '2')
+ if (TREE_CODE_CLASS (code) == tcc_comparison
+ || TREE_CODE_CLASS (code) == tcc_unary
+ || TREE_CODE_CLASS (code) == tcc_binary)
arg0_type = TREE_TYPE (arg0);
- if (TREE_CODE_CLASS (code) == '2'
- || TREE_CODE_CLASS (code) == '<'
- || (TREE_CODE_CLASS (code) == 'e'
+ if (TREE_CODE_CLASS (code) == tcc_binary
+ || TREE_CODE_CLASS (code) == tcc_comparison
+ || (TREE_CODE_CLASS (code) == tcc_expression
&& TREE_CODE_LENGTH (code) > 1))
arg1 = TREE_OPERAND (exp, 1);
}
@@ -4192,7 +4192,7 @@ fold_cond_expr_with_comparison (tree type, tree arg0, tree arg1, tree arg2)
tem = fold (build1 (ABS_EXPR, TREE_TYPE (arg1), arg1));
return negate_expr (fold_convert (type, tem));
default:
- gcc_assert (TREE_CODE_CLASS (comp_code) == '<');
+ gcc_assert (TREE_CODE_CLASS (comp_code) == tcc_comparison);
break;
}
@@ -4296,7 +4296,7 @@ fold_cond_expr_with_comparison (tree type, tree arg0, tree arg1, tree arg2)
return pedantic_non_lvalue (fold_convert (type, arg1));
break;
default:
- gcc_assert (TREE_CODE_CLASS (comp_code) == '<');
+ gcc_assert (TREE_CODE_CLASS (comp_code) == tcc_comparison);
break;
}
}
@@ -4569,7 +4569,8 @@ fold_truthop (enum tree_code code, tree truth_type, tree lhs, tree rhs)
rcode = NE_EXPR;
}
- if (TREE_CODE_CLASS (lcode) != '<' || TREE_CODE_CLASS (rcode) != '<')
+ if (TREE_CODE_CLASS (lcode) != tcc_comparison
+ || TREE_CODE_CLASS (rcode) != tcc_comparison)
return 0;
ll_arg = TREE_OPERAND (lhs, 0);
@@ -5073,10 +5074,10 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type)
if (integer_zerop (c))
return NULL_TREE;
- if (TREE_CODE_CLASS (tcode) == '1')
+ if (TREE_CODE_CLASS (tcode) == tcc_unary)
op0 = TREE_OPERAND (t, 0);
- if (TREE_CODE_CLASS (tcode) == '2')
+ if (TREE_CODE_CLASS (tcode) == tcc_binary)
op0 = TREE_OPERAND (t, 0), op1 = TREE_OPERAND (t, 1);
/* Note that we need not handle conditional operations here since fold
@@ -5094,10 +5095,10 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type)
case CONVERT_EXPR: case NON_LVALUE_EXPR: case NOP_EXPR:
/* If op0 is an expression ... */
- if ((TREE_CODE_CLASS (TREE_CODE (op0)) == '<'
- || TREE_CODE_CLASS (TREE_CODE (op0)) == '1'
- || TREE_CODE_CLASS (TREE_CODE (op0)) == '2'
- || TREE_CODE_CLASS (TREE_CODE (op0)) == 'e')
+ if ((COMPARISON_CLASS_P (op0)
+ || UNARY_CLASS_P (op0)
+ || BINARY_CLASS_P (op0)
+ || EXPRESSION_CLASS_P (op0))
/* ... and is unsigned, and its type is smaller than ctype,
then we cannot pass through as widening. */
&& ((TYPE_UNSIGNED (TREE_TYPE (op0))
@@ -5990,14 +5991,14 @@ fold (tree expr)
tree tem;
tree arg0 = NULL_TREE, arg1 = NULL_TREE;
enum tree_code code = TREE_CODE (t);
- int kind = TREE_CODE_CLASS (code);
+ enum tree_code_class kind = TREE_CODE_CLASS (code);
/* WINS will be nonzero when the switch is done
if all operands are constant. */
int wins = 1;
/* Return right away if a constant. */
- if (kind == 'c')
+ if (kind == tcc_constant)
return t;
if (code == NOP_EXPR || code == FLOAT_EXPR || code == CONVERT_EXPR)
@@ -6046,7 +6047,7 @@ fold (tree expr)
of the arguments so that their form can be studied. In any
cases, the appropriate type conversions should be put back in
the tree that will get out of the constant folder. */
- if (kind == '<')
+ if (kind == tcc_comparison)
STRIP_SIGN_NOPS (op);
else
STRIP_NOPS (op);
@@ -6118,7 +6119,7 @@ fold (tree expr)
return tem;
}
- if (TREE_CODE_CLASS (code) == '1')
+ if (TREE_CODE_CLASS (code) == tcc_unary)
{
if (TREE_CODE (arg0) == COMPOUND_EXPR)
return build2 (COMPOUND_EXPR, type, TREE_OPERAND (arg0, 0),
@@ -6165,7 +6166,7 @@ fold (tree expr)
TREE_OPERAND (TREE_OPERAND (tem, 2), 0)));
return tem;
}
- else if (TREE_CODE_CLASS (TREE_CODE (arg0)) == '<')
+ else if (COMPARISON_CLASS_P (arg0))
{
if (TREE_CODE (type) == BOOLEAN_TYPE)
{
@@ -6181,16 +6182,16 @@ fold (tree expr)
integer_zero_node))));
}
}
- else if (TREE_CODE_CLASS (code) == '<'
+ else if (TREE_CODE_CLASS (code) == tcc_comparison
&& TREE_CODE (arg0) == COMPOUND_EXPR)
return build2 (COMPOUND_EXPR, type, TREE_OPERAND (arg0, 0),
fold (build2 (code, type, TREE_OPERAND (arg0, 1), arg1)));
- else if (TREE_CODE_CLASS (code) == '<'
+ else if (TREE_CODE_CLASS (code) == tcc_comparison
&& TREE_CODE (arg1) == COMPOUND_EXPR)
return build2 (COMPOUND_EXPR, type, TREE_OPERAND (arg1, 0),
fold (build2 (code, type, arg0, TREE_OPERAND (arg1, 1))));
- else if (TREE_CODE_CLASS (code) == '2'
- || TREE_CODE_CLASS (code) == '<')
+ else if (TREE_CODE_CLASS (code) == tcc_binary
+ || TREE_CODE_CLASS (code) == tcc_comparison)
{
if (TREE_CODE (arg0) == COMPOUND_EXPR)
return build2 (COMPOUND_EXPR, type, TREE_OPERAND (arg0, 0),
@@ -6202,8 +6203,7 @@ fold (tree expr)
fold (build2 (code, type,
arg0, TREE_OPERAND (arg1, 1))));
- if (TREE_CODE (arg0) == COND_EXPR
- || TREE_CODE_CLASS (TREE_CODE (arg0)) == '<')
+ if (TREE_CODE (arg0) == COND_EXPR || COMPARISON_CLASS_P (arg0))
{
tem = fold_binary_op_with_conditional_arg (code, type, arg0, arg1,
/*cond_first_p=*/1);
@@ -6211,8 +6211,7 @@ fold (tree expr)
return tem;
}
- if (TREE_CODE (arg1) == COND_EXPR
- || TREE_CODE_CLASS (TREE_CODE (arg1)) == '<')
+ if (TREE_CODE (arg1) == COND_EXPR || COMPARISON_CLASS_P (arg1))
{
tem = fold_binary_op_with_conditional_arg (code, type, arg1, arg0,
/*cond_first_p=*/0);
@@ -6382,7 +6381,7 @@ fold (tree expr)
/* Convert (T1)((T2)X op Y) into (T1)X op Y, for pointer types T1 and
T2 being pointers to types of the same size. */
if (POINTER_TYPE_P (TREE_TYPE (t))
- && TREE_CODE_CLASS (TREE_CODE (arg0)) == '2'
+ && BINARY_CLASS_P (arg0)
&& TREE_CODE (TREE_OPERAND (arg0, 0)) == NOP_EXPR
&& POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (arg0, 0))))
{
@@ -8772,7 +8771,7 @@ fold (tree expr)
for reasons given above each one.
Also try swapping the arguments and inverting the conditional. */
- if (TREE_CODE_CLASS (TREE_CODE (arg0)) == '<'
+ if (COMPARISON_CLASS_P (arg0)
&& operand_equal_for_comparison_p (TREE_OPERAND (arg0, 0),
arg1, TREE_OPERAND (arg0, 1))
&& !HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg1))))
@@ -8784,14 +8783,14 @@ fold (tree expr)
return tem;
}
- if (TREE_CODE_CLASS (TREE_CODE (arg0)) == '<'
+ if (COMPARISON_CLASS_P (arg0)
&& operand_equal_for_comparison_p (TREE_OPERAND (arg0, 0),
TREE_OPERAND (t, 2),
TREE_OPERAND (arg0, 1))
&& !HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (TREE_OPERAND (t, 2)))))
{
tem = invert_truthvalue (arg0);
- if (TREE_CODE_CLASS (TREE_CODE (tem)) == '<')
+ if (COMPARISON_CLASS_P (tem))
{
tem = fold_cond_expr_with_comparison (type, tem,
TREE_OPERAND (t, 2),
@@ -9055,14 +9054,15 @@ fold_checksum_tree (tree expr, struct md5_ctx *ctx, htab_t ht)
return;
*slot = expr;
code = TREE_CODE (expr);
- if (TREE_CODE_CLASS (code) == 'd' && DECL_ASSEMBLER_NAME_SET_P (expr))
+ if (TREE_CODE_CLASS (code) == tcc_declaration
+ && DECL_ASSEMBLER_NAME_SET_P (expr))
{
/* Allow DECL_ASSEMBLER_NAME to be modified. */
memcpy (buf, expr, tree_size (expr));
expr = (tree) buf;
SET_DECL_ASSEMBLER_NAME (expr, NULL);
}
- else if (TREE_CODE_CLASS (code) == 't'
+ else if (TREE_CODE_CLASS (code) == tcc_type
&& (TYPE_POINTER_TO (expr) || TYPE_REFERENCE_TO (expr)
|| TYPE_CACHED_VALUES_P (expr)))
{
@@ -9076,11 +9076,12 @@ fold_checksum_tree (tree expr, struct md5_ctx *ctx, htab_t ht)
}
md5_process_bytes (expr, tree_size (expr), ctx);
fold_checksum_tree (TREE_TYPE (expr), ctx, ht);
- if (TREE_CODE_CLASS (code) != 't' && TREE_CODE_CLASS (code) != 'd')
+ if (TREE_CODE_CLASS (code) != tcc_type
+ && TREE_CODE_CLASS (code) != tcc_declaration)
fold_checksum_tree (TREE_CHAIN (expr), ctx, ht);
switch (TREE_CODE_CLASS (code))
{
- case 'c':
+ case tcc_constant:
switch (code)
{
case STRING_CST:
@@ -9098,7 +9099,7 @@ fold_checksum_tree (tree expr, struct md5_ctx *ctx, htab_t ht)
break;
}
break;
- case 'x':
+ case tcc_exceptional:
switch (code)
{
case TREE_LIST:
@@ -9113,17 +9114,17 @@ fold_checksum_tree (tree expr, struct md5_ctx *ctx, htab_t ht)
break;
}
break;
- case 'e':
- case 'r':
- case '<':
- case '1':
- case '2':
- case 's':
+ case tcc_expression:
+ case tcc_reference:
+ case tcc_comparison:
+ case tcc_unary:
+ case tcc_binary:
+ case tcc_statement:
len = first_rtl_op (code);
for (i = 0; i < len; ++i)
fold_checksum_tree (TREE_OPERAND (expr, i), ctx, ht);
break;
- case 'd':
+ case tcc_declaration:
fold_checksum_tree (DECL_SIZE (expr), ctx, ht);
fold_checksum_tree (DECL_SIZE_UNIT (expr), ctx, ht);
fold_checksum_tree (DECL_NAME (expr), ctx, ht);
@@ -9136,7 +9137,7 @@ fold_checksum_tree (tree expr, struct md5_ctx *ctx, htab_t ht)
fold_checksum_tree (DECL_ATTRIBUTES (expr), ctx, ht);
fold_checksum_tree (DECL_VINDEX (expr), ctx, ht);
break;
- case 't':
+ case tcc_type:
if (TREE_CODE (expr) == ENUMERAL_TYPE)
fold_checksum_tree (TYPE_VALUES (expr), ctx, ht);
fold_checksum_tree (TYPE_SIZE (expr), ctx, ht);
@@ -9630,7 +9631,7 @@ tree_expr_nonzero_p (tree t)
return !DECL_WEAK (base);
/* Constants are never weak. */
- if (TREE_CODE_CLASS (TREE_CODE (base)) == 'c')
+ if (CONSTANT_CLASS_P (base))
return true;
return false;
@@ -10554,12 +10555,12 @@ fold_ignored_result (tree t)
for (;;)
switch (TREE_CODE_CLASS (TREE_CODE (t)))
{
- case '1':
+ case tcc_unary:
t = TREE_OPERAND (t, 0);
break;
- case '2':
- case '<':
+ case tcc_binary:
+ case tcc_comparison:
if (!TREE_SIDE_EFFECTS (TREE_OPERAND (t, 1)))
t = TREE_OPERAND (t, 0);
else if (!TREE_SIDE_EFFECTS (TREE_OPERAND (t, 0)))
@@ -10568,7 +10569,7 @@ fold_ignored_result (tree t)
return t;
break;
- case 'e':
+ case tcc_expression:
switch (TREE_CODE (t))
{
case COMPOUND_EXPR:
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 4d4b445cc34..9053f3652d1 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com>
+ Zack Weinberg <zack@codesourcery.com>
+
+ * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class
+ enumeration constants.
+
2004-09-17 Paul Brook <paul@codesourcery.com>
* gfortran.h (struct gfc_linebuf): Don't use C99 empty arrays.
@@ -312,30 +318,30 @@
2004-08-26 Richard Henderson <rth@redhat.com>
- * arith.c: Include system.h, not real system headers.
- (MPZ_NULL, MPF_NULL, DEF_GFC_INTEGER_KIND, DEF_GFC_LOGICAL_KIND,
- DEF_GFC_REAL_KIND, GFC_SP_KIND, GFC_SP_PREC, GFC_SP_EMIN, GFC_SP_EMAX,
- GFC_DP_KIND, GFC_DP_PREC, GFC_DP_EMIN, GFC_DP_EMAX, GFC_QP_KIND,
- GFC_QP_PREC, GFC_QP_EMIN, GFC_QP_EMAX): Remove.
- (gfc_integer_kinds, gfc_logical_kinds, gfc_real_kinds,
- gfc_index_integer_kind, gfc_default_integer_kind,
- gfc_default_real_kind,gfc_default_double_kind,
- gfc_default_character_kind, gfc_default_logical_kind,
- gfc_default_complex_kind, validate_integer, validate_real,
- validate_logical, validate_character,
- gfc_validate_kind): Move to trans-types.c.
- (gfc_set_model_kind): Use gfc_validate_kind.
- (gfc_set_model): Just copy the current precision to default.
- (gfc_arith_init_1): Use mpfr precision 128 for integer setup.
- * f95-lang.c (gfc_init_decl_processing): Invoke gfc_init_kinds.
- * gfortran.h: Update file commentary.
- * trans-types.c (MAX_INT_KINDS, MAX_REAL_KINDS): New.
- (gfc_default_integer_kind_1, gfc_default_real_kind_1,
- gfc_default_double_kind_1, gfc_default_character_kind_1,
- gfc_default_logical_kind_1, gfc_default_complex_kind_1): New.
- (gfc_init_kinds): New.
- (gfc_init_types): Don't set gfc_index_integer_kind here.
- * trans-types.h (gfc_init_kinds): Declare.
+ * arith.c: Include system.h, not real system headers.
+ (MPZ_NULL, MPF_NULL, DEF_GFC_INTEGER_KIND, DEF_GFC_LOGICAL_KIND,
+ DEF_GFC_REAL_KIND, GFC_SP_KIND, GFC_SP_PREC, GFC_SP_EMIN, GFC_SP_EMAX,
+ GFC_DP_KIND, GFC_DP_PREC, GFC_DP_EMIN, GFC_DP_EMAX, GFC_QP_KIND,
+ GFC_QP_PREC, GFC_QP_EMIN, GFC_QP_EMAX): Remove.
+ (gfc_integer_kinds, gfc_logical_kinds, gfc_real_kinds,
+ gfc_index_integer_kind, gfc_default_integer_kind,
+ gfc_default_real_kind,gfc_default_double_kind,
+ gfc_default_character_kind, gfc_default_logical_kind,
+ gfc_default_complex_kind, validate_integer, validate_real,
+ validate_logical, validate_character,
+ gfc_validate_kind): Move to trans-types.c.
+ (gfc_set_model_kind): Use gfc_validate_kind.
+ (gfc_set_model): Just copy the current precision to default.
+ (gfc_arith_init_1): Use mpfr precision 128 for integer setup.
+ * f95-lang.c (gfc_init_decl_processing): Invoke gfc_init_kinds.
+ * gfortran.h: Update file commentary.
+ * trans-types.c (MAX_INT_KINDS, MAX_REAL_KINDS): New.
+ (gfc_default_integer_kind_1, gfc_default_real_kind_1,
+ gfc_default_double_kind_1, gfc_default_character_kind_1,
+ gfc_default_logical_kind_1, gfc_default_complex_kind_1): New.
+ (gfc_init_kinds): New.
+ (gfc_init_types): Don't set gfc_index_integer_kind here.
+ * trans-types.h (gfc_init_kinds): Declare.
* doc/invoke.texi: Clarify DOUBLE PRECISION behaviour wrt -r8.
2004-08-26 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
@@ -422,7 +428,7 @@
build.
* trans-array.c (gfc_conv_descriptor_data,
gfc_conv_descriptor_offset, gfc_conv_descriptor_dimension,
- gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound,
+ gfc_conv_descriptor_stride, gfc_conv_descriptor_lbound,
gfc_conv_descriptor_ubound, gfc_trans_allocate_array_storage,
gfc_trans_allocate_temp_array,
gfc_trans_array_constructor_subarray,
@@ -480,7 +486,7 @@
2004-08-25 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
- * trans-const.c (gfc_conv_mpz_to_tree): Change call to
+ * trans-const.c (gfc_conv_mpz_to_tree): Change call to
build_int_cst to build_int_cst_wide in accordance to Nathan's
previous patch.
@@ -503,7 +509,7 @@
2004-08-24 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
- * trans-decl.c, trans-types.c: Add and remove blank lines as
+ * trans-decl.c, trans-types.c: Add and remove blank lines as
required.
2004-08-24 Richard Henderson <rth@redhat.com>
@@ -512,9 +518,9 @@
2004-08-24 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
- * resolve.c (merge_argument_lists): Revert unintentionally
+ * resolve.c (merge_argument_lists): Revert unintentionally
committed change.
-
+
2004-08-24 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
* trans-decl.c (build_function_decl): Fix spelling in comment.
@@ -545,15 +551,15 @@
2004-08-22 Richard Henderson <rth@redhat.com>
PR 13465
- * data.c (find_con_by_offset): Search ordered list; handle
- elements with repeat counts.
- (gfc_assign_data_value_range): New.
- * gfortran.h (struct gfc_data_value): Make repeat unsigned.
- (gfc_assign_data_value_range): Declare.
- * match.c (top_val_list): Extract repeat count into a temporary.
- * resolve.c (values): Make left unsigned.
- (next_data_value): Don't decrement left.
- (check_data_variable): Use gfc_assign_data_value_range.
+ * data.c (find_con_by_offset): Search ordered list; handle
+ elements with repeat counts.
+ (gfc_assign_data_value_range): New.
+ * gfortran.h (struct gfc_data_value): Make repeat unsigned.
+ (gfc_assign_data_value_range): Declare.
+ * match.c (top_val_list): Extract repeat count into a temporary.
+ * resolve.c (values): Make left unsigned.
+ (next_data_value): Don't decrement left.
+ (check_data_variable): Use gfc_assign_data_value_range.
2004-08-22 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
@@ -1416,7 +1422,7 @@
unused variables if they're use associated.
2004-06-14 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
- Andrew Vaught <andyv@firstinter.net>
+ Andrew Vaught <andyv@firstinter.net>
PR fortran/14928
* gfortran.h (gfc_check_f): Add new field f3ml.
@@ -1769,7 +1775,7 @@
2004-05-17 Steve Kargl <kargls@comcast.net>
* arith.c (gfc_real2complex): Range checking wrong part of complex
- number.
+ number.
2004-05-16 Paul Brook <paul@codesourcery.com>
@@ -1911,15 +1917,15 @@
2004-05-14 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
- PR fortran/14066
+ PR fortran/14066
* match.c (gfc_match_do): Allow infinite loops with
label-do-stmt. Do not enforce space after comma.
2004-05-14 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
- PR fortran/15051
+ PR fortran/15051
* parse.c (parse_interface): Allow empty INTERFACE, remove
- seen_body.
+ seen_body.
2004-05-14 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
@@ -1941,7 +1947,7 @@
PR fortran/14568
* trans-decl.c (generate_local_decl): Don't warn for unused
- variables which are in common blocks.
+ variables which are in common blocks.
2004-05-13 Diego Novillo <dnovillo@redhat.com>
@@ -2166,9 +2172,9 @@
2004-03-24 Bud Davis <bdavis9659@comcast.net>
- PR 14055
+ PR 14055
* arith.c (gfc_convert_integer,gfc_convert_real): Removed leading '+'
- before conversion by gmp library call.
+ before conversion by gmp library call.
2004-03-24 Bud Davis <bdavis9659@comcast.net>
@@ -3103,8 +3109,8 @@
* lang-options.h: Remove.
2003-07-23 Arnaud Desitter <arnaud.desitter@geography.oxford.ac.uk>
- * iresolve.c (g95_resolve_transpose): Proper variable in switch.
- * simplify.c (g95_simplify_nearest): Fix typo and use a correct test
+ * iresolve.c (g95_resolve_transpose): Proper variable in switch.
+ * simplify.c (g95_simplify_nearest): Fix typo and use a correct test
on kind.
2003-07-22 Steven Bosscher <steven@gcc.gnu.org>
@@ -3749,21 +3755,21 @@
2003-04-10 Canqun Yang <canqun@yahoo.com.cn>
- * trans-stmt.c (g95_trans_forall): Implement WHERE inside FORALL.
- (g95_trans_forall_body): New function.
+ * trans-stmt.c (g95_trans_forall): Implement WHERE inside FORALL.
+ (g95_trans_forall_body): New function.
2003-04-10 Canqun Yang <canqun@yahoo.com.cn>
- * resolve.c (resove_where): New function.
- (resolve_where_shape): New function.
- (resolve_code): Add call to 'resolve_where'
- * trans-stmt.c (g95_trans_where): Modified.
- (g95_trans_where_2): New function.
- (g95_trans_where_assign): New function.
- (g95_evaluate_where_mask): New function.
- (g95_add_to_stmt_list): New function.
- (g95_get_temp_expr): New function.
- * trans.h (where_stmt_list): New structure.
+ * resolve.c (resove_where): New function.
+ (resolve_where_shape): New function.
+ (resolve_code): Add call to 'resolve_where'
+ * trans-stmt.c (g95_trans_where): Modified.
+ (g95_trans_where_2): New function.
+ (g95_trans_where_assign): New function.
+ (g95_evaluate_where_mask): New function.
+ (g95_add_to_stmt_list): New function.
+ (g95_get_temp_expr): New function.
+ * trans.h (where_stmt_list): New structure.
2003-04-10 Paul Brook <paul@nowt.org>
@@ -3851,7 +3857,7 @@
* arith.c (validate_logical), g95.h, options.c (g95_init_options):
Remove option l1.
- * g95.h, intrinsic.c(g95_get_intrinsic_sub_symbol): Add const.
+ * g95.h, intrinsic.c(g95_get_intrinsic_sub_symbol): Add const.
* iresolve.c(g95_resolve_cpu_time, g95_resolve_random_number): Add
const.
* lang-options.h: Remove -finline-repack-arrays. Add -fg77-calls.
@@ -4092,7 +4098,7 @@
2003-02-05 Toon Moene <toon@moene.indiv.nluug.nl>
* lang-options.h: Fix warning involving C90 concatenated
- strings.
+ strings.
2003-02-06 Steven Bosscher <s.bosscher@student.tudelft.nl>
Arnaud Desitter <arnaud.desitter@geography.oxford.ac.uk>
@@ -4178,7 +4184,7 @@
2003-01-28 Steven Bosscher <s.bosscher@student.tudelft.n>
- * Make-lang.in: Don't build with broken tree-ssa-pre.
+ * Make-lang.in: Don't build with broken tree-ssa-pre.
2003-01-28 Steven Bosscher <s.bosscher@student.tudelft.nl>
@@ -4515,7 +4521,7 @@
2003-01-10 Steven Bosscher <s.bosscher@student.tudelft.nl>
- * dump-parse-tree.c (g95_show_namespace): Fixed another
+ * dump-parse-tree.c (g95_show_namespace): Fixed another
typo. Sorry, it's Friday...
2003-01-10 Steven Bosscher <s.bosscher@student.tudelft.nl>
@@ -5018,7 +5024,7 @@
2002-09-01 Toon Moene <toon@moene.indiv.nluug.nl>
* g95_conv_mpz_to_tree: Free storage pointed to by q,
- not by buff.
+ not by buff.
2002-08-30 Paul Brook <paul@nowt.org>
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index d5e436d1159..8edf5692bb0 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -153,7 +153,7 @@ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-const char tree_code_type[] = {
+const enum tree_code_class tree_code_type[] = {
#include "tree.def"
};
#undef DEFTREECODE
@@ -221,7 +221,7 @@ gfc_truthvalue_conversion (tree expr)
case BOOLEAN_TYPE:
if (TREE_TYPE (expr) == boolean_type_node)
return expr;
- else if (TREE_CODE_CLASS (TREE_CODE (expr)) == '<')
+ else if (COMPARISON_CLASS_P (expr))
{
TREE_TYPE (expr) = boolean_type_node;
return expr;
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 9e4df47f3da..29550b715e6 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -107,7 +107,7 @@ gfc_make_safe_expr (gfc_se * se)
{
tree var;
- if (TREE_CODE_CLASS (TREE_CODE (se->expr)) == 'c')
+ if (CONSTANT_CLASS_P (se->expr))
return;
/* We need a temporary for this result. */
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 306c4759109..8005b32924b 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -127,7 +127,7 @@ gfc_evaluate_now (tree expr, stmtblock_t * pblock)
{
tree var;
- if (TREE_CODE_CLASS (TREE_CODE (expr)) == 'c')
+ if (CONSTANT_CLASS_P (expr))
return expr;
var = gfc_create_var (TREE_TYPE (expr), NULL);
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 52351181892..f648985e457 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -562,9 +562,7 @@ should_carry_locus_p (tree stmt)
static void
annotate_one_with_locus (tree t, location_t locus)
{
- if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (t)))
- && ! EXPR_HAS_LOCATION (t)
- && should_carry_locus_p (t))
+ if (EXPR_P (t) && ! EXPR_HAS_LOCATION (t) && should_carry_locus_p (t))
SET_EXPR_LOCATION (t, locus);
}
@@ -599,9 +597,9 @@ mostly_copy_tree_r (tree *tp, int *walk_subtrees, void *data)
{
enum tree_code code = TREE_CODE (*tp);
/* Don't unshare types, decls, constants and SAVE_EXPR nodes. */
- if (TREE_CODE_CLASS (code) == 't'
- || TREE_CODE_CLASS (code) == 'd'
- || TREE_CODE_CLASS (code) == 'c'
+ if (TREE_CODE_CLASS (code) == tcc_type
+ || TREE_CODE_CLASS (code) == tcc_declaration
+ || TREE_CODE_CLASS (code) == tcc_constant
|| code == SAVE_EXPR || code == TARGET_EXPR
/* We can't do anything sensible with a BLOCK used as an expression,
but we also can't abort when we see it because of non-expression
@@ -637,9 +635,9 @@ copy_if_shared_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
types and the bounds of types. Mark them as visited so we properly
unmark their subtrees on the unmark pass. If we've already seen them,
don't look down further. */
- if (TREE_CODE_CLASS (code) == 't'
- || TREE_CODE_CLASS (code) == 'd'
- || TREE_CODE_CLASS (code) == 'c')
+ if (TREE_CODE_CLASS (code) == tcc_type
+ || TREE_CODE_CLASS (code) == tcc_declaration
+ || TREE_CODE_CLASS (code) == tcc_constant)
{
if (TREE_VISITED (t))
*walk_subtrees = 0;
@@ -2319,7 +2317,7 @@ gimplify_init_ctor_preeval_1 (tree *tp, int *walk_subtrees, void *xdata)
&& alias_sets_conflict_p (data->lhs_alias_set, get_alias_set (t)))
return t;
- if (DECL_P (t) || TYPE_P (t))
+ if (IS_TYPE_OR_DECL_P (t))
*walk_subtrees = 0;
return NULL;
}
@@ -3872,7 +3870,7 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
default:
switch (TREE_CODE_CLASS (TREE_CODE (*expr_p)))
{
- case '<':
+ case tcc_comparison:
/* If this is a comparison of objects of aggregate type,
handle it specially (by converting to a call to
memcmp). It would be nice to only have to do this
@@ -3886,12 +3884,12 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
/* If *EXPR_P does not need to be special-cased, handle it
according to its class. */
- case '1':
+ case tcc_unary:
ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
post_p, is_gimple_val, fb_rvalue);
break;
- case '2':
+ case tcc_binary:
expr_2:
{
enum gimplify_status r0, r1;
@@ -3905,8 +3903,8 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
break;
}
- case 'd':
- case 'c':
+ case tcc_declaration:
+ case tcc_constant:
ret = GS_ALL_DONE;
goto dont_recalculate;
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index ecb2cad4e8d..f0311cc5049 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,11 @@
+2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com>
+ Zack Weinberg <zack@codesourcery.com>
+
+ * java-tree.def: Use tree_code_class enumeration constants
+ instead of code letters.
+ * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for
+ new tree-class enumeration constants.
+
2004-09-13 Tom Tromey <tromey@redhat.com>
PR java/17216:
@@ -131,7 +139,7 @@
* class.c (build_utf8_ref, build_static_field_ref,
make_field_value, make_method_value, get_dispatch_table,
make_class_data, emit_symbol_table, emit_catch_table): Likewise.
- * constants.c (get_tag_node, build_ref_from_constant_pool,
+ * constants.c (get_tag_node, build_ref_from_constant_pool,
build_constants_constructor): Likewise.
* decl.c (java_init_decl_processing): Likewise.
* expr.c (build_java_array_length_access, build_newarray,
@@ -627,7 +635,7 @@
set_nested_class_simple_name_value.
2004-06-22 Andrew Haley <aph@redhat.com>
- Ranjit Mathew <rmathew@hotmail.com>
+ Ranjit Mathew <rmathew@hotmail.com>
Fixes PR java/16113.
* decl.c (force_poplevels): Remove call to expand_end_bindings.
@@ -699,7 +707,7 @@
of unordered conditionals. Add comment.
2004-05-29 Ranjit Mathew <rmathew@hotmail.com>
- Per Bothner <per@bothner.com>
+ Per Bothner <per@bothner.com>
* java-tree.h (DECL_LOCAL_FINAL_IUD): New macro to test if a
local variable was initialised upon declaration.
diff --git a/gcc/java/java-gimplify.c b/gcc/java/java-gimplify.c
index 6632e934e8a..54d5c754472 100644
--- a/gcc/java/java-gimplify.c
+++ b/gcc/java/java-gimplify.c
@@ -141,7 +141,8 @@ java_gimplify_expr (tree *expr_p, tree *pre_p ATTRIBUTE_UNUSED,
Parameter lists, maybe? Or perhaps that's unnecessary because
the front end already generates SAVE_EXPRs. */
- if (TREE_CODE_CLASS (code) == '2' || TREE_CODE_CLASS (code) == '<')
+ if (TREE_CODE_CLASS (code) == tcc_binary
+ || TREE_CODE_CLASS (code) == tcc_comparison)
{
enum gimplify_status stat
= gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
diff --git a/gcc/java/java-tree.def b/gcc/java/java-tree.def
index 25ee5386205..2f2b9f467eb 100644
--- a/gcc/java/java-tree.def
+++ b/gcc/java/java-tree.def
@@ -1,33 +1,34 @@
/* Shift right, logical. */
-DEFTREECODE (URSHIFT_EXPR, "urshift_expr", '2', 2)
+DEFTREECODE (URSHIFT_EXPR, "urshift_expr", tcc_binary, 2)
/* Return -1, 0, 1 depending on whether the first argument is
less, equal, or greater to the second argument. */
-DEFTREECODE (COMPARE_EXPR, "compare_expr", '2', 2)
+DEFTREECODE (COMPARE_EXPR, "compare_expr", tcc_binary, 2)
/* Same as COMPARE_EXPR, but if either value is NaN, the result is -1. */
-DEFTREECODE (COMPARE_L_EXPR, "compare_l_expr", '2', 2)
+DEFTREECODE (COMPARE_L_EXPR, "compare_l_expr", tcc_binary, 2)
/* Same as COMPARE_EXPR, but if either value is NaN, the result is 1. */
-DEFTREECODE (COMPARE_G_EXPR, "compare_g_expr", '2', 2)
+DEFTREECODE (COMPARE_G_EXPR, "compare_g_expr", tcc_binary, 2)
/* Unary plus. Operand 0 is the expression the unary plus is applied
to */
-DEFTREECODE (UNARY_PLUS_EXPR, "unary_plus_expr", '1', 1)
+DEFTREECODE (UNARY_PLUS_EXPR, "unary_plus_expr", tcc_unary, 1)
/* New array creation expression.
Operand 0 is the array base type.
Operand 1 is the list of dimension expressions.
Operand 2 is the number of other dimensions of unspecified range.
Once patched, the node will bear the type of the created array. */
-DEFTREECODE (NEW_ARRAY_EXPR, "new_array_expr", 'e', 3)
+DEFTREECODE (NEW_ARRAY_EXPR, "new_array_expr", tcc_expression, 3)
/* New anonymous array creation expression.
Operand 0 is the base type of the anonymous array.
Operand 1 is the signature of the dimensions this array contains.
Operand 2 is the anonymous array initializer.
Once patched, the node will bear the type of the created array. */
-DEFTREECODE (NEW_ANONYMOUS_ARRAY_EXPR, "new_anonymous_array", 'e', 3)
+DEFTREECODE (NEW_ANONYMOUS_ARRAY_EXPR, "new_anonymous_array",
+ tcc_expression, 3)
/* New class creation expression.
Operand 0 is the name of the class to be created
@@ -35,68 +36,69 @@ DEFTREECODE (NEW_ANONYMOUS_ARRAY_EXPR, "new_anonymous_array", 'e', 3)
There is no operand 2. That slot is used for the
CALL_EXPR_RTL macro (see preexpand_calls).
The type should be the one of the created class. */
-DEFTREECODE (NEW_CLASS_EXPR, "new_class_expr", 'e', 3)
+DEFTREECODE (NEW_CLASS_EXPR, "new_class_expr", tcc_expression, 3)
/* Defines `this' as an expression. */
-DEFTREECODE (THIS_EXPR, "this", '1', 0)
+DEFTREECODE (THIS_EXPR, "this", tcc_unary, 0)
/* Case statement expression.
Operand 1 is the case value. */
-DEFTREECODE (CASE_EXPR, "case", 'e', 1)
+DEFTREECODE (CASE_EXPR, "case", tcc_expression, 1)
/* Default statement expression. */
-DEFTREECODE (DEFAULT_EXPR, "default", 'e', 0)
+DEFTREECODE (DEFAULT_EXPR, "default", tcc_expression, 0)
/* Try expression
Operand 0 is the tried block,
Operand 1 contains chained catch nodes. */
-DEFTREECODE (TRY_EXPR, "try-catch", 'e', 2)
+DEFTREECODE (TRY_EXPR, "try-catch", tcc_expression, 2)
/* Catch clause.
Operand 0 is the catch clause block, which contains the declaration of
the catch clause parameter. */
-DEFTREECODE (JAVA_CATCH_EXPR, "catch", '1', 1)
+DEFTREECODE (JAVA_CATCH_EXPR, "catch", tcc_unary, 1)
/* Synchronized statement.
Operand 0 is the expression on which we wish to synchronize,
Operand 1 is the synchronized expression block. */
-DEFTREECODE (SYNCHRONIZED_EXPR, "synchronized", 'e', 2)
+DEFTREECODE (SYNCHRONIZED_EXPR, "synchronized", tcc_expression, 2)
/* Throw statement.
Operand 0 is the throw expression. */
-DEFTREECODE (THROW_EXPR, "throw", '1', 1)
+DEFTREECODE (THROW_EXPR, "throw", tcc_unary, 1)
/* Conditional operator.
Operand 0 is the condition expression
Operand 1 is the then-value
Operand 2 is the else-value. */
-DEFTREECODE (CONDITIONAL_EXPR, "?:", 'e', 3)
+DEFTREECODE (CONDITIONAL_EXPR, "?:", tcc_expression, 3)
/* instanceof operator.
Operand 0 is the expression that is getting tested
Operand 1 is the class used for the test. */
-DEFTREECODE (INSTANCEOF_EXPR, "instanceof", 'e', 2)
+DEFTREECODE (INSTANCEOF_EXPR, "instanceof", tcc_expression, 2)
/* Array initializers.
Operand 0 is the (sub) array target to initialize, left to NULL_TREE
when the node is created.
Operand 1 is a CONSTRUCTOR node. */
-DEFTREECODE (NEW_ARRAY_INIT, "new_array_init", '1', 1)
+DEFTREECODE (NEW_ARRAY_INIT, "new_array_init", tcc_unary, 1)
/* Class literal.
Operand 0 is the name of the class we're trying to build a
reference from. */
-DEFTREECODE (CLASS_LITERAL, "class_literal", '1', 1)
+DEFTREECODE (CLASS_LITERAL, "class_literal", tcc_unary, 1)
/* The Java object within the exception object from the runtime. */
-DEFTREECODE (JAVA_EXC_OBJ_EXPR, "java_exc_obj_expr", 'e', 0)
+DEFTREECODE (JAVA_EXC_OBJ_EXPR, "java_exc_obj_expr", tcc_expression, 0)
/* Annotates a tree node (usually an expression) with source location
information: a file name (EXPR_WFL_FILENAME); a line number
(EXPR_WFL_LINENO); and column number (EXPR_WFL_COLNO). It is
expanded as the contained node (EXPR_WFL_NODE); a line note should
be emitted first if EXPR_WFL_EMIT_LINE_NOTE. */
-DEFTREECODE (EXPR_WITH_FILE_LOCATION, "expr_with_file_location", 'e', 3)
+DEFTREECODE (EXPR_WITH_FILE_LOCATION, "expr_with_file_location",
+ tcc_expression, 3)
/*
Local variables:
diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c
index 7b5bdcce7f1..5137eecf292 100644
--- a/gcc/java/jcf-write.c
+++ b/gcc/java/jcf-write.c
@@ -2036,8 +2036,7 @@ generate_bytecode_insns (tree exp, int target, struct jcf_partial *state)
/* If the rhs is a binary expression and the left operand is
`==' to the lhs then we have an OP= expression. In this
case we must do some special processing. */
- if (TREE_CODE_CLASS (TREE_CODE (rhs)) == '2'
- && lhs == TREE_OPERAND (rhs, 0))
+ if (BINARY_CLASS_P (rhs) && lhs == TREE_OPERAND (rhs, 0))
{
if (TREE_CODE (lhs) == COMPONENT_REF)
{
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index b9429a1fade..d1c69770787 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -78,9 +78,9 @@ static void java_clear_binding_stack (void);
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-const char tree_code_type[] = {
+const enum tree_code_class tree_code_type[] = {
#include "tree.def"
- 'x',
+ tcc_exceptional,
#include "java-tree.def"
};
#undef DEFTREECODE
@@ -430,8 +430,7 @@ put_decl_node (tree node)
node = TREE_TYPE (node);
was_pointer = 1;
}
- if (TREE_CODE_CLASS (TREE_CODE (node)) == 'd'
- && DECL_NAME (node) != NULL_TREE)
+ if (DECL_P (node) && DECL_NAME (node) != NULL_TREE)
{
if (TREE_CODE (node) == FUNCTION_DECL)
{
@@ -464,8 +463,7 @@ put_decl_node (tree node)
else
put_decl_node (DECL_NAME (node));
}
- else if (TREE_CODE_CLASS (TREE_CODE (node)) == 't'
- && TYPE_NAME (node) != NULL_TREE)
+ else if (TYPE_P (node) && TYPE_NAME (node) != NULL_TREE)
{
if (TREE_CODE (node) == RECORD_TYPE && TYPE_ARRAY_P (node))
{
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 499627152bc..377c195323b 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -1687,7 +1687,7 @@ do_statement:
for_statement:
for_begin SC_TK expression SC_TK for_update CP_TK statement
{
- if (TREE_CODE_CLASS (TREE_CODE ($3)) == 'c')
+ if (CONSTANT_CLASS_P ($3))
$3 = build_wfl_node ($3);
$$ = finish_for_loop (EXPR_WFL_LINECOL ($3), $3, $5, $7);
}
@@ -3126,7 +3126,7 @@ find_expr_with_wfl (tree node)
{
while (node)
{
- char code;
+ enum tree_code_class code;
tree to_return;
switch (TREE_CODE (node))
@@ -3152,7 +3152,8 @@ find_expr_with_wfl (tree node)
default:
code = TREE_CODE_CLASS (TREE_CODE (node));
- if (((code == '1') || (code == '2') || (code == 'e'))
+ if (((code == tcc_unary) || (code == tcc_binary)
+ || (code == tcc_expression))
&& EXPR_WFL_LINECOL (node))
return node;
return NULL_TREE;
@@ -14895,8 +14896,7 @@ finish_for_loop (int location, tree condition, tree update, tree body)
{
/* Try to detect constraint violations. These would be
programming errors somewhere. */
- if (! IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (up2)))
- || TREE_CODE (up2) == LOOP_EXPR)
+ if (! EXPR_P (up2) || TREE_CODE (up2) == LOOP_EXPR)
abort ();
SUPPRESS_UNREACHABLE_ERROR (up2) = 1;
}
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c
index f780da57754..c520a6bf501 100644
--- a/gcc/lambda-code.c
+++ b/gcc/lambda-code.c
@@ -1420,7 +1420,7 @@ find_induction_var_from_exit_cond (struct loop *loop)
if (TREE_CODE (expr) != COND_EXPR)
return NULL_TREE;
test = TREE_OPERAND (expr, 0);
- if (TREE_CODE_CLASS (TREE_CODE (test)) != '<')
+ if (!COMPARISON_CLASS_P (test))
return NULL_TREE;
/* This is a guess. We say that for a <,!=,<= b, a is the induction
variable.
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index b52d36b612c..199c93e9b50 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -422,7 +422,7 @@ lhd_tree_dump_type_quals (tree t)
tree
lhd_expr_size (tree exp)
{
- if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd'
+ if (DECL_P (exp)
&& DECL_SIZE_UNIT (exp) != 0)
return DECL_SIZE_UNIT (exp);
else
@@ -439,8 +439,8 @@ lhd_gimplify_expr (tree *expr_p ATTRIBUTE_UNUSED, tree *pre_p ATTRIBUTE_UNUSED,
}
/* lang_hooks.tree_size: Determine the size of a tree with code C,
- which is a language-specific tree code in category 'x'. The
- default expects never to be called. */
+ which is a language-specific tree code in category tcc_constant or
+ tcc_exceptional. The default expects never to be called. */
size_t
lhd_tree_size (enum tree_code c ATTRIBUTE_UNUSED)
{
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index 1b2dae10564..43749a24e88 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -205,9 +205,10 @@ struct lang_hooks
identifier nodes long enough for the language-specific slots. */
size_t identifier_size;
- /* Determines the size of any language-specific 'x' or 'c' nodes.
- Since it is called from make_node, the only information available
- is the tree code. Expected to abort on unrecognized codes. */
+ /* Determines the size of any language-specific tcc_constant or
+ tcc_exceptional nodes. Since it is called from make_node, the
+ only information available is the tree code. Expected to abort
+ on unrecognized codes. */
size_t (*tree_size) (enum tree_code);
/* The first callback made to the front end, for simple
@@ -338,12 +339,12 @@ struct lang_hooks
this hook. It should output to stderr. */
void (*print_statistics) (void);
- /* Called by print_tree when there is a tree of class 'x' that it
- doesn't know how to display. */
+ /* Called by print_tree when there is a tree of class tcc_exceptional
+ that it doesn't know how to display. */
lang_print_tree_hook print_xnode;
- /* Called to print language-dependent parts of a class 'd', class
- 't', and IDENTIFIER_NODE nodes. */
+ /* Called to print language-dependent parts of tcc_decl, tcc_type,
+ and IDENTIFIER_NODE nodes. */
lang_print_tree_hook print_decl;
lang_print_tree_hook print_type;
lang_print_tree_hook print_identifier;
diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c
index 0b657725306..2d8319d2417 100644
--- a/gcc/objc/objc-lang.c
+++ b/gcc/objc/objc-lang.c
@@ -54,11 +54,11 @@ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-const char tree_code_type[] = {
+const enum tree_code_class tree_code_type[] = {
#include "tree.def"
- 'x',
+ tcc_exceptional,
#include "c-common.def"
- 'x',
+ tcc_exceptional,
#include "objc-tree.def"
};
#undef DEFTREECODE
diff --git a/gcc/objc/objc-tree.def b/gcc/objc/objc-tree.def
index ea88d1eec33..8702e968426 100644
--- a/gcc/objc/objc-tree.def
+++ b/gcc/objc/objc-tree.def
@@ -1,7 +1,7 @@
/* This file contains the definitions and documentation for the
additional tree codes used in the Objective C front end (see tree.def
for the standard codes).
- Copyright (C) 1990, 1997, 1998, 1999, 2000, 2001, 2003
+ Copyright (C) 1990, 1997, 1998, 1999, 2000, 2001, 2003, 2004
Free Software Foundation, Inc.
This file is part of GCC.
@@ -23,20 +23,22 @@ Boston, MA 02111-1307, USA. */
/* Objective-C types. */
-DEFTREECODE (CLASS_INTERFACE_TYPE, "class_interface_type", 't', 0)
-DEFTREECODE (CLASS_IMPLEMENTATION_TYPE, "class_implementation_type", 't', 0)
-DEFTREECODE (CATEGORY_INTERFACE_TYPE, "category_interface_type", 't', 0)
-DEFTREECODE (CATEGORY_IMPLEMENTATION_TYPE,"category_implementation_type", 't', 0)
-DEFTREECODE (PROTOCOL_INTERFACE_TYPE, "protocol_interface_type", 't', 0)
+DEFTREECODE (CLASS_INTERFACE_TYPE, "class_interface_type", tcc_type, 0)
+DEFTREECODE (CLASS_IMPLEMENTATION_TYPE, "class_implementation_type",
+ tcc_type, 0)
+DEFTREECODE (CATEGORY_INTERFACE_TYPE, "category_interface_type", tcc_type, 0)
+DEFTREECODE (CATEGORY_IMPLEMENTATION_TYPE,"category_implementation_type",
+ tcc_type, 0)
+DEFTREECODE (PROTOCOL_INTERFACE_TYPE, "protocol_interface_type", tcc_type, 0)
/* Objective-C decls. */
-DEFTREECODE (KEYWORD_DECL, "keyword_decl", 'd', 0)
-DEFTREECODE (INSTANCE_METHOD_DECL, "instance_method_decl", 'd', 0)
-DEFTREECODE (CLASS_METHOD_DECL, "class_method_decl", 'd', 0)
+DEFTREECODE (KEYWORD_DECL, "keyword_decl", tcc_declaration, 0)
+DEFTREECODE (INSTANCE_METHOD_DECL, "instance_method_decl", tcc_declaration, 0)
+DEFTREECODE (CLASS_METHOD_DECL, "class_method_decl", tcc_declaration, 0)
/* Objective-C expressions. */
-DEFTREECODE (MESSAGE_SEND_EXPR, "message_send_expr", 'e', 3)
-DEFTREECODE (CLASS_REFERENCE_EXPR, "class_reference_expr", 'e', 1)
+DEFTREECODE (MESSAGE_SEND_EXPR, "message_send_expr", tcc_expression, 3)
+DEFTREECODE (CLASS_REFERENCE_EXPR, "class_reference_expr", tcc_expression, 1)
/*
Local variables:
diff --git a/gcc/predict.c b/gcc/predict.c
index 8a7f093f014..c6d5ce7cb94 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -1048,7 +1048,7 @@ tree_predict_by_opcode (basic_block bb)
if (then_edge->flags & EDGE_TRUE_VALUE)
break;
cond = TREE_OPERAND (stmt, 0);
- if (TREE_CODE_CLASS (TREE_CODE (cond)) != '<')
+ if (!COMPARISON_CLASS_P (cond))
return;
op0 = TREE_OPERAND (cond, 0);
type = TREE_TYPE (op0);
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 829e2c9f302..20822af24b1 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -61,7 +61,7 @@ debug_tree (tree node)
void
print_node_brief (FILE *file, const char *prefix, tree node, int indent)
{
- char class;
+ enum tree_code_class class;
if (node == 0)
return;
@@ -75,12 +75,12 @@ print_node_brief (FILE *file, const char *prefix, tree node, int indent)
fprintf (file, "%s <%s " HOST_PTR_PRINTF,
prefix, tree_code_name[(int) TREE_CODE (node)], (char *) node);
- if (class == 'd')
+ if (class == tcc_declaration)
{
if (DECL_NAME (node))
fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
}
- else if (class == 't')
+ else if (class == tcc_type)
{
if (TYPE_NAME (node))
{
@@ -156,7 +156,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
int hash;
struct bucket *b;
enum machine_mode mode;
- char class;
+ enum tree_code_class class;
int len;
int first_rtl;
int i;
@@ -177,7 +177,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
return;
}
- if (indent > 8 && (class == 't' || class == 'd'))
+ if (indent > 8 && (class == tcc_type || class == tcc_declaration))
{
print_node_brief (file, prefix, node, indent);
return;
@@ -214,12 +214,12 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
prefix, tree_code_name[(int) TREE_CODE (node)], (void *) node);
/* Print the name, if any. */
- if (class == 'd')
+ if (class == tcc_declaration)
{
if (DECL_NAME (node))
fprintf (file, " %s", IDENTIFIER_POINTER (DECL_NAME (node)));
}
- else if (class == 't')
+ else if (class == tcc_type)
{
if (TYPE_NAME (node))
{
@@ -296,7 +296,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
switch (TREE_CODE_CLASS (TREE_CODE (node)))
{
- case 'd':
+ case tcc_declaration:
mode = DECL_MODE (node);
if (DECL_UNSIGNED (node))
@@ -461,7 +461,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
break;
- case 't':
+ case tcc_type:
if (TYPE_UNSIGNED (node))
fputs (" unsigned", file);
@@ -573,12 +573,12 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
print_node_brief (file, "chain", TREE_CHAIN (node), indent + 4);
break;
- case 'e':
- case '<':
- case '1':
- case '2':
- case 'r':
- case 's':
+ case tcc_expression:
+ case tcc_comparison:
+ case tcc_unary:
+ case tcc_binary:
+ case tcc_reference:
+ case tcc_statement:
if (TREE_CODE (node) == BIT_FIELD_REF && BIT_FIELD_REF_UNSIGNED (node))
fputs (" unsigned", file);
if (TREE_CODE (node) == BIND_EXPR)
@@ -619,8 +619,8 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
print_node (file, "chain", TREE_CHAIN (node), indent + 4);
break;
- case 'c':
- case 'x':
+ case tcc_constant:
+ case tcc_exceptional:
switch (TREE_CODE (node))
{
case INTEGER_CST:
@@ -765,7 +765,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
break;
default:
- if (TREE_CODE_CLASS (TREE_CODE (node)) == 'x')
+ if (EXCEPTIONAL_CLASS_P (node))
lang_hooks.print_xnode (file, node, indent);
break;
}
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 8d2c2d8af1b..c63d418b39c 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -2032,7 +2032,7 @@ alter_reg (int i, int from_reg)
/* If we have a decl for the original register, set it for the
memory. If this is a shared MEM, make a copy. */
if (REG_EXPR (regno_reg_rtx[i])
- && TREE_CODE_CLASS (TREE_CODE (REG_EXPR (regno_reg_rtx[i]))) == 'd')
+ && DECL_P (REG_EXPR (regno_reg_rtx[i])))
{
rtx decl = DECL_RTL_IF_SET (REG_EXPR (regno_reg_rtx[i]));
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 2db6dfa896d..e5d094d5ae9 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -1471,16 +1471,14 @@ warn_if_unused_value (tree exp, location_t locus)
default:
/* Referencing a volatile value is a side effect, so don't warn. */
- if ((DECL_P (exp)
- || TREE_CODE_CLASS (TREE_CODE (exp)) == 'r')
+ if ((DECL_P (exp) || REFERENCE_CLASS_P (exp))
&& TREE_THIS_VOLATILE (exp))
return 0;
/* If this is an expression which has no operands, there is no value
to be unused. There are no such language-independent codes,
but front ends may define such. */
- if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'e'
- && TREE_CODE_LENGTH (TREE_CODE (exp)) == 0)
+ if (EXPRESSION_CLASS_P (exp) && TREE_CODE_LENGTH (TREE_CODE (exp)) == 0)
return 0;
maybe_warn:
diff --git a/gcc/tree-browser.c b/gcc/tree-browser.c
index 891c761e25e..1ac5dda331d 100644
--- a/gcc/tree-browser.c
+++ b/gcc/tree-browser.c
@@ -1,5 +1,5 @@
/* Tree browser.
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Sebastian Pop <s.pop@laposte.net>
This file is part of GCC.
@@ -262,14 +262,14 @@ browse_tree (tree begin)
break;
case TB_REFERENCE_TO_THIS:
- if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 't')
+ if (head && TYPE_P (head))
TB_SET_HEAD (TYPE_REFERENCE_TO (head));
else
TB_WF;
break;
case TB_POINTER_TO_THIS:
- if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 't')
+ if (head && TYPE_P (head))
TB_SET_HEAD (TYPE_POINTER_TO (head));
else
TB_WF;
@@ -338,28 +338,28 @@ browse_tree (tree begin)
break;
case TB_INITIAL:
- if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'd')
+ if (head && DECL_P (head))
TB_SET_HEAD (DECL_INITIAL (head));
else
TB_WF;
break;
case TB_RESULT:
- if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'd')
+ if (head && DECL_P (head))
TB_SET_HEAD (DECL_RESULT_FLD (head));
else
TB_WF;
break;
case TB_ARGUMENTS:
- if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'd')
+ if (head && DECL_P (head))
TB_SET_HEAD (DECL_ARGUMENTS (head));
else
TB_WF;
break;
case TB_ABSTRACT_ORIGIN:
- if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'd')
+ if (head && DECL_P (head))
TB_SET_HEAD (DECL_ABSTRACT_ORIGIN (head));
else if (head && TREE_CODE (head) == BLOCK)
TB_SET_HEAD (BLOCK_ABSTRACT_ORIGIN (head));
@@ -368,18 +368,18 @@ browse_tree (tree begin)
break;
case TB_ATTRIBUTES:
- if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'd')
+ if (head && DECL_P (head))
TB_SET_HEAD (DECL_ATTRIBUTES (head));
- else if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 't')
+ else if (head && TYPE_P (head))
TB_SET_HEAD (TYPE_ATTRIBUTES (head));
else
TB_WF;
break;
case TB_CONTEXT:
- if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'd')
+ if (head && DECL_P (head))
TB_SET_HEAD (DECL_CONTEXT (head));
- else if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 't'
+ else if (head && TYPE_P (head)
&& TYPE_CONTEXT (head))
TB_SET_HEAD (TYPE_CONTEXT (head));
else
@@ -401,18 +401,18 @@ browse_tree (tree begin)
break;
case TB_UNIT_SIZE:
- if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'd')
+ if (head && DECL_P (head))
TB_SET_HEAD (DECL_SIZE_UNIT (head));
- else if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 't')
+ else if (head && TYPE_P (head))
TB_SET_HEAD (TYPE_SIZE_UNIT (head));
else
TB_WF;
break;
case TB_SIZE:
- if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 'd')
+ if (head && DECL_P (head))
TB_SET_HEAD (DECL_SIZE (head));
- else if (head && TREE_CODE_CLASS (TREE_CODE (head)) == 't')
+ else if (head && TYPE_P (head))
TB_SET_HEAD (TYPE_SIZE (head));
else
TB_WF;
@@ -441,32 +441,28 @@ browse_tree (tree begin)
break;
case TB_CHILD_0:
- if (head && IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (head)))
- && TREE_OPERAND (head, 0))
+ if (head && EXPR_P (head) && TREE_OPERAND (head, 0))
TB_SET_HEAD (TREE_OPERAND (head, 0));
else
TB_WF;
break;
case TB_CHILD_1:
- if (head && IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (head)))
- && TREE_OPERAND (head, 1))
+ if (head && EXPR_P (head) && TREE_OPERAND (head, 1))
TB_SET_HEAD (TREE_OPERAND (head, 1));
else
TB_WF;
break;
case TB_CHILD_2:
- if (head && IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (head)))
- && TREE_OPERAND (head, 2))
+ if (head && EXPR_P (head) && TREE_OPERAND (head, 2))
TB_SET_HEAD (TREE_OPERAND (head, 2));
else
TB_WF;
break;
case TB_CHILD_3:
- if (head && IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (head)))
- && TREE_OPERAND (head, 3))
+ if (head && EXPR_P (head) && TREE_OPERAND (head, 3))
TB_SET_HEAD (TREE_OPERAND (head, 3));
else
TB_WF;
@@ -751,7 +747,7 @@ store_child_info (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
node = *tp;
/* 'node' is the parent of 'TREE_OPERAND (node, *)'. */
- if (TREE_CODE_CLASS (TREE_CODE (node)) == 'e')
+ if (EXPRESSION_CLASS_P (node))
{
#define STORE_CHILD(N) do { \
@@ -808,7 +804,7 @@ TB_parent_eq (const void *p1, const void *p2)
if (p1 == NULL || p2 == NULL)
return 0;
- if (TREE_CODE_CLASS(TREE_CODE(parent)) == 'e')
+ if (EXPRESSION_CLASS_P (parent))
{
#define TEST_CHILD(N) do { \
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index f7c5155b6b7..69c8b2587f7 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2004,7 +2004,7 @@ find_taken_edge (basic_block bb, tree val)
SSA_NAME, we can always determine its truth value (except when
doing floating point comparisons that may involve NaNs). */
if (val
- && TREE_CODE_CLASS (TREE_CODE (val)) == '<'
+ && COMPARISON_CLASS_P (val)
&& TREE_OPERAND (val, 0) == TREE_OPERAND (val, 1)
&& TREE_CODE (TREE_OPERAND (val, 0)) == SSA_NAME
&& (TREE_CODE (TREE_TYPE (TREE_OPERAND (val, 0))) != REAL_TYPE
@@ -3085,8 +3085,8 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
We check for constants explicitly since they are not considered
gimple invariants if they overflowed. */
#define CHECK_OP(N, MSG) \
- do { if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t, N))) != 'c' \
- && !is_gimple_val (TREE_OPERAND (t, N))) \
+ do { if (!CONSTANT_CLASS_P (TREE_OPERAND (t, N)) \
+ && !is_gimple_val (TREE_OPERAND (t, N))) \
{ error (MSG); return TREE_OPERAND (t, N); }} while (0)
switch (TREE_CODE (t))
@@ -3187,8 +3187,7 @@ verify_expr (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
t = TREE_OPERAND (t, 0);
}
- if (TREE_CODE_CLASS (TREE_CODE (t)) != 'c'
- && !is_gimple_lvalue (t))
+ if (!CONSTANT_CLASS_P (t) && !is_gimple_lvalue (t))
{
error ("Invalid reference prefix.");
return t;
@@ -3298,10 +3297,10 @@ verify_stmt (tree stmt, bool last_in_block)
static bool
tree_node_can_be_shared (tree t)
{
- if (TYPE_P (t) || DECL_P (t)
+ if (IS_TYPE_OR_DECL_P (t)
/* We check for constants explicitly since they are not considered
gimple invariants if they overflowed. */
- || TREE_CODE_CLASS (TREE_CODE (t)) == 'c'
+ || CONSTANT_CLASS_P (t)
|| is_gimple_min_invariant (t)
|| TREE_CODE (t) == SSA_NAME)
return true;
@@ -3309,7 +3308,7 @@ tree_node_can_be_shared (tree t)
while (((TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
/* We check for constants explicitly since they are not considered
gimple invariants if they overflowed. */
- && (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t, 1))) == 'c'
+ && (CONSTANT_CLASS_P (TREE_OPERAND (t, 1))
|| is_gimple_min_invariant (TREE_OPERAND (t, 1))))
|| (TREE_CODE (t) == COMPONENT_REF
|| TREE_CODE (t) == REALPART_EXPR
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c
index c6b79b62c42..47419c2c3d7 100644
--- a/gcc/tree-chrec.c
+++ b/gcc/tree-chrec.c
@@ -932,7 +932,7 @@ chrec_convert (tree type,
/* Don't propagate overflows. */
TREE_OVERFLOW (res) = 0;
- if (TREE_CODE_CLASS (TREE_CODE (res)) == 'c')
+ if (CONSTANT_CLASS_P (res))
TREE_CONSTANT_OVERFLOW (res) = 0;
return res;
}
diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c
index 363e3a2d578..5a4fdf5a668 100644
--- a/gcc/tree-complex.c
+++ b/gcc/tree-complex.c
@@ -425,7 +425,7 @@ expand_complex_operations_1 (block_stmt_iterator *bsi)
ar = extract_component (bsi, ac, 0);
ai = extract_component (bsi, ac, 1);
- if (TREE_CODE_CLASS (code) == '1')
+ if (TREE_CODE_CLASS (code) == tcc_unary)
bc = br = bi = NULL;
else
{
@@ -776,8 +776,8 @@ expand_vector_operations_1 (block_stmt_iterator *bsi)
return;
code = TREE_CODE (rhs);
- if (TREE_CODE_CLASS (code) != '1'
- && TREE_CODE_CLASS (code) != '2')
+ if (TREE_CODE_CLASS (code) != tcc_unary
+ && TREE_CODE_CLASS (code) != tcc_binary)
return;
if (code == NOP_EXPR || code == VIEW_CONVERT_EXPR)
@@ -872,7 +872,7 @@ expand_vector_operations_1 (block_stmt_iterator *bsi)
break;
}
- if (TREE_CODE_CLASS (code) == '1')
+ if (TREE_CODE_CLASS (code) == tcc_unary)
*p_rhs = expand_vector_piecewise (bsi, do_unop, type, compute_type,
TREE_OPERAND (rhs, 0),
NULL_TREE, code);
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index 3d7e4d4b4d6..4e65c5dffc8 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -847,9 +847,7 @@ find_vars_r (tree *tp, int *walk_subtrees, void *data)
/* Type, _DECL and constant nodes have no interesting children.
Ignore them. */
- else if (DECL_P (*tp)
- || TYPE_P (*tp)
- || TREE_CODE_CLASS (TREE_CODE (*tp)) == 'c')
+ else if (IS_TYPE_OR_DECL_P (*tp) || CONSTANT_CLASS_P (*tp))
*walk_subtrees = 0;
return NULL_TREE;
diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c
index a8818c30f86..d8d370fc304 100644
--- a/gcc/tree-dump.c
+++ b/gcc/tree-dump.c
@@ -216,7 +216,7 @@ dequeue_and_dump (dump_info_p di)
tree t;
unsigned int index;
enum tree_code code;
- char code_class;
+ enum tree_code_class code_class;
const char* code_name;
/* Get the next node from the queue. */
@@ -292,19 +292,19 @@ dequeue_and_dump (dump_info_p di)
switch (code_class)
{
- case '1':
+ case tcc_unary:
dump_child ("op 0", TREE_OPERAND (t, 0));
break;
- case '2':
- case '<':
+ case tcc_binary:
+ case tcc_comparison:
dump_child ("op 0", TREE_OPERAND (t, 0));
dump_child ("op 1", TREE_OPERAND (t, 1));
break;
- case 'e':
- case 'r':
- case 's':
+ case tcc_expression:
+ case tcc_reference:
+ case tcc_statement:
/* These nodes are handled explicitly below. */
break;
@@ -346,7 +346,7 @@ dequeue_and_dump (dump_info_p di)
if (TREE_CHAIN (t) && !dump_flag (di, TDF_SLIM, NULL))
dump_child ("chan", TREE_CHAIN (t));
}
- else if (code_class == 't')
+ else if (code_class == tcc_type)
{
/* All types have qualifiers. */
int quals = lang_hooks.tree_dump.type_quals (t);
@@ -373,7 +373,7 @@ dequeue_and_dump (dump_info_p di)
/* All types have alignments. */
dump_int (di, "algn", TYPE_ALIGN (t));
}
- else if (code_class == 'c')
+ else if (code_class == tcc_constant)
/* All constants can have types. */
queue_and_dump_type (di, t);
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 008632de728..b7bc7c3221b 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -1,5 +1,5 @@
/* Exception handling semantics and decomposition for trees.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@@ -1719,9 +1719,9 @@ tree_could_trap_p (tree expr)
bool honor_trapv = false;
tree t, base, idx;
- if (TREE_CODE_CLASS (code) == '<'
- || TREE_CODE_CLASS (code) == '1'
- || TREE_CODE_CLASS (code) == '2')
+ if (TREE_CODE_CLASS (code) == tcc_comparison
+ || TREE_CODE_CLASS (code) == tcc_unary
+ || TREE_CODE_CLASS (code) == tcc_binary)
{
t = TREE_TYPE (expr);
fp_operation = FLOAT_TYPE_P (t);
diff --git a/gcc/tree-gimple.c b/gcc/tree-gimple.c
index 9211a65f164..d9fe0205b3c 100644
--- a/gcc/tree-gimple.c
+++ b/gcc/tree-gimple.c
@@ -201,9 +201,9 @@ is_gimple_formal_tmp_rhs (tree t)
switch (TREE_CODE_CLASS (code))
{
- case '1':
- case '2':
- case '<':
+ case tcc_unary:
+ case tcc_binary:
+ case tcc_comparison:
return true;
default:
@@ -312,8 +312,7 @@ is_gimple_lvalue (tree t)
bool
is_gimple_condexpr (tree t)
{
- return (is_gimple_val (t)
- || TREE_CODE_CLASS (TREE_CODE (t)) == '<');
+ return (is_gimple_val (t) || COMPARISON_CLASS_P (t));
}
/* Return true if T is something whose address can be taken. */
@@ -579,7 +578,7 @@ recalculate_side_effects (tree t)
switch (TREE_CODE_CLASS (code))
{
- case 'e':
+ case tcc_expression:
switch (code)
{
case INIT_EXPR:
@@ -598,10 +597,10 @@ recalculate_side_effects (tree t)
}
/* Fall through. */
- case '<': /* a comparison expression */
- case '1': /* a unary arithmetic expression */
- case '2': /* a binary arithmetic expression */
- case 'r': /* a reference */
+ case tcc_comparison: /* a comparison expression */
+ case tcc_unary: /* a unary arithmetic expression */
+ case tcc_binary: /* a binary arithmetic expression */
+ case tcc_reference: /* a reference */
TREE_SIDE_EFFECTS (t) = TREE_THIS_VOLATILE (t);
for (i = 0; i < fro; ++i)
{
@@ -610,5 +609,9 @@ recalculate_side_effects (tree t)
TREE_SIDE_EFFECTS (t) = 1;
}
break;
+
+ default:
+ /* Can never be used with non-expressions. */
+ gcc_unreachable ();
}
}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 82b7857cb1b..707faaf75a3 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1159,7 +1159,7 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
int *count = data;
tree x = *tp;
- if (TYPE_P (x) || DECL_P (x))
+ if (IS_TYPE_OR_DECL_P (x))
{
*walk_subtrees = 0;
return NULL;
@@ -1167,8 +1167,7 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
/* Assume that constants and references counts nothing. These should
be majorized by amount of operations among them we count later
and are common target of CSE and similar optimizations. */
- else if (TREE_CODE_CLASS (TREE_CODE (x)) == 'c'
- || TREE_CODE_CLASS (TREE_CODE (x)) == 'r')
+ else if (CONSTANT_CLASS_P (x) || REFERENCE_CLASS_P (x))
return NULL;
switch (TREE_CODE (x))
@@ -2258,7 +2257,7 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
/* We make copies of most nodes. */
if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (code))
- || TREE_CODE_CLASS (code) == 'c'
+ || TREE_CODE_CLASS (code) == tcc_constant
|| code == TREE_LIST
|| code == TREE_VEC
|| code == TYPE_DECL)
@@ -2288,9 +2287,9 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
BIND_EXPR_BLOCK (*tp) = NULL_TREE;
}
- else if (TREE_CODE_CLASS (code) == 't')
+ else if (TREE_CODE_CLASS (code) == tcc_type)
*walk_subtrees = 0;
- else if (TREE_CODE_CLASS (code) == 'd')
+ else if (TREE_CODE_CLASS (code) == tcc_declaration)
*walk_subtrees = 0;
else
gcc_assert (code != STATEMENT_LIST);
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 9f4a57d9921..135ac0486a8 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -831,7 +831,7 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
break;
default:
- if (!DECL_P (t) && !TYPE_P (t))
+ if (!IS_TYPE_OR_DECL_P (t))
{
*walk_subtrees = 1;
wi->val_only = true;
@@ -945,7 +945,7 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
break;
default:
- if (!DECL_P (t) && !TYPE_P (t))
+ if (!IS_TYPE_OR_DECL_P (t))
{
*walk_subtrees = 1;
wi->val_only = true;
@@ -1124,7 +1124,7 @@ convert_tramp_reference (tree *tp, int *walk_subtrees, void *data)
break;
default:
- if (!DECL_P (t) && !TYPE_P (t))
+ if (!IS_TYPE_OR_DECL_P (t))
*walk_subtrees = 1;
break;
}
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 4c8c21677ca..185e39bc598 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -1750,7 +1750,7 @@ discover_nonconstant_array_refs_r (tree * tp, int *walk_subtrees,
{
tree t = *tp;
- if (TYPE_P (t) || DECL_P (t))
+ if (IS_TYPE_OR_DECL_P (t))
*walk_subtrees = 0;
else if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
{
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index d0b9aedc156..71196fbe783 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -1,5 +1,5 @@
/* Pretty formatting of GENERIC trees in C syntax.
- Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Adapted from c-pretty-print.c by Diego Novillo <dnovillo@redhat.com>
This file is part of GCC.
@@ -70,7 +70,7 @@ do_niy (pretty_printer *buffer, tree node)
pp_string (buffer, "<<< Unknown tree: ");
pp_string (buffer, tree_code_name[(int) TREE_CODE (node)]);
- if (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (node))))
+ if (EXPR_P (node))
{
len = first_rtl_op (TREE_CODE (node));
for (i = 0; i < len; ++i)
@@ -303,7 +303,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case CHAR_TYPE:
{
unsigned int quals = TYPE_QUALS (node);
- char class;
+ enum tree_code_class class;
if (quals & TYPE_QUAL_CONST)
pp_string (buffer, "const ");
@@ -314,14 +314,14 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
class = TREE_CODE_CLASS (TREE_CODE (node));
- if (class == 'd')
+ if (class == tcc_declaration)
{
if (DECL_NAME (node))
dump_decl_name (buffer, node, flags);
else
pp_string (buffer, "<unnamed type decl>");
}
- else if (class == 't')
+ else if (class == tcc_type)
{
if (TYPE_NAME (node))
{
@@ -1330,9 +1330,7 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
case GOTO_EXPR:
op0 = GOTO_DESTINATION (node);
- if (TREE_CODE (op0) != SSA_NAME
- && DECL_P (op0)
- && DECL_NAME (op0))
+ if (TREE_CODE (op0) != SSA_NAME && DECL_P (op0) && DECL_NAME (op0))
{
const char *name = IDENTIFIER_POINTER (DECL_NAME (op0));
if (strcmp (name, "break") == 0
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index e54d7d158fa..01a609acda2 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -1553,7 +1553,7 @@ find_new_referenced_vars_1 (tree *tp, int *walk_subtrees,
if (TREE_CODE (t) == VAR_DECL && !var_ann (t))
add_referenced_tmp_var (t);
- if (DECL_P (t) || TYPE_P (t))
+ if (IS_TYPE_OR_DECL_P (t))
*walk_subtrees = 0;
return NULL;
@@ -1903,7 +1903,7 @@ mark_notrap (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
TREE_THIS_NOTRAP (t) = 1;
*walk_subtrees = 0;
}
- else if (DECL_P (t) || TYPE_P (t))
+ else if (IS_TYPE_OR_DECL_P (t))
*walk_subtrees = 0;
return NULL;
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 2fe4069c3c0..ae06ea0680b 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -1790,7 +1790,7 @@ add_pointed_to_var (struct alias_info *ai, tree ptr, tree value)
gcc_assert (TREE_CODE (value) == ADDR_EXPR);
pt_var = TREE_OPERAND (value, 0);
- if (TREE_CODE_CLASS (TREE_CODE (pt_var)) == 'r')
+ if (REFERENCE_CLASS_P (pt_var))
pt_var = get_base_address (pt_var);
if (pt_var && SSA_VAR_P (pt_var))
diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c
index 54ff28a08dc..81ce67321c5 100644
--- a/gcc/tree-ssa-ccp.c
+++ b/gcc/tree-ssa-ccp.c
@@ -787,7 +787,7 @@ ccp_fold (tree stmt)
{
tree rhs = get_rhs (stmt);
enum tree_code code = TREE_CODE (rhs);
- int kind = TREE_CODE_CLASS (code);
+ enum tree_code_class kind = TREE_CODE_CLASS (code);
tree retval = NULL_TREE;
vuse_optype vuses;
@@ -805,7 +805,7 @@ ccp_fold (tree stmt)
/* Unary operators. Note that we know the single operand must
be a constant. So this should almost always return a
simplified RHS. */
- if (kind == '1')
+ if (kind == tcc_unary)
{
/* Handle unary operators which can appear in GIMPLE form. */
tree op0 = TREE_OPERAND (rhs, 0);
@@ -845,8 +845,8 @@ ccp_fold (tree stmt)
/* Binary and comparison operators. We know one or both of the
operands are constants. */
- else if (kind == '2'
- || kind == '<'
+ else if (kind == tcc_binary
+ || kind == tcc_comparison
|| code == TRUTH_AND_EXPR
|| code == TRUTH_OR_EXPR
|| code == TRUTH_XOR_EXPR)
@@ -2035,7 +2035,8 @@ fold_stmt (tree *stmt_p)
if (TREE_CODE (callee) == OBJ_TYPE_REF
&& lang_hooks.fold_obj_type_ref
&& TREE_CODE (OBJ_TYPE_REF_OBJECT (callee)) == ADDR_EXPR
- && DECL_P (TREE_OPERAND (OBJ_TYPE_REF_OBJECT (callee), 0)))
+ && DECL_P (TREE_OPERAND
+ (OBJ_TYPE_REF_OBJECT (callee), 0)))
{
tree t;
diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c
index fec54ab40fb..80357dcfc27 100644
--- a/gcc/tree-ssa-dce.c
+++ b/gcc/tree-ssa-dce.c
@@ -402,7 +402,7 @@ mark_stmt_if_obviously_necessary (tree stmt, bool aggressive)
a global variable. Otherwise, we check if the base variable
is a global. */
lhs = TREE_OPERAND (stmt, 0);
- if (TREE_CODE_CLASS (TREE_CODE (lhs)) == 'r')
+ if (REFERENCE_CLASS_P (lhs))
lhs = get_base_address (lhs);
if (lhs == NULL_TREE)
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index e0e0b46a9db..1953dfbde66 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -616,7 +616,7 @@ thread_across_edge (struct dom_walk_data *walk_data, edge e)
else
cond = SWITCH_COND (stmt);
- if (TREE_CODE_CLASS (TREE_CODE (cond)) == '<')
+ if (COMPARISON_CLASS_P (cond))
{
tree dummy_cond, op0, op1;
enum tree_code cond_code;
@@ -776,8 +776,7 @@ initialize_hash_element (tree expr, tree lhs, struct expr_hash_elt *element)
For the former case, we have no annotation and we want to hash the
conditional expression. In the latter case we have an annotation and
we want to record the expression the statement evaluates. */
- if (TREE_CODE_CLASS (TREE_CODE (expr)) == '<'
- || TREE_CODE (expr) == TRUTH_NOT_EXPR)
+ if (COMPARISON_CLASS_P (expr) || TREE_CODE (expr) == TRUTH_NOT_EXPR)
{
element->ann = NULL;
element->rhs = expr;
@@ -932,7 +931,7 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
}
else if ((last = last_stmt (bb))
&& TREE_CODE (last) == COND_EXPR
- && (TREE_CODE_CLASS (TREE_CODE (COND_EXPR_COND (last))) == '<'
+ && (COMPARISON_CLASS_P (COND_EXPR_COND (last))
|| TREE_CODE (COND_EXPR_COND (last)) == SSA_NAME)
&& bb->succ
&& (bb->succ->flags & EDGE_ABNORMAL) == 0
@@ -949,7 +948,7 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
cond = COND_EXPR_COND (last);
cond_code = TREE_CODE (cond);
- if (TREE_CODE_CLASS (cond_code) == '<')
+ if (TREE_CODE_CLASS (cond_code) == tcc_comparison)
inverted = invert_truthvalue (cond);
/* If the THEN arm is the end of a dominator tree or has PHI nodes,
@@ -965,7 +964,7 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
VARRAY_PUSH_TREE (const_and_copies_stack, NULL_TREE);
/* Record any equivalences created by following this edge. */
- if (TREE_CODE_CLASS (cond_code) == '<')
+ if (TREE_CODE_CLASS (cond_code) == tcc_comparison)
{
record_cond (cond, boolean_true_node);
record_dominating_conditions (cond);
@@ -989,7 +988,7 @@ dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
|| phi_nodes (false_edge->dest))
{
/* Record any equivalences created by following this edge. */
- if (TREE_CODE_CLASS (cond_code) == '<')
+ if (TREE_CODE_CLASS (cond_code) == tcc_comparison)
{
record_cond (cond, boolean_false_node);
record_cond (inverted, boolean_true_node);
@@ -1699,10 +1698,9 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data,
/* If the result is a suitable looking gimple expression,
then use it instead of the original for STMT. */
if (TREE_CODE (t) == SSA_NAME
- || (TREE_CODE_CLASS (TREE_CODE (t)) == '1'
+ || (UNARY_CLASS_P (t)
&& TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME)
- || ((TREE_CODE_CLASS (TREE_CODE (t)) == '2'
- || TREE_CODE_CLASS (TREE_CODE (t)) == '<')
+ || ((BINARY_CLASS_P (t) || COMPARISON_CLASS_P (t))
&& TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
&& is_gimple_val (TREE_OPERAND (t, 1))))
result = update_rhs_and_lookup_avail_expr (stmt, t, insert);
@@ -1920,7 +1918,7 @@ simplify_cond_and_lookup_avail_expr (tree stmt,
{
tree cond = COND_EXPR_COND (stmt);
- if (TREE_CODE_CLASS (TREE_CODE (cond)) == '<')
+ if (COMPARISON_CLASS_P (cond))
{
tree op0 = TREE_OPERAND (cond, 0);
tree op1 = TREE_OPERAND (cond, 1);
@@ -3023,7 +3021,7 @@ record_range (tree cond, basic_block bb, varray_type *vrp_variables_p)
{
/* We explicitly ignore NE_EXPRs. They rarely allow for meaningful
range optimizations and significantly complicate the implementation. */
- if (TREE_CODE_CLASS (TREE_CODE (cond)) == '<'
+ if (COMPARISON_CLASS_P (cond)
&& TREE_CODE (cond) != NE_EXPR
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (cond, 1))) == INTEGER_TYPE)
{
@@ -3091,7 +3089,7 @@ get_eq_expr_value (tree if_stmt,
/* If we have a comparison expression, then record its result into
the available expression table. */
- if (TREE_CODE_CLASS (TREE_CODE (cond)) == '<')
+ if (COMPARISON_CLASS_P (cond))
{
tree op0 = TREE_OPERAND (cond, 0);
tree op1 = TREE_OPERAND (cond, 1);
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index 9343ec2f50a..52c386001c9 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -172,7 +172,7 @@ record_single_argument_cond_exprs (varray_type cond_worklist,
if (cond_code == SSA_NAME
|| ((cond_code == EQ_EXPR || cond_code == NE_EXPR)
&& TREE_CODE (TREE_OPERAND (cond, 0)) == SSA_NAME
- && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (cond, 1))) == 'c'
+ && CONSTANT_CLASS_P (TREE_OPERAND (cond, 1))
&& INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (cond, 1)))))
{
tree def;
@@ -209,7 +209,7 @@ record_single_argument_cond_exprs (varray_type cond_worklist,
/* The first operand must be an SSA_NAME and the second
operand must be a constant. */
if (TREE_CODE (op0) != SSA_NAME
- || TREE_CODE_CLASS (TREE_CODE (op1)) != 'c'
+ || !CONSTANT_CLASS_P (op1)
|| !INTEGRAL_TYPE_P (TREE_TYPE (op1)))
continue;
}
@@ -223,7 +223,7 @@ record_single_argument_cond_exprs (varray_type cond_worklist,
/* If TEST_VAR is set from a relational operation
between two SSA_NAMEs or a combination of an SSA_NAME
and a constant, then it is interesting. */
- if (TREE_CODE_CLASS (TREE_CODE (def_rhs)) == '<')
+ if (COMPARISON_CLASS_P (def_rhs))
{
tree op0 = TREE_OPERAND (def_rhs, 0);
tree op1 = TREE_OPERAND (def_rhs, 1);
@@ -364,7 +364,7 @@ substitute_single_use_vars (varray_type *cond_worklist,
new_cond = build (cond_code, boolean_type_node, op0, t);
}
/* If the variable is defined by a conditional expression... */
- else if (TREE_CODE_CLASS (def_rhs_code) == '<')
+ else if (TREE_CODE_CLASS (def_rhs_code) == tcc_comparison)
{
/* TEST_VAR was set from a relational operator. */
tree op0 = TREE_OPERAND (def_rhs, 0);
@@ -382,7 +382,7 @@ substitute_single_use_vars (varray_type *cond_worklist,
/* If we did not get a simple relational expression or
bare SSA_NAME, then we can not optimize this case. */
- if (TREE_CODE_CLASS (TREE_CODE (new_cond)) != '<'
+ if (!COMPARISON_CLASS_P (new_cond)
&& TREE_CODE (new_cond) != SSA_NAME)
continue;
}
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index 3c4825ef03c..507f3782abb 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -1,5 +1,5 @@
/* Liveness for SSA trees.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
Contributed by Andrew MacLeod <amacleod@redhat.com>
This file is part of GCC.
@@ -297,7 +297,7 @@ mark_all_vars_used_1 (tree *tp, int *walk_subtrees,
if (TREE_CODE (t) == VAR_DECL)
set_is_used (t);
- if (DECL_P (t) || TYPE_P (t))
+ if (IS_TYPE_OR_DECL_P (t))
*walk_subtrees = 0;
return NULL;
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index bc606e60a8a..de8649173d0 100644
--- a/gcc/tree-ssa-loop-im.c
+++ b/gcc/tree-ssa-loop-im.c
@@ -1,5 +1,5 @@
/* Loop invariant motion.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@@ -256,7 +256,7 @@ outermost_invariant_loop (tree def, struct loop *loop)
static struct loop *
outermost_invariant_loop_expr (tree expr, struct loop *loop)
{
- char class = TREE_CODE_CLASS (TREE_CODE (expr));
+ enum tree_code_class class = TREE_CODE_CLASS (TREE_CODE (expr));
unsigned i, nops;
struct loop *max_loop = superloop_at_depth (loop, 1), *aloop;
@@ -265,10 +265,10 @@ outermost_invariant_loop_expr (tree expr, struct loop *loop)
|| is_gimple_min_invariant (expr))
return outermost_invariant_loop (expr, loop);
- if (class != '1'
- && class != '2'
- && class != 'e'
- && class != '<')
+ if (class != tcc_unary
+ && class != tcc_binary
+ && class != tcc_expression
+ && class != tcc_comparison)
return NULL;
nops = first_rtl_op (TREE_CODE (expr));
@@ -714,7 +714,7 @@ may_move_till (tree ref, tree *index, void *data)
static void
force_move_till_expr (tree expr, struct loop *orig_loop, struct loop *loop)
{
- char class = TREE_CODE_CLASS (TREE_CODE (expr));
+ enum tree_code_class class = TREE_CODE_CLASS (TREE_CODE (expr));
unsigned i, nops;
if (TREE_CODE (expr) == SSA_NAME)
@@ -727,10 +727,10 @@ force_move_till_expr (tree expr, struct loop *orig_loop, struct loop *loop)
return;
}
- if (class != '1'
- && class != '2'
- && class != 'e'
- && class != '<')
+ if (class != tcc_unary
+ && class != tcc_binary
+ && class != tcc_expression
+ && class != tcc_comparison)
return;
nops = first_rtl_op (TREE_CODE (expr));
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index e831b511088..078e8a36cf9 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -1,5 +1,5 @@
/* Induction variable optimizations.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@@ -721,7 +721,7 @@ static bool
contains_abnormal_ssa_name_p (tree expr)
{
enum tree_code code = TREE_CODE (expr);
- char class = TREE_CODE_CLASS (code);
+ enum tree_code_class class = TREE_CODE_CLASS (code);
if (code == SSA_NAME)
return SSA_NAME_OCCURS_IN_ABNORMAL_PHI (expr) != 0;
@@ -737,13 +737,13 @@ contains_abnormal_ssa_name_p (tree expr)
switch (class)
{
- case '2':
- case '<':
+ case tcc_binary:
+ case tcc_comparison:
if (contains_abnormal_ssa_name_p (TREE_OPERAND (expr, 1)))
return true;
/* Fallthru. */
- case '1':
+ case tcc_unary:
if (contains_abnormal_ssa_name_p (TREE_OPERAND (expr, 0)))
return true;
@@ -1347,21 +1347,20 @@ find_interesting_uses_stmt (struct ivopts_data *data, tree stmt)
switch (TREE_CODE_CLASS (TREE_CODE (rhs)))
{
- case '<':
+ case tcc_comparison:
find_interesting_uses_cond (data, stmt, &TREE_OPERAND (stmt, 1));
return;
- case 'r':
+ case tcc_reference:
find_interesting_uses_address (data, stmt, &TREE_OPERAND (stmt, 1));
- if (TREE_CODE_CLASS (TREE_CODE (lhs)) == 'r')
+ if (REFERENCE_CLASS_P (lhs))
find_interesting_uses_address (data, stmt, &TREE_OPERAND (stmt, 0));
return;
default: ;
}
- /* Handle memory = gimple_val. */
- if (TREE_CODE_CLASS (TREE_CODE (lhs)) == 'r'
+ if (REFERENCE_CLASS_P (lhs)
&& is_gimple_val (rhs))
{
find_interesting_uses_address (data, stmt, &TREE_OPERAND (stmt, 0));
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index a007b502aae..8aae4ca1c6d 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -1,5 +1,5 @@
/* SSA operands management for trees.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@@ -967,7 +967,7 @@ static void
get_expr_operands (tree stmt, tree *expr_p, int flags)
{
enum tree_code code;
- char class;
+ enum tree_code_class class;
tree expr = *expr_p;
if (expr == NULL || expr == error_mark_node)
@@ -1170,11 +1170,11 @@ get_expr_operands (tree stmt, tree *expr_p, int flags)
return;
default:
- if (class == '1')
+ if (class == tcc_unary)
goto do_unary;
- if (class == '2' || class == '<')
+ if (class == tcc_binary || class == tcc_comparison)
goto do_binary;
- if (class == 'c' || class == 't')
+ if (class == tcc_constant || class == tcc_type)
return;
}
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index bbdccf43777..5d7f0e4e03c 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -341,7 +341,7 @@ conditional_replacement (basic_block bb, tree phi, tree arg0, tree arg1)
if (old_result)
{
tree new1;
- if (TREE_CODE_CLASS (TREE_CODE (old_result)) != '<')
+ if (!COMPARISON_CLASS_P (old_result))
return false;
new1 = build (TREE_CODE (old_result), TREE_TYPE (result),
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index bf332f41b9b..cbaba2c2117 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -848,15 +848,21 @@ phi_translate (tree expr, value_set_t set, basic_block pred,
if (expr == NULL)
return NULL;
+ if (is_gimple_min_invariant (expr))
+ return expr;
+
/* Phi translations of a given expression don't change, */
phitrans = phi_trans_lookup (expr, pred);
if (phitrans)
return phitrans;
-
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
- case '2':
+ case tcc_reference:
+ /* XXX: Until we have PRE of loads working, none will be ANTIC. */
+ return NULL;
+
+ case tcc_binary:
{
tree oldop1 = TREE_OPERAND (expr, 0);
tree oldop2 = TREE_OPERAND (expr, 1);
@@ -884,13 +890,9 @@ phi_translate (tree expr, value_set_t set, basic_block pred,
phi_trans_add (oldexpr, newexpr, pred);
}
}
- break;
- /* XXX: Until we have PRE of loads working, none will be ANTIC.
- */
- case 'r':
- return NULL;
- break;
- case '1':
+ return expr;
+
+ case tcc_unary:
{
tree oldop1 = TREE_OPERAND (expr, 0);
tree newop1;
@@ -911,10 +913,9 @@ phi_translate (tree expr, value_set_t set, basic_block pred,
phi_trans_add (oldexpr, newexpr, pred);
}
}
- break;
- case 'd':
- gcc_unreachable ();
- case 'x':
+ return expr;
+
+ case tcc_exceptional:
{
tree phi = NULL;
int i;
@@ -934,9 +935,11 @@ phi_translate (tree expr, value_set_t set, basic_block pred,
return PHI_ARG_DEF (phi, i);
}
}
- break;
+ return expr;
+
+ default:
+ gcc_unreachable ();
}
- return expr;
}
static void
@@ -1046,34 +1049,31 @@ valid_in_set (value_set_t set, tree expr)
{
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
- case '2':
+ case tcc_binary:
{
tree op1 = TREE_OPERAND (expr, 0);
tree op2 = TREE_OPERAND (expr, 1);
return set_contains_value (set, op1) && set_contains_value (set, op2);
}
- break;
- case '1':
+
+ case tcc_unary:
{
tree op1 = TREE_OPERAND (expr, 0);
return set_contains_value (set, op1);
}
- break;
- /* XXX: Until PRE of loads works, no reference nodes are ANTIC.
- */
- case 'r':
- {
- return false;
- }
- case 'x':
- {
- gcc_assert (TREE_CODE (expr) == SSA_NAME);
- return true;
- }
- case 'c':
- gcc_unreachable ();
- }
- return false;
+
+ case tcc_reference:
+ /* XXX: Until PRE of loads works, no reference nodes are ANTIC. */
+ return false;
+
+ case tcc_exceptional:
+ gcc_assert (TREE_CODE (expr) == SSA_NAME);
+ return true;
+
+ default:
+ /* No other cases should be encountered. */
+ gcc_unreachable ();
+ }
}
/* Clean the set of expressions that are no longer valid in SET. This
@@ -1291,9 +1291,9 @@ find_or_generate_expression (basic_block block, tree expr, tree stmts)
if (genop == NULL)
{
genop = VALUE_HANDLE_EXPR_SET (expr)->head->expr;
- gcc_assert (TREE_CODE_CLASS (TREE_CODE (genop)) == '1'
- || TREE_CODE_CLASS (TREE_CODE (genop)) == '2'
- || TREE_CODE_CLASS (TREE_CODE (genop)) == 'r');
+ gcc_assert (UNARY_CLASS_P (genop)
+ || BINARY_CLASS_P (genop)
+ || REFERENCE_CLASS_P (genop));
genop = create_expression_by_pieces (block, genop, stmts);
}
return genop;
@@ -1323,7 +1323,7 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts)
switch (TREE_CODE_CLASS (TREE_CODE (expr)))
{
- case '2':
+ case tcc_binary:
{
tree_stmt_iterator tsi;
tree genop1, genop2;
@@ -1345,7 +1345,7 @@ create_expression_by_pieces (basic_block block, tree expr, tree stmts)
pre_stats.insertions++;
break;
}
- case '1':
+ case tcc_unary:
{
tree_stmt_iterator tsi;
tree genop1;
@@ -1423,8 +1423,8 @@ insert_aux (basic_block block)
node;
node = node->next)
{
- if (TREE_CODE_CLASS (TREE_CODE (node->expr)) == '2'
- || TREE_CODE_CLASS (TREE_CODE (node->expr)) == '1')
+ if (BINARY_CLASS_P (node->expr)
+ || UNARY_CLASS_P (node->expr))
{
tree *avail;
tree val;
@@ -1528,8 +1528,8 @@ insert_aux (basic_block block)
tree builtexpr;
bprime = pred->src;
eprime = avail[bprime->index];
- if (TREE_CODE_CLASS (TREE_CODE (eprime)) == '2'
- || TREE_CODE_CLASS (TREE_CODE (eprime)) == '1')
+ if (BINARY_CLASS_P (eprime)
+ || UNARY_CLASS_P (eprime))
{
builtexpr = create_expression_by_pieces (bprime,
eprime,
@@ -1668,13 +1668,13 @@ create_value_expr_from (tree expr, basic_block block, vuse_optype vuses)
enum tree_code code = TREE_CODE (expr);
tree vexpr;
- gcc_assert (TREE_CODE_CLASS (code) == '1'
- || TREE_CODE_CLASS (code) == '2'
- || TREE_CODE_CLASS (code) == 'r');
+ gcc_assert (TREE_CODE_CLASS (code) == tcc_unary
+ || TREE_CODE_CLASS (code) == tcc_binary
+ || TREE_CODE_CLASS (code) == tcc_reference);
- if (TREE_CODE_CLASS (code) == '1')
+ if (TREE_CODE_CLASS (code) == tcc_unary)
vexpr = pool_alloc (unary_node_pool);
- else if (TREE_CODE_CLASS (code) == 'r')
+ else if (TREE_CODE_CLASS (code) == tcc_reference)
vexpr = pool_alloc (reference_node_pool);
else
vexpr = pool_alloc (binary_node_pool);
@@ -1791,8 +1791,7 @@ compute_avail (basic_block block)
value_insert_into_set (EXP_GEN (block), rhs);
continue;
}
- else if (TREE_CODE_CLASS (TREE_CODE (rhs)) == '1'
- || TREE_CODE_CLASS (TREE_CODE (rhs)) == '2'
+ else if (UNARY_CLASS_P (rhs) || BINARY_CLASS_P (rhs)
|| TREE_CODE (rhs) == INDIRECT_REF)
{
/* For binary, unary, and reference expressions,
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c
index 8e65f6444a4..ffb7c9c00b0 100644
--- a/gcc/tree-ssa-propagate.c
+++ b/gcc/tree-ssa-propagate.c
@@ -564,13 +564,13 @@ set_rhs (tree *stmt_p, tree expr)
ssa_op_iter iter;
/* Verify the constant folded result is valid gimple. */
- if (TREE_CODE_CLASS (code) == '2')
+ if (TREE_CODE_CLASS (code) == tcc_binary)
{
if (!is_gimple_val (TREE_OPERAND (expr, 0))
|| !is_gimple_val (TREE_OPERAND (expr, 1)))
return false;
}
- else if (TREE_CODE_CLASS (code) == '1')
+ else if (TREE_CODE_CLASS (code) == tcc_unary)
{
if (!is_gimple_val (TREE_OPERAND (expr, 0)))
return false;
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c
index f79466da38a..21dc59aac02 100644
--- a/gcc/tree-ssa.c
+++ b/gcc/tree-ssa.c
@@ -1296,7 +1296,7 @@ warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data)
warn_uninit (t, "%H'%D' is used uninitialized in this function", locus);
*walk_subtrees = 0;
}
- else if (DECL_P (t) || TYPE_P (t))
+ else if (IS_TYPE_OR_DECL_P (t))
*walk_subtrees = 0;
return NULL_TREE;
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index d138a793ebf..55ba145c35a 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -1,5 +1,5 @@
/* Generic routines for manipulating SSA_NAME expressions
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@@ -184,9 +184,7 @@ make_ssa_name (tree var, tree stmt)
gcc_assert (DECL_P (var)
|| TREE_CODE (var) == INDIRECT_REF);
- gcc_assert (!stmt
- || IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (stmt)))
- || TREE_CODE (stmt) == PHI_NODE);
+ gcc_assert (!stmt || EXPR_P (stmt) || TREE_CODE (stmt) == PHI_NODE);
/* If our free list has an element, then use it. Also reuse the
SSA version number of the element on the free list which helps
diff --git a/gcc/tree-tailcall.c b/gcc/tree-tailcall.c
index e1c1f672ac6..6f3fdcaaf93 100644
--- a/gcc/tree-tailcall.c
+++ b/gcc/tree-tailcall.c
@@ -1,5 +1,5 @@
/* Tail call optimization on trees.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GCC.
@@ -279,7 +279,7 @@ process_assignment (tree ass, tree stmt, block_stmt_iterator call, tree *m,
return true;
}
- if (TREE_CODE_CLASS (code) != '2')
+ if (TREE_CODE_CLASS (code) != tcc_binary)
return false;
/* Accumulator optimizations will reverse the order of operations.
diff --git a/gcc/tree.c b/gcc/tree.c
index 05bbc1eaa92..f0c55e0acd3 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -50,6 +50,23 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "tree-flow.h"
#include "params.h"
+/* Each tree code class has an associated string representation.
+ These must correspond to the tree_code_class entries. */
+
+const char* tree_code_class_strings[] =
+ {
+ "exceptional",
+ "constant",
+ "type",
+ "declaration",
+ "reference",
+ "comparison",
+ "unary",
+ "binary",
+ "statement",
+ "expression",
+ };
+
/* obstack.[ch] explicitly declined to prototype this. */
extern int _obstack_allocated_p (struct obstack *h, void *obj);
@@ -155,22 +172,22 @@ tree_code_size (enum tree_code code)
switch (TREE_CODE_CLASS (code))
{
- case 'd': /* A decl node */
+ case tcc_declaration: /* A decl node */
return sizeof (struct tree_decl);
- case 't': /* a type node */
+ case tcc_type: /* a type node */
return sizeof (struct tree_type);
- case 'r': /* a reference */
- case 'e': /* an expression */
- case 's': /* an expression with side effects */
- case '<': /* a comparison expression */
- case '1': /* a unary arithmetic expression */
- case '2': /* a binary arithmetic expression */
+ case tcc_reference: /* a reference */
+ case tcc_expression: /* an expression */
+ case tcc_statement: /* an expression with side effects */
+ case tcc_comparison: /* a comparison expression */
+ case tcc_unary: /* a unary arithmetic expression */
+ case tcc_binary: /* a binary arithmetic expression */
return (sizeof (struct tree_exp)
+ (TREE_CODE_LENGTH (code) - 1) * sizeof (char *));
- case 'c': /* a constant */
+ case tcc_constant: /* a constant */
switch (code)
{
case INTEGER_CST: return sizeof (struct tree_int_cst);
@@ -182,7 +199,7 @@ tree_code_size (enum tree_code code)
return lang_hooks.tree_size (code);
}
- case 'x': /* something random, like an identifier. */
+ case tcc_exceptional: /* something random, like an identifier. */
switch (code)
{
case IDENTIFIER_NODE: return lang_hooks.identifier_size;
@@ -240,41 +257,41 @@ tree
make_node_stat (enum tree_code code MEM_STAT_DECL)
{
tree t;
- int type = TREE_CODE_CLASS (code);
+ enum tree_code_class type = TREE_CODE_CLASS (code);
size_t length = tree_code_size (code);
#ifdef GATHER_STATISTICS
tree_node_kind kind;
switch (type)
{
- case 'd': /* A decl node */
+ case tcc_declaration: /* A decl node */
kind = d_kind;
break;
- case 't': /* a type node */
+ case tcc_type: /* a type node */
kind = t_kind;
break;
- case 's': /* an expression with side effects */
+ case tcc_statement: /* an expression with side effects */
kind = s_kind;
break;
- case 'r': /* a reference */
+ case tcc_reference: /* a reference */
kind = r_kind;
break;
- case 'e': /* an expression */
- case '<': /* a comparison expression */
- case '1': /* a unary arithmetic expression */
- case '2': /* a binary arithmetic expression */
+ case tcc_expression: /* an expression */
+ case tcc_comparison: /* a comparison expression */
+ case tcc_unary: /* a unary arithmetic expression */
+ case tcc_binary: /* a binary arithmetic expression */
kind = e_kind;
break;
- case 'c': /* a constant */
+ case tcc_constant: /* a constant */
kind = c_kind;
break;
- case 'x': /* something random, like an identifier. */
+ case tcc_exceptional: /* something random, like an identifier. */
if (code == IDENTIFIER_NODE)
kind = id_kind;
else if (code == TREE_VEC)
@@ -290,9 +307,6 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
else
kind = x_kind;
break;
-
- default:
- gcc_unreachable ();
}
tree_node_counts[(int) kind]++;
@@ -307,11 +321,11 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
switch (type)
{
- case 's':
+ case tcc_statement:
TREE_SIDE_EFFECTS (t) = 1;
break;
- case 'd':
+ case tcc_declaration:
if (code != FUNCTION_DECL)
DECL_ALIGN (t) = 1;
DECL_USER_ALIGN (t) = 0;
@@ -323,7 +337,7 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
DECL_POINTER_ALIAS_SET (t) = -1;
break;
- case 't':
+ case tcc_type:
TYPE_UID (t) = next_type_uid++;
TYPE_ALIGN (t) = char_type_node ? TYPE_ALIGN (char_type_node) : 0;
TYPE_USER_ALIGN (t) = 0;
@@ -337,12 +351,12 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
TYPE_ALIAS_SET (t) = -1;
break;
- case 'c':
+ case tcc_constant:
TREE_CONSTANT (t) = 1;
TREE_INVARIANT (t) = 1;
break;
- case 'e':
+ case tcc_expression:
switch (code)
{
case INIT_EXPR:
@@ -361,6 +375,10 @@ make_node_stat (enum tree_code code MEM_STAT_DECL)
break;
}
break;
+
+ default:
+ /* Other classes need no special treatment. */
+ break;
}
return t;
@@ -387,9 +405,9 @@ copy_node_stat (tree node MEM_STAT_DECL)
TREE_VISITED (t) = 0;
t->common.ann = 0;
- if (TREE_CODE_CLASS (code) == 'd')
+ if (TREE_CODE_CLASS (code) == tcc_declaration)
DECL_UID (t) = next_decl_uid++;
- else if (TREE_CODE_CLASS (code) == 't')
+ else if (TREE_CODE_CLASS (code) == tcc_type)
{
TYPE_UID (t) = next_type_uid++;
/* The following is so that the debug code for
@@ -1566,9 +1584,9 @@ skip_simple_arithmetic (tree expr)
inner = expr;
while (1)
{
- if (TREE_CODE_CLASS (TREE_CODE (inner)) == '1')
+ if (UNARY_CLASS_P (inner))
inner = TREE_OPERAND (inner, 0);
- else if (TREE_CODE_CLASS (TREE_CODE (inner)) == '2')
+ else if (BINARY_CLASS_P (inner))
{
if (TREE_INVARIANT (TREE_OPERAND (inner, 1)))
inner = TREE_OPERAND (inner, 0);
@@ -1606,22 +1624,29 @@ tree_node_structure (tree t)
switch (TREE_CODE_CLASS (code))
{
- case 'd': return TS_DECL;
- case 't': return TS_TYPE;
- case 'r': case '<': case '1': case '2': case 'e': case 's':
+ case tcc_declaration:
+ return TS_DECL;
+ case tcc_type:
+ return TS_TYPE;
+ case tcc_reference:
+ case tcc_comparison:
+ case tcc_unary:
+ case tcc_binary:
+ case tcc_expression:
+ case tcc_statement:
return TS_EXP;
- default: /* 'c' and 'x' */
+ default: /* tcc_constant and tcc_exceptional */
break;
}
switch (code)
{
- /* 'c' cases. */
+ /* tcc_constant cases. */
case INTEGER_CST: return TS_INT_CST;
case REAL_CST: return TS_REAL_CST;
case COMPLEX_CST: return TS_COMPLEX;
case VECTOR_CST: return TS_VECTOR;
case STRING_CST: return TS_STRING;
- /* 'x' cases. */
+ /* tcc_exceptional cases. */
case ERROR_MARK: return TS_COMMON;
case IDENTIFIER_NODE: return TS_IDENTIFIER;
case TREE_LIST: return TS_LIST;
@@ -1656,22 +1681,23 @@ contains_placeholder_p (tree exp)
switch (TREE_CODE_CLASS (code))
{
- case 'r':
+ case tcc_reference:
/* Don't look at any PLACEHOLDER_EXPRs that might be in index or bit
position computations since they will be converted into a
WITH_RECORD_EXPR involving the reference, which will assume
here will be valid. */
return CONTAINS_PLACEHOLDER_P (TREE_OPERAND (exp, 0));
- case 'x':
+ case tcc_exceptional:
if (code == TREE_LIST)
return (CONTAINS_PLACEHOLDER_P (TREE_VALUE (exp))
|| CONTAINS_PLACEHOLDER_P (TREE_CHAIN (exp)));
break;
- case '1':
- case '2': case '<':
- case 'e':
+ case tcc_unary:
+ case tcc_binary:
+ case tcc_comparison:
+ case tcc_expression:
switch (code)
{
case COMPOUND_EXPR:
@@ -1823,7 +1849,7 @@ substitute_in_expr (tree exp, tree f, tree r)
/* If this expression is getting a value from a PLACEHOLDER_EXPR
and it is the right field, replace it with R. */
for (inner = TREE_OPERAND (exp, 0);
- TREE_CODE_CLASS (TREE_CODE (inner)) == 'r';
+ REFERENCE_CLASS_P (inner);
inner = TREE_OPERAND (inner, 0))
;
if (TREE_CODE (inner) == PLACEHOLDER_EXPR
@@ -1844,16 +1870,16 @@ substitute_in_expr (tree exp, tree f, tree r)
else
switch (TREE_CODE_CLASS (code))
{
- case 'c':
- case 'd':
+ case tcc_constant:
+ case tcc_declaration:
return exp;
- case 'x':
- case '1':
- case '2':
- case '<':
- case 'e':
- case 'r':
+ case tcc_exceptional:
+ case tcc_unary:
+ case tcc_binary:
+ case tcc_comparison:
+ case tcc_expression:
+ case tcc_reference:
switch (first_rtl_op (code))
{
case 0:
@@ -1922,10 +1948,10 @@ substitute_placeholder_in_expr (tree exp, tree obj)
elt = ((TREE_CODE (elt) == COMPOUND_EXPR
|| TREE_CODE (elt) == COND_EXPR)
? TREE_OPERAND (elt, 1)
- : (TREE_CODE_CLASS (TREE_CODE (elt)) == 'r'
- || TREE_CODE_CLASS (TREE_CODE (elt)) == '1'
- || TREE_CODE_CLASS (TREE_CODE (elt)) == '2'
- || TREE_CODE_CLASS (TREE_CODE (elt)) == 'e')
+ : (REFERENCE_CLASS_P (elt)
+ || UNARY_CLASS_P (elt)
+ || BINARY_CLASS_P (elt)
+ || EXPRESSION_CLASS_P (elt))
? TREE_OPERAND (elt, 0) : 0))
if (TYPE_MAIN_VARIANT (TREE_TYPE (elt)) == need_type)
return elt;
@@ -1934,10 +1960,10 @@ substitute_placeholder_in_expr (tree exp, tree obj)
elt = ((TREE_CODE (elt) == COMPOUND_EXPR
|| TREE_CODE (elt) == COND_EXPR)
? TREE_OPERAND (elt, 1)
- : (TREE_CODE_CLASS (TREE_CODE (elt)) == 'r'
- || TREE_CODE_CLASS (TREE_CODE (elt)) == '1'
- || TREE_CODE_CLASS (TREE_CODE (elt)) == '2'
- || TREE_CODE_CLASS (TREE_CODE (elt)) == 'e')
+ : (REFERENCE_CLASS_P (elt)
+ || UNARY_CLASS_P (elt)
+ || BINARY_CLASS_P (elt)
+ || EXPRESSION_CLASS_P (elt))
? TREE_OPERAND (elt, 0) : 0))
if (POINTER_TYPE_P (TREE_TYPE (elt))
&& (TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (elt)))
@@ -1963,17 +1989,17 @@ substitute_placeholder_in_expr (tree exp, tree obj)
else
switch (TREE_CODE_CLASS (code))
{
- case 'c':
- case 'd':
+ case tcc_constant:
+ case tcc_declaration:
return exp;
- case 'x':
- case '1':
- case '2':
- case '<':
- case 'e':
- case 'r':
- case 's':
+ case tcc_exceptional:
+ case tcc_unary:
+ case tcc_binary:
+ case tcc_comparison:
+ case tcc_expression:
+ case tcc_reference:
+ case tcc_statement:
switch (first_rtl_op (code))
{
case 0:
@@ -2145,13 +2171,13 @@ stabilize_reference_1 (tree e)
switch (TREE_CODE_CLASS (code))
{
- case 'x':
- case 't':
- case 'd':
- case '<':
- case 's':
- case 'e':
- case 'r':
+ case tcc_exceptional:
+ case tcc_type:
+ case tcc_declaration:
+ case tcc_comparison:
+ case tcc_statement:
+ case tcc_expression:
+ case tcc_reference:
/* If the expression has side-effects, then encase it in a SAVE_EXPR
so that it will only be evaluated once. */
/* The reference (r) and comparison (<) classes could be handled as
@@ -2160,12 +2186,12 @@ stabilize_reference_1 (tree e)
return save_expr (e);
return e;
- case 'c':
+ case tcc_constant:
/* Constants need no processing. In fact, we should never reach
here. */
return e;
- case '2':
+ case tcc_binary:
/* Division is slow and tends to be compiled with jumps,
especially the division by powers of 2 that is often
found inside of an array reference. So do it just once. */
@@ -2179,7 +2205,7 @@ stabilize_reference_1 (tree e)
stabilize_reference_1 (TREE_OPERAND (e, 1)));
break;
- case '1':
+ case tcc_unary:
/* Recursively stabilize each operand. */
result = build_nt (code, stabilize_reference_1 (TREE_OPERAND (e, 0)));
break;
@@ -2271,7 +2297,7 @@ do { tree _node = (NODE); \
else
ti = tc = false;
}
- else if (TREE_CODE_CLASS (TREE_CODE (node)) == 'c')
+ else if (CONSTANT_CLASS_P (node))
;
else
{
@@ -2319,10 +2345,10 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL)
#ifdef GATHER_STATISTICS
switch (TREE_CODE_CLASS (code))
{
- case 's': /* an expression with side effects */
+ case tcc_statement: /* an expression with side effects */
kind = s_kind;
break;
- case 'r': /* a reference */
+ case tcc_reference: /* a reference */
kind = r_kind;
break;
default:
@@ -2357,7 +2383,7 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL)
TREE_READONLY (t) = TREE_READONLY (node);
}
- if (TREE_CODE_CLASS (code) == 's')
+ if (TREE_CODE_CLASS (code) == tcc_statement)
TREE_SIDE_EFFECTS (t) = 1;
else switch (code)
{
@@ -2386,12 +2412,15 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL)
break;
default:
- if (TREE_CODE_CLASS (code) == '1' && node && !TYPE_P (node)
+ if (TREE_CODE_CLASS (code) == tcc_unary
+ && node && !TYPE_P (node)
&& TREE_CONSTANT (node))
TREE_CONSTANT (t) = 1;
- if (TREE_CODE_CLASS (code) == '1' && node && TREE_INVARIANT (node))
+ if (TREE_CODE_CLASS (code) == tcc_unary
+ && node && TREE_INVARIANT (node))
TREE_INVARIANT (t) = 1;
- if (TREE_CODE_CLASS (code) == 'r' && node && TREE_THIS_VOLATILE (node))
+ if (TREE_CODE_CLASS (code) == tcc_reference
+ && node && TREE_THIS_VOLATILE (node))
TREE_THIS_VOLATILE (t) = 1;
break;
}
@@ -2435,8 +2464,8 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
/* Expressions without side effects may be constant if their
arguments are as well. */
- constant = (TREE_CODE_CLASS (code) == '<'
- || TREE_CODE_CLASS (code) == '2');
+ constant = (TREE_CODE_CLASS (code) == tcc_comparison
+ || TREE_CODE_CLASS (code) == tcc_binary);
read_only = 1;
side_effects = TREE_SIDE_EFFECTS (t);
invariant = constant;
@@ -2449,7 +2478,8 @@ build2_stat (enum tree_code code, tree tt, tree arg0, tree arg1 MEM_STAT_DECL)
TREE_INVARIANT (t) = invariant;
TREE_SIDE_EFFECTS (t) = side_effects;
TREE_THIS_VOLATILE (t)
- = TREE_CODE_CLASS (code) == 'r' && arg0 && TREE_THIS_VOLATILE (arg0);
+ = (TREE_CODE_CLASS (code) == tcc_reference
+ && arg0 && TREE_THIS_VOLATILE (arg0));
return t;
}
@@ -2497,7 +2527,8 @@ build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
TREE_SIDE_EFFECTS (t) = side_effects;
TREE_THIS_VOLATILE (t)
- = TREE_CODE_CLASS (code) == 'r' && arg0 && TREE_THIS_VOLATILE (arg0);
+ = (TREE_CODE_CLASS (code) == tcc_reference
+ && arg0 && TREE_THIS_VOLATILE (arg0));
return t;
}
@@ -2526,7 +2557,8 @@ build4_stat (enum tree_code code, tree tt, tree arg0, tree arg1,
TREE_SIDE_EFFECTS (t) = side_effects;
TREE_THIS_VOLATILE (t)
- = TREE_CODE_CLASS (code) == 'r' && arg0 && TREE_THIS_VOLATILE (arg0);
+ = (TREE_CODE_CLASS (code) == tcc_reference
+ && arg0 && TREE_THIS_VOLATILE (arg0));
return t;
}
@@ -3829,12 +3861,12 @@ simple_cst_equal (tree t1, tree t2)
switch (TREE_CODE_CLASS (code1))
{
- case '1':
- case '2':
- case '<':
- case 'e':
- case 'r':
- case 's':
+ case tcc_unary:
+ case tcc_binary:
+ case tcc_comparison:
+ case tcc_expression:
+ case tcc_reference:
+ case tcc_statement:
cmp = 1;
for (i = 0; i < TREE_CODE_LENGTH (code1); i++)
{
@@ -3976,7 +4008,7 @@ iterative_hash_expr (tree t, hashval_t val)
default:
class = TREE_CODE_CLASS (code);
- if (class == 'd')
+ if (class == tcc_declaration)
{
/* Decls we can just compare by pointer. */
val = iterative_hash_pointer (t, val);
@@ -4774,7 +4806,8 @@ find_var_from_fn (tree *tp, int *walk_subtrees, void *data)
if (TYPE_P (*tp))
*walk_subtrees = 0;
- else if (DECL_P (*tp) && lang_hooks.tree_inlining.auto_var_in_fn_p (*tp, fn))
+ else if (DECL_P (*tp)
+ && lang_hooks.tree_inlining.auto_var_in_fn_p (*tp, fn))
return *tp;
return NULL_TREE;
@@ -5312,12 +5345,13 @@ tree_not_check_failed (const tree node, const char *file,
code, given in CL. */
void
-tree_class_check_failed (const tree node, int cl, const char *file,
- int line, const char *function)
+tree_class_check_failed (const tree node, const enum tree_code_class cl,
+ const char *file, int line, const char *function)
{
internal_error
- ("tree check: expected class %qc, have %qc (%s) in %s, at %s:%d",
- cl, TREE_CODE_CLASS (TREE_CODE (node)),
+ ("tree check: expected class %qs, have %qs (%s) in %s, at %s:%d",
+ TREE_CODE_CLASS_STRING (cl),
+ TREE_CODE_CLASS_STRING (TREE_CODE_CLASS (TREE_CODE (node))),
tree_code_name[TREE_CODE (node)], function, trim_filename (file), line);
}
diff --git a/gcc/tree.def b/gcc/tree.def
index fc7ed81a54f..c0507423671 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -21,49 +21,37 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
-/* The third argument can be:
- 'x' for an exceptional code (fits no category).
- 't' for a type object code.
- 'c' for codes for constants.
- 'd' for codes for declarations (also serving as variable refs).
- 'r' for codes for references to storage.
- '<' for codes for comparison expressions.
- '1' for codes for unary arithmetic expressions.
- '2' for codes for binary arithmetic expressions.
- 's' for codes for "statement" expressions, which have side-effects,
- but usually no interesting value.
- 'e' for codes for other kinds of expressions. */
-
-/* For `r', `e', `<', `1', `2', and `s' nodes, which use struct
- tree_exp, the 4th element is the number of argument slots to
- allocate. This determines the size of the tree node object.
- Other nodes use different structures, and the size is determined
- by the tree_union member structure; the 4th element should be
- zero. Languages that define language-specific 'x' or 'c' codes
- must define the tree_size langhook to say how big they are. */
+/* For tcc_references, tcc_expression, tcc_comparison, tcc_unary,
+ tcc_binary, and tcc_statement nodes, which use struct tree_exp, the
+ 4th element is the number of argument slots to allocate. This
+ determines the size of the tree node object. Other nodes use
+ different structures, and the size is determined by the tree_union
+ member structure; the 4th element should be zero. Languages that
+ define language-specific tcc_exceptional or tcc_constant codes must
+ define the tree_size langhook to say how big they are. */
/* Any erroneous construct is parsed into a node of this type.
This type of node is accepted without complaint in all contexts
by later parsing activities, to avoid multiple error messages
for one error.
No fields in these nodes are used except the TREE_CODE. */
-DEFTREECODE (ERROR_MARK, "error_mark", 'x', 0)
+DEFTREECODE (ERROR_MARK, "error_mark", tcc_exceptional, 0)
/* Used to represent a name (such as, in the DECL_NAME of a decl node).
Internally it looks like a STRING_CST node.
There is only one IDENTIFIER_NODE ever made for any particular name.
Use `get_identifier' to get it (or create it, the first time). */
-DEFTREECODE (IDENTIFIER_NODE, "identifier_node", 'x', 0)
+DEFTREECODE (IDENTIFIER_NODE, "identifier_node", tcc_exceptional, 0)
/* Has the TREE_VALUE and TREE_PURPOSE fields. */
/* These nodes are made into lists by chaining through the
TREE_CHAIN field. The elements of the list live in the
TREE_VALUE fields, while TREE_PURPOSE fields are occasionally
used as well to get the effect of Lisp association lists. */
-DEFTREECODE (TREE_LIST, "tree_list", 'x', 0)
+DEFTREECODE (TREE_LIST, "tree_list", tcc_exceptional, 0)
/* These nodes contain an array of tree nodes. */
-DEFTREECODE (TREE_VEC, "tree_vec", 'x', 0)
+DEFTREECODE (TREE_VEC, "tree_vec", tcc_exceptional, 0)
/* A symbol binding block. These are arranged in a tree,
where the BLOCK_SUBBLOCKS field contains a chain of subblocks
@@ -85,7 +73,7 @@ DEFTREECODE (TREE_VEC, "tree_vec", 'x', 0)
instance of an inline function).
TREE_ASM_WRITTEN is nonzero if the block was actually referenced
in the generated assembly. */
-DEFTREECODE (BLOCK, "block", 'x', 0)
+DEFTREECODE (BLOCK, "block", tcc_exceptional, 0)
/* Each data type is represented by a tree node whose code is one of
the following: */
@@ -130,7 +118,8 @@ DEFTREECODE (BLOCK, "block", 'x', 0)
ENUMERAL_TYPE, RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE nodes;
see below. */
-DEFTREECODE (VOID_TYPE, "void_type", 't', 0) /* The void type in C */
+DEFTREECODE (VOID_TYPE, "void_type", tcc_type, 0)
+ /* The void type in C */
/* Integer types in all languages, including char in C.
Also used for sub-ranges of other discrete types.
@@ -140,20 +129,20 @@ DEFTREECODE (VOID_TYPE, "void_type", 't', 0) /* The void type in C */
of this will point at the supertype (another INTEGER_TYPE,
or an ENUMERAL_TYPE, CHAR_TYPE, or BOOLEAN_TYPE).
Otherwise, the TREE_TYPE is zero. */
-DEFTREECODE (INTEGER_TYPE, "integer_type", 't', 0)
+DEFTREECODE (INTEGER_TYPE, "integer_type", tcc_type, 0)
/* C's float and double. Different floating types are distinguished
by machine mode and by the TYPE_SIZE and the TYPE_PRECISION. */
-DEFTREECODE (REAL_TYPE, "real_type", 't', 0)
+DEFTREECODE (REAL_TYPE, "real_type", tcc_type, 0)
/* Complex number types. The TREE_TYPE field is the data type
of the real and imaginary parts. */
-DEFTREECODE (COMPLEX_TYPE, "complex_type", 't', 0)
+DEFTREECODE (COMPLEX_TYPE, "complex_type", tcc_type, 0)
/* Vector types. The TREE_TYPE field is the data type of the vector
elements. The TYPE_PRECISION field is the number of subparts of
the vector. */
-DEFTREECODE (VECTOR_TYPE, "vector_type", 't', 0)
+DEFTREECODE (VECTOR_TYPE, "vector_type", tcc_type, 0)
/* C enums. The type node looks just like an INTEGER_TYPE node.
The symbols for the values of the enum type are defined by
@@ -166,39 +155,39 @@ DEFTREECODE (VECTOR_TYPE, "vector_type", 't', 0)
fields are filled in.
RECORD_TYPE, UNION_TYPE, and QUAL_UNION_TYPE forward refs are
treated similarly. */
-DEFTREECODE (ENUMERAL_TYPE, "enumeral_type", 't', 0)
+DEFTREECODE (ENUMERAL_TYPE, "enumeral_type", tcc_type, 0)
/* Pascal's boolean type (true or false are the only values);
no special fields needed. */
-DEFTREECODE (BOOLEAN_TYPE, "boolean_type", 't', 0)
+DEFTREECODE (BOOLEAN_TYPE, "boolean_type", tcc_type, 0)
/* CHAR in Pascal; not used in C.
No special fields needed. */
-DEFTREECODE (CHAR_TYPE, "char_type", 't', 0)
+DEFTREECODE (CHAR_TYPE, "char_type", tcc_type, 0)
/* All pointer-to-x types have code POINTER_TYPE.
The TREE_TYPE points to the node for the type pointed to. */
-DEFTREECODE (POINTER_TYPE, "pointer_type", 't', 0)
+DEFTREECODE (POINTER_TYPE, "pointer_type", tcc_type, 0)
/* An offset is a pointer relative to an object.
The TREE_TYPE field is the type of the object at the offset.
The TYPE_OFFSET_BASETYPE points to the node for the type of object
that the offset is relative to. */
-DEFTREECODE (OFFSET_TYPE, "offset_type", 't', 0)
+DEFTREECODE (OFFSET_TYPE, "offset_type", tcc_type, 0)
/* A reference is like a pointer except that it is coerced
automatically to the value it points to. Used in C++. */
-DEFTREECODE (REFERENCE_TYPE, "reference_type", 't', 0)
+DEFTREECODE (REFERENCE_TYPE, "reference_type", tcc_type, 0)
/* METHOD_TYPE is the type of a function which takes an extra first
argument for "self", which is not present in the declared argument list.
The TREE_TYPE is the return type of the method. The TYPE_METHOD_BASETYPE
is the type of "self". TYPE_ARG_TYPES is the real argument list, which
includes the hidden argument for "self". */
-DEFTREECODE (METHOD_TYPE, "method_type", 't', 0)
+DEFTREECODE (METHOD_TYPE, "method_type", tcc_type, 0)
/* Used for Pascal; details not determined right now. */
-DEFTREECODE (FILE_TYPE, "file_type", 't', 0)
+DEFTREECODE (FILE_TYPE, "file_type", tcc_type, 0)
/* Types of arrays. Special fields:
TREE_TYPE Type of an array element.
@@ -209,13 +198,13 @@ DEFTREECODE (FILE_TYPE, "file_type", 't', 0)
TYPE_STRING_FLAG indicates a string (in contrast to an array of chars)
in languages (such as Chill) that make a distinction. */
/* Array types in C or Pascal */
-DEFTREECODE (ARRAY_TYPE, "array_type", 't', 0)
+DEFTREECODE (ARRAY_TYPE, "array_type", tcc_type, 0)
/* Types of sets for Pascal. Special fields are the same as
in an array type. The target type is always a boolean type.
Used for both bitstrings and powersets in Chill;
TYPE_STRING_FLAG indicates a bitstring. */
-DEFTREECODE (SET_TYPE, "set_type", 't', 0)
+DEFTREECODE (SET_TYPE, "set_type", tcc_type, 0)
/* Struct in C, or record in Pascal. */
/* Special fields:
@@ -225,19 +214,19 @@ DEFTREECODE (SET_TYPE, "set_type", 't', 0)
A few may need to be added for Pascal. */
/* See the comment above, before ENUMERAL_TYPE, for how
forward references to struct tags are handled in C. */
-DEFTREECODE (RECORD_TYPE, "record_type", 't', 0)
+DEFTREECODE (RECORD_TYPE, "record_type", tcc_type, 0)
/* Union in C. Like a struct, except that the offsets of the fields
will all be zero. */
/* See the comment above, before ENUMERAL_TYPE, for how
forward references to union tags are handled in C. */
-DEFTREECODE (UNION_TYPE, "union_type", 't', 0) /* C union type */
+DEFTREECODE (UNION_TYPE, "union_type", tcc_type, 0) /* C union type */
/* Similar to UNION_TYPE, except that the expressions in DECL_QUALIFIER
in each FIELD_DECL determine what the union contains. The first
field whose DECL_QUALIFIER expression is true is deemed to occupy
the union. */
-DEFTREECODE (QUAL_UNION_TYPE, "qual_union_type", 't', 0)
+DEFTREECODE (QUAL_UNION_TYPE, "qual_union_type", tcc_type, 0)
/* Type of functions. Special fields:
TREE_TYPE type of value returned.
@@ -245,13 +234,13 @@ DEFTREECODE (QUAL_UNION_TYPE, "qual_union_type", 't', 0)
this list is made of TREE_LIST nodes.
Types of "Procedures" in languages where they are different from functions
have code FUNCTION_TYPE also, but then TREE_TYPE is zero or void type. */
-DEFTREECODE (FUNCTION_TYPE, "function_type", 't', 0)
+DEFTREECODE (FUNCTION_TYPE, "function_type", tcc_type, 0)
/* This is a language-specific kind of type.
Its meaning is defined by the language front end.
layout_type does not know how to lay this out,
so the front-end must do so manually. */
-DEFTREECODE (LANG_TYPE, "lang_type", 't', 0)
+DEFTREECODE (LANG_TYPE, "lang_type", tcc_type, 0)
/* Expressions */
@@ -265,20 +254,20 @@ DEFTREECODE (LANG_TYPE, "lang_type", 't', 0)
TREE_CONSTANT_OVERFLOW already set, it is known to be unique.
INTEGER_CST nodes are created for the integral types, for pointer
types and for vector and float types in some circumstances. */
-DEFTREECODE (INTEGER_CST, "integer_cst", 'c', 0)
+DEFTREECODE (INTEGER_CST, "integer_cst", tcc_constant, 0)
/* Contents are in TREE_REAL_CST field. */
-DEFTREECODE (REAL_CST, "real_cst", 'c', 0)
+DEFTREECODE (REAL_CST, "real_cst", tcc_constant, 0)
/* Contents are in TREE_REALPART and TREE_IMAGPART fields,
whose contents are other constant nodes. */
-DEFTREECODE (COMPLEX_CST, "complex_cst", 'c', 0)
+DEFTREECODE (COMPLEX_CST, "complex_cst", tcc_constant, 0)
/* Contents are in TREE_VECTOR_CST_ELTS field. */
-DEFTREECODE (VECTOR_CST, "vector_cst", 'c', 0)
+DEFTREECODE (VECTOR_CST, "vector_cst", tcc_constant, 0)
/* Contents are TREE_STRING_LENGTH and TREE_STRING_POINTER fields. */
-DEFTREECODE (STRING_CST, "string_cst", 'c', 0)
+DEFTREECODE (STRING_CST, "string_cst", tcc_constant, 0)
/* Declarations. All references to names are represented as ..._DECL
nodes. The decls in one binding context are chained through the
@@ -338,22 +327,23 @@ DEFTREECODE (STRING_CST, "string_cst", 'c', 0)
of a decl (i.e. one which is nested within an abstract instance of a
inline function. */
-DEFTREECODE (FUNCTION_DECL, "function_decl", 'd', 0)
-DEFTREECODE (LABEL_DECL, "label_decl", 'd', 0)
-DEFTREECODE (CONST_DECL, "const_decl", 'd', 0)
-DEFTREECODE (TYPE_DECL, "type_decl", 'd', 0)
-DEFTREECODE (VAR_DECL, "var_decl", 'd', 0)
-DEFTREECODE (PARM_DECL, "parm_decl", 'd', 0)
-DEFTREECODE (RESULT_DECL, "result_decl", 'd', 0)
-DEFTREECODE (FIELD_DECL, "field_decl", 'd', 0)
+DEFTREECODE (FUNCTION_DECL, "function_decl", tcc_declaration, 0)
+DEFTREECODE (LABEL_DECL, "label_decl", tcc_declaration, 0)
+DEFTREECODE (CONST_DECL, "const_decl", tcc_declaration, 0)
+DEFTREECODE (TYPE_DECL, "type_decl", tcc_declaration, 0)
+DEFTREECODE (VAR_DECL, "var_decl", tcc_declaration, 0)
+DEFTREECODE (PARM_DECL, "parm_decl", tcc_declaration, 0)
+DEFTREECODE (RESULT_DECL, "result_decl", tcc_declaration, 0)
+DEFTREECODE (FIELD_DECL, "field_decl", tcc_declaration, 0)
/* A namespace declaration. Namespaces appear in DECL_CONTEXT of other
_DECLs, providing a hierarchy of names. */
-DEFTREECODE (NAMESPACE_DECL, "namespace_decl", 'd', 0)
+DEFTREECODE (NAMESPACE_DECL, "namespace_decl", tcc_declaration, 0)
/* A translation unit. This is not technically a declaration, since it
can't be looked up, but it's close enough. */
-DEFTREECODE (TRANSLATION_UNIT_DECL, "translation_unit_decl", 'd', 0)
+DEFTREECODE (TRANSLATION_UNIT_DECL, "translation_unit_decl",\
+ tcc_declaration, 0)
/* References to storage. */
@@ -362,7 +352,7 @@ DEFTREECODE (TRANSLATION_UNIT_DECL, "translation_unit_decl", 'd', 0)
Operand 1 is the field (a node of type FIELD_DECL).
Operand 2, if present, is the value of DECL_FIELD_OFFSET, measured
in units of DECL_OFFSET_ALIGN / BITS_PER_UNIT. */
-DEFTREECODE (COMPONENT_REF, "component_ref", 'r', 3)
+DEFTREECODE (COMPONENT_REF, "component_ref", tcc_reference, 3)
/* Reference to a group of bits within an object. Similar to COMPONENT_REF
except the position is given explicitly rather than via a FIELD_DECL.
@@ -371,22 +361,22 @@ DEFTREECODE (COMPONENT_REF, "component_ref", 'r', 3)
operand 2 is a tree giving the position of the first referenced bit.
The field can be either a signed or unsigned field;
BIT_FIELD_REF_UNSIGNED says which. */
-DEFTREECODE (BIT_FIELD_REF, "bit_field_ref", 'r', 3)
+DEFTREECODE (BIT_FIELD_REF, "bit_field_ref", tcc_reference, 3)
/* C unary `*' or Pascal `^'. One operand, an expression for a pointer. */
-DEFTREECODE (INDIRECT_REF, "indirect_ref", 'r', 1)
+DEFTREECODE (INDIRECT_REF, "indirect_ref", tcc_reference, 1)
/* Array indexing.
Operand 0 is the array; operand 1 is a (single) array index.
Operand 2, if present, is a copy of TYPE_MIN_VALUE of the index.
Operand 3, if present, is the element size, measured in units of
the alignment of the element type. */
-DEFTREECODE (ARRAY_REF, "array_ref", 'r', 4)
+DEFTREECODE (ARRAY_REF, "array_ref", tcc_reference, 4)
/* Likewise, except that the result is a range ("slice") of the array. The
starting index of the resulting array is taken from operand 1 and the size
of the range is taken from the type of the expression. */
-DEFTREECODE (ARRAY_RANGE_REF, "array_range_ref", 'r', 4)
+DEFTREECODE (ARRAY_RANGE_REF, "array_range_ref", tcc_reference, 4)
/* Used to represent lookup of runtime type dependent data. Often this is
a reference to a vtable, but it needn't be. Operands are:
@@ -398,13 +388,13 @@ DEFTREECODE (ARRAY_RANGE_REF, "array_range_ref", 'r', 4)
reference to something simpler, usually to the address of a DECL.
Never touched by the middle-end. Good choices would be either an
identifier or a vtable index. */
-DEFTREECODE (OBJ_TYPE_REF, "obj_type_ref", 'e', 3)
+DEFTREECODE (OBJ_TYPE_REF, "obj_type_ref", tcc_expression, 3)
/* The exception object from the runtime. */
-DEFTREECODE (EXC_PTR_EXPR, "exc_ptr_expr", 'e', 0)
+DEFTREECODE (EXC_PTR_EXPR, "exc_ptr_expr", tcc_expression, 0)
/* The filter object from the runtime. */
-DEFTREECODE (FILTER_EXPR, "filter_expr", 'e', 0)
+DEFTREECODE (FILTER_EXPR, "filter_expr", tcc_expression, 0)
/* Constructor: return an aggregate value made from specified components.
In C, this is used only for structure and array initializers.
@@ -426,7 +416,7 @@ DEFTREECODE (FILTER_EXPR, "filter_expr", 'e', 0)
The TREE_VALUE specifies a value (index) in the set that is true.
If TREE_PURPOSE is non-NULL, it specifies the lower limit of a
range of true values. Elements not listed are false (not in the set). */
-DEFTREECODE (CONSTRUCTOR, "constructor", 'e', 1)
+DEFTREECODE (CONSTRUCTOR, "constructor", tcc_expression, 1)
/* The expression types are mostly straightforward, with the fourth argument
of DEFTREECODE saying how many operands there are.
@@ -436,14 +426,14 @@ DEFTREECODE (CONSTRUCTOR, "constructor", 'e', 1)
/* Contains two expressions to compute, one followed by the other.
the first value is ignored. The second one's value is used. The
type of the first expression need not agree with the other types. */
-DEFTREECODE (COMPOUND_EXPR, "compound_expr", 'e', 2)
+DEFTREECODE (COMPOUND_EXPR, "compound_expr", tcc_expression, 2)
/* Assignment expression. Operand 0 is the what to set; 1, the new value. */
-DEFTREECODE (MODIFY_EXPR, "modify_expr", 'e', 2)
+DEFTREECODE (MODIFY_EXPR, "modify_expr", tcc_expression, 2)
/* Initialization expression. Operand 0 is the variable to initialize;
Operand 1 is the initializer. */
-DEFTREECODE (INIT_EXPR, "init_expr", 'e', 2)
+DEFTREECODE (INIT_EXPR, "init_expr", tcc_expression, 2)
/* For TARGET_EXPR, operand 0 is the target of an initialization,
operand 1 is the initializer for the target, which may be void
@@ -451,7 +441,7 @@ DEFTREECODE (INIT_EXPR, "init_expr", 'e', 2)
operand 2 is the cleanup for this node, if any.
operand 3 is the saved initializer after this node has been
expanded once; this is so we can re-expand the tree later. */
-DEFTREECODE (TARGET_EXPR, "target_expr", 'e', 4)
+DEFTREECODE (TARGET_EXPR, "target_expr", tcc_expression, 4)
/* Conditional expression ( ... ? ... : ... in C).
Operand 0 is the condition.
@@ -461,7 +451,7 @@ DEFTREECODE (TARGET_EXPR, "target_expr", 'e', 4)
Operand 1 must have the same type as the entire expression, unless
it unconditionally throws an exception, in which case it should
have VOID_TYPE. The same constraints apply to operand 2. */
-DEFTREECODE (COND_EXPR, "cond_expr", 'e', 3)
+DEFTREECODE (COND_EXPR, "cond_expr", tcc_expression, 3)
/* Declare local variables, including making RTL and allocating space.
BIND_EXPR_VARS is a chain of VAR_DECL nodes for the variables.
@@ -484,25 +474,25 @@ DEFTREECODE (COND_EXPR, "cond_expr", 'e', 3)
In order for the BIND_EXPR to be known at all, the code that creates it
must also install it as a subblock in the tree of BLOCK
nodes for the function. */
-DEFTREECODE (BIND_EXPR, "bind_expr", 'e', 3)
+DEFTREECODE (BIND_EXPR, "bind_expr", tcc_expression, 3)
/* A labeled block. Operand 0 is the label that will be generated to
mark the end of the block.
Operand 1 is the labeled block body. */
-DEFTREECODE (LABELED_BLOCK_EXPR, "labeled_block_expr", 'e', 2)
+DEFTREECODE (LABELED_BLOCK_EXPR, "labeled_block_expr", tcc_expression, 2)
/* Function call. Operand 0 is the function.
Operand 1 is the argument list, a list of expressions
made out of a chain of TREE_LIST nodes.
Operand 2 is the static chain argument, or NULL. */
-DEFTREECODE (CALL_EXPR, "call_expr", 'e', 3)
+DEFTREECODE (CALL_EXPR, "call_expr", tcc_expression, 3)
/* Specify a value to compute along with its corresponding cleanup.
Operand 0 is the cleanup expression.
The cleanup is executed by the first enclosing CLEANUP_POINT_EXPR,
which must exist. This differs from TRY_CATCH_EXPR in that operand 1
is always evaluated when cleanups are run. */
-DEFTREECODE (WITH_CLEANUP_EXPR, "with_cleanup_expr", 'e', 1)
+DEFTREECODE (WITH_CLEANUP_EXPR, "with_cleanup_expr", tcc_expression, 1)
/* Specify a cleanup point.
Operand 0 is an expression that may have cleanups. If it does, those
@@ -519,7 +509,7 @@ DEFTREECODE (WITH_CLEANUP_EXPR, "with_cleanup_expr", 'e', 1)
As a consequence, the operand of a CLEANUP_POINT_EXPR must not have
BLKmode, because it will not be forced out of memory. */
-DEFTREECODE (CLEANUP_POINT_EXPR, "cleanup_point_expr", 'e', 1)
+DEFTREECODE (CLEANUP_POINT_EXPR, "cleanup_point_expr", tcc_expression, 1)
/* The following two codes are used in languages that have types where
some field in an object of the type contains a value that is used in
@@ -571,62 +561,62 @@ DEFTREECODE (CLEANUP_POINT_EXPR, "cleanup_point_expr", 'e', 1)
/* Denotes a record to later be substituted before evaluating this expression.
The type of this expression is used to find the record to replace it. */
-DEFTREECODE (PLACEHOLDER_EXPR, "placeholder_expr", 'x', 0)
+DEFTREECODE (PLACEHOLDER_EXPR, "placeholder_expr", tcc_exceptional, 0)
/* Simple arithmetic. */
-DEFTREECODE (PLUS_EXPR, "plus_expr", '2', 2)
-DEFTREECODE (MINUS_EXPR, "minus_expr", '2', 2)
-DEFTREECODE (MULT_EXPR, "mult_expr", '2', 2)
+DEFTREECODE (PLUS_EXPR, "plus_expr", tcc_binary, 2)
+DEFTREECODE (MINUS_EXPR, "minus_expr", tcc_binary, 2)
+DEFTREECODE (MULT_EXPR, "mult_expr", tcc_binary, 2)
/* Division for integer result that rounds the quotient toward zero. */
-DEFTREECODE (TRUNC_DIV_EXPR, "trunc_div_expr", '2', 2)
+DEFTREECODE (TRUNC_DIV_EXPR, "trunc_div_expr", tcc_binary, 2)
/* Division for integer result that rounds the quotient toward infinity. */
-DEFTREECODE (CEIL_DIV_EXPR, "ceil_div_expr", '2', 2)
+DEFTREECODE (CEIL_DIV_EXPR, "ceil_div_expr", tcc_binary, 2)
/* Division for integer result that rounds toward minus infinity. */
-DEFTREECODE (FLOOR_DIV_EXPR, "floor_div_expr", '2', 2)
+DEFTREECODE (FLOOR_DIV_EXPR, "floor_div_expr", tcc_binary, 2)
/* Division for integer result that rounds toward nearest integer. */
-DEFTREECODE (ROUND_DIV_EXPR, "round_div_expr", '2', 2)
+DEFTREECODE (ROUND_DIV_EXPR, "round_div_expr", tcc_binary, 2)
/* Four kinds of remainder that go with the four kinds of division. */
-DEFTREECODE (TRUNC_MOD_EXPR, "trunc_mod_expr", '2', 2)
-DEFTREECODE (CEIL_MOD_EXPR, "ceil_mod_expr", '2', 2)
-DEFTREECODE (FLOOR_MOD_EXPR, "floor_mod_expr", '2', 2)
-DEFTREECODE (ROUND_MOD_EXPR, "round_mod_expr", '2', 2)
+DEFTREECODE (TRUNC_MOD_EXPR, "trunc_mod_expr", tcc_binary, 2)
+DEFTREECODE (CEIL_MOD_EXPR, "ceil_mod_expr", tcc_binary, 2)
+DEFTREECODE (FLOOR_MOD_EXPR, "floor_mod_expr", tcc_binary, 2)
+DEFTREECODE (ROUND_MOD_EXPR, "round_mod_expr", tcc_binary, 2)
/* Division for real result. */
-DEFTREECODE (RDIV_EXPR, "rdiv_expr", '2', 2)
+DEFTREECODE (RDIV_EXPR, "rdiv_expr", tcc_binary, 2)
/* Division which is not supposed to need rounding.
Used for pointer subtraction in C. */
-DEFTREECODE (EXACT_DIV_EXPR, "exact_div_expr", '2', 2)
+DEFTREECODE (EXACT_DIV_EXPR, "exact_div_expr", tcc_binary, 2)
/* Conversion of real to fixed point: four ways to round,
like the four ways to divide.
CONVERT_EXPR can also be used to convert a real to an integer,
and that is what is used in languages that do not have ways of
specifying which of these is wanted. Maybe these are not needed. */
-DEFTREECODE (FIX_TRUNC_EXPR, "fix_trunc_expr", '1', 1)
-DEFTREECODE (FIX_CEIL_EXPR, "fix_ceil_expr", '1', 1)
-DEFTREECODE (FIX_FLOOR_EXPR, "fix_floor_expr", '1', 1)
-DEFTREECODE (FIX_ROUND_EXPR, "fix_round_expr", '1', 1)
+DEFTREECODE (FIX_TRUNC_EXPR, "fix_trunc_expr", tcc_unary, 1)
+DEFTREECODE (FIX_CEIL_EXPR, "fix_ceil_expr", tcc_unary, 1)
+DEFTREECODE (FIX_FLOOR_EXPR, "fix_floor_expr", tcc_unary, 1)
+DEFTREECODE (FIX_ROUND_EXPR, "fix_round_expr", tcc_unary, 1)
/* Conversion of an integer to a real. */
-DEFTREECODE (FLOAT_EXPR, "float_expr", '1', 1)
+DEFTREECODE (FLOAT_EXPR, "float_expr", tcc_unary, 1)
/* Unary negation. */
-DEFTREECODE (NEGATE_EXPR, "negate_expr", '1', 1)
+DEFTREECODE (NEGATE_EXPR, "negate_expr", tcc_unary, 1)
-DEFTREECODE (MIN_EXPR, "min_expr", '2', 2)
-DEFTREECODE (MAX_EXPR, "max_expr", '2', 2)
+DEFTREECODE (MIN_EXPR, "min_expr", tcc_binary, 2)
+DEFTREECODE (MAX_EXPR, "max_expr", tcc_binary, 2)
/* Represents the absolute value of the operand.
An ABS_EXPR must have either an INTEGER_TYPE or a REAL_TYPE. The
operand of the ABS_EXPR must have the same type. */
-DEFTREECODE (ABS_EXPR, "abs_expr", '1', 1)
+DEFTREECODE (ABS_EXPR, "abs_expr", tcc_unary, 1)
/* Shift operations for shift and rotate.
Shift means logical shift if done on an
@@ -635,16 +625,16 @@ DEFTREECODE (ABS_EXPR, "abs_expr", '1', 1)
shift by; it need not be the same type as the first operand and result.
Note that the result is undefined if the second operand is larger
than the first operand's type size. */
-DEFTREECODE (LSHIFT_EXPR, "lshift_expr", '2', 2)
-DEFTREECODE (RSHIFT_EXPR, "rshift_expr", '2', 2)
-DEFTREECODE (LROTATE_EXPR, "lrotate_expr", '2', 2)
-DEFTREECODE (RROTATE_EXPR, "rrotate_expr", '2', 2)
+DEFTREECODE (LSHIFT_EXPR, "lshift_expr", tcc_binary, 2)
+DEFTREECODE (RSHIFT_EXPR, "rshift_expr", tcc_binary, 2)
+DEFTREECODE (LROTATE_EXPR, "lrotate_expr", tcc_binary, 2)
+DEFTREECODE (RROTATE_EXPR, "rrotate_expr", tcc_binary, 2)
/* Bitwise operations. Operands have same mode as result. */
-DEFTREECODE (BIT_IOR_EXPR, "bit_ior_expr", '2', 2)
-DEFTREECODE (BIT_XOR_EXPR, "bit_xor_expr", '2', 2)
-DEFTREECODE (BIT_AND_EXPR, "bit_and_expr", '2', 2)
-DEFTREECODE (BIT_NOT_EXPR, "bit_not_expr", '1', 1)
+DEFTREECODE (BIT_IOR_EXPR, "bit_ior_expr", tcc_binary, 2)
+DEFTREECODE (BIT_XOR_EXPR, "bit_xor_expr", tcc_binary, 2)
+DEFTREECODE (BIT_AND_EXPR, "bit_and_expr", tcc_binary, 2)
+DEFTREECODE (BIT_NOT_EXPR, "bit_not_expr", tcc_unary, 1)
/* ANDIF and ORIF allow the second operand not to be computed if the
value of the expression is determined from the first operand. AND,
@@ -655,12 +645,12 @@ DEFTREECODE (BIT_NOT_EXPR, "bit_not_expr", '1', 1)
an INTEGER_TYPE VAR_DECL as its argument; instead, a NE_EXPR will be
used to compare the VAR_DECL to zero, thereby obtaining a node with
value zero or one. */
-DEFTREECODE (TRUTH_ANDIF_EXPR, "truth_andif_expr", 'e', 2)
-DEFTREECODE (TRUTH_ORIF_EXPR, "truth_orif_expr", 'e', 2)
-DEFTREECODE (TRUTH_AND_EXPR, "truth_and_expr", 'e', 2)
-DEFTREECODE (TRUTH_OR_EXPR, "truth_or_expr", 'e', 2)
-DEFTREECODE (TRUTH_XOR_EXPR, "truth_xor_expr", 'e', 2)
-DEFTREECODE (TRUTH_NOT_EXPR, "truth_not_expr", 'e', 1)
+DEFTREECODE (TRUTH_ANDIF_EXPR, "truth_andif_expr", tcc_expression, 2)
+DEFTREECODE (TRUTH_ORIF_EXPR, "truth_orif_expr", tcc_expression, 2)
+DEFTREECODE (TRUTH_AND_EXPR, "truth_and_expr", tcc_expression, 2)
+DEFTREECODE (TRUTH_OR_EXPR, "truth_or_expr", tcc_expression, 2)
+DEFTREECODE (TRUTH_XOR_EXPR, "truth_xor_expr", tcc_expression, 2)
+DEFTREECODE (TRUTH_NOT_EXPR, "truth_not_expr", tcc_expression, 1)
/* Relational operators.
`EQ_EXPR' and `NE_EXPR' are allowed for any types.
@@ -668,39 +658,39 @@ DEFTREECODE (TRUTH_NOT_EXPR, "truth_not_expr", 'e', 1)
or real types.
In all cases the operands will have the same type,
and the value is always the type used by the language for booleans. */
-DEFTREECODE (LT_EXPR, "lt_expr", '<', 2)
-DEFTREECODE (LE_EXPR, "le_expr", '<', 2)
-DEFTREECODE (GT_EXPR, "gt_expr", '<', 2)
-DEFTREECODE (GE_EXPR, "ge_expr", '<', 2)
-DEFTREECODE (EQ_EXPR, "eq_expr", '<', 2)
-DEFTREECODE (NE_EXPR, "ne_expr", '<', 2)
+DEFTREECODE (LT_EXPR, "lt_expr", tcc_comparison, 2)
+DEFTREECODE (LE_EXPR, "le_expr", tcc_comparison, 2)
+DEFTREECODE (GT_EXPR, "gt_expr", tcc_comparison, 2)
+DEFTREECODE (GE_EXPR, "ge_expr", tcc_comparison, 2)
+DEFTREECODE (EQ_EXPR, "eq_expr", tcc_comparison, 2)
+DEFTREECODE (NE_EXPR, "ne_expr", tcc_comparison, 2)
/* Additional relational operators for floating point unordered. */
-DEFTREECODE (UNORDERED_EXPR, "unordered_expr", '<', 2)
-DEFTREECODE (ORDERED_EXPR, "ordered_expr", '<', 2)
+DEFTREECODE (UNORDERED_EXPR, "unordered_expr", tcc_comparison, 2)
+DEFTREECODE (ORDERED_EXPR, "ordered_expr", tcc_comparison, 2)
/* These are equivalent to unordered or ... */
-DEFTREECODE (UNLT_EXPR, "unlt_expr", '<', 2)
-DEFTREECODE (UNLE_EXPR, "unle_expr", '<', 2)
-DEFTREECODE (UNGT_EXPR, "ungt_expr", '<', 2)
-DEFTREECODE (UNGE_EXPR, "unge_expr", '<', 2)
-DEFTREECODE (UNEQ_EXPR, "uneq_expr", '<', 2)
+DEFTREECODE (UNLT_EXPR, "unlt_expr", tcc_comparison, 2)
+DEFTREECODE (UNLE_EXPR, "unle_expr", tcc_comparison, 2)
+DEFTREECODE (UNGT_EXPR, "ungt_expr", tcc_comparison, 2)
+DEFTREECODE (UNGE_EXPR, "unge_expr", tcc_comparison, 2)
+DEFTREECODE (UNEQ_EXPR, "uneq_expr", tcc_comparison, 2)
/* This is the reverse of uneq_expr. */
-DEFTREECODE (LTGT_EXPR, "ltgt_expr", '<', 2)
+DEFTREECODE (LTGT_EXPR, "ltgt_expr", tcc_comparison, 2)
-DEFTREECODE (RANGE_EXPR, "range_expr", '2', 2)
+DEFTREECODE (RANGE_EXPR, "range_expr", tcc_binary, 2)
/* Represents a conversion of type of a value.
All conversions, including implicit ones, must be
represented by CONVERT_EXPR or NOP_EXPR nodes. */
-DEFTREECODE (CONVERT_EXPR, "convert_expr", '1', 1)
+DEFTREECODE (CONVERT_EXPR, "convert_expr", tcc_unary, 1)
/* Represents a conversion expected to require no code to be generated. */
-DEFTREECODE (NOP_EXPR, "nop_expr", '1', 1)
+DEFTREECODE (NOP_EXPR, "nop_expr", tcc_unary, 1)
/* Value is same as argument, but guaranteed not an lvalue. */
-DEFTREECODE (NON_LVALUE_EXPR, "non_lvalue_expr", '1', 1)
+DEFTREECODE (NON_LVALUE_EXPR, "non_lvalue_expr", tcc_unary, 1)
/* Represents viewing something of one type as being of a second type.
This corresponds to an "Unchecked Conversion" in Ada and roughly to
@@ -712,91 +702,91 @@ DEFTREECODE (NON_LVALUE_EXPR, "non_lvalue_expr", '1', 1)
case no actual data motion may occur. TREE_ADDRESSABLE will be set in
this case and GCC must abort if it could not do the operation without
generating insns. */
-DEFTREECODE (VIEW_CONVERT_EXPR, "view_convert_expr", 'r', 1)
+DEFTREECODE (VIEW_CONVERT_EXPR, "view_convert_expr", tcc_reference, 1)
/* Represents something we computed once and will use multiple times.
First operand is that expression. After it is evaluated once, it
will be replaced by the temporary variable that holds the value. */
-DEFTREECODE (SAVE_EXPR, "save_expr", 'e', 1)
+DEFTREECODE (SAVE_EXPR, "save_expr", tcc_expression, 1)
/* & in C. Value is the address at which the operand's value resides.
Operand may have any mode. Result mode is Pmode. */
-DEFTREECODE (ADDR_EXPR, "addr_expr", 'e', 1)
+DEFTREECODE (ADDR_EXPR, "addr_expr", tcc_expression, 1)
/* Operand0 is a function constant; result is part N of a function
descriptor of type ptr_mode. */
-DEFTREECODE (FDESC_EXPR, "fdesc_expr", 'e', 2)
+DEFTREECODE (FDESC_EXPR, "fdesc_expr", tcc_expression, 2)
/* Given two real or integer operands of the same type,
returns a complex value of the corresponding complex type. */
-DEFTREECODE (COMPLEX_EXPR, "complex_expr", '2', 2)
+DEFTREECODE (COMPLEX_EXPR, "complex_expr", tcc_binary, 2)
/* Complex conjugate of operand. Used only on complex types. */
-DEFTREECODE (CONJ_EXPR, "conj_expr", '1', 1)
+DEFTREECODE (CONJ_EXPR, "conj_expr", tcc_unary, 1)
/* Used only on an operand of complex type, these return
a value of the corresponding component type. */
-DEFTREECODE (REALPART_EXPR, "realpart_expr", 'r', 1)
-DEFTREECODE (IMAGPART_EXPR, "imagpart_expr", 'r', 1)
+DEFTREECODE (REALPART_EXPR, "realpart_expr", tcc_reference, 1)
+DEFTREECODE (IMAGPART_EXPR, "imagpart_expr", tcc_reference, 1)
/* Nodes for ++ and -- in C.
The second arg is how much to increment or decrement by.
For a pointer, it would be the size of the object pointed to. */
-DEFTREECODE (PREDECREMENT_EXPR, "predecrement_expr", 'e', 2)
-DEFTREECODE (PREINCREMENT_EXPR, "preincrement_expr", 'e', 2)
-DEFTREECODE (POSTDECREMENT_EXPR, "postdecrement_expr", 'e', 2)
-DEFTREECODE (POSTINCREMENT_EXPR, "postincrement_expr", 'e', 2)
+DEFTREECODE (PREDECREMENT_EXPR, "predecrement_expr", tcc_expression, 2)
+DEFTREECODE (PREINCREMENT_EXPR, "preincrement_expr", tcc_expression, 2)
+DEFTREECODE (POSTDECREMENT_EXPR, "postdecrement_expr", tcc_expression, 2)
+DEFTREECODE (POSTINCREMENT_EXPR, "postincrement_expr", tcc_expression, 2)
/* Used to implement `va_arg'. */
-DEFTREECODE (VA_ARG_EXPR, "va_arg_expr", 'e', 1)
+DEFTREECODE (VA_ARG_EXPR, "va_arg_expr", tcc_expression, 1)
/* Evaluate operand 1. If and only if an exception is thrown during
the evaluation of operand 1, evaluate operand 2.
This differs from TRY_FINALLY_EXPR in that operand 2 is not evaluated
on a normal or jump exit, only on an exception. */
-DEFTREECODE (TRY_CATCH_EXPR, "try_catch_expr", 's', 2)
+DEFTREECODE (TRY_CATCH_EXPR, "try_catch_expr", tcc_statement, 2)
/* Evaluate the first operand.
The second operand is a cleanup expression which is evaluated
on any exit (normal, exception, or jump out) from this expression. */
-DEFTREECODE (TRY_FINALLY_EXPR, "try_finally", 's', 2)
+DEFTREECODE (TRY_FINALLY_EXPR, "try_finally", tcc_statement, 2)
/* These types of expressions have no useful value,
and always have side effects. */
/* Used to represent a local declaration. The operand is DECL_EXPR_DECL. */
-DEFTREECODE (DECL_EXPR, "decl_expr", 's', 1)
+DEFTREECODE (DECL_EXPR, "decl_expr", tcc_statement, 1)
/* A label definition, encapsulated as a statement.
Operand 0 is the LABEL_DECL node for the label that appears here.
The type should be void and the value should be ignored. */
-DEFTREECODE (LABEL_EXPR, "label_expr", 's', 1)
+DEFTREECODE (LABEL_EXPR, "label_expr", tcc_statement, 1)
/* GOTO. Operand 0 is a LABEL_DECL node or an expression.
The type should be void and the value should be ignored. */
-DEFTREECODE (GOTO_EXPR, "goto_expr", 's', 1)
+DEFTREECODE (GOTO_EXPR, "goto_expr", tcc_statement, 1)
/* RETURN. Evaluates operand 0, then returns from the current function.
Presumably that operand is an assignment that stores into the
RESULT_DECL that hold the value to be returned.
The operand may be null.
The type should be void and the value should be ignored. */
-DEFTREECODE (RETURN_EXPR, "return_expr", 's', 1)
+DEFTREECODE (RETURN_EXPR, "return_expr", tcc_statement, 1)
/* Exit the inner most loop conditionally. Operand 0 is the condition.
The type should be void and the value should be ignored. */
-DEFTREECODE (EXIT_EXPR, "exit_expr", 's', 1)
+DEFTREECODE (EXIT_EXPR, "exit_expr", tcc_statement, 1)
/* A loop. Operand 0 is the body of the loop.
It must contain an EXIT_EXPR or is an infinite loop.
The type should be void and the value should be ignored. */
-DEFTREECODE (LOOP_EXPR, "loop_expr", 's', 1)
+DEFTREECODE (LOOP_EXPR, "loop_expr", tcc_statement, 1)
/* Exit a labeled block, possibly returning a value. Operand 0 is a
LABELED_BLOCK_EXPR to exit. Operand 1 is the value to return. It
may be left null. */
-DEFTREECODE (EXIT_BLOCK_EXPR, "exit_block_expr", 's', 2)
+DEFTREECODE (EXIT_BLOCK_EXPR, "exit_block_expr", tcc_statement, 2)
/* Switch expression.
@@ -810,28 +800,28 @@ DEFTREECODE (EXIT_BLOCK_EXPR, "exit_block_expr", 's', 2)
must not be NULL.
Operand 2 is either NULL_TREE or a TREE_VEC of the CASE_LABEL_EXPRs
of all the cases. */
-DEFTREECODE (SWITCH_EXPR, "switch_expr", 's', 3)
+DEFTREECODE (SWITCH_EXPR, "switch_expr", tcc_statement, 3)
/* Used to represent a case label. The operands are CASE_LOW and
CASE_HIGH, respectively. If CASE_LOW is NULL_TREE, the label is a
'default' label. If CASE_HIGH is NULL_TREE, the label is a normal case
label. CASE_LABEL is the corresponding LABEL_DECL. */
-DEFTREECODE (CASE_LABEL_EXPR, "case_label_expr", 's', 3)
+DEFTREECODE (CASE_LABEL_EXPR, "case_label_expr", tcc_statement, 3)
/* RESX. Resume execution after an exception. Operand 0 is a
number indicating the exception region that is being left. */
-DEFTREECODE (RESX_EXPR, "resx_expr", 's', 1)
+DEFTREECODE (RESX_EXPR, "resx_expr", tcc_statement, 1)
/* Used to represent an inline assembly statement. ASM_STRING returns a
STRING_CST for the instruction (e.g., "mov x, y"). ASM_OUTPUTS,
ASM_INPUTS, and ASM_CLOBBERS represent the outputs, inputs, and clobbers
for the statement. */
-DEFTREECODE (ASM_EXPR, "asm_expr", 's', 4)
+DEFTREECODE (ASM_EXPR, "asm_expr", tcc_statement, 4)
/* Variable references for SSA analysis. New SSA names are created every
time a variable is assigned a new value. The SSA builder uses SSA_NAME
nodes to implement SSA versioning. */
-DEFTREECODE (SSA_NAME, "ssa_name", 'x', 0)
+DEFTREECODE (SSA_NAME, "ssa_name", tcc_exceptional, 0)
/* SSA PHI operator. PHI_RESULT is the new SSA_NAME node created by
the PHI node. PHI_ARG_LENGTH is the number of arguments.
@@ -839,50 +829,50 @@ DEFTREECODE (SSA_NAME, "ssa_name", 'x', 0)
argument list. Each tuple contains the incoming reaching
definition (SSA_NAME node) and the edge via which that definition
is coming through. */
-DEFTREECODE (PHI_NODE, "phi_node", 'x', 0)
+DEFTREECODE (PHI_NODE, "phi_node", tcc_exceptional, 0)
/* Used to represent a typed exception handler. CATCH_TYPES is the type (or
list of types) handled, and CATCH_BODY is the code for the handler. */
-DEFTREECODE (CATCH_EXPR, "catch_expr", 's', 2)
+DEFTREECODE (CATCH_EXPR, "catch_expr", tcc_statement, 2)
/* Used to represent an exception specification. EH_FILTER_TYPES is a list
of allowed types, and EH_FILTER_FAILURE is an expression to evaluate on
failure. EH_FILTER_MUST_NOT_THROW controls which range type to use when
expanding. */
-DEFTREECODE (EH_FILTER_EXPR, "eh_filter_expr", 's', 2)
+DEFTREECODE (EH_FILTER_EXPR, "eh_filter_expr", tcc_statement, 2)
/* Node used for describing a property that is known at compile
time. */
-DEFTREECODE (SCEV_KNOWN, "scev_known", 'e', 0)
+DEFTREECODE (SCEV_KNOWN, "scev_known", tcc_expression, 0)
/* Node used for describing a property that is not known at compile
time. */
-DEFTREECODE (SCEV_NOT_KNOWN, "scev_not_known", 'e', 0)
+DEFTREECODE (SCEV_NOT_KNOWN, "scev_not_known", tcc_expression, 0)
/* Polynomial chains of recurrences.
Under the form: cr = {CHREC_LEFT (cr), +, CHREC_RIGHT (cr)}. */
-DEFTREECODE (POLYNOMIAL_CHREC, "polynomial_chrec", 'e', 3)
+DEFTREECODE (POLYNOMIAL_CHREC, "polynomial_chrec", tcc_expression, 3)
/* Used to chain children of container statements together.
Use the interface in tree-iterator.h to access this node. */
-DEFTREECODE (STATEMENT_LIST, "statement_list", 'x', 0)
+DEFTREECODE (STATEMENT_LIST, "statement_list", tcc_exceptional, 0)
/* Value handles. Artificial nodes to represent expressions in
partial redundancy elimination (tree-ssa-pre.c). These nodes are
used for expression canonicalization. If two expressions compute
the same value, they will be assigned the same value handle. */
-DEFTREECODE (VALUE_HANDLE, "value_handle", 'x', 0)
+DEFTREECODE (VALUE_HANDLE, "value_handle", tcc_exceptional, 0)
/* Base class information. Holds information about a class as a
baseclass of itself or another class. */
-DEFTREECODE (TREE_BINFO, "tree_binfo", 'x', 0)
+DEFTREECODE (TREE_BINFO, "tree_binfo", tcc_exceptional, 0)
/* Records the size for an expression of variable size type. This is
for use in contexts in which we are accessing the entire object,
such as for a function call, or block copy.
Operand 0 is the real expression.
Operand 1 is the size of the type in the expression. */
-DEFTREECODE (WITH_SIZE_EXPR, "with_size_expr", 'e', 2)
+DEFTREECODE (WITH_SIZE_EXPR, "with_size_expr", tcc_expression, 2)
/*
Local variables:
diff --git a/gcc/tree.h b/gcc/tree.h
index 19ba2201b84..83f90b7773a 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -43,25 +43,103 @@ enum tree_code {
/* Number of language-independent tree codes. */
#define NUM_TREE_CODES ((int) LAST_AND_UNUSED_TREE_CODE)
-/* Indexed by enum tree_code, contains a character which is
- `<' for a comparison expression, `1', for a unary arithmetic
- expression, `2' for a binary arithmetic expression, `e' for
- other types of expressions, `r' for a reference, `c' for a
- constant, `d' for a decl, `t' for a type, `s' for a statement,
- and `x' for anything else (TREE_LIST, IDENTIFIER, etc). */
+/* Tree code classes. */
+
+/* Each tree_code has an associated code class represented by a
+ TREE_CODE_CLASS. */
+
+enum tree_code_class {
+ tcc_exceptional, /* An exceptional code (fits no category). */
+ tcc_constant, /* A constant. */
+ tcc_type, /* A type object code. */
+ tcc_declaration, /* A declaration (also serving as variable refs). */
+ tcc_reference, /* A reference to storage. */
+ tcc_comparison, /* A comparison expression. */
+ tcc_unary, /* A unary arithmetic expression. */
+ tcc_binary, /* A binary arithmetic expression. */
+ tcc_statement, /* A statement expression, which have side effects
+ but usually no interesting value. */
+ tcc_expression /* Any other expression. */
+};
+
+/* Each tree code class has an associated string representation.
+ These must correspond to the tree_code_class entries. */
+
+extern const char* tree_code_class_strings[];
+
+/* Returns the string representing CLASS. */
+
+#define TREE_CODE_CLASS_STRING(CLASS)\
+ tree_code_class_strings[(int) (CLASS)]
#define MAX_TREE_CODES 256
-extern const char tree_code_type[];
+extern const enum tree_code_class tree_code_type[];
#define TREE_CODE_CLASS(CODE) tree_code_type[(int) (CODE)]
+/* Nonzero if CODE represents an exceptional code. */
+
+#define EXCEPTIONAL_CLASS_P(CODE)\
+ (TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_exceptional)
+
+/* Nonzero if CODE represents a constant. */
+
+#define CONSTANT_CLASS_P(CODE)\
+ (TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_constant)
+
+/* Nonzero if CODE represents a type. */
+
+#define TYPE_P(CODE)\
+ (TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_type)
+
+/* Nonzero if CODE represents a declaration. */
+
+#define DECL_P(CODE)\
+ (TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_declaration)
+
+/* Nonzero if CODE represents a reference. */
+
+#define REFERENCE_CLASS_P(CODE)\
+ (TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_reference)
+
+/* Nonzero if CODE represents a comparison. */
+
+#define COMPARISON_CLASS_P(CODE)\
+ (TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_comparison)
+
+/* Nonzero if CODE represents a unary arithmetic expression. */
+
+#define UNARY_CLASS_P(CODE)\
+ (TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_unary)
+
+/* Nonzero if CODE represents a binary arithmetic expression. */
+
+#define BINARY_CLASS_P(CODE)\
+ (TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_binary)
+
+/* Nonzero if CODE represents a statement expression. */
+
+#define STATEMENT_CLASS_P(CODE)\
+ (TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_statement)
+
+/* Nonzero if CODE represents any other expression. */
+
+#define EXPRESSION_CLASS_P(CODE)\
+ (TREE_CODE_CLASS (TREE_CODE (CODE)) == tcc_expression)
+
/* Returns nonzero iff CLASS is not the tree code of a type. */
-#define IS_NON_TYPE_CODE_CLASS(CLASS) ((CLASS) != 't')
+#define IS_NON_TYPE_CODE_CLASS(CLASS) ((CLASS) != tcc_type)
+
+/* Returns nonzero iff CODE represents a type or declaration. */
+
+#define IS_TYPE_OR_DECL_P(CODE)\
+ (TYPE_P (CODE) || DECL_P (CODE))
/* Returns nonzero iff CLASS is the tree-code class of an
expression. */
-#define IS_EXPR_CODE_CLASS(CLASS) (strchr ("<12ers", (CLASS)) != 0)
+#define IS_EXPR_CODE_CLASS(CLASS)\
+ (((CLASS) >= tcc_reference) && ((CLASS) <= tcc_expression))
/* Returns nonzero iff NODE is an expression of some kind. */
@@ -448,7 +526,7 @@ struct tree_common GTY(())
({ const tree __t = (T); \
char const __c = TREE_CODE_CLASS (TREE_CODE (__t)); \
if (!IS_EXPR_CODE_CLASS (__c)) \
- tree_class_check_failed (__t, 'E', __FILE__, __LINE__, \
+ tree_class_check_failed (__t, tcc_expression, __FILE__, __LINE__, \
__FUNCTION__); \
__t; })
@@ -457,7 +535,7 @@ struct tree_common GTY(())
({ const tree __t = (T); \
char const __c = TREE_CODE_CLASS (TREE_CODE (__t)); \
if (!IS_NON_TYPE_CODE_CLASS (__c)) \
- tree_class_check_failed (__t, 'T', __FILE__, __LINE__, \
+ tree_class_check_failed (__t, tcc_type, __FILE__, __LINE__, \
__FUNCTION__); \
__t; })
@@ -517,7 +595,7 @@ extern void tree_check_failed (const tree, const char *, int, const char *,
...) ATTRIBUTE_NORETURN;
extern void tree_not_check_failed (const tree, const char *, int, const char *,
...) ATTRIBUTE_NORETURN;
-extern void tree_class_check_failed (const tree, int,
+extern void tree_class_check_failed (const tree, const enum tree_code_class,
const char *, int, const char *)
ATTRIBUTE_NORETURN;
extern void tree_vec_elt_check_failed (int, int, const char *,
@@ -557,10 +635,10 @@ extern void tree_operand_check_failed (int, enum tree_code,
#include "tree-check.h"
-#define TYPE_CHECK(T) TREE_CLASS_CHECK (T, 't')
-#define DECL_CHECK(T) TREE_CLASS_CHECK (T, 'd')
-#define CST_CHECK(T) TREE_CLASS_CHECK (T, 'c')
-#define STMT_CHECK(T) TREE_CLASS_CHECK (T, 's')
+#define TYPE_CHECK(T) TREE_CLASS_CHECK (T, tcc_type)
+#define DECL_CHECK(T) TREE_CLASS_CHECK (T, tcc_declaration)
+#define CST_CHECK(T) TREE_CLASS_CHECK (T, tcc_constant)
+#define STMT_CHECK(T) TREE_CLASS_CHECK (T, tcc_statement)
#define FUNC_OR_METHOD_CHECK(T) TREE_CHECK2 (T, FUNCTION_TYPE, METHOD_TYPE)
#define PTR_OR_REF_CHECK(T) TREE_CHECK2 (T, POINTER_TYPE, REFERENCE_TYPE)
@@ -712,9 +790,6 @@ extern void tree_operand_check_failed (int, enum tree_code,
#define COMPLETE_OR_UNBOUND_ARRAY_TYPE_P(NODE) \
(COMPLETE_TYPE_P (TREE_CODE (NODE) == ARRAY_TYPE ? TREE_TYPE (NODE) : (NODE)))
-/* Nonzero if TYPE represents a type. */
-
-#define TYPE_P(TYPE) (TREE_CODE_CLASS (TREE_CODE (TYPE)) == 't')
/* Define many boolean fields that all tree nodes have. */
@@ -839,7 +914,8 @@ extern void tree_operand_check_failed (int, enum tree_code,
#define TREE_READONLY(NODE) (NON_TYPE_CHECK (NODE)->common.readonly_flag)
/* Nonzero if NODE is a _DECL with TREE_READONLY set. */
-#define TREE_READONLY_DECL_P(NODE) (DECL_P (NODE) && TREE_READONLY (NODE))
+#define TREE_READONLY_DECL_P(NODE)\
+ (DECL_P (NODE) && TREE_READONLY (NODE))
/* Value of expression is constant. Always on in all ..._CST nodes. May
also appear in an expression or decl where the value is constant. */
@@ -1091,17 +1167,13 @@ struct tree_vec GTY(())
decls and constants can be shared among multiple locations, so
return nothing. */
#define EXPR_LOCATION(NODE) \
- (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE))) \
- ? (NODE)->exp.locus \
- : UNKNOWN_LOCATION)
+ (EXPR_P (NODE) ? (NODE)->exp.locus : UNKNOWN_LOCATION)
#define SET_EXPR_LOCATION(NODE, FROM) \
(EXPR_CHECK (NODE)->exp.locus = (FROM))
#define EXPR_HAS_LOCATION(NODE) (EXPR_LOCATION (NODE) != UNKNOWN_LOCATION)
/* EXPR_LOCUS and SET_EXPR_LOCUS are deprecated. */
#define EXPR_LOCUS(NODE) \
- (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE))) \
- ? &(NODE)->exp.locus \
- : (location_t *)NULL)
+ (EXPR_P (NODE) ? &(NODE)->exp.locus : (location_t *)NULL)
#define SET_EXPR_LOCUS(NODE, FROM) \
do { source_location *loc_tmp = FROM; \
EXPR_CHECK (NODE)->exp.locus \
@@ -1115,9 +1187,7 @@ struct tree_vec GTY(())
decls and constants can be shared among multiple locations, so
return nothing. */
#define EXPR_LOCUS(NODE) \
- (IS_EXPR_CODE_CLASS (TREE_CODE_CLASS (TREE_CODE (NODE))) \
- ? (NODE)->exp.locus \
- : (location_t *)NULL)
+ (EXPR_P (NODE) ? (NODE)->exp.locus : (location_t *)NULL)
#define SET_EXPR_LOCUS(NODE, FROM) \
(EXPR_CHECK (NODE)->exp.locus = (FROM))
#define SET_EXPR_LOCATION(NODE, FROM) annotate_with_locus (NODE, FROM)
@@ -1753,9 +1823,6 @@ struct tree_binfo GTY (())
/* Define fields and accessors for nodes representing declared names. */
-/* Nonzero if DECL represents a decl. */
-#define DECL_P(DECL) (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'd')
-
/* Nonzero if DECL represents a variable for the SSA passes. */
#define SSA_VAR_P(DECL) \
(TREE_CODE (DECL) == VAR_DECL \
diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog
index e53d82499f8..773a50a5e46 100644
--- a/gcc/treelang/ChangeLog
+++ b/gcc/treelang/ChangeLog
@@ -1,3 +1,8 @@
+2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com>
+ Zack Weinberg <zack@codesourcery.com>
+
+ * treetree.c: Update for new tree-class enumeration constants.
+
2004-09-15 Zack Weinberg <zack@codesourcery.com>
* Make-lang.in (treelang-warn): Set to $(STRICT_WARN).
diff --git a/gcc/treelang/treetree.c b/gcc/treelang/treetree.c
index c86918c7f6c..e0a220fe65d 100644
--- a/gcc/treelang/treetree.c
+++ b/gcc/treelang/treetree.c
@@ -199,9 +199,9 @@ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
-const char tree_code_type[] = {
+const enum tree_code_class tree_code_type[] = {
#include "tree.def"
- 'x'
+ tcc_exceptional
};
#undef DEFTREECODE
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 05d60eb44d1..5bb96c648cf 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2466,7 +2466,7 @@ copy_constant (tree exp)
case ADDR_EXPR:
/* For ADDR_EXPR, we do not want to copy the decl whose address
is requested. We do want to copy constants though. */
- if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == 'c')
+ if (CONSTANT_CLASS_P (TREE_OPERAND (exp, 0)))
return build1 (TREE_CODE (exp), TREE_TYPE (exp),
copy_constant (TREE_OPERAND (exp, 0)));
else
@@ -3378,8 +3378,7 @@ output_addressed_constants (tree exp)
tem = TREE_OPERAND (tem, 0))
;
- if (TREE_CODE_CLASS (TREE_CODE (tem)) == 'c'
- || TREE_CODE (tem) == CONSTRUCTOR)
+ if (CONSTANT_CLASS_P (tem) || TREE_CODE (tem) == CONSTRUCTOR)
output_constant_def (tem, 0);
break;