summaryrefslogtreecommitdiff
path: root/gcc/c-common.h
diff options
context:
space:
mode:
authorchaoyingfu <chaoyingfu@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-20 22:26:47 +0000
committerchaoyingfu <chaoyingfu@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-20 22:26:47 +0000
commit9421ebb9b381242a1fa9d4b435babe0910a58118 (patch)
tree64870172714a26b5105facd128201e6fef2f87b8 /gcc/c-common.h
parenta37e11205961890d4a52cca73615df79976171b2 (diff)
downloadgcc-9421ebb9b381242a1fa9d4b435babe0910a58118.tar.gz
* c-common.h (enum rid): Add new enumeration values of RID_SAT,
RID_FRACT, and RID_ACCUM. RID_SAT needs to be inserted before RID_ONEWAY, so that it can be checked in declspecs_add_type. (c_common_fixed_point_type_for_size): Declare. * c-parser.c (reswords): Add _Fract, _Accum, and _Sat. (c_token_starts_typename): Handle RID_FRACT, RID_ACCUM, and RID_SAT. (c_token_starts_declspecs): Likewise. (c_parser_declspecs): Likewise. (c_parser_attributes): Likewise. * c-tree.h (enum c_typespec_keyword): Add cts_fract and cts_accum. (c_declspecs): Add saturating_p. * c-decl.c (build_null_declspecs): Initialize saturating_p. (declspecs_add_type): Avoid using complex with _Fract, _Accum, or _Sat. Handle RID_SAT. Avoid using void, bool, char, int, float, double, _Decimal32, _Decimal64, _Decimal128, and complex with _Sat. Handle RID_FRACT and RID_ACCUM. Make sure _Sat is used with _Fract or _Accum. (finish_declspecs): Handle cts_fract and cts_accum. * c-common.c (fixed-value.h): New include. (constant_expression_warning): Handle FIXED_CST. (overflow_warning): Likewise. (warnings_for_convert_and_check): Likewise. (c_common_fixed_point_type_for_size): New. (c_common_type_for_mode): Handle fixed-point modes to return various saturating/non-saturating, signed/unsigned types. (c_common_signed_or_unsigned_type): Support fixed-point types. (shorten_compare): Check fixed-point zero. Handle FIXED_POINT_TYPE. (c_common_truthvalue_conversion): Handle FIXED_CST. Handle FIXED_POINT_TYPE. (c_common_nodes_and_builtins): Record builtin types for fixed-point types. (handle_mode_attribute): Handle fixed-point modes. Need to check if the signness of base type and fixed-point modes are consistent. (handle_vector_size_attribute): Handle fixed-point modes. (same_scalar_type_ignoring_signedness): Handle FIXED_POINT_TYPE. (warn_for_div_by_zero): Check fixed-point zero. * c-typeck.c (c_common_type): Check FIXED_POINT_TYPE. Build a common fixed-point type based on fbit, ibit, sign, and saturation. (build_unary_op): Allow FIXED_POINT_TYPE for CONVERT_EXPR, NEGATE_EXPR, TRUTH_NOT_EXPR, PREINCREMENT_EXPR, POSTINCREMENT_EXPR, PREDECREMENT_EXPR, and POSTDECREMENT_EXPR. (convert_for_assignment): Support FIXED_POINT_TYPE. (digest_init): Handle FIXED_POINT_TYPE. (build_binary_op): Support FIXED_POINT_TYPE in *_DIV_EXPR, TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR, TRUTH_AND_EXPR, TRUTH_OR_EXPR, TRUTH_XOR_EXPR, RSHIFT_EXPR, LSHIFT_EXPR, EQ_EXPR, NE_EXPR, LE_EXPR, GE_EXPR, LT_EXPR, GT_EXPR. * target-def.h (TARGET_FIXED_POINT_SUPPORTED_P): New. (TARGET_INITIALIZER): Add TARGET_FIXED_POINT_SUPPORTED_P. * target.h (gcc_target): Add fixed_point_supported_p. * targhooks.c (default_scalar_mode_supported_p): Handle MODE_FRACT, MODE_UFRACT, MODE_ACCUM, and MODE_UACCUM. (default_fixed_point_supported_p): Define. * targhooks.h (default_fixed_point_supported_p): Declare. * doc/tm.texi (TARGET_FIXED_POINT_SUPPORTED_P): Add. * doc/install.texi (Configuration): Add --enable-fixed-point. * configure.ac (--enable-fixed-point): New to enable fixed-point arithmetic extension to C. For mips targets, we enable it by default. * configure, config.in: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127652 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-common.h')
-rw-r--r--gcc/c-common.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/c-common.h b/gcc/c-common.h
index 7d4761cd2b4..a41cf6f245f 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -52,7 +52,7 @@ enum rid
RID_VOLATILE, RID_SIGNED, RID_AUTO, RID_RESTRICT,
/* C extensions */
- RID_COMPLEX, RID_THREAD,
+ RID_COMPLEX, RID_THREAD, RID_SAT,
/* C++ */
RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE,
@@ -72,6 +72,7 @@ enum rid
RID_EXTENSION, RID_IMAGPART, RID_REALPART, RID_LABEL, RID_CHOOSE_EXPR,
RID_TYPES_COMPATIBLE_P,
RID_DFLOAT32, RID_DFLOAT64, RID_DFLOAT128,
+ RID_FRACT, RID_ACCUM,
/* Too many ways of getting the name of a function as a string */
RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME, RID_C99_FUNCTION_NAME,
@@ -670,6 +671,8 @@ extern int c_common_handle_option (size_t code, const char *arg, int value);
extern bool c_common_missing_argument (const char *opt, size_t code);
extern tree c_common_type_for_mode (enum machine_mode, int);
extern tree c_common_type_for_size (unsigned int, int);
+extern tree c_common_fixed_point_type_for_size (unsigned int, unsigned int,
+ int, int);
extern tree c_common_unsigned_type (tree);
extern tree c_common_signed_type (tree);
extern tree c_common_signed_or_unsigned_type (int, tree);