diff options
Diffstat (limited to 'gcc/tree.h')
-rw-r--r-- | gcc/tree.h | 226 |
1 files changed, 224 insertions, 2 deletions
@@ -384,6 +384,7 @@ struct tree_base GTY(()) unsigned protected_flag : 1; unsigned deprecated_flag : 1; unsigned invariant_flag : 1; + unsigned saturating_flag : 1; unsigned lang_flag_0 : 1; unsigned lang_flag_1 : 1; @@ -394,7 +395,7 @@ struct tree_base GTY(()) unsigned lang_flag_6 : 1; unsigned visited : 1; - unsigned spare : 24; + unsigned spare : 23; /* FIXME tuples: Eventually, we need to move this somewhere external to the trees. */ @@ -575,6 +576,11 @@ struct gimple_stmt GTY(()) TREE_INVARIANT in all expressions. + saturating_flag: + + TYPE_SATURATING in + all types + nowarning_flag: TREE_NO_WARNING in @@ -951,7 +957,8 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, TREE_NOT_CHECK3 (T, RECORD_TYPE, UNION_TYPE, QUAL_UNION_TYPE) #define NUMERICAL_TYPE_CHECK(T) \ - TREE_CHECK4 (T, INTEGER_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, REAL_TYPE) + TREE_CHECK5 (T, INTEGER_TYPE, ENUMERAL_TYPE, BOOLEAN_TYPE, REAL_TYPE, \ + FIXED_POINT_TYPE) /* Nonzero if NODE is a GIMPLE statement. */ #define GIMPLE_STMT_P(NODE) \ @@ -1039,6 +1046,20 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, || TREE_CODE (TYPE) == BOOLEAN_TYPE \ || TREE_CODE (TYPE) == INTEGER_TYPE) +/* Nonzero if TYPE represents a non-saturating fixed-point type. */ + +#define NON_SAT_FIXED_POINT_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == FIXED_POINT_TYPE && !TYPE_SATURATING (TYPE)) + +/* Nonzero if TYPE represents a saturating fixed-point type. */ + +#define SAT_FIXED_POINT_TYPE_P(TYPE) \ + (TREE_CODE (TYPE) == FIXED_POINT_TYPE && TYPE_SATURATING (TYPE)) + +/* Nonzero if TYPE represents a fixed-point type. */ + +#define FIXED_POINT_TYPE_P(TYPE) (TREE_CODE (TYPE) == FIXED_POINT_TYPE) + /* Nonzero if TYPE represents a scalar floating-point type. */ #define SCALAR_FLOAT_TYPE_P(TYPE) (TREE_CODE (TYPE) == REAL_TYPE) @@ -1336,6 +1357,9 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int, any expression node. */ #define TREE_INVARIANT(NODE) ((NODE)->base.invariant_flag) +/* In fixed-point types, means a saturating type. */ +#define TYPE_SATURATING(NODE) ((NODE)->base.saturating_flag) + /* These flags are available for each language front end to use internally. */ #define TREE_LANG_FLAG_0(NODE) ((NODE)->base.lang_flag_0) #define TREE_LANG_FLAG_1(NODE) ((NODE)->base.lang_flag_1) @@ -1387,6 +1411,18 @@ struct tree_real_cst GTY(()) struct real_value * real_cst_ptr; }; +/* In a FIXED_CST node. */ +struct fixed_value; + +#define TREE_FIXED_CST_PTR(NODE) (FIXED_CST_CHECK (NODE)->fixed_cst.fixed_cst_ptr) +#define TREE_FIXED_CST(NODE) (*TREE_FIXED_CST_PTR (NODE)) + +struct tree_fixed_cst GTY(()) +{ + struct tree_common common; + struct fixed_value * fixed_cst_ptr; +}; + /* In a STRING_CST */ #define TREE_STRING_LENGTH(NODE) (STRING_CST_CHECK (NODE)->string.length) #define TREE_STRING_POINTER(NODE) \ @@ -2084,6 +2120,8 @@ struct tree_block GTY(()) type node requires structural equality. */ #define SET_TYPE_STRUCTURAL_EQUALITY(NODE) (TYPE_CANONICAL (NODE) = NULL_TREE) #define TYPE_LANG_SPECIFIC(NODE) (TYPE_CHECK (NODE)->type.lang_specific) +#define TYPE_IBIT(NODE) (GET_MODE_IBIT (TYPE_MODE (NODE))) +#define TYPE_FBIT(NODE) (GET_MODE_FBIT (TYPE_MODE (NODE))) /* For a VECTOR_TYPE node, this describes a different type which is emitted in the debugging output. We use this to describe a vector as a @@ -3365,6 +3403,7 @@ union tree_node GTY ((ptr_alias (union lang_tree_node), struct tree_common GTY ((tag ("TS_COMMON"))) common; struct tree_int_cst GTY ((tag ("TS_INT_CST"))) int_cst; struct tree_real_cst GTY ((tag ("TS_REAL_CST"))) real_cst; + struct tree_fixed_cst GTY ((tag ("TS_FIXED_CST"))) fixed_cst; struct tree_vector GTY ((tag ("TS_VECTOR"))) vector; struct tree_string GTY ((tag ("TS_STRING"))) string; struct tree_complex GTY ((tag ("TS_COMPLEX"))) complex; @@ -3476,6 +3515,75 @@ enum tree_index TI_MAIN_IDENTIFIER, + TI_SAT_SFRACT_TYPE, + TI_SAT_FRACT_TYPE, + TI_SAT_LFRACT_TYPE, + TI_SAT_LLFRACT_TYPE, + TI_SAT_USFRACT_TYPE, + TI_SAT_UFRACT_TYPE, + TI_SAT_ULFRACT_TYPE, + TI_SAT_ULLFRACT_TYPE, + TI_SFRACT_TYPE, + TI_FRACT_TYPE, + TI_LFRACT_TYPE, + TI_LLFRACT_TYPE, + TI_USFRACT_TYPE, + TI_UFRACT_TYPE, + TI_ULFRACT_TYPE, + TI_ULLFRACT_TYPE, + TI_SAT_SACCUM_TYPE, + TI_SAT_ACCUM_TYPE, + TI_SAT_LACCUM_TYPE, + TI_SAT_LLACCUM_TYPE, + TI_SAT_USACCUM_TYPE, + TI_SAT_UACCUM_TYPE, + TI_SAT_ULACCUM_TYPE, + TI_SAT_ULLACCUM_TYPE, + TI_SACCUM_TYPE, + TI_ACCUM_TYPE, + TI_LACCUM_TYPE, + TI_LLACCUM_TYPE, + TI_USACCUM_TYPE, + TI_UACCUM_TYPE, + TI_ULACCUM_TYPE, + TI_ULLACCUM_TYPE, + TI_QQ_TYPE, + TI_HQ_TYPE, + TI_SQ_TYPE, + TI_DQ_TYPE, + TI_TQ_TYPE, + TI_UQQ_TYPE, + TI_UHQ_TYPE, + TI_USQ_TYPE, + TI_UDQ_TYPE, + TI_UTQ_TYPE, + TI_SAT_QQ_TYPE, + TI_SAT_HQ_TYPE, + TI_SAT_SQ_TYPE, + TI_SAT_DQ_TYPE, + TI_SAT_TQ_TYPE, + TI_SAT_UQQ_TYPE, + TI_SAT_UHQ_TYPE, + TI_SAT_USQ_TYPE, + TI_SAT_UDQ_TYPE, + TI_SAT_UTQ_TYPE, + TI_HA_TYPE, + TI_SA_TYPE, + TI_DA_TYPE, + TI_TA_TYPE, + TI_UHA_TYPE, + TI_USA_TYPE, + TI_UDA_TYPE, + TI_UTA_TYPE, + TI_SAT_HA_TYPE, + TI_SAT_SA_TYPE, + TI_SAT_DA_TYPE, + TI_SAT_TA_TYPE, + TI_SAT_UHA_TYPE, + TI_SAT_USA_TYPE, + TI_SAT_UDA_TYPE, + TI_SAT_UTA_TYPE, + TI_MAX }; @@ -3555,6 +3663,84 @@ extern GTY(()) tree global_trees[TI_MAX]; #define dfloat64_ptr_type_node global_trees[TI_DFLOAT64_PTR_TYPE] #define dfloat128_ptr_type_node global_trees[TI_DFLOAT128_PTR_TYPE] +/* The fixed-point types. */ +#define sat_short_fract_type_node global_trees[TI_SAT_SFRACT_TYPE] +#define sat_fract_type_node global_trees[TI_SAT_FRACT_TYPE] +#define sat_long_fract_type_node global_trees[TI_SAT_LFRACT_TYPE] +#define sat_long_long_fract_type_node global_trees[TI_SAT_LLFRACT_TYPE] +#define sat_unsigned_short_fract_type_node \ + global_trees[TI_SAT_USFRACT_TYPE] +#define sat_unsigned_fract_type_node global_trees[TI_SAT_UFRACT_TYPE] +#define sat_unsigned_long_fract_type_node \ + global_trees[TI_SAT_ULFRACT_TYPE] +#define sat_unsigned_long_long_fract_type_node \ + global_trees[TI_SAT_ULLFRACT_TYPE] +#define short_fract_type_node global_trees[TI_SFRACT_TYPE] +#define fract_type_node global_trees[TI_FRACT_TYPE] +#define long_fract_type_node global_trees[TI_LFRACT_TYPE] +#define long_long_fract_type_node global_trees[TI_LLFRACT_TYPE] +#define unsigned_short_fract_type_node global_trees[TI_USFRACT_TYPE] +#define unsigned_fract_type_node global_trees[TI_UFRACT_TYPE] +#define unsigned_long_fract_type_node global_trees[TI_ULFRACT_TYPE] +#define unsigned_long_long_fract_type_node \ + global_trees[TI_ULLFRACT_TYPE] +#define sat_short_accum_type_node global_trees[TI_SAT_SACCUM_TYPE] +#define sat_accum_type_node global_trees[TI_SAT_ACCUM_TYPE] +#define sat_long_accum_type_node global_trees[TI_SAT_LACCUM_TYPE] +#define sat_long_long_accum_type_node global_trees[TI_SAT_LLACCUM_TYPE] +#define sat_unsigned_short_accum_type_node \ + global_trees[TI_SAT_USACCUM_TYPE] +#define sat_unsigned_accum_type_node global_trees[TI_SAT_UACCUM_TYPE] +#define sat_unsigned_long_accum_type_node \ + global_trees[TI_SAT_ULACCUM_TYPE] +#define sat_unsigned_long_long_accum_type_node \ + global_trees[TI_SAT_ULLACCUM_TYPE] +#define short_accum_type_node global_trees[TI_SACCUM_TYPE] +#define accum_type_node global_trees[TI_ACCUM_TYPE] +#define long_accum_type_node global_trees[TI_LACCUM_TYPE] +#define long_long_accum_type_node global_trees[TI_LLACCUM_TYPE] +#define unsigned_short_accum_type_node global_trees[TI_USACCUM_TYPE] +#define unsigned_accum_type_node global_trees[TI_UACCUM_TYPE] +#define unsigned_long_accum_type_node global_trees[TI_ULACCUM_TYPE] +#define unsigned_long_long_accum_type_node \ + global_trees[TI_ULLACCUM_TYPE] +#define qq_type_node global_trees[TI_QQ_TYPE] +#define hq_type_node global_trees[TI_HQ_TYPE] +#define sq_type_node global_trees[TI_SQ_TYPE] +#define dq_type_node global_trees[TI_DQ_TYPE] +#define tq_type_node global_trees[TI_TQ_TYPE] +#define uqq_type_node global_trees[TI_UQQ_TYPE] +#define uhq_type_node global_trees[TI_UHQ_TYPE] +#define usq_type_node global_trees[TI_USQ_TYPE] +#define udq_type_node global_trees[TI_UDQ_TYPE] +#define utq_type_node global_trees[TI_UTQ_TYPE] +#define sat_qq_type_node global_trees[TI_SAT_QQ_TYPE] +#define sat_hq_type_node global_trees[TI_SAT_HQ_TYPE] +#define sat_sq_type_node global_trees[TI_SAT_SQ_TYPE] +#define sat_dq_type_node global_trees[TI_SAT_DQ_TYPE] +#define sat_tq_type_node global_trees[TI_SAT_TQ_TYPE] +#define sat_uqq_type_node global_trees[TI_SAT_UQQ_TYPE] +#define sat_uhq_type_node global_trees[TI_SAT_UHQ_TYPE] +#define sat_usq_type_node global_trees[TI_SAT_USQ_TYPE] +#define sat_udq_type_node global_trees[TI_SAT_UDQ_TYPE] +#define sat_utq_type_node global_trees[TI_SAT_UTQ_TYPE] +#define ha_type_node global_trees[TI_HA_TYPE] +#define sa_type_node global_trees[TI_SA_TYPE] +#define da_type_node global_trees[TI_DA_TYPE] +#define ta_type_node global_trees[TI_TA_TYPE] +#define uha_type_node global_trees[TI_UHA_TYPE] +#define usa_type_node global_trees[TI_USA_TYPE] +#define uda_type_node global_trees[TI_UDA_TYPE] +#define uta_type_node global_trees[TI_UTA_TYPE] +#define sat_ha_type_node global_trees[TI_SAT_HA_TYPE] +#define sat_sa_type_node global_trees[TI_SAT_SA_TYPE] +#define sat_da_type_node global_trees[TI_SAT_DA_TYPE] +#define sat_ta_type_node global_trees[TI_SAT_TA_TYPE] +#define sat_uha_type_node global_trees[TI_SAT_UHA_TYPE] +#define sat_usa_type_node global_trees[TI_SAT_USA_TYPE] +#define sat_uda_type_node global_trees[TI_SAT_UDA_TYPE] +#define sat_uta_type_node global_trees[TI_SAT_UTA_TYPE] + /* The node that should be placed at the end of a parameter list to indicate that the function does not take a variable number of arguments. The TREE_VALUE will be void_type_node and there will be @@ -3834,6 +4020,37 @@ extern bool tree_expr_nonnegative_warnv_p (tree, bool *); extern bool may_negate_without_overflow_p (const_tree); extern tree get_inner_array_type (const_tree); +/* Construct various nodes representing fract or accum data types. */ + +extern tree make_fract_type (int, int, int); +extern tree make_accum_type (int, int, int); + +#define make_signed_fract_type(P) make_fract_type (P, 0, 0) +#define make_unsigned_fract_type(P) make_fract_type (P, 1, 0) +#define make_sat_signed_fract_type(P) make_fract_type (P, 0, 1) +#define make_sat_unsigned_fract_type(P) make_fract_type (P, 1, 1) +#define make_signed_accum_type(P) make_accum_type (P, 0, 0) +#define make_unsigned_accum_type(P) make_accum_type (P, 1, 0) +#define make_sat_signed_accum_type(P) make_accum_type (P, 0, 1) +#define make_sat_unsigned_accum_type(P) make_accum_type (P, 1, 1) + +#define make_or_reuse_signed_fract_type(P) \ + make_or_reuse_fract_type (P, 0, 0) +#define make_or_reuse_unsigned_fract_type(P) \ + make_or_reuse_fract_type (P, 1, 0) +#define make_or_reuse_sat_signed_fract_type(P) \ + make_or_reuse_fract_type (P, 0, 1) +#define make_or_reuse_sat_unsigned_fract_type(P) \ + make_or_reuse_fract_type (P, 1, 1) +#define make_or_reuse_signed_accum_type(P) \ + make_or_reuse_accum_type (P, 0, 0) +#define make_or_reuse_unsigned_accum_type(P) \ + make_or_reuse_accum_type (P, 1, 0) +#define make_or_reuse_sat_signed_accum_type(P) \ + make_or_reuse_accum_type (P, 0, 1) +#define make_or_reuse_sat_unsigned_accum_type(P) \ + make_or_reuse_accum_type (P, 1, 1) + /* From expmed.c. Since rtl.h is included after tree.h, we can't put the prototype here. Rtl.h does declare the prototype if tree.h had been included. */ @@ -4209,6 +4426,11 @@ extern int integer_nonzerop (const_tree); extern bool cst_and_fits_in_hwi (const_tree); extern tree num_ending_zeros (const_tree); +/* fixed_zerop (tree x) is nonzero if X is a fixed-point constant of + value 0. */ + +extern int fixed_zerop (tree); + /* staticp (tree x) is nonzero if X is a reference to data allocated at a fixed address in memory. Returns the outermost data. */ |