📄 tree.h
字号:
/* Front-end tree definitions for GNU compiler. Copyright (C) 1989, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.This file is part of GNU CC.GNU CC is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU CC is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU CC; see the file COPYING. If not, write tothe Free Software Foundation, 59 Temple Place - Suite 330,Boston, MA 02111-1307, USA. */#include "machmode.h"#ifndef RTX_CODEstruct rtx_def;#endif/* Codes of tree nodes */#define DEFTREECODE(SYM, STRING, TYPE, NARGS) SYM,enum tree_code {#include "tree.def" LAST_AND_UNUSED_TREE_CODE /* A convenient way to get a value for NUM_TREE_CODE. */};#undef DEFTREECODE/* Number of 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). */extern char **tree_code_type;#define TREE_CODE_CLASS(CODE) (*tree_code_type[(int) (CODE)])/* Number of argument-words in each kind of tree-node. */extern int *tree_code_length;/* Names of tree components. */extern char **tree_code_name;/* Codes that identify the various built in functions so that expand_call can identify them quickly. */enum built_in_function{ NOT_BUILT_IN, BUILT_IN_ALLOCA, BUILT_IN_ABS, BUILT_IN_FABS, BUILT_IN_LABS, BUILT_IN_FFS, BUILT_IN_DIV, BUILT_IN_LDIV, BUILT_IN_FFLOOR, BUILT_IN_FCEIL, BUILT_IN_FMOD, BUILT_IN_FREM, BUILT_IN_MEMCPY, BUILT_IN_MEMCMP, BUILT_IN_MEMSET, BUILT_IN_STRCPY, BUILT_IN_STRCMP, BUILT_IN_STRLEN, BUILT_IN_FSQRT, BUILT_IN_SIN, BUILT_IN_COS, BUILT_IN_GETEXP, BUILT_IN_GETMAN, BUILT_IN_SAVEREGS, BUILT_IN_CLASSIFY_TYPE, BUILT_IN_NEXT_ARG, BUILT_IN_ARGS_INFO, BUILT_IN_CONSTANT_P, BUILT_IN_FRAME_ADDRESS, BUILT_IN_RETURN_ADDRESS, BUILT_IN_AGGREGATE_INCOMING_ADDRESS, BUILT_IN_CALLER_RETURN_ADDRESS, BUILT_IN_APPLY_ARGS, BUILT_IN_APPLY, BUILT_IN_RETURN, BUILT_IN_SETJMP, BUILT_IN_LONGJMP, /* Various hooks for the DWARF 2 __throw routine. */ BUILT_IN_FP, BUILT_IN_SP, BUILT_IN_UNWIND_INIT, BUILT_IN_DWARF_FP_REGNUM, BUILT_IN_DWARF_REG_SIZE, BUILT_IN_FROB_RETURN_ADDR, BUILT_IN_EXTRACT_RETURN_ADDR, BUILT_IN_SET_RETURN_ADDR_REG, BUILT_IN_EH_STUB, BUILT_IN_SET_EH_REGS, /* C++ extensions */ BUILT_IN_NEW, BUILT_IN_VEC_NEW, BUILT_IN_DELETE, BUILT_IN_VEC_DELETE, /* Upper bound on non-language-specific builtins. */ END_BUILTINS};/* The definition of tree nodes fills the next several pages. *//* A tree node can represent a data type, a variable, an expression or a statement. Each node has a TREE_CODE which says what kind of thing it represents. Some common codes are: INTEGER_TYPE -- represents a type of integers. ARRAY_TYPE -- represents a type of pointer. VAR_DECL -- represents a declared variable. INTEGER_CST -- represents a constant integer value. PLUS_EXPR -- represents a sum (an expression). As for the contents of a tree node: there are some fields that all nodes share. Each TREE_CODE has various special-purpose fields as well. The fields of a node are never accessed directly, always through accessor macros. *//* This type is used everywhere to refer to a tree node. */typedef union tree_node *tree;/* Every kind of tree node starts with this structure, so all nodes have these fields. See the accessor macros, defined below, for documentation of the fields. */struct tree_common{ union tree_node *chain; union tree_node *type;#ifdef ONLY_INT_FIELDS unsigned int code : 8;#else enum tree_code code : 8;#endif unsigned side_effects_flag : 1; unsigned constant_flag : 1; unsigned permanent_flag : 1; unsigned addressable_flag : 1; unsigned volatile_flag : 1; unsigned readonly_flag : 1; unsigned unsigned_flag : 1; unsigned asm_written_flag: 1; unsigned used_flag : 1; unsigned raises_flag : 1; unsigned static_flag : 1; unsigned public_flag : 1; unsigned private_flag : 1; unsigned protected_flag : 1; unsigned lang_flag_0 : 1; unsigned lang_flag_1 : 1; unsigned lang_flag_2 : 1; unsigned lang_flag_3 : 1; unsigned lang_flag_4 : 1; unsigned lang_flag_5 : 1; unsigned lang_flag_6 : 1; /* There is room for three more flags. */};/* The following table lists the uses of each of the above flags and for which types of nodes they are defined. Note that expressions include decls. addressable_flag: TREE_ADDRESSABLE in VAR_DECL, FUNCTION_DECL, CONSTRUCTOR, LABEL_DECL, ..._TYPE IDENTIFIER_NODE static_flag: TREE_STATIC in VAR_DECL, FUNCTION_DECL, CONSTRUCTOR TREE_NO_UNUSED_WARNING in CONVERT_EXPR, NOP_EXPR, COMPOUND_EXPR TREE_VIA_VIRTUAL in TREE_LIST or TREE_VEC TREE_CONSTANT_OVERFLOW in INTEGER_CST, REAL_CST, COMPLEX_CST TREE_SYMBOL_REFERENCED in IDENTIFIER_NODE public_flag: TREE_OVERFLOW in INTEGER_CST, REAL_CST, COMPLEX_CST TREE_PUBLIC in VAR_DECL or FUNCTION_DECL TREE_VIA_PUBLIC in TREE_LIST or TREE_VEC private_flag: TREE_VIA_PRIVATE in TREE_LIST or TREE_VEC TREE_PRIVATE in ??? unspecified nodes protected_flag: TREE_VIA_PROTECTED in TREE_LIST TREE_PROTECTED in BLOCK ??? unspecified nodes side_effects_flag: TREE_SIDE_EFFECTS in all expressions volatile_flag: TREE_THIS_VOLATILE in all expressions TYPE_VOLATILE in ..._TYPE readonly_flag: TREE_READONLY in VAR_DECL, PARM_DECL, FIELD_DECL, ..._REF ITERATOR_BOUND_P in VAR_DECL if iterator (C) TYPE_READONLY in ..._TYPE constant_flag: TREE_CONSTANT in all expressions permanent_flag: TREE_PERMANENT in all nodes unsigned_flag: TREE_UNSIGNED in INTEGER_TYPE, ENUMERAL_TYPE, FIELD_DECL DECL_BUILT_IN_NONANSI in FUNCTION_DECL TREE_PARMLIST in TREE_PARMLIST (C++) SAVE_EXPR_NOPLACEHOLDER in SAVE_EXPR asm_written_flag: TREE_ASM_WRITTEN in VAR_DECL, FUNCTION_DECL, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE BLOCK used_flag: TREE_USED in expressions, IDENTIFIER_NODE raises_flag: TREE_RAISES in expressions *//* Define accessors for the fields that all tree nodes have (though some fields are not used for all kinds of nodes). *//* The tree-code says what kind of node it is. Codes are defined in tree.def. */#define TREE_CODE(NODE) ((enum tree_code) (NODE)->common.code)#define TREE_SET_CODE(NODE, VALUE) ((NODE)->common.code = (int) (VALUE))/* In all nodes that are expressions, this is the data type of the expression. In POINTER_TYPE nodes, this is the type that the pointer points to. In ARRAY_TYPE nodes, this is the type of the elements. */#define TREE_TYPE(NODE) ((NODE)->common.type)/* Nodes are chained together for many purposes. Types are chained together to record them for being output to the debugger (see the function `chain_type'). Decls in the same scope are chained together to record the contents of the scope. Statement nodes for successive statements used to be chained together. Often lists of things are represented by TREE_LIST nodes that are chained together. */#define TREE_CHAIN(NODE) ((NODE)->common.chain)/* Given an expression as a tree, strip any NON_LVALUE_EXPRs and NOP_EXPRs that don't change the machine mode. */#define STRIP_NOPS(EXP) \ while ((TREE_CODE (EXP) == NOP_EXPR \ || TREE_CODE (EXP) == CONVERT_EXPR \ || TREE_CODE (EXP) == NON_LVALUE_EXPR) \ && (TYPE_MODE (TREE_TYPE (EXP)) \ == TYPE_MODE (TREE_TYPE (TREE_OPERAND (EXP, 0))))) \ (EXP) = TREE_OPERAND (EXP, 0);/* Like STRIP_NOPS, but don't alter the TREE_TYPE either. */#define STRIP_TYPE_NOPS(EXP) \ while ((TREE_CODE (EXP) == NOP_EXPR \ || TREE_CODE (EXP) == CONVERT_EXPR \ || TREE_CODE (EXP) == NON_LVALUE_EXPR) \ && (TREE_TYPE (EXP) \ == TREE_TYPE (TREE_OPERAND (EXP, 0)))) \ (EXP) = TREE_OPERAND (EXP, 0);/* Nonzero if TYPE represents an integral type. Note that we do not include COMPLEX types here. */#define INTEGRAL_TYPE_P(TYPE) \ (TREE_CODE (TYPE) == INTEGER_TYPE || TREE_CODE (TYPE) == ENUMERAL_TYPE \ || TREE_CODE (TYPE) == BOOLEAN_TYPE || TREE_CODE (TYPE) == CHAR_TYPE)/* Nonzero if TYPE represents a floating-point type, including complex floating-point types. */#define FLOAT_TYPE_P(TYPE) \ (TREE_CODE (TYPE) == REAL_TYPE \ || (TREE_CODE (TYPE) == COMPLEX_TYPE \ && TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE))/* Nonzero if TYPE represents an aggregate (multi-component) type. */#define AGGREGATE_TYPE_P(TYPE) \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -