X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Ftree.h;h=00b663726b8f336cc7411eb4f2dae8d1389efb72;hp=fe76f8fe5b995a997238587aa662671842d97198;hb=22bf03adcd87d035bbd9b581693050842a096e77;hpb=927b65fbd6595e4a28ed8d91e5f27a33adc32a2b diff --git a/gcc/tree.h b/gcc/tree.h index fe76f8fe5b9..00b663726b8 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -335,10 +335,6 @@ extern const char * built_in_names[(int) END_BUILTINS]; #define CASE_FLT_FN(FN) case FN: case FN##F: case FN##L #define CASE_FLT_FN_REENT(FN) case FN##_R: case FN##F_R: case FN##L_R #define CASE_INT_FN(FN) case FN: case FN##L: case FN##LL - -/* An array of _DECL trees for the above. */ -extern GTY(()) tree built_in_decls[(int) END_BUILTINS]; -extern GTY(()) tree implicit_built_in_decls[(int) END_BUILTINS]; /* In an OMP_CLAUSE node. */ @@ -403,7 +399,13 @@ enum omp_clause_code OMP_CLAUSE_COLLAPSE, /* OpenMP clause: untied. */ - OMP_CLAUSE_UNTIED + OMP_CLAUSE_UNTIED, + + /* OpenMP clause: final (scalar-expression). */ + OMP_CLAUSE_FINAL, + + /* OpenMP clause: mergeable. */ + OMP_CLAUSE_MERGEABLE }; /* The definition of tree nodes fills the next several pages. */ @@ -789,7 +791,7 @@ enum tree_node_structure_enum { (CODE1), (CODE2), (CODE3), (CODE4), 0); \ __t; }) -#define NON_TREE_CHECK4(T, CODE1, CODE2, CODE3, CODE4) __extension__ \ +#define TREE_NOT_CHECK4(T, CODE1, CODE2, CODE3, CODE4) __extension__ \ ({ __typeof (T) const __t = (T); \ if (TREE_CODE (__t) == (CODE1) \ || TREE_CODE (__t) == (CODE2) \ @@ -1118,6 +1120,13 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, (TREE_CODE (TYPE) == COMPLEX_TYPE \ && TREE_CODE (TREE_TYPE (TYPE)) == REAL_TYPE) +/* Nonzero if TYPE represents a vector integer type. */ + +#define VECTOR_INTEGER_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == VECTOR_TYPE \ + && TREE_CODE (TREE_TYPE (TYPE)) == INTEGER_TYPE) + + /* Nonzero if TYPE represents a vector floating-point type. */ #define VECTOR_FLOAT_TYPE_P(TYPE) \ @@ -1512,6 +1521,7 @@ struct GTY(()) tree_fixed_cst { }; /* In a STRING_CST */ +/* In C terms, this is sizeof, not strlen. */ #define TREE_STRING_LENGTH(NODE) (STRING_CST_CHECK (NODE)->string.length) #define TREE_STRING_POINTER(NODE) \ ((const char *)(STRING_CST_CHECK (NODE)->string.str)) @@ -1879,6 +1889,8 @@ extern void protected_set_expr_location (tree, location_t); #define OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ(NODE) \ (OMP_CLAUSE_CHECK (NODE))->omp_clause.gimple_reduction_init +#define OMP_CLAUSE_FINAL_EXPR(NODE) \ + OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_FINAL), 0) #define OMP_CLAUSE_IF_EXPR(NODE) \ OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_IF), 0) #define OMP_CLAUSE_NUM_THREADS_EXPR(NODE) \ @@ -2674,7 +2686,9 @@ struct function; nodes, this points to either the FUNCTION_DECL for the containing function, the RECORD_TYPE or UNION_TYPE for the containing type, or NULL_TREE or a TRANSLATION_UNIT_DECL if the given decl has "file - scope". */ + scope". In particular, for VAR_DECLs which are virtual table pointers + (they have DECL_VIRTUAL set), we use DECL_CONTEXT to determine the type + they belong to. */ #define DECL_CONTEXT(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.context) #define DECL_FIELD_CONTEXT(NODE) \ (FIELD_DECL_CHECK (NODE)->decl_minimal.context) @@ -2963,6 +2977,17 @@ extern void decl_value_expr_insert (tree, tree); /* The DECL_RTL for NODE, if it is set, or NULL, if it is not set. */ #define DECL_RTL_IF_SET(NODE) (DECL_RTL_SET_P (NODE) ? DECL_RTL (NODE) : NULL) +#if (GCC_VERSION >= 2007) +#define DECL_RTL_KNOWN_SET(decl) __extension__ \ +({ tree const __d = (decl); \ + gcc_checking_assert (DECL_RTL_SET_P (__d)); \ + /* Dereference it so the compiler knows it can't be NULL even \ + without assertion checking. */ \ + &*DECL_RTL_IF_SET (__d); }) +#else +#define DECL_RTL_KNOWN_SET(decl) (&*DECL_RTL_IF_SET (decl)) +#endif + /* In VAR_DECL and PARM_DECL nodes, nonzero means declared `register'. */ #define DECL_REGISTER(NODE) (DECL_WRTL_CHECK (NODE)->decl_common.decl_flag_0) @@ -4372,7 +4397,6 @@ tree_low_cst (const_tree t, int pos) return TREE_INT_CST_LOW (t); } #endif -extern int tree_int_cst_msb (const_tree); extern int tree_int_cst_sgn (const_tree); extern int tree_int_cst_sign_bit (const_tree); extern unsigned int tree_int_cst_min_precision (tree, bool); @@ -5267,7 +5291,7 @@ extern tree build_simple_mem_ref_loc (location_t, tree); extern double_int mem_ref_offset (const_tree); extern tree reference_alias_ptr_type (const_tree); extern tree build_invariant_address (tree, tree, HOST_WIDE_INT); -extern tree constant_boolean_node (int, tree); +extern tree constant_boolean_node (bool, tree); extern tree div_if_zero_remainder (enum tree_code, const_tree, const_tree); extern bool tree_swap_operands_p (const_tree, const_tree, bool); @@ -5305,8 +5329,47 @@ truth_value_p (enum tree_code code) || code == TRUTH_XOR_EXPR || code == TRUTH_NOT_EXPR); } +/* Return whether TYPE is a type suitable for an offset for + a POINTER_PLUS_EXPR. */ +static inline bool +ptrofftype_p (tree type) +{ + return (INTEGRAL_TYPE_P (type) + && TYPE_PRECISION (type) == TYPE_PRECISION (sizetype) + && TYPE_UNSIGNED (type) == TYPE_UNSIGNED (sizetype)); +} + +/* Return OFF converted to a pointer offset type suitable as offset for + POINTER_PLUS_EXPR. Use location LOC for this conversion. */ +static inline tree +convert_to_ptrofftype_loc (location_t loc, tree off) +{ + return fold_convert_loc (loc, sizetype, off); +} +#define convert_to_ptrofftype(t) convert_to_ptrofftype_loc (UNKNOWN_LOCATION, t) + +/* Build and fold a POINTER_PLUS_EXPR at LOC offsetting PTR by OFF. */ +static inline tree +fold_build_pointer_plus_loc (location_t loc, tree ptr, tree off) +{ + return fold_build2_loc (loc, POINTER_PLUS_EXPR, TREE_TYPE (ptr), + ptr, fold_convert_loc (loc, sizetype, off)); +} +#define fold_build_pointer_plus(p,o) \ + fold_build_pointer_plus_loc (UNKNOWN_LOCATION, p, o) + +/* Build and fold a POINTER_PLUS_EXPR at LOC offsetting PTR by OFF. */ +static inline tree +fold_build_pointer_plus_hwi_loc (location_t loc, tree ptr, HOST_WIDE_INT off) +{ + return fold_build2_loc (loc, POINTER_PLUS_EXPR, TREE_TYPE (ptr), + ptr, size_int (off)); +} +#define fold_build_pointer_plus_hwi(p,o) \ + fold_build_pointer_plus_hwi_loc (UNKNOWN_LOCATION, p, o) /* In builtins.c */ +extern bool avoid_folding_inline_builtin (tree); extern tree fold_call_expr (location_t, tree, bool); extern tree fold_builtin_fputs (location_t, tree, tree, bool, bool, tree); extern tree fold_builtin_strcpy (location_t, tree, tree, tree, tree); @@ -5331,15 +5394,16 @@ extern tree build_va_arg_indirect_ref (tree); extern tree build_string_literal (int, const char *); extern bool validate_arglist (const_tree, ...); extern rtx builtin_memset_read_str (void *, HOST_WIDE_INT, enum machine_mode); -extern bool can_trust_pointer_alignment (void); -extern unsigned int get_pointer_alignment (tree, unsigned int); extern bool is_builtin_name (const char *); extern bool is_builtin_fn (tree); extern unsigned int get_object_alignment_1 (tree, unsigned HOST_WIDE_INT *); -extern unsigned int get_object_alignment (tree, unsigned int); +extern unsigned int get_object_alignment (tree); +extern unsigned int get_pointer_alignment (tree); extern tree fold_call_stmt (gimple, bool); extern tree gimple_fold_builtin_snprintf_chk (gimple, tree, enum built_in_function); extern tree make_range (tree, int *, tree *, tree *, bool *); +extern tree make_range_step (location_t, enum tree_code, tree, tree, tree, + tree *, tree *, int *, bool *); extern tree build_range_check (location_t, tree, tree, int, tree, tree); extern bool merge_ranges (int *, tree *, tree *, int, tree, tree, int, tree, tree); @@ -5520,6 +5584,8 @@ extern bool must_pass_in_stack_var_size_or_pad (enum machine_mode, const_tree); extern const struct attribute_spec *lookup_attribute_spec (const_tree); +extern void init_attributes (void); + /* Process the attributes listed in ATTRIBUTES and install them in *NODE, which is either a DECL (including a TYPE_DECL) or a TYPE. If a DECL, it should be modified in place; if a TYPE, a copy should be created @@ -5728,6 +5794,7 @@ tree target_for_debug_bind (tree); /* In tree-ssa-address.c. */ extern tree tree_mem_ref_addr (tree, tree); extern void copy_mem_ref_info (tree, tree); +extern void copy_ref_info (tree, tree); /* In tree-vrp.c */ extern bool ssa_name_nonnegative_p (const_tree); @@ -5868,4 +5935,94 @@ is_lang_specific (tree t) /* In gimple-low.c. */ extern bool block_may_fallthru (const_tree); + +/* Functional interface to the builtin functions. */ + +/* The builtin_info structure holds the FUNCTION_DECL of the standard builtin + function, and a flag that says if the function is available implicitly, or + whether the user has to code explicit calls to __builtin_. */ + +typedef struct GTY(()) builtin_info_type_d { + tree decl[(int)END_BUILTINS]; + bool implicit_p[(int)END_BUILTINS]; +} builtin_info_type; + +extern GTY(()) builtin_info_type builtin_info; + +/* Valid builtin number. */ +#define BUILTIN_VALID_P(FNCODE) \ + (IN_RANGE ((int)FNCODE, ((int)BUILT_IN_NONE) + 1, ((int) END_BUILTINS) - 1)) + +/* Return the tree node for an explicit standard builtin function or NULL. */ +static inline tree +builtin_decl_explicit (enum built_in_function fncode) +{ + gcc_checking_assert (BUILTIN_VALID_P (fncode)); + + return builtin_info.decl[(size_t)fncode]; +} + +/* Return the tree node for an implicit builtin function or NULL. */ +static inline tree +builtin_decl_implicit (enum built_in_function fncode) +{ + size_t uns_fncode = (size_t)fncode; + gcc_checking_assert (BUILTIN_VALID_P (fncode)); + + if (!builtin_info.implicit_p[uns_fncode]) + return NULL_TREE; + + return builtin_info.decl[uns_fncode]; +} + +/* Set explicit builtin function nodes and whether it is an implicit + function. */ + +static inline void +set_builtin_decl (enum built_in_function fncode, tree decl, bool implicit_p) +{ + size_t ufncode = (size_t)fncode; + + gcc_checking_assert (BUILTIN_VALID_P (fncode) + && (decl != NULL_TREE || !implicit_p)); + + builtin_info.decl[ufncode] = decl; + builtin_info.implicit_p[ufncode] = implicit_p; +} + +/* Set the implicit flag for a builtin function. */ + +static inline void +set_builtin_decl_implicit_p (enum built_in_function fncode, bool implicit_p) +{ + size_t uns_fncode = (size_t)fncode; + + gcc_checking_assert (BUILTIN_VALID_P (fncode) + && builtin_info.decl[uns_fncode] != NULL_TREE); + + builtin_info.implicit_p[uns_fncode] = implicit_p; +} + +/* Return whether the standard builtin function can be used as an explicit + function. */ + +static inline bool +builtin_decl_explicit_p (enum built_in_function fncode) +{ + gcc_checking_assert (BUILTIN_VALID_P (fncode)); + return (builtin_info.decl[(size_t)fncode] != NULL_TREE); +} + +/* Return whether the standard builtin function can be used implicitly. */ + +static inline bool +builtin_decl_implicit_p (enum built_in_function fncode) +{ + size_t uns_fncode = (size_t)fncode; + + gcc_checking_assert (BUILTIN_VALID_P (fncode)); + return (builtin_info.decl[uns_fncode] != NULL_TREE + && builtin_info.implicit_p[uns_fncode]); +} + #endif /* GCC_TREE_H */