📄 tree.h
字号:
/* Front-end tree definitions for GNU compiler. Copyright (C) 1989 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 1, 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, 675 Mass Ave, Cambridge, MA 02139, USA. *//* codes of tree nodes */#define DEFTREECODE(SYM, STRING, TYPE, NARGS) SYM,enum tree_code {#include "tree.def" LAST_AND_UNUSED_TREE_CODE /* A convienent 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 `e' for an expression, `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[];/* Number of argument-words in each kind of tree-node. */extern int tree_code_length[];/* Get the definition of `enum machine_mode' */#ifndef HAVE_MACHINE_MODES#define DEF_MACHMODE(SYM, NAME, TYPE, SIZE, UNIT, WIDER) SYM,enum machine_mode {#include "machmode.def"MAX_MACHINE_MODE };#undef DEF_MACHMODE#define HAVE_MACHINE_MODES#endif /* not HAVE_MACHINE_MODES */#ifndef NUM_MACHINE_MODES#define NUM_MACHINE_MODES (int) MAX_MACHINE_MODE#endif/* 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_FSQRT, BUILT_IN_GETEXP, BUILT_IN_GETMAN, BUILT_IN_SAVEREGS, BUILT_IN_CLASSIFY_TYPE, BUILT_IN_NEXT_ARG, /* C++ extensions */ BUILT_IN_NEW, BUILT_IN_VEC_NEW, BUILT_IN_DELETE, BUILT_IN_VEC_DELETE};/* 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;#define NULL_TREE (tree) NULL/* 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{ int uid; union tree_node *chain; union tree_node *type; unsigned char code : 8; unsigned external_attr : 1; unsigned public_attr : 1; unsigned static_attr : 1; unsigned volatile_attr : 1; unsigned packed_attr : 1; unsigned readonly_attr : 1; unsigned literal_attr : 1; unsigned nonlocal_attr : 1; unsigned permanent_attr : 1; unsigned addressable_attr : 1; unsigned regdecl_attr : 1; unsigned this_vol_attr : 1; unsigned unsigned_attr : 1; unsigned asm_written_attr: 1; unsigned inline_attr : 1; unsigned used_attr : 1; unsigned lang_flag_1 : 1; unsigned lang_flag_2 : 1; unsigned lang_flag_3 : 1; unsigned lang_flag_4 : 1; /* There is room for four more attributes. */};/* Define accessors for the fields that all tree nodes have (though some fields are not used for all kinds of nodes). *//* The unique id of a tree node distinguishes it from all other nodes in the same compiler run. */#define TREE_UID(NODE) ((NODE)->common.uid)/* 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)/* Define many boolean fields that all tree nodes have. *//* In a VAR_DECL or FUNCTION_DECL, nonzero means external reference: do not allocate storage, and refer to a definition elsewhere. */#define TREE_EXTERNAL(NODE) ((NODE)->common.external_attr)/* In a VAR_DECL, nonzero means allocate static storage. In a FUNCTION_DECL, currently nonzero if function has been defined. */#define TREE_STATIC(NODE) ((NODE)->common.static_attr)/* In a VAR_DECL or FUNCTION_DECL, nonzero means name is to be accessible from outside this module. */#define TREE_PUBLIC(NODE) ((NODE)->common.public_attr)/* In VAR_DECL nodes, nonzero means address of this is needed. So it cannot be in a register. In a FUNCTION_DECL, nonzero means its address is needed. So it must be compiled even if it is an inline function. In CONSTRUCTOR nodes, it means the elements are all constants suitable for output as assembly-language initializers. In LABEL_DECL nodes, it means a goto for this label has been seen from a place outside all binding contours that restore stack levels. In ..._TYPE nodes, it means that objects of this type must be fully addressable. This means that pieces of this object cannot go into register parameters, for example. */#define TREE_ADDRESSABLE(NODE) ((NODE)->common.addressable_attr)/* In VAR_DECL nodes, nonzero means declared `register'. In LABEL_DECL nodes, nonzero means that an error message about jumping into such a binding contour has been printed for this label. */#define TREE_REGDECL(NODE) ((NODE)->common.regdecl_attr)/* In any expression, nonzero means it has side effects or reevaluation of the whole expression could produce a different value. This is set if any subexpression is a function call, a side effect or a reference to a volatile variable. In a ..._DECL, this is set only if the declaration said `volatile'. In a ..._TYPE, nonzero means the type is volatile-qualified. */#define TREE_VOLATILE(NODE) ((NODE)->common.volatile_attr)/* Nonzero means this expression is volatile in the C sense: its address should be of type `volatile WHATEVER *'. If this bit is set, so is `volatile_attr'. */#define TREE_THIS_VOLATILE(NODE) ((NODE)->common.this_vol_attr)/* In a VAR_DECL, PARM_DECL or FIELD_DECL, or any kind of ..._REF node, nonzero means it may not be the lhs of an assignment. In a ..._TYPE node, means this type is const-qualified. */#define TREE_READONLY(NODE) ((NODE)->common.readonly_attr)/* Nonzero in a FIELD_DECL means it is a bit-field; it may occupy less than a storage unit, and its address may not be taken, etc. This controls layout of the containing record. In a LABEL_DECL, nonzero means label was defined inside a binding contour that restored a stack level and which is now exited. */#define TREE_PACKED(NODE) ((NODE)->common.packed_attr)/* Value of expression is constant. Always appears in all ..._CST nodes. May also appear in an arithmetic expression, an ADDR_EXPR or a CONSTRUCTOR if the value is constant. */#define TREE_LITERAL(NODE) ((NODE)->common.literal_attr)/* Nonzero in a ..._DECL means this variable is ref'd from a nested function. Cannot happen in C because it does not allow nested functions, as of now. For VAR_DECL nodes, PARM_DECL nodes, and maybe FUNCTION_DECL or LABEL_DECL nodes. Also set in some languages for variables, etc., outside the normal lexical scope, such as class instance variables. */#define TREE_NONLOCAL(NODE) ((NODE)->common.nonlocal_attr)/* Nonzero means permanent node; node will continue to exist for the entire compiler run. Otherwise it will be recycled at the end of the function. */#define TREE_PERMANENT(NODE) ((NODE)->common.permanent_attr)/* In INTEGER_TYPE or ENUMERAL_TYPE nodes, means an unsigned type. In FIELD_DECL nodes, means an unsigned bit field. */#define TREE_UNSIGNED(NODE) ((NODE)->common.unsigned_attr)/* Nonzero in a VAR_DECL means assembler code has been written. Nonzero in a FUNCTION_DECL means that the function has been compiled. This is interesting in an inline function, since it might not need to be compiled separately. */#define TREE_ASM_WRITTEN(NODE) ((NODE)->common.asm_written_attr)/* Nonzero in a FUNCTION_DECL means this function can be substituted where it is called. */#define TREE_INLINE(NODE) ((NODE)->common.inline_attr)/* Nonzero in a _DECL if the name is used in its scope. */#define TREE_USED(NODE) ((NODE)->common.used_attr)#define TREE_LANG_FLAG_1(NODE) ((NODE)->common.lang_flag_1)#define TREE_LANG_FLAG_2(NODE) ((NODE)->common.lang_flag_2)#define TREE_LANG_FLAG_3(NODE) ((NODE)->common.lang_flag_3)#define TREE_LANG_FLAG_4(NODE) ((NODE)->common.lang_flag_4)/* Define additional fields and accessors for nodes representing constants. *//* In an INTEGER_CST node. These two together make a 64 bit integer. If the data type is signed, the value is sign-extended to 64 bits even though not all of them may really be in use. In an unsigned constant shorter than 64 bits, the extra bits are 0. */#define TREE_INT_CST_LOW(NODE) ((NODE)->int_cst.int_cst_low)#define TREE_INT_CST_HIGH(NODE) ((NODE)->int_cst.int_cst_high)#define INT_CST_LT(A, B) \(TREE_INT_CST_HIGH (A) < TREE_INT_CST_HIGH (B) \ || (TREE_INT_CST_HIGH (A) == TREE_INT_CST_HIGH (B) \ && ((unsigned) TREE_INT_CST_LOW (A) < (unsigned) TREE_INT_CST_LOW (B))))#define INT_CST_LT_UNSIGNED(A, B) \((unsigned) TREE_INT_CST_HIGH (A) < (unsigned) TREE_INT_CST_HIGH (B) \ || ((unsigned) TREE_INT_CST_HIGH (A) == (unsigned) TREE_INT_CST_HIGH (B) \ && ((unsigned) TREE_INT_CST_LOW (A) < (unsigned) TREE_INT_CST_LOW (B))))struct tree_int_cst{ char common[sizeof (struct tree_common)]; long int_cst_low; long int_cst_high;};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -