diff options
author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-11-22 02:33:02 +0000 |
---|---|---|
committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-11-22 02:33:02 +0000 |
commit | 3119c950bd8c5f06ee2d61c2e8db88b98a7f8f0f (patch) | |
tree | 0e638461639b9ee591262162e137dc8d4432891b /gcc | |
parent | 1ff6063a627720169bb5577dd50a1d0ed0e531e6 (diff) | |
download | gcc-3119c950bd8c5f06ee2d61c2e8db88b98a7f8f0f.tar.gz |
* tree-dump.c: Rename from c-dump.c. Include c-tree.h, not c-common.h.
(lang_type_quals): Declare.
(dequeue_and_dump): Use lang_hooks.tree_dump.type_quals function to
retrieve language-specific qualifiers for a type node, instead of
C_TYPE_QUALS. Likewise for lang_hooks.tree_dump.dump_tree instead of
lang_dump_tree.
* tree-dump.h: Rename from c-dump.h.
* c-common.h (C_TYPE_QUALS): Removed.
Move declarations for tree-dump.c interface to...
* tree.h: ... here. Remove lang_dump_tree.
* langhooks.h (struct lang_hooks_for_tree_dump): New.
(struct lang_hooks): Add tree_dump hooks.
* langhooks.c (lhd_tree_dump_dump_tree): New function.
(lhd_tree_dump_type_quals): New function.
* langhooks-def.h (lhd_tree_dump_dump_tree, lhd_tree_dump_type_quals):
Declare.
(LANG_HOOKS_INITIALIZER): Add tree_dump hooks.
* Makefile.in: Move tree-dump.o to language-independent back-end.
cp:
* cp-tree.h (CP_TYPE_QUALS): Removed.
* decl.c (cxx_init_decl_processing): Don't set lang_dump_tree.
* cp-lang.c: Set LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN and
LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN.
* dump.c (cp_dump_tree): Use void* dump_info argument to match
lang-hooks prototype.
* call.c, cp-tree.h, cvt.c, decl.c, init.c, mangle.c, method.c, pt.c,
rtti.c, semantics.c, tree.c, typeck.c, typeck2.c: All references to
CP_TYPE_QUALS changed to cp_type_quals.
* Make-lang.in: References to c-dump.h changed to tree-dump.h.
(CXX_C_OBJS): Remove c-dump.o.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47257 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 21 | ||||
-rw-r--r-- | gcc/Makefile.in | 14 | ||||
-rw-r--r-- | gcc/c-common.h | 47 | ||||
-rw-r--r-- | gcc/c-dump.c | 933 | ||||
-rw-r--r-- | gcc/c-dump.h | 95 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/cp/Make-lang.in | 4 | ||||
-rw-r--r-- | gcc/cp/call.c | 8 | ||||
-rw-r--r-- | gcc/cp/cp-lang.c | 4 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 14 | ||||
-rw-r--r-- | gcc/cp/cvt.c | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 17 | ||||
-rw-r--r-- | gcc/cp/dump.c | 7 | ||||
-rw-r--r-- | gcc/cp/init.c | 2 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 4 | ||||
-rw-r--r-- | gcc/cp/method.c | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 20 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 6 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 2 | ||||
-rw-r--r-- | gcc/cp/tree.c | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 37 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 4 | ||||
-rw-r--r-- | gcc/langhooks-def.h | 17 | ||||
-rw-r--r-- | gcc/langhooks.c | 23 | ||||
-rw-r--r-- | gcc/langhooks.h | 16 | ||||
-rw-r--r-- | gcc/tree-dump.c | 2 | ||||
-rw-r--r-- | gcc/tree-dump.h | 6 | ||||
-rw-r--r-- | gcc/tree.h | 31 |
28 files changed, 203 insertions, 1161 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 480c2794016..4909aaca435 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,24 @@ +2001-11-21 Bryce McKinlay <bryce@waitaki.otago.ac.nz> + + * tree-dump.c: Rename from c-dump.c. Include c-tree.h, not c-common.h. + (lang_type_quals): Declare. + (dequeue_and_dump): Use lang_hooks.tree_dump.type_quals function to + retrieve language-specific qualifiers for a type node, instead of + C_TYPE_QUALS. Likewise for lang_hooks.tree_dump.dump_tree instead of + lang_dump_tree. + * tree-dump.h: Rename from c-dump.h. + * c-common.h (C_TYPE_QUALS): Removed. + Move declarations for tree-dump.c interface to... + * tree.h: ... here. Remove lang_dump_tree. + * langhooks.h (struct lang_hooks_for_tree_dump): New. + (struct lang_hooks): Add tree_dump hooks. + * langhooks.c (lhd_tree_dump_dump_tree): New function. + (lhd_tree_dump_type_quals): New function. + * langhooks-def.h (lhd_tree_dump_dump_tree, lhd_tree_dump_type_quals): + Declare. + (LANG_HOOKS_INITIALIZER): Add tree_dump hooks. + * Makefile.in: Move tree-dump.o to language-independent back-end. + 2001-11-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> * 1750a.h (DBX_REGISTER_NUMBER): Don't define. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index a1034081ea1..f88b0b4bf1e 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -723,7 +723,7 @@ CXX_TARGET_OBJS=@cxx_target_objs@ # Language-specific object files for C and Objective C. C_AND_OBJC_OBJS = attribs.o c-errors.o c-lex.o c-pragma.o c-decl.o c-typeck.o \ - c-convert.o c-aux-info.o c-common.o c-format.o c-semantics.o c-dump.o \ + c-convert.o c-aux-info.o c-common.o c-format.o c-semantics.o \ libcpp.a $(C_TARGET_OBJS) # Language-specific object files for C. @@ -745,8 +745,9 @@ OBJS = alias.o bb-reorder.o bitmap.o builtins.o caller-save.o calls.o \ reload.o reload1.o reorg.o resource.o rtl.o rtlanal.o rtl-error.o \ sbitmap.o sched-deps.o sched-ebb.o sched-rgn.o sched-vis.o sdbout.o \ sibcall.o simplify-rtx.o splay-tree.o ssa.o ssa-ccp.o ssa-dce.o stmt.o \ - stor-layout.o stringpool.o timevar.o toplev.o tree.o tree-inline.o \ - unroll.o varasm.o varray.o version.o xcoffout.o cfglayout.o \ + stor-layout.o stringpool.o timevar.o toplev.o tree.o tree-dump.o \ + tree-inline.o unroll.o varasm.o varray.o version.o xcoffout.o \ + cfglayout.o \ $(GGC) $(out_object_file) $(EXTRA_OBJS) BACKEND = main.o libbackend.a @@ -1264,10 +1265,6 @@ c-semantics.o : c-semantics.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \ c-lex.h flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \ $(EXPR_H) -c-dump.o: c-dump.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \ - c-lex.h flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \ - $(EXPR_H) $(SPLAY_TREE_H) c-dump.h - # Language-independent files. DRIVER_DEFINES = \ @@ -1352,6 +1349,9 @@ langhooks.o : langhooks.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) toplev.h \ tree-inline.h $(RTL_H) insn-config.h integrate.h langhooks.h langhooks-def.h tree.o : tree.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h function.h toplev.h \ $(GGC_H) $(HASHTAB_H) $(TARGET_H) output.h $(TM_P_H) langhooks.h +tree-dump.o: tree-dump.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \ + flags.h langhooks.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \ + $(EXPR_H) $(SPLAY_TREE_H) tree-dump.h tree-inline.o : tree-inline.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) \ expr.h flags.h params.h input.h insn-config.h $(INTEGRATE_H) \ $(VARRAY_H) $(HASHTAB_H) $(SPLAY_TREE_H) toplev.h langhooks.h \ diff --git a/gcc/c-common.h b/gcc/c-common.h index 7ccaef7ee8f..b289cb8b24f 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -457,14 +457,6 @@ extern int warn_long_long; #define C_TYPE_FUNCTION_P(type) \ (TREE_CODE (type) == FUNCTION_TYPE) -/* Return the qualifiers that apply to this type. In C++, that means - descending through array types. Note that this macro evaluates its - arguments more than once. */ -#define C_TYPE_QUALS(TYPE) \ - (TYPE_QUALS ((TREE_CODE (TYPE) == ARRAY_TYPE \ - && c_language == clk_cplusplus) \ - ? strip_array_types (TYPE) : TYPE)) - /* For convenience we define a single macro to identify the class of object or incomplete types. */ #define C_TYPE_OBJECT_OR_INCOMPLETE_P(type) \ @@ -819,45 +811,6 @@ extern int c_safe_from_p PARAMS ((rtx, tree)); extern int c_unsafe_for_reeval PARAMS ((tree)); -/* In c-dump.c */ - -/* Different tree dump places. When you add new tree dump places, - extend the DUMP_FILES array in c-dump.c */ -enum tree_dump_index -{ - TDI_all, /* dump the whole translation unit */ - TDI_class, /* dump class hierarchy */ - TDI_original, /* dump each function before optimizing it */ - TDI_optimized, /* dump each function after optimizing it */ - TDI_inlined, /* dump each function after inlining - within it. */ - TDI_end -}; - -/* Bit masks to control tree dumping. Not all values are applicable to - all tree dumps. Add new ones at the end. When you define new - values, extend the DUMP_OPTIONS array in c-dump.c */ -#define TDF_ADDRESS (1 << 0) /* dump node addresses */ -#define TDF_SLIM (1 << 1) /* don't go wild following links */ - -typedef struct dump_info *dump_info_p; - -/* A callback function used dump language-specific parts of tree - nodes. Returns non-zero if it does not want the usual dumping of - the second argument. */ - -typedef int (*dump_tree_fn) PARAMS ((dump_info_p, tree)); - -extern dump_tree_fn lang_dump_tree; - -extern int dump_flag PARAMS ((dump_info_p, int, tree)); -extern int dump_enabled_p PARAMS ((enum tree_dump_index)); -extern FILE *dump_begin PARAMS ((enum tree_dump_index, int *)); -extern void dump_end PARAMS ((enum tree_dump_index, FILE *)); -extern void dump_node PARAMS ((tree, int, FILE *)); -extern int dump_switch_p PARAMS ((const char *)); -extern const char *dump_flag_name PARAMS ((enum tree_dump_index)); - /* Information recorded about each file examined during compilation. */ struct c_fileinfo diff --git a/gcc/c-dump.c b/gcc/c-dump.c deleted file mode 100644 index 7f3dbdd3734..00000000000 --- a/gcc/c-dump.c +++ /dev/null @@ -1,933 +0,0 @@ -/* Tree-dumping functionality for intermediate representation. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. - Written by Mark Mitchell <mark@codesourcery.com> - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "tree.h" -#include "c-common.h" -#include "splay-tree.h" -#include "diagnostic.h" -#include "toplev.h" -#include "c-dump.h" - -/* A callback function used dump language-specific parts of tree - nodes. Returns non-zero if it does not want the usual dumping of - the second argument. */ - -dump_tree_fn lang_dump_tree; - -static unsigned int queue PARAMS ((dump_info_p, tree, int)); -static void dump_index PARAMS ((dump_info_p, unsigned int)); -static void dequeue_and_dump PARAMS ((dump_info_p)); -static void dump_new_line PARAMS ((dump_info_p)); -static void dump_maybe_newline PARAMS ((dump_info_p)); -static void dump_string_field PARAMS ((dump_info_p, const char *, const char *)); - -/* Add T to the end of the queue of nodes to dump. Returns the index - assigned to T. */ - -static unsigned int -queue (di, t, flags) - dump_info_p di; - tree t; - int flags; -{ - dump_queue_p dq; - dump_node_info_p dni; - unsigned int index; - - /* Assign the next available index to T. */ - index = ++di->index; - - /* Obtain a new queue node. */ - if (di->free_list) - { - dq = di->free_list; - di->free_list = dq->next; - } - else - dq = (dump_queue_p) xmalloc (sizeof (struct dump_queue)); - - /* Create a new entry in the splay-tree. */ - dni = (dump_node_info_p) xmalloc (sizeof (struct dump_node_info)); - dni->index = index; - dni->binfo_p = ((flags & DUMP_BINFO) != 0); - dq->node = splay_tree_insert (di->nodes, (splay_tree_key) t, - (splay_tree_value) dni); - - /* Add it to the end of the queue. */ - dq->next = 0; - if (!di->queue_end) - di->queue = dq; - else - di->queue_end->next = dq; - di->queue_end = dq; - - /* Return the index. */ - return index; -} - -static void -dump_index (di, index) - dump_info_p di; - unsigned int index; -{ - fprintf (di->stream, "@%-6u ", index); - di->column += 8; -} - -/* If T has not already been output, queue it for subsequent output. - FIELD is a string to print before printing the index. Then, the - index of T is printed. */ - -void -queue_and_dump_index (di, field, t, flags) - dump_info_p di; - const char *field; - tree t; - int flags; -{ - unsigned int index; - splay_tree_node n; - - /* If there's no node, just return. This makes for fewer checks in - our callers. */ - if (!t) - return; - - /* See if we've already queued or dumped this node. */ - n = splay_tree_lookup (di->nodes, (splay_tree_key) t); - if (n) - index = ((dump_node_info_p) n->value)->index; - else - /* If we haven't, add it to the queue. */ - index = queue (di, t, flags); - - /* Print the index of the node. */ - dump_maybe_newline (di); - fprintf (di->stream, "%-4s: ", field); - di->column += 6; - dump_index (di, index); -} - -/* Dump the type of T. */ - -void -queue_and_dump_type (di, t) - dump_info_p di; - tree t; -{ - queue_and_dump_index (di, "type", TREE_TYPE (t), DUMP_NONE); -} - -/* Dump column control */ -#define SOL_COLUMN 25 /* Start of line column. */ -#define EOL_COLUMN 55 /* End of line column. */ -#define COLUMN_ALIGNMENT 15 /* Alignment. */ - -/* Insert a new line in the dump output, and indent to an appropriate - place to start printing more fields. */ - -static void -dump_new_line (di) - dump_info_p di; -{ - fprintf (di->stream, "\n%*s", SOL_COLUMN, ""); - di->column = SOL_COLUMN; -} - -/* If necessary, insert a new line. */ - -static void -dump_maybe_newline (di) - dump_info_p di; -{ - int extra; - - /* See if we need a new line. */ - if (di->column > EOL_COLUMN) - dump_new_line (di); - /* See if we need any padding. */ - else if ((extra = (di->column - SOL_COLUMN) % COLUMN_ALIGNMENT) != 0) - { - fprintf (di->stream, "%*s", COLUMN_ALIGNMENT - extra, ""); - di->column += COLUMN_ALIGNMENT - extra; - } -} - -/* Dump pointer PTR using FIELD to identify it. */ - -void -dump_pointer (di, field, ptr) - dump_info_p di; - const char *field; - void *ptr; -{ - dump_maybe_newline (di); - fprintf (di->stream, "%-4s: %-8lx ", field, (long) ptr); - di->column += 15; -} - -/* Dump integer I using FIELD to identify it. */ - -void -dump_int (di, field, i) - dump_info_p di; - const char *field; - int i; -{ - dump_maybe_newline (di); - fprintf (di->stream, "%-4s: %-7d ", field, i); - di->column += 14; -} - -/* Dump the string S. */ - -void -dump_string (di, string) - dump_info_p di; - const char *string; -{ - dump_maybe_newline (di); - fprintf (di->stream, "%-13s ", string); - if (strlen (string) > 13) - di->column += strlen (string) + 1; - else - di->column += 14; -} - -/* Dump the string field S. */ - -static void -dump_string_field (di, field, string) - dump_info_p di; - const char *field; - const char *string; -{ - dump_maybe_newline (di); - fprintf (di->stream, "%-4s: %-7s ", field, string); - if (strlen (string) > 7) - di->column += 6 + strlen (string) + 1; - else - di->column += 14; -} - -/* Dump information common to statements from STMT. */ - -void -dump_stmt (di, t) - dump_info_p di; - tree t; -{ - dump_int (di, "line", STMT_LINENO (t)); -} - -/* Dump the next statement after STMT. */ - -void -dump_next_stmt (di, t) - dump_info_p di; - tree t; -{ - dump_child ("next", TREE_CHAIN (t)); -} - -/* Dump the next node in the queue. */ - -static void -dequeue_and_dump (di) - dump_info_p di; -{ - dump_queue_p dq; - splay_tree_node stn; - dump_node_info_p dni; - tree t; - unsigned int index; - enum tree_code code; - char code_class; - const char* code_name; - - /* Get the next node from the queue. */ - dq = di->queue; - stn = dq->node; - t = (tree) stn->key; - dni = (dump_node_info_p) stn->value; - index = dni->index; - - /* Remove the node from the queue, and put it on the free list. */ - di->queue = dq->next; - if (!di->queue) - di->queue_end = 0; - dq->next = di->free_list; - di->free_list = dq; - - /* Print the node index. */ - dump_index (di, index); - /* And the type of node this is. */ - if (dni->binfo_p) - code_name = "binfo"; - else - code_name = tree_code_name[(int) TREE_CODE (t)]; - fprintf (di->stream, "%-16s ", code_name); - di->column = 25; - - /* Figure out what kind of node this is. */ - code = TREE_CODE (t); - code_class = TREE_CODE_CLASS (code); - - /* Although BINFOs are TREE_VECs, we dump them specially so as to be - more informative. */ - if (dni->binfo_p) - { - if (TREE_VIA_PUBLIC (t)) - dump_string (di, "pub"); - else if (TREE_VIA_PROTECTED (t)) - dump_string (di, "prot"); - else if (TREE_VIA_PRIVATE (t)) - dump_string (di, "priv"); - if (TREE_VIA_VIRTUAL (t)) - dump_string (di, "virt"); - - dump_child ("type", BINFO_TYPE (t)); - dump_child ("base", BINFO_BASETYPES (t)); - - goto done; - } - - /* We can knock off a bunch of expression nodes in exactly the same - way. */ - if (IS_EXPR_CODE_CLASS (code_class)) - { - /* If we're dumping children, dump them now. */ - queue_and_dump_type (di, t); - - switch (code_class) - { - case '1': - dump_child ("op 0", TREE_OPERAND (t, 0)); - break; - - case '2': - case '<': - dump_child ("op 0", TREE_OPERAND (t, 0)); - dump_child ("op 1", TREE_OPERAND (t, 1)); - break; - - case 'e': - /* These nodes are handled explicitly below. */ - break; - - default: - abort(); - } - } - else if (DECL_P (t)) - { - /* All declarations have names. */ - if (DECL_NAME (t)) - dump_child ("name", DECL_NAME (t)); - if (DECL_ASSEMBLER_NAME_SET_P (t) - && DECL_ASSEMBLER_NAME (t) != DECL_NAME (t)) - dump_child ("mngl", DECL_ASSEMBLER_NAME (t)); - /* And types. */ - queue_and_dump_type (di, t); - dump_child ("scpe", DECL_CONTEXT (t)); - /* And a source position. */ - if (DECL_SOURCE_FILE (t)) - { - const char *filename = strrchr (DECL_SOURCE_FILE (t), '/'); - if (!filename) - filename = DECL_SOURCE_FILE (t); - else - /* Skip the slash. */ - ++filename; - - dump_maybe_newline (di); - fprintf (di->stream, "srcp: %s:%-6d ", filename, - DECL_SOURCE_LINE (t)); - di->column += 6 + strlen (filename) + 8; - } - /* And any declaration can be compiler-generated. */ - if (DECL_ARTIFICIAL (t)) - dump_string (di, "artificial"); - if (TREE_CHAIN (t) && !dump_flag (di, TDF_SLIM, NULL)) - dump_child ("chan", TREE_CHAIN (t)); - } - else if (code_class == 't') - { - /* All types have qualifiers. */ - int quals = C_TYPE_QUALS (t); - if (quals != TYPE_UNQUALIFIED) - { - fprintf (di->stream, "qual: %c%c%c ", - (quals & TYPE_QUAL_CONST) ? 'c' : ' ', - (quals & TYPE_QUAL_VOLATILE) ? 'v' : ' ', - (quals & TYPE_QUAL_RESTRICT) ? 'r' : ' '); - di->column += 14; - } - - /* All types have associated declarations. */ - dump_child ("name", TYPE_NAME (t)); - - /* All types have a main variant. */ - if (TYPE_MAIN_VARIANT (t) != t) - dump_child ("unql", TYPE_MAIN_VARIANT (t)); - - /* And sizes. */ - dump_child ("size", TYPE_SIZE (t)); - - /* All types have alignments. */ - dump_int (di, "algn", TYPE_ALIGN (t)); - } - else if (code_class == 'c') - /* All constants can have types. */ - queue_and_dump_type (di, t); - - /* Give the language-specific code a chance to print something. If - it's completely taken care of things, don't bother printing - anything more ourselves. */ - if (lang_dump_tree && (*lang_dump_tree) (di, t)) - goto done; - - /* Now handle the various kinds of nodes. */ - switch (code) - { - int i; - - case IDENTIFIER_NODE: - dump_string_field (di, "strg", IDENTIFIER_POINTER (t)); - dump_int (di, "lngt", IDENTIFIER_LENGTH (t)); - break; - - case TREE_LIST: - dump_child ("purp", TREE_PURPOSE (t)); - dump_child ("valu", TREE_VALUE (t)); - dump_child ("chan", TREE_CHAIN (t)); - break; - - case TREE_VEC: - dump_int (di, "lngt", TREE_VEC_LENGTH (t)); - for (i = 0; i < TREE_VEC_LENGTH (t); ++i) - { - char buffer[32]; - sprintf (buffer, "%u", i); - dump_child (buffer, TREE_VEC_ELT (t, i)); - } - break; - - case INTEGER_TYPE: - case ENUMERAL_TYPE: - dump_int (di, "prec", TYPE_PRECISION (t)); - if (TREE_UNSIGNED (t)) - dump_string (di, "unsigned"); - dump_child ("min", TYPE_MIN_VALUE (t)); - dump_child ("max", TYPE_MAX_VALUE (t)); - - if (code == ENUMERAL_TYPE) - dump_child ("csts", TYPE_VALUES (t)); - break; - - case REAL_TYPE: - dump_int (di, "prec", TYPE_PRECISION (t)); - break; - - case POINTER_TYPE: - dump_child ("ptd", TREE_TYPE (t)); - break; - - case REFERENCE_TYPE: - dump_child ("refd", TREE_TYPE (t)); - break; - - case METHOD_TYPE: - dump_child ("clas", TYPE_METHOD_BASETYPE (t)); - /* Fall through. */ - - case FUNCTION_TYPE: - dump_child ("retn", TREE_TYPE (t)); - dump_child ("prms", TYPE_ARG_TYPES (t)); - break; - - case ARRAY_TYPE: - dump_child ("elts", TREE_TYPE (t)); - dump_child ("domn", TYPE_DOMAIN (t)); - break; - - case RECORD_TYPE: - case UNION_TYPE: - if (TREE_CODE (t) == RECORD_TYPE) - dump_string (di, "struct"); - else - dump_string (di, "union"); - - dump_child ("flds", TYPE_FIELDS (t)); - dump_child ("fncs", TYPE_METHODS (t)); - queue_and_dump_index (di, "binf", TYPE_BINFO (t), - DUMP_BINFO); - break; - - case CONST_DECL: - dump_child ("cnst", DECL_INITIAL (t)); - break; - - case VAR_DECL: - case PARM_DECL: - case FIELD_DECL: - case RESULT_DECL: - if (TREE_CODE (t) == PARM_DECL) - dump_child ("argt", DECL_ARG_TYPE (t)); - else - dump_child ("init", DECL_INITIAL (t)); - dump_child ("size", DECL_SIZE (t)); - dump_int (di, "algn", DECL_ALIGN (t)); - - if (TREE_CODE (t) == FIELD_DECL) - { - if (DECL_C_BIT_FIELD (t)) - dump_string (di, "bitfield"); - if (DECL_FIELD_OFFSET (t)) - dump_child ("bpos", bit_position (t)); - } - else if (TREE_CODE (t) == VAR_DECL - || TREE_CODE (t) == PARM_DECL) - { - dump_int (di, "used", TREE_USED (t)); - if (DECL_REGISTER (t)) - dump_string (di, "register"); - } - break; - - case FUNCTION_DECL: - dump_child ("args", DECL_ARGUMENTS (t)); - if (DECL_EXTERNAL (t)) - dump_string (di, "undefined"); - if (TREE_PUBLIC (t)) - dump_string (di, "extern"); - else - dump_string (di, "static"); - if (DECL_LANG_SPECIFIC (t) && !dump_flag (di, TDF_SLIM, t)) - dump_child ("body", DECL_SAVED_TREE (t)); - break; - - case ASM_STMT: - dump_stmt (di, t); - if (ASM_VOLATILE_P (t)) - dump_string (di, "volatile"); - dump_child ("strg", ASM_STRING (t)); - dump_child ("outs", ASM_OUTPUTS (t)); - dump_child ("ins", ASM_INPUTS (t)); - dump_child ("clbr", ASM_CLOBBERS (t)); - dump_next_stmt (di, t); - break; - - case BREAK_STMT: - case CONTINUE_STMT: - dump_stmt (di, t); - dump_next_stmt (di, t); - break; - - case CASE_LABEL: - /* Note that a case label is not like other statements; there is - no way to get the line-number of a case label. */ - dump_child ("low", CASE_LOW (t)); - dump_child ("high", CASE_HIGH (t)); - dump_next_stmt (di, t); - break; - - case COMPOUND_STMT: - dump_stmt (di, t); - dump_child ("body", COMPOUND_BODY (t)); - dump_next_stmt (di, t); - break; - - case DECL_STMT: - dump_stmt (di, t); - dump_child ("decl", DECL_STMT_DECL (t)); - dump_next_stmt (di, t); - break; - - case DO_STMT: - dump_stmt (di, t); - dump_child ("body", DO_BODY (t)); - dump_child ("cond", DO_COND (t)); - dump_next_stmt (di, t); - break; - - case EXPR_STMT: - dump_stmt (di, t); - dump_child ("expr", EXPR_STMT_EXPR (t)); - dump_next_stmt (di, t); - break; - - case FOR_STMT: - dump_stmt (di, t); - dump_child ("init", FOR_INIT_STMT (t)); - dump_child ("cond", FOR_COND (t)); - dump_child ("expr", FOR_EXPR (t)); - dump_child ("body", FOR_BODY (t)); - dump_next_stmt (di, t); - break; - - case GOTO_STMT: - dump_stmt (di, t); - dump_child ("dest", GOTO_DESTINATION (t)); - dump_next_stmt (di, t); - break; - - case IF_STMT: - dump_stmt (di, t); - dump_child ("cond", IF_COND (t)); - dump_child ("then", THEN_CLAUSE (t)); - dump_child ("else", ELSE_CLAUSE (t)); - dump_next_stmt (di, t); - break; - - case LABEL_STMT: - dump_stmt (di, t); - dump_child ("labl", LABEL_STMT_LABEL (t)); - dump_next_stmt (di, t); - break; - - case RETURN_STMT: - dump_stmt (di, t); - dump_child ("expr", RETURN_EXPR (t)); - dump_next_stmt (di, t); - break; - - case SWITCH_STMT: - dump_stmt (di, t); - dump_child ("cond", SWITCH_COND (t)); - dump_child ("body", SWITCH_BODY (t)); - dump_next_stmt (di, t); - break; - - case WHILE_STMT: - dump_stmt (di, t); - dump_child ("cond", WHILE_COND (t)); - dump_child ("body", WHILE_BODY (t)); - dump_next_stmt (di, t); - break; - - case SCOPE_STMT: - dump_stmt (di, t); - if (SCOPE_BEGIN_P (t)) - dump_string (di, "begn"); - else - dump_string (di, "end"); - if (SCOPE_NULLIFIED_P (t)) - dump_string (di, "null"); - if (!SCOPE_NO_CLEANUPS_P (t)) - dump_string (di, "clnp"); - dump_next_stmt (di, t); - break; - - case INTEGER_CST: - if (TREE_INT_CST_HIGH (t)) - dump_int (di, "high", TREE_INT_CST_HIGH (t)); - dump_int (di, "low", TREE_INT_CST_LOW (t)); - break; - - case STRING_CST: - fprintf (di->stream, "strg: %-7s ", TREE_STRING_POINTER (t)); - dump_int (di, "lngt", TREE_STRING_LENGTH (t)); - break; - - case TRUTH_NOT_EXPR: - case ADDR_EXPR: - case INDIRECT_REF: - case CLEANUP_POINT_EXPR: - case SAVE_EXPR: - /* These nodes are unary, but do not have code class `1'. */ - dump_child ("op 0", TREE_OPERAND (t, 0)); - break; - - case TRUTH_ANDIF_EXPR: - case TRUTH_ORIF_EXPR: - case INIT_EXPR: - case MODIFY_EXPR: - case COMPONENT_REF: - case COMPOUND_EXPR: - case ARRAY_REF: - case PREDECREMENT_EXPR: - case PREINCREMENT_EXPR: - case POSTDECREMENT_EXPR: - case POSTINCREMENT_EXPR: - /* These nodes are binary, but do not have code class `2'. */ - dump_child ("op 0", TREE_OPERAND (t, 0)); - dump_child ("op 1", TREE_OPERAND (t, 1)); - break; - - case COND_EXPR: - dump_child ("op 0", TREE_OPERAND (t, 0)); - dump_child ("op 1", TREE_OPERAND (t, 1)); - dump_child ("op 2", TREE_OPERAND (t, 2)); - break; - - case CALL_EXPR: - dump_child ("fn", TREE_OPERAND (t, 0)); - dump_child ("args", TREE_OPERAND (t, 1)); - break; - - case CONSTRUCTOR: - dump_child ("elts", TREE_OPERAND (t, 1)); - break; - - case STMT_EXPR: - dump_child ("stmt", STMT_EXPR_STMT (t)); - break; - - case BIND_EXPR: - dump_child ("vars", TREE_OPERAND (t, 0)); - dump_child ("body", TREE_OPERAND (t, 1)); - break; - - case LOOP_EXPR: - dump_child ("body", TREE_OPERAND (t, 0)); - break; - - case EXIT_EXPR: - dump_child ("cond", TREE_OPERAND (t, 0)); - break; - - case TARGET_EXPR: - dump_child ("decl", TREE_OPERAND (t, 0)); - dump_child ("init", TREE_OPERAND (t, 1)); - dump_child ("clnp", TREE_OPERAND (t, 2)); - /* There really are two possible places the initializer can be. - After RTL expansion, the second operand is moved to the - position of the fourth operand, and the second operand - becomes NULL. */ - dump_child ("init", TREE_OPERAND (t, 3)); - break; - - case EXPR_WITH_FILE_LOCATION: - dump_child ("expr", EXPR_WFL_NODE (t)); - break; - - default: - /* There are no additional fields to print. */ - break; - } - - done: - if (dump_flag (di, TDF_ADDRESS, NULL)) - dump_pointer (di, "addr", (void *)t); - - /* Terminate the line. */ - fprintf (di->stream, "\n"); -} - -/* Return non-zero if FLAG has been specified for the dump, and NODE - is not the root node of the dump. */ - -int dump_flag (di, flag, node) - dump_info_p di; - int flag; - tree node; -{ - return (di->flags & flag) && (node != di->node); -} - -/* Dump T, and all its children, on STREAM. */ - -void -dump_node (t, flags, stream) - tree t; - int flags; - FILE *stream; -{ - struct dump_info di; - dump_queue_p dq; - dump_queue_p next_dq; - - /* Initialize the dump-information structure. */ - di.stream = stream; - di.index = 0; - di.column = 0; - di.queue = 0; - di.queue_end = 0; - di.free_list = 0; - di.flags = flags; - di.node = t; - di.nodes = splay_tree_new (splay_tree_compare_pointers, 0, - (splay_tree_delete_value_fn) &free); - - /* Queue up the first node. */ - queue (&di, t, DUMP_NONE); - - /* Until the queue is empty, keep dumping nodes. */ - while (di.queue) - dequeue_and_dump (&di); - - /* Now, clean up. */ - for (dq = di.free_list; dq; dq = next_dq) - { - next_dq = dq->next; - free (dq); - } - splay_tree_delete (di.nodes); -} - -/* Define a tree dump switch. */ -struct dump_file_info -{ - const char *suffix; /* suffix to give output file. */ - const char *swtch; /* command line switch */ - int flags; /* user flags */ - int state; /* state of play */ -}; - -/* Table of tree dump switches. This must be consistent with the - TREE_DUMP_INDEX enumeration in c-common.h */ -static struct dump_file_info dump_files[TDI_end] = -{ - {".tu", "dump-translation-unit", 0, 0}, - {".class", "dump-class-hierarchy", 0, 0}, - {".original", "dump-tree-original", 0, 0}, - {".optimized", "dump-tree-optimized", 0, 0}, - {".inlined", "dump-tree-inlined", 0, 0}, -}; - -/* Define a name->number mapping for a dump flag value. */ -struct dump_option_value_info -{ - const char *const name; /* the name of the value */ - const int value; /* the value of the name */ -}; - -/* Table of dump options. This must be consistent with the TDF_* flags - in c-common.h */ -static const struct dump_option_value_info dump_options[] = -{ - {"address", TDF_ADDRESS}, - {"slim", TDF_SLIM}, - {"all", ~0}, - {NULL, 0} -}; - -/* Begin a tree dump for PHASE. Stores any user supplied flag in - *FLAG_PTR and returns a stream to write to. If the dump is not - enabled, returns NULL. - Multiple calls will reopen and append to the dump file. */ - -FILE * -dump_begin (phase, flag_ptr) - enum tree_dump_index phase; - int *flag_ptr; -{ - FILE *stream; - char *name; - - if (!dump_files[phase].state) - return NULL; - - name = concat (dump_base_name, dump_files[phase].suffix, NULL); - stream = fopen (name, dump_files[phase].state < 0 ? "w" : "a"); - if (!stream) - error ("could not open dump file `%s'", name); - else - dump_files[phase].state = 1; - free (name); - if (flag_ptr) - *flag_ptr = dump_files[phase].flags; - - return stream; -} - -/* Returns non-zero if tree dump PHASE is enabled. */ - -int -dump_enabled_p (phase) - enum tree_dump_index phase; -{ - return dump_files[phase].state; -} - -/* Returns the switch name of PHASE. */ - -const char * -dump_flag_name (phase) - enum tree_dump_index phase; -{ - return dump_files[phase].swtch; -} - -/* Finish a tree dump for PHASE. STREAM is the stream created by - dump_begin. */ - -void -dump_end (phase, stream) - enum tree_dump_index phase ATTRIBUTE_UNUSED; - FILE *stream; -{ - fclose (stream); -} - -/* Parse ARG as a dump switch. Return non-zero if it is, and store the - relevant details in the dump_files array. */ - -int -dump_switch_p (arg) - const char *arg; -{ - unsigned ix; - const char *option_value; - - for (ix = 0; ix != TDI_end; ix++) - if ((option_value = skip_leading_substring (arg, dump_files[ix].swtch))) - { - const char *ptr = option_value; - int flags = 0; - - while (*ptr) - { - const struct dump_option_value_info *option_ptr; - const char *end_ptr; - unsigned length; - - while (*ptr == '-') - ptr++; - end_ptr = strchr (ptr, '-'); - if (!end_ptr) - end_ptr = ptr + strlen (ptr); - length = end_ptr - ptr; - - for (option_ptr = dump_options; option_ptr->name; - option_ptr++) - if (strlen (option_ptr->name) == length - && !memcmp (option_ptr->name, ptr, length)) - { - flags |= option_ptr->value; - goto found; - } - warning ("ignoring unknown option `%.*s' in `-f%s'", - length, ptr, dump_files[ix].swtch); - found:; - ptr = end_ptr; - } - - dump_files[ix].state = -1; - dump_files[ix].flags = flags; - - return 1; - } - return 0; -} diff --git a/gcc/c-dump.h b/gcc/c-dump.h deleted file mode 100644 index 4c4962c9a5c..00000000000 --- a/gcc/c-dump.h +++ /dev/null @@ -1,95 +0,0 @@ -/* Tree-dumping functionality for intermediate representation. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. - Written by Mark Mitchell <mark@codesourcery.com> - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 2, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ - -#ifndef GCC_C_DUMP_H -#define GCC_C_DUMP_H - -/* Flags used with queue functions. */ -#define DUMP_NONE 0 -#define DUMP_BINFO 1 - -/* Information about a node to be dumped. */ - -typedef struct dump_node_info -{ - /* The index for the node. */ - unsigned int index; - /* Nonzero if the node is a binfo. */ - unsigned int binfo_p : 1; -} *dump_node_info_p; - -/* A dump_queue is a link in the queue of things to be dumped. */ - -typedef struct dump_queue -{ - /* The queued tree node. */ - splay_tree_node node; - /* The next node in the queue. */ - struct dump_queue *next; -} *dump_queue_p; - -/* A dump_info gives information about how we should perform the dump - and about the current state of the dump. */ - -struct dump_info -{ - /* The stream on which to dump the information. */ - FILE *stream; - /* The original node. */ - tree node; - /* User flags. */ - int flags; - /* The next unused node index. */ - unsigned int index; - /* The next column. */ - unsigned int column; - /* The first node in the queue of nodes to be written out. */ - dump_queue_p queue; - /* The last node in the queue. */ - dump_queue_p queue_end; - /* Free queue nodes. */ - dump_queue_p free_list; - /* The tree nodes which we have already written out. The - keys are the addresses of the nodes; the values are the integer - indices we assigned them. */ - splay_tree nodes; -}; - -/* Dump the CHILD and its children. */ -#define dump_child(field, child) \ - queue_and_dump_index (di, field, child, DUMP_NONE) - -extern void dump_pointer - PARAMS ((dump_info_p, const char *, void *)); -extern void dump_int - PARAMS ((dump_info_p, const char *, int)); -extern void dump_string - PARAMS ((dump_info_p, const char *)); -extern void dump_stmt - PARAMS ((dump_info_p, tree)); -extern void dump_next_stmt - PARAMS ((dump_info_p, tree)); -extern void queue_and_dump_index - PARAMS ((dump_info_p, const char *, tree, int)); -extern void queue_and_dump_type - PARAMS ((dump_info_p, tree)); - -#endif /* ! GCC_C_DUMP_H */ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9637ab5704e..a3856da7f4a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,17 @@ +2001-11-22 Bryce McKinlay <bryce@waitaki.otago.ac.nz> + + * cp-tree.h (CP_TYPE_QUALS): Removed. + * decl.c (cxx_init_decl_processing): Don't set lang_dump_tree. + * cp-lang.c: Set LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN and + LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN. + * dump.c (cp_dump_tree): Use void* dump_info argument to match + lang-hooks prototype. + * call.c, cp-tree.h, cvt.c, decl.c, init.c, mangle.c, method.c, pt.c, + rtti.c, semantics.c, tree.c, typeck.c, typeck2.c: All references to + CP_TYPE_QUALS changed to cp_type_quals. + * Make-lang.in: References to c-dump.h changed to tree-dump.h. + (CXX_C_OBJS): Remove c-dump.o. + 2001-11-21 Mark Mitchell <mark@codesourcery.com> PR c++/3637 diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index 6bf274c1225..3a1f1497fd0 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -96,7 +96,7 @@ $(DEMANGLER_PROG): cxxmain.o underscore.o $(LIBDEPS) # The compiler itself. # Shared with C front end: CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \ - c-dump.o $(CXX_TARGET_OBJS) + $(CXX_TARGET_OBJS) # Language-specific object files. CXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \ @@ -279,7 +279,7 @@ cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \ flags.h $(GGC_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \ tree-inline.h -cp/dump.o: cp/dump.c $(CXX_TREE_H) c-dump.h +cp/dump.o: cp/dump.c $(CXX_TREE_H) tree-dump.h cp/optimize.o: cp/optimize.c $(CXX_TREE_H) rtl.h integrate.h insn-config.h \ input.h $(PARAMS_H) debug.h tree-inline.h cp/mangle.o: cp/mangle.c $(CXX_TREE_H) toplev.h diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 4d06dc5dcd6..46aacca2f04 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -777,7 +777,7 @@ standard_conversion (to, from, expr) { from = build_pointer_type (cp_build_qualified_type (void_type_node, - CP_TYPE_QUALS (TREE_TYPE (from)))); + cp_type_quals (TREE_TYPE (from)))); conv = build_conv (PTR_CONV, from, conv); } else if (ufcode == OFFSET_TYPE && utcode == OFFSET_TYPE) @@ -803,7 +803,7 @@ standard_conversion (to, from, expr) { from = cp_build_qualified_type (TREE_TYPE (to), - CP_TYPE_QUALS (TREE_TYPE (from))); + cp_type_quals (TREE_TYPE (from))); from = build_pointer_type (from); conv = build_conv (PTR_CONV, from, conv); } @@ -838,10 +838,10 @@ standard_conversion (to, from, expr) || !same_type_p (TREE_TYPE (fromfn), TREE_TYPE (tofn)) || !compparms (TREE_CHAIN (TYPE_ARG_TYPES (fromfn)), TREE_CHAIN (TYPE_ARG_TYPES (tofn))) - || CP_TYPE_QUALS (fbase) != CP_TYPE_QUALS (tbase)) + || cp_type_quals (fbase) != cp_type_quals (tbase)) return 0; - from = cp_build_qualified_type (tbase, CP_TYPE_QUALS (fbase)); + from = cp_build_qualified_type (tbase, cp_type_quals (fbase)); from = build_cplus_method_type (from, TREE_TYPE (fromfn), TREE_CHAIN (TYPE_ARG_TYPES (fromfn))); from = build_ptrmemfunc_type (build_pointer_type (from)); diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 08ecf5bccf9..dbca8af24de 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -78,6 +78,10 @@ static HOST_WIDE_INT cxx_get_alias_set PARAMS ((tree)); cp_copy_res_decl_for_inlining #undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P #define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P anon_aggr_type_p +#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN +#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN cp_dump_tree +#undef LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN +#define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN cp_type_quals /* Each front end provides its own hooks, for toplev.c. */ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index b4854347eeb..4b39e804172 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1128,28 +1128,24 @@ enum languages { lang_c, lang_cplusplus, lang_java }; /* True if this a "Java" type, defined in 'extern "Java"'. */ #define TYPE_FOR_JAVA(NODE) TYPE_LANG_FLAG_3(NODE) -/* The type qualifiers for this type, including the qualifiers on the - elements for an array type. */ -#define CP_TYPE_QUALS(NODE) C_TYPE_QUALS (NODE) - /* Nonzero if this type is const-qualified. */ #define CP_TYPE_CONST_P(NODE) \ - ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_CONST) != 0) + ((cp_type_quals (NODE) & TYPE_QUAL_CONST) != 0) /* Nonzero if this type is volatile-qualified. */ #define CP_TYPE_VOLATILE_P(NODE) \ - ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_VOLATILE) != 0) + ((cp_type_quals (NODE) & TYPE_QUAL_VOLATILE) != 0) /* Nonzero if this type is restrict-qualified. */ #define CP_TYPE_RESTRICT_P(NODE) \ - ((CP_TYPE_QUALS (NODE) & TYPE_QUAL_RESTRICT) != 0) + ((cp_type_quals (NODE) & TYPE_QUAL_RESTRICT) != 0) /* Nonzero if this type is const-qualified, but not volatile-qualified. Other qualifiers are ignored. This macro is used to test whether or not it is OK to bind an rvalue to a reference. */ #define CP_TYPE_CONST_NON_VOLATILE_P(NODE) \ - ((CP_TYPE_QUALS (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \ + ((cp_type_quals (NODE) & (TYPE_QUAL_CONST | TYPE_QUAL_VOLATILE)) \ == TYPE_QUAL_CONST) #define FUNCTION_ARG_CHAIN(NODE) \ @@ -4341,7 +4337,7 @@ extern tree mangle_guard_variable PARAMS ((tree)); extern tree mangle_ref_init_variable PARAMS ((tree)); /* in dump.c */ -extern int cp_dump_tree PARAMS ((dump_info_p, tree)); +extern int cp_dump_tree PARAMS ((void *, tree)); /* -- end of C++ */ diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 960552c8e6a..3ab60b63f8f 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -657,7 +657,7 @@ convert_pointer_to_real (binfo, expr) } ptr_type = cp_build_qualified_type (type, - CP_TYPE_QUALS (TREE_TYPE (intype))); + cp_type_quals (TREE_TYPE (intype))); ptr_type = build_pointer_type (ptr_type); if (same_type_p (ptr_type, TYPE_MAIN_VARIANT (intype))) return expr; @@ -1267,7 +1267,7 @@ type_promotes_to (type) if (type == error_mark_node) return error_mark_node; - type_quals = CP_TYPE_QUALS (type); + type_quals = cp_type_quals (type); type = TYPE_MAIN_VARIANT (type); /* bool always promotes to int (not unsigned), even if it's the same diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index f7448f5f108..6fdb1c48d65 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6408,7 +6408,6 @@ cxx_init_decl_processing () free_lang_status = &pop_cp_function_context; mark_lang_status = &mark_cp_function_context; lang_safe_from_p = &c_safe_from_p; - lang_dump_tree = &cp_dump_tree; lang_missing_noreturn_ok_p = &cp_missing_noreturn_ok_p; cp_parse_init (); @@ -9206,7 +9205,7 @@ build_ptrmemfunc_type (type) /* Make sure that we always have the unqualified pointer-to-member type first. */ - if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED) + if (cp_type_quals (type) != TYPE_UNQUALIFIED) unqualified_variant = build_ptrmemfunc_type (TYPE_MAIN_VARIANT (type)); @@ -9229,9 +9228,9 @@ build_ptrmemfunc_type (type) type, set the TYPE_MAIN_VARIANT for this type to be the unqualified type. Since they are actually RECORD_TYPEs that are not variants of each other, we must do this manually. */ - if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED) + if (cp_type_quals (type) != TYPE_UNQUALIFIED) { - t = build_qualified_type (t, CP_TYPE_QUALS (type)); + t = build_qualified_type (t, cp_type_quals (type)); TYPE_MAIN_VARIANT (t) = unqualified_variant; TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (unqualified_variant); TYPE_NEXT_VARIANT (unqualified_variant) = t; @@ -10159,7 +10158,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) { RIDBIT_RESET (RID_LONG, specbits); type = build_qualified_type (long_double_type_node, - CP_TYPE_QUALS (type)); + cp_type_quals (type)); } /* Check all other uses of type modifiers. */ @@ -11129,7 +11128,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) && TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL && TYPE_ANONYMOUS_P (type) - && CP_TYPE_QUALS (type) == TYPE_UNQUALIFIED) + && cp_type_quals (type) == TYPE_UNQUALIFIED) { tree oldname = TYPE_NAME (type); tree t; @@ -13539,7 +13538,7 @@ start_function (declspecs, declarator, attrs, flags) { DECL_RESULT (decl1) = build_decl (RESULT_DECL, 0, TYPE_MAIN_VARIANT (restype)); - c_apply_type_quals_to_decl (CP_TYPE_QUALS (restype), + c_apply_type_quals_to_decl (cp_type_quals (restype), DECL_RESULT (decl1)); } } @@ -14469,14 +14468,14 @@ revert_static_member_fn (decl) tree function = TREE_TYPE (decl); tree args = TYPE_ARG_TYPES (function); - if (CP_TYPE_QUALS (TREE_TYPE (TREE_VALUE (args))) + if (cp_type_quals (TREE_TYPE (TREE_VALUE (args))) != TYPE_UNQUALIFIED) cp_error ("static member function `%#D' declared with type qualifiers", decl); args = TREE_CHAIN (args); tmp = build_function_type (TREE_TYPE (function), args); - tmp = build_qualified_type (tmp, CP_TYPE_QUALS (function)); + tmp = build_qualified_type (tmp, cp_type_quals (function)); tmp = build_exception_variant (tmp, TYPE_RAISES_EXCEPTIONS (function)); TREE_TYPE (decl) = tmp; diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c index dea990aa4c2..98c1fc49d87 100644 --- a/gcc/cp/dump.c +++ b/gcc/cp/dump.c @@ -23,7 +23,7 @@ Boston, MA 02111-1307, USA. */ #include "system.h" #include "tree.h" #include "cp-tree.h" -#include "c-dump.h" +#include "tree-dump.h" static void dump_access PARAMS ((dump_info_p, tree)); @@ -208,11 +208,12 @@ dump_op (di, t) } int -cp_dump_tree (di, t) - dump_info_p di; +cp_dump_tree (dump_info, t) + void *dump_info; tree t; { enum tree_code code; + dump_info_p di = (dump_info_p) dump_info; /* Figure out what kind of node this is. */ code = TREE_CODE (t); diff --git a/gcc/cp/init.c b/gcc/cp/init.c index fdb3557d2b1..ffbe8221309 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1177,7 +1177,7 @@ build_aggr_init (exp, init, flags) cp_error ("bad array initializer"); return error_mark_node; } - if (CP_TYPE_QUALS (type) != TYPE_UNQUALIFIED) + if (cp_type_quals (type) != TYPE_UNQUALIFIED) { TREE_TYPE (exp) = TYPE_MAIN_VARIANT (type); if (init) diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index 5466ca90bf1..a0260e19b68 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -509,7 +509,7 @@ find_substitution (node) std::basic_string <char, std::char_traits<char>, std::allocator<char> > . */ - if (CP_TYPE_QUALS (type) == TYPE_UNQUALIFIED + if (cp_type_quals (type) == TYPE_UNQUALIFIED && CLASSTYPE_USE_TEMPLATE (type)) { tree args = CLASSTYPE_TI_ARGS (type); @@ -535,7 +535,7 @@ find_substitution (node) /* Check for basic_{i,o,io}stream. */ if (TYPE_P (node) - && CP_TYPE_QUALS (type) == TYPE_UNQUALIFIED + && cp_type_quals (type) == TYPE_UNQUALIFIED && CLASS_TYPE_P (type) && CLASSTYPE_USE_TEMPLATE (type) && CLASSTYPE_TEMPLATE_INFO (type) != NULL) diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 24fd379933a..4de7605984c 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -551,7 +551,7 @@ do_build_copy_constructor (fndecl) tree binfos = TYPE_BINFO_BASETYPES (current_class_type); tree member_init_list = NULL_TREE; tree base_init_list = NULL_TREE; - int cvquals = CP_TYPE_QUALS (TREE_TYPE (parm)); + int cvquals = cp_type_quals (TREE_TYPE (parm)); int i; /* Initialize all the base-classes with the parameter converted to @@ -640,7 +640,7 @@ do_build_assign_ref (fndecl) tree fields = TYPE_FIELDS (current_class_type); int n_bases = CLASSTYPE_N_BASECLASSES (current_class_type); tree binfos = TYPE_BINFO_BASETYPES (current_class_type); - int cvquals = CP_TYPE_QUALS (TREE_TYPE (parm)); + int cvquals = cp_type_quals (TREE_TYPE (parm)); int i; for (i = 0; i < n_bases; ++i) @@ -919,7 +919,7 @@ locate_copy (type, client_) continue; if (!sufficient_parms_p (TREE_CHAIN (parms))) continue; - quals = CP_TYPE_QUALS (src_type); + quals = cp_type_quals (src_type); if (client->quals & ~quals) continue; excess = quals & ~client->quals; diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index f80392ac875..8273e168d1c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5905,7 +5905,7 @@ tsubst_decl (t, args, type) { r = copy_node (t); TREE_TYPE (r) = type; - c_apply_type_quals_to_decl (CP_TYPE_QUALS (type), r); + c_apply_type_quals_to_decl (cp_type_quals (type), r); if (TREE_CODE (DECL_INITIAL (r)) != TEMPLATE_PARM_INDEX) DECL_INITIAL (r) = TREE_TYPE (r); @@ -5928,7 +5928,7 @@ tsubst_decl (t, args, type) { r = copy_decl (t); TREE_TYPE (r) = type; - c_apply_type_quals_to_decl (CP_TYPE_QUALS (type), r); + c_apply_type_quals_to_decl (cp_type_quals (type), r); /* We don't have to set DECL_CONTEXT here; it is set by finish_member_declaration. */ @@ -6007,7 +6007,7 @@ tsubst_decl (t, args, type) r = copy_decl (t); TREE_TYPE (r) = type; - c_apply_type_quals_to_decl (CP_TYPE_QUALS (type), r); + c_apply_type_quals_to_decl (cp_type_quals (type), r); DECL_CONTEXT (r) = ctx; /* Clear out the mangled name and RTL for the instantiation. */ SET_DECL_ASSEMBLER_NAME (r, NULL_TREE); @@ -6394,7 +6394,7 @@ tsubst (t, args, complain, in_decl) { my_friendly_assert (TYPE_P (arg), 0); return cp_build_qualified_type_real - (arg, CP_TYPE_QUALS (arg) | CP_TYPE_QUALS (t), + (arg, cp_type_quals (arg) | cp_type_quals (t), complain); } else if (TREE_CODE (t) == BOUND_TEMPLATE_TEMPLATE_PARM) @@ -6445,10 +6445,10 @@ tsubst (t, args, complain, in_decl) case TEMPLATE_TYPE_PARM: case TEMPLATE_TEMPLATE_PARM: case BOUND_TEMPLATE_TEMPLATE_PARM: - if (CP_TYPE_QUALS (t)) + if (cp_type_quals (t)) { r = tsubst (TYPE_MAIN_VARIANT (t), args, complain, in_decl); - r = cp_build_qualified_type_real (r, CP_TYPE_QUALS (t), + r = cp_build_qualified_type_real (r, cp_type_quals (t), complain); } else @@ -6755,8 +6755,8 @@ tsubst (t, args, complain, in_decl) if (f == error_mark_node) return f; return cp_build_qualified_type_real (f, - CP_TYPE_QUALS (f) - | CP_TYPE_QUALS (t), + cp_type_quals (f) + | cp_type_quals (t), complain); } @@ -8667,8 +8667,8 @@ unify (tparms, targs, parm, arg, strict) PARM is `const T'. Then, T should be `volatile int'. */ arg = cp_build_qualified_type_real (arg, - CP_TYPE_QUALS (arg) - & ~CP_TYPE_QUALS (parm), + cp_type_quals (arg) + & ~cp_type_quals (parm), /*complain=*/0); if (arg == error_mark_node) return 1; diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index c91b378a313..ae9600c648d 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -107,7 +107,7 @@ build_headof (exp) offset = build_vtbl_ref (build_indirect_ref (exp, NULL), index); type = build_qualified_type (ptr_type_node, - CP_TYPE_QUALS (TREE_TYPE (exp))); + cp_type_quals (TREE_TYPE (exp))); return build (PLUS_EXPR, type, exp, cp_convert (ptrdiff_type_node, offset)); } @@ -923,8 +923,8 @@ typeinfo_in_lib_p (type) /* The typeinfo objects for `T*' and `const T*' are in the runtime library for simple types T. */ if (TREE_CODE (type) == POINTER_TYPE - && (CP_TYPE_QUALS (TREE_TYPE (type)) == TYPE_QUAL_CONST - || CP_TYPE_QUALS (TREE_TYPE (type)) == TYPE_UNQUALIFIED)) + && (cp_type_quals (TREE_TYPE (type)) == TYPE_QUAL_CONST + || cp_type_quals (TREE_TYPE (type)) == TYPE_UNQUALIFIED)) type = TREE_TYPE (type); switch (TREE_CODE (type)) diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index ae1e5975818..edd676be368 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2128,7 +2128,7 @@ finish_base_specifier (access_specifier, base_class) result = NULL_TREE; else { - if (CP_TYPE_QUALS (base_class) != 0) + if (cp_type_quals (base_class) != 0) { cp_error ("base class `%T' has cv qualifiers", base_class); base_class = TYPE_MAIN_VARIANT (base_class); diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 97ae23154a9..ae4c375fd9e 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -490,7 +490,7 @@ build_cplus_array_type (elt_type, index_type) tree index_type; { tree t; - int type_quals = CP_TYPE_QUALS (elt_type); + int type_quals = cp_type_quals (elt_type); if (type_quals != TYPE_UNQUALIFIED) elt_type = cp_build_qualified_type (elt_type, TYPE_UNQUALIFIED); @@ -521,7 +521,7 @@ cp_build_qualified_type_real (type, type_quals, complain) if (type == error_mark_node) return type; - if (type_quals == CP_TYPE_QUALS (type)) + if (type_quals == cp_type_quals (type)) return type; /* A restrict-qualified pointer type must be a pointer (or reference) @@ -624,7 +624,7 @@ tree canonical_type_variant (t) tree t; { - return cp_build_qualified_type (TYPE_MAIN_VARIANT (t), CP_TYPE_QUALS (t)); + return cp_build_qualified_type (TYPE_MAIN_VARIANT (t), cp_type_quals (t)); } /* Makes new binfos for the indirect bases under BINFO, and updates diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index e57dd1cc18d..c4c0e10d078 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -223,7 +223,7 @@ qualify_type_recursive (t1, t2) else b1 = NULL_TREE; - type_quals = (CP_TYPE_QUALS (tt1) | CP_TYPE_QUALS (tt2)); + type_quals = (cp_type_quals (tt1) | cp_type_quals (tt2)); tgt = qualify_type_recursive (tt1, tt2); tgt = cp_build_qualified_type (tgt, type_quals); if (b1) @@ -486,8 +486,8 @@ composite_pointer_type (t1, t2, arg1, arg2, location) t1 = TREE_TYPE (t1); t2 = TREE_TYPE (t2); result_type = cp_build_qualified_type (void_type_node, - (CP_TYPE_QUALS (t1) - | CP_TYPE_QUALS (t2))); + (cp_type_quals (t1) + | cp_type_quals (t2))); result_type = build_pointer_type (result_type); } else @@ -617,7 +617,7 @@ common_type (t1, t2) else b1 = b2 = NULL_TREE; - type_quals = (CP_TYPE_QUALS (tt1) | CP_TYPE_QUALS (tt2)); + type_quals = (cp_type_quals (tt1) | cp_type_quals (tt2)); tt1 = TYPE_MAIN_VARIANT (tt1); tt2 = TYPE_MAIN_VARIANT (tt2); @@ -795,7 +795,7 @@ comp_except_types (a, b, exact) return 1; else if (!exact) { - if (CP_TYPE_QUALS (a) || CP_TYPE_QUALS (b)) + if (cp_type_quals (a) || cp_type_quals (b)) return 0; if (TREE_CODE (a) == POINTER_TYPE @@ -803,7 +803,7 @@ comp_except_types (a, b, exact) { a = TREE_TYPE (a); b = TREE_TYPE (b); - if (CP_TYPE_QUALS (a) || CP_TYPE_QUALS (b)) + if (cp_type_quals (a) || cp_type_quals (b)) return 0; } @@ -983,7 +983,7 @@ comptypes (t1, t2, strict) return 0; /* Qualifiers must match. */ - if (CP_TYPE_QUALS (t1) != CP_TYPE_QUALS (t2)) + if (cp_type_quals (t1) != cp_type_quals (t2)) return 0; if (strict == COMPARE_STRICT && TYPE_FOR_JAVA (t1) != TYPE_FOR_JAVA (t2)) @@ -1327,8 +1327,8 @@ at_least_as_qualified_p (type1, type2) tree type2; { /* All qualifiers for TYPE2 must also appear in TYPE1. */ - return ((CP_TYPE_QUALS (type1) & CP_TYPE_QUALS (type2)) - == CP_TYPE_QUALS (type2)); + return ((cp_type_quals (type1) & cp_type_quals (type2)) + == cp_type_quals (type2)); } /* Returns 1 if TYPE1 is more qualified than TYPE2. */ @@ -1338,7 +1338,7 @@ more_qualified_p (type1, type2) tree type1; tree type2; { - return (CP_TYPE_QUALS (type1) != CP_TYPE_QUALS (type2) + return (cp_type_quals (type1) != cp_type_quals (type2) && at_least_as_qualified_p (type1, type2)); } @@ -1350,7 +1350,7 @@ comp_cv_qualification (type1, type2) tree type1; tree type2; { - if (CP_TYPE_QUALS (type1) == CP_TYPE_QUALS (type2)) + if (cp_type_quals (type1) == cp_type_quals (type2)) return 0; if (at_least_as_qualified_p (type1, type2)) @@ -2241,8 +2241,8 @@ build_component_ref (datum, component, basetype_path, protect) ; else { - type_quals = (CP_TYPE_QUALS (field_type) - | CP_TYPE_QUALS (TREE_TYPE (datum))); + type_quals = (cp_type_quals (field_type) + | cp_type_quals (TREE_TYPE (datum))); /* A field is const (volatile) if the enclosing object, or the field itself, is const (volatile). But, a mutable field is @@ -6892,7 +6892,8 @@ comp_ptr_ttypes_reinterpret (to, from) } } -/* Returns the type-qualifier set corresponding to TYPE. */ +/* Returns the type qualifiers for this type, including the qualifiers on the + elements for an array type. */ int cp_type_quals (type) @@ -6958,14 +6959,14 @@ casts_away_constness_r (t1, t2) || TREE_CODE (*t2) != POINTER_TYPE) { *t1 = cp_build_qualified_type (void_type_node, - CP_TYPE_QUALS (*t1)); + cp_type_quals (*t1)); *t2 = cp_build_qualified_type (void_type_node, - CP_TYPE_QUALS (*t2)); + cp_type_quals (*t2)); return; } - quals1 = CP_TYPE_QUALS (*t1); - quals2 = CP_TYPE_QUALS (*t2); + quals1 = cp_type_quals (*t1); + quals2 = cp_type_quals (*t2); *t1 = TREE_TYPE (*t1); *t2 = TREE_TYPE (*t2); casts_away_constness_r (t1, t2); diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 2a9b2a91794..8281b34de49 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1159,8 +1159,8 @@ build_m_component_ref (datum, component) ; else { - type_quals = (CP_TYPE_QUALS (field_type) - | CP_TYPE_QUALS (TREE_TYPE (datum))); + type_quals = (cp_type_quals (field_type) + | cp_type_quals (TREE_TYPE (datum))); /* There's no such thing as a mutable pointer-to-member, so we don't need to deal with that here like we do in build_component_ref. */ diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index ef767511f23..7c8480f4f84 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -103,7 +103,19 @@ int lhd_tree_inlining_anon_aggr_type_p PARAMS ((tree)); LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \ } \ -/* The whole thing. The structure is defined in toplev.h. */ +/* Tree dump hooks. */ +int lhd_tree_dump_dump_tree PARAMS ((void *, tree)); +int lhd_tree_dump_type_quals PARAMS ((tree)); + +#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN lhd_tree_dump_dump_tree +#define LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN lhd_tree_dump_type_quals + +#define LANG_HOOKS_TREE_DUMP_INITIALIZER { \ + LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN, \ + LANG_HOOKS_TREE_DUMP_TYPE_QUALS_FN \ +} \ + +/* The whole thing. The structure is defined in langhooks.h. */ #define LANG_HOOKS_INITIALIZER { \ LANG_HOOKS_NAME, \ LANG_HOOKS_IDENTIFIER_SIZE, \ @@ -121,7 +133,8 @@ int lhd_tree_inlining_anon_aggr_type_p PARAMS ((tree)); LANG_HOOKS_PRINT_TYPE, \ LANG_HOOKS_PRINT_IDENTIFIER, \ LANG_HOOKS_SET_YYDEBUG, \ - LANG_HOOKS_TREE_INLINING_INITIALIZER \ + LANG_HOOKS_TREE_INLINING_INITIALIZER, \ + LANG_HOOKS_TREE_DUMP_INITIALIZER \ } #endif /* GCC_LANG_HOOKS_DEF_H */ diff --git a/gcc/langhooks.c b/gcc/langhooks.c index f2b982121f8..8465bd32e50 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA. */ #include "system.h" #include "toplev.h" #include "tree.h" +#include "c-tree.h" #include "tree-inline.h" #include "rtl.h" #include "insn-config.h" @@ -211,3 +212,25 @@ lhd_tree_inlining_anon_aggr_type_p (t) return 0; } +/* lang_hooks.tree_dump.dump_tree: Dump language-specific parts of tree + nodes. Returns non-zero if it does not want the usual dumping of the + second argument. */ + +int +lhd_tree_dump_dump_tree (di, t) + void *di ATTRIBUTE_UNUSED; + tree t ATTRIBUTE_UNUSED; +{ + return 0; +} + +/* lang_hooks.tree_dump.type_qual: Determine type qualifiers in a + language-specific way. */ + +int +lhd_tree_dump_type_quals (t) + tree t; +{ + return TYPE_QUALS (t); +} + diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 0402940a398..4ec01e70d01 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -48,6 +48,18 @@ struct lang_hooks_for_tree_inlining int (*anon_aggr_type_p) PARAMS ((union tree_node *)); }; +/* The following hooks are used by tree-dump.c. */ + +struct lang_hooks_for_tree_dump +{ + /* Dump language-specific parts of tree nodes. Returns non-zero if it + does not want the usual dumping of the second argument. */ + int (*dump_tree) PARAMS ((void *, tree)); + + /* Determine type qualifiers in a language-specific way. */ + int (*type_quals) PARAMS ((tree)); +}; + /* Language-specific hooks. See langhooks-def.h for defaults. */ struct lang_hooks @@ -116,8 +128,10 @@ struct lang_hooks void (*set_yydebug) PARAMS ((int)); struct lang_hooks_for_tree_inlining tree_inlining; + + struct lang_hooks_for_tree_dump tree_dump; - /* Whenever you add entries here, make sure you adjust langhooks.h + /* Whenever you add entries here, make sure you adjust langhooks-def.h and langhooks.c accordingly. */ }; diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index 28e7248a051..91d6e714c55 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -26,7 +26,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "splay-tree.h" #include "diagnostic.h" #include "toplev.h" -#include "c-dump.h" +#include "tree-dump.h" #include "langhooks.h" static unsigned int queue PARAMS ((dump_info_p, tree, int)); diff --git a/gcc/tree-dump.h b/gcc/tree-dump.h index 4c4962c9a5c..9e9888e0ad5 100644 --- a/gcc/tree-dump.h +++ b/gcc/tree-dump.h @@ -19,8 +19,8 @@ along with GCC; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef GCC_C_DUMP_H -#define GCC_C_DUMP_H +#ifndef GCC_TREE_DUMP_H +#define GCC_TREE_DUMP_H /* Flags used with queue functions. */ #define DUMP_NONE 0 @@ -92,4 +92,4 @@ extern void queue_and_dump_index extern void queue_and_dump_type PARAMS ((dump_info_p, tree)); -#endif /* ! GCC_C_DUMP_H */ +#endif /* ! GCC_TREE_DUMP_H */ diff --git a/gcc/tree.h b/gcc/tree.h index c28edf12df6..5f6424da7b7 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3059,6 +3059,37 @@ extern void dwarf2out_return_reg PARAMS ((const char *, unsigned)); typedef tree (*walk_tree_fn) PARAMS ((tree *, int *, void *)); +/* In tree-dump.c */ + +/* Different tree dump places. When you add new tree dump places, + extend the DUMP_FILES array in tree-dump.c */ +enum tree_dump_index +{ + TDI_all, /* dump the whole translation unit */ + TDI_class, /* dump class hierarchy */ + TDI_original, /* dump each function before optimizing it */ + TDI_optimized, /* dump each function after optimizing it */ + TDI_inlined, /* dump each function after inlining + within it. */ + TDI_end +}; + +/* Bit masks to control tree dumping. Not all values are applicable to + all tree dumps. Add new ones at the end. When you define new + values, extend the DUMP_OPTIONS array in tree-dump.c */ +#define TDF_ADDRESS (1 << 0) /* dump node addresses */ +#define TDF_SLIM (1 << 1) /* don't go wild following links */ + +typedef struct dump_info *dump_info_p; + +extern int dump_flag PARAMS ((dump_info_p, int, tree)); +extern int dump_enabled_p PARAMS ((enum tree_dump_index)); +extern FILE *dump_begin PARAMS ((enum tree_dump_index, int *)); +extern void dump_end PARAMS ((enum tree_dump_index, FILE *)); +extern void dump_node PARAMS ((tree, int, FILE *)); +extern int dump_switch_p PARAMS ((const char *)); +extern const char *dump_flag_name PARAMS ((enum tree_dump_index)); + /* Redefine abort to report an internal error w/o coredump, and reporting the location of the error in the source file. This logic |