This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][RFC] Introduce type safety and debuggability into tree.h
- From: Simon Baldwin <simonb at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 09 Aug 2007 15:21:34 -0700
- Subject: [PATCH][RFC] Introduce type safety and debuggability into tree.h
This patch replaces some of the function-like macros in gcc/tree.h with
static inlined function equivalents.
The aim is to improve the experience of debugging gcc with gdb, and to
introduce some type-safety into tree accessor functions. There are
around 450 such macros in type.h. This patch addresses the first couple
of dozen as an initial foray into refactoring. Lengthy, but
functionally neutral.
Confirmed with full bootstrap across all languages, and with the full
testsuite across those same languages. Compiler throughput for
optimized gcc builds is the same as before the patch, within the limits
of timing stability.
Does a patch of this nature seem useful?
gcc/gcc/Changelog
2007-08-09 Simon Baldwin <simonb@google.com>
* tree.h: Replaced the following macros with equivalent static
inline
functions: CODE_CONTAINS_STRUCT, TREE_CODE_CLASS_STRING,
TREE_CODE_CLASS, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P, TYPE_P,
DECL_P, MTAG_P, VAR_OR_FUNCTION_DECL_P, INDIRECT_REF_P,
REFERENCE_CLASS_P COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P,
STATEMENT_CLASS_P, VL_EXP_CLASS_P, EXPRESSION_CLASS_P,
IS_TYPE_OR_DECL_P, IS_EXPR_CODE_CLASS, IS_GIMPLE_STMT_CODE_CLASS,
OMP_DIRECTIVE_P, TREE_CODE_LENGTH
* alias.c, attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c,
c-objc-common.c, c-parser.c, c-pragma.c, c-pretty-print.c,
c-semantics.c, c-typeck.c, calls.c, cfgexpand.c, cgraphbuild.c,
config/alpha/alpha.c, config/arm/arm.c, config/avr/avr.c,...
...remainder in compressed attachment.
Attachment:
refactor_tree.patch.bz2
Description: application/bzip