📄 ch-tree.h
字号:
/* Definitions for CHILL parsing and type checking. Copyright (C) 1992, 93, 94, 98, 1999 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. */#ifndef _CH_TREE_H#define _CH_TREE_H/* Usage of TREE_LANG_FLAG_?: 1: TUPLE_NAMED_FIELD " TYPE_FIELDS_READONLY (in ARRAY_TYPE, RECORD_TYPE or UNION_TYPE) " C_DECLARED_LABEL_FLAG " C_TYPE_VARIABLE_SIZE 2: C_TYPE_FIELDS_VOLATILE (in RECORD_TYPE or UNION_TYPE) " ELSE_LABEL_SPECIFIED (in CASE selector expression) 3: UNSATISFIED_FLAG 4: CH_USE_SEIZEFILE_RESTRICTED " CH_ALREADY_GRANTED 5: CH_DERIVED_FLAG (in EXPR or DECL)*//* Usage of TYPE_LANG_FLAG_?: 0: CH_TYPE_NONVALUE_P 1: C_TYPE_VARIABLE_SIZE 2: CH_IS_ACCESS_MODE 3: CH_IS_BUFFER_MODE 4: CH_IS_EVENT_MODE 5: CH_ENUM_IS_NUMBERED 6: CH_IS_TEXT_MODE*//* Language-dependent contents of an identifier. */struct lang_identifier{ /* These match the fields in c-tree.h. */ struct tree_identifier ignore; tree outer_value, local_value, implicit_decl; tree error_locus, limbo_value; /* These are Chill-specific. */ tree forbid; tree signal_dest; int signal_data;};/* Macros for access to language-specific slots in an identifier. *//* The outer_value is a chain of decls (normally a single decl), that have been granted into the scope surrounding all modules. */#define IDENTIFIER_OUTER_VALUE(NODE) \ (((struct lang_identifier *)(NODE))->outer_value)#define IDENTIFIER_LOCAL_VALUE(NODE) \ (((struct lang_identifier *)(NODE))->local_value)#define IDENTIFIER_IMPLICIT_DECL(NODE) \ (((struct lang_identifier *)(NODE))->implicit_decl)#define IDENTIFIER_ERROR_LOCUS(NODE) \ (((struct lang_identifier *)(NODE))->error_locus)#define IDENTIFIER_FORBID(NODE) \ (((struct lang_identifier *)(NODE))->forbid)/* The nesting level increates by one for every nested 'group'. Predefined declarations have level -1; the global scope is level 0. */#define DECL_NESTING_LEVEL(DECL) \ ((DECL)->decl.vindex ? TREE_INT_CST_LOW((DECL)->decl.vindex) : -1)/* Nesting of things that can have an ON-unit attached. */extern int action_nesting_level;/* The DECL_NAME of a FIELD_DECL that represents the ELSE part of a variant. */#define ELSE_VARIANT_NAME ridpointers[(int) RID_ELSE]/* For a LABEL_DECL: action_nesting_level of its target. */#define DECL_ACTION_NESTING_LEVEL(NODE) ((NODE)->decl.saved_insns.i)#define DECL_OLD_PREFIX(DECL) ((DECL)->decl.initial)#define DECL_NEW_PREFIX(DECL) ((DECL)->decl.result)#define DECL_POSTFIX(DECL) ((DECL)->decl.arguments)extern tree ALL_POSTFIX;#define DECL_SEIZEFILE(DECL) ((DECL)->decl.size)#define DECL_POSTFIX_ALL(DECL) (DECL_POSTFIX(DECL) == ALL_POSTFIX)#define DECL_OLD_NAME(DECL) decl_old_name(DECL)/* For a siezefile name this means restricted usage of this file. In this case, the USE_SEIZE_FILE directive will not be copied into the grant file */#define CH_USE_SEIZEFILE_RESTRICTED(NODE) TREE_LANG_FLAG_4(NODE)extern tree decl_old_name PROTO ((tree));/* for selective granting, mark as already granted */#define CH_ALREADY_GRANTED(NODE) TREE_LANG_FLAG_4(NODE)/* to store the receiving process of that signal at definition time */#define IDENTIFIER_SIGNAL_DEST(NODE) \ (((struct lang_identifier *)(NODE))->signal_dest)/* indicates a signal with no data */#define IDENTIFIER_SIGNAL_DATA(NODE) \ (((struct lang_identifier *)(NODE))->signal_data)/* In identifiers, C uses the following fields in a special way: TREE_PUBLIC to record that there was a previous local extern decl. TREE_USED to record that such a decl was used. TREE_ADDRESSABLE to record that the address of such a decl was used. *//* Nonzero means reject anything that Z.200 Recommendation forbids. */extern int pedantic;/* the prototypical CHILL INSTANCE type */extern tree instance_type_node;/* Non-zero if type or expr depends on non-resolved identifier. */#define UNSATISFIED(expr) \ (UNSATISFIED_FLAG (expr) || TREE_CODE (expr) == IDENTIFIER_NODE)#define UNSATISFIED_FLAG(expr) TREE_LANG_FLAG_3 (expr)/* Non-zero in a TREE_LIST if part of a labelled structure tuple. */#define TUPLE_NAMED_FIELD(LIST) TREE_LANG_FLAG_1(LIST)/* In an ARRAY_TYPE, RECORD_TYPE or UNION_TYPE, nonzero if any component is read-only. */#define TYPE_FIELDS_READONLY(type) TREE_LANG_FLAG_1 (type)/* True if TYPE has the "read-only property." */#define TYPE_READONLY_PROPERTY(TYPE) \ (TYPE_READONLY (TYPE) || TYPE_FIELDS_READONLY (TYPE))/* In a RECORD_TYPE or UNION_TYPE, nonzero if any component is volatile. */#define C_TYPE_FIELDS_VOLATILE(type) TREE_LANG_FLAG_2 (type)/* In a CASE selector expression, nonzero if any alternative specifies (ELSE) for that selector. */#define ELSE_LABEL_SPECIFIED(expr) TREE_LANG_FLAG_2 (expr)/* CH_CHARS_TYPE_P(TYPE) is true iff TYPE is a character string type. There is no essential difference between a string and a (one-dimensional) character array, at least for non-varying types. I don't know where the Chill designers got the idea that it was useful to make a distinction. (I suspect packing might be involved, but on a byte-adressable machine we don't care.) Since we want the same code to be generated for char arrays as for char strings, we use the same representation for both. But we still need to distinguish them for the sake a Chill type checking. We do that using TYPE_STRING_FLAG. */#define MARK_AS_STRING_TYPE(TYPE) (TYPE_STRING_FLAG (TYPE) = 1)#define CH_CHARS_TYPE_P(type) \ (TREE_CODE (type) == ARRAY_TYPE && TREE_CODE(TREE_TYPE(type)) == CHAR_TYPE \ && TYPE_STRING_FLAG (type))/* True if TYPE is CHARS(1). */#define CH_CHARS_ONE_P(TYPE) (CH_CHARS_TYPE_P(TYPE) \ && integer_zerop (TYPE_MAX_VALUE (TYPE_DOMAIN (TYPE))))/* True if TYPE is a bitstring (BOOLS or BIT) type. The TYPE_STRING_FLAG is used to distinguish a bitstring from a powerset. */#define CH_BOOLS_TYPE_P(type) \ (TREE_CODE (type) == SET_TYPE && TYPE_STRING_FLAG (type))/* True if TYPE is BOOLS(1). */#define CH_BOOLS_ONE_P(TYPE) (CH_BOOLS_TYPE_P(TYPE) \ && integer_zerop (TYPE_MAX_VALUE (TYPE_DOMAIN (TYPE))))/* Value is nonzero if TYPE is a CHILL string type. See CH_CHARS_TYPE_P and CH_BOOLS_TYPE_P above. */#define CH_STRING_TYPE_P(type) \ ((TREE_CODE (type) == ARRAY_TYPE || TREE_CODE (type) == SET_TYPE) \ && TYPE_STRING_FLAG (type))/* In a RECORD_TYPE, a sorted array of the fields of the type. */struct lang_type_record{ int len; tree tasking_code_decl; tree elts[1];};struct lang_type{ union { struct lang_type_record rec; } foo;};struct lang_decl{ union { tree stuff; } foo;};/* A tasking type's corresponding tasking_code_variable has its decl pointer in here. */#define DECL_TASKING_CODE_DECL(DECL) (DECL_LANG_SPECIFIC(DECL))/* A pointer to an as-yet undefined type. */extern tree unknown_type_node;/* The CHILL type INT (either integer_type_node or short_integer_type_node). */extern tree chill_integer_type_node;extern tree chill_unsigned_type_node;/* Nonzero for FIELD_DECL node means that this FIELD_DECL is a member of a union construct. */#define TREE_UNION_ELEM(NODE) ((NODE)->decl.regdecl_flag) /* overloaded! *//* Mark which labels are explicitly declared. These may be shadowed, and may be referenced from nested functions. */#define C_DECLARED_LABEL_FLAG(label) TREE_LANG_FLAG_1 (label)/* Record whether a type was written with nonconstant size. Note that TYPE_SIZE may have simplified to a constant. */#define C_TYPE_VARIABLE_SIZE(type) TYPE_LANG_FLAG_1 (type)#define DECL_WEAK_NAME(DECL) DECL_LANG_FLAG_0(DECL)/* These are for FUNCTION_DECLs. */#define CH_DECL_GENERAL(DECL) DECL_LANG_FLAG_1(DECL)#define CH_DECL_SIMPLE(DECL) DECL_LANG_FLAG_2(DECL)#define CH_DECL_RECURSIVE(DECL) DECL_LANG_FLAG_3(DECL)#define CH_FUNCTION_SETS_RESULT(DECL) DECL_LANG_FLAG_6(DECL)/* For a CONST_DECL, indicates that it was implicitly declared in a SET mode declaration, and it should not be explicitly granted. */#define CH_DECL_ENUM(DECL) DECL_LANG_FLAG_3(DECL)/* in a FIELD_DECL use DECL_LANG_FLAG_4 to mark FORBID in a grant-statement */#define CH_DECL_FORBID(DECL) DECL_LANG_FLAG_4(DECL)/* in an ALIAS_DECL use DECL_LANG_FLAG_4 to mark decl was granted */#define CH_DECL_GRANTED(DECL) DECL_LANG_FLAG_4(DECL)/* (in a non-FIELD_DECL) note that this decl was hidden by push_module(). */#define DECL_HIDDEN_BY_MODULE(decl) DECL_LANG_FLAG_4 (decl)/* Record in each node resulting from a binary operator what operator was specified for it. */#define C_EXP_ORIGINAL_CODE(exp) ((enum tree_code) TREE_COMPLEXITY (exp))/* Store a value in that field. */#define C_SET_EXP_ORIGINAL_CODE(exp, code) \ (TREE_COMPLEXITY (exp) = (int)(code))/* Record whether a typedef for type `int' was actually `signed int'. */#define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))/* For FUNCTION_TYPE, a hidden list of types of arguments. The same as TYPE_ARG_TYPES for functions with prototypes, but created for functions without prototypes. */#define TYPE_ACTUAL_ARG_TYPES(NODE) TYPE_NONCOPIED_PARTS (NODE)/* For FUNCTION_TYPE or METHOD_TYPE, a list of the (names of) exceptions that this type can raise. */#define TYPE_RAISES_EXCEPTIONS(NODE) ((NODE)->type.minval)/* For UNION_TYPE, the list of tag fields that distinguishes the members. */#define TYPE_TAGFIELDS(NODE) ((NODE)->type.minval)/* For RECORD_TYPE, the tag values that select it. */#define TYPE_TAG_VALUES(NODE) TYPE_BINFO(NODE)/* For VAR_DECL, TYPE_DECL, FUNCTION_DECL, indicates that the DECL was read from a seizefile but not seized */#define CH_DECL_NOTDECLARED(DECL) DECL_LANG_FLAG_5(DECL)/* For FUNCTION_DECL's, mark as PROCESSEs. */#define CH_DECL_PROCESS(DECL) DECL_LANG_FLAG_7(DECL)/* For TYPE_DECL's, mark as SIGNALs. */#define CH_DECL_SIGNAL(DECL) DECL_LANG_FLAG_7(DECL)/* Macros using terminology of the CHILL Blue Book. *//* A class is either Null, All, M-value, M-derived, or M-reference, where M is some mode (type). */enum ch_class_kind {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -