This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[fixed-point] Patch to parse _Fract, _Accum, _Sat


Hello,

  Here is the patch to parse _Fract, _Accum, and _Sat.
GCC can parse the following fixed-point types now.
Ex: 
short _Fract q0;_Fract q1;long _Fract q2;long long _Fract q3;
unsigned short _Fract q4;unsigned _Fract q5;
unsigned long _Fract q6;unsigned long long _Fract q7;
_Sat short _Fract sq0;_Sat _Fract sq1;
_Sat long _Fract sq2;_Sat long long _Fract sq3;
_Sat unsigned short _Fract sq4;_Sat unsigned _Fract sq5;
_Sat unsigned long _Fract sq6;_Sat unsigned long long _Fract sq7;
short _Accum a0;_Accum a1;long _Accum a2;long long _Accum a3;
unsigned short _Accum a4;unsigned _Accum a5;
unsigned long _Accum a6;unsigned long long _Accum a7;
_Sat short _Accum sa0;_Sat _Accum sa1;
_Sat long _Accum sa2;_Sat long long _Accum sa3;
_Sat unsigned short _Accum sa4;_Sat unsigned _Accum sa5;
_Sat unsigned long _Accum sa6;_Sat unsigned long long _Accum sa7;

  Thanks!

Regards,
Chao-ying

2006-11-07  Chao-ying Fu  <fu@mips.com>

	* defaults.h (SHORT_FRACT_TYPE_SIZE, FRACT_TYPE_SIZE,
	LONG_FRACT_TYPE_SIZE, LONG_LONG_FRACT_TYPE_SIZE,
	SHORT_ACCUM_TYPE_SIZE, ACCUM_TYPE_SIZE, LONG_ACCUM_TYPE_SIZE,
	LONG_LONG_ACCUM_TYPE_SIZE): Define.

	* tree.def (FIXED_POINT_TYPE): New type.

	* tree.h (struct tree_common): Add saturating_flag.
	(TYPE_SATURATING): Define.
	(TYPE_IBIT, TYPE_FBIT): Define.
	(enum tree_index): Add new enumeration values
	TI_SAT_SFRACT_TYPE, TI_SAT_FRACT_TYPE, TI_SAT_LFRACT_TYPE,
	TI_SAT_LLFRACT_TYPE, TI_S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_type_node, sat_long_long_fract_type_node,
	sat_unsigned_short_fract_type_node, sat_unsigned_fract_type_node,
	sat_unsigned_long_fract_type_node,
	sat_unsigned_long_long_fract_type_node, short_fract_type_node,
	fract_type_node, long_fract_type_node, long_long_fract_type_node,
	unsigned_short_fract_type_node, unsigned_fract_type_node,
	unsigned_long_fract_type_node, unsigned_long_long_fract_type_node,
	sat_short_accum_type_node, sat_accum_type_node,
	sat_long_accum_type_node, sat_long_long_accum_type_node,
	sat_unsigned_short_accum_type_node, sat_unsigned_accum_type_node,
	sat_unsigned_long_accum_type_node,
	sat_unsigned_long_long_accum_type_node, short_accum_type_node,
	accum_type_node, long_accum_type_node, long_long_accum_type_node,
	unsigned_short_accum_type_node, unsigned_accum_type_node,
	unsigned_long_accum_type_node, unsigned_long_long_accum_type_node,
	qq_type_node, hq_type_node, sq_type_node, dq_type_node, tq_type_node,
	uqq_type_node, uhq_type_node, usq_type_node, udq_type_node,
	utq_type_node, sat_qq_type_node, sat_hq_type_node, sat_sq_type_node,
	sat_dq_type_node, sat_tq_type_node, sat_uqq_type_node,
	sat_uhq_type_node, sat_usq_type_node, sat_udq_type_node,
	sat_utq_type_node, ha_type_node, sa_type_node, da_type_node
	ta_type_node, uha_type_node, usa_type_node, uda_type_node,
	uta_type_node, sat_ha_type_node, sat_sa_type_node, sat_da_type_node,
	sat_ta_type_node, sat_uha_type_node, sat_usa_type_node,
	sat_uda_type_node, sat_uta_type_node): New macro.
	(make_fract_type, make_accum_type, make_or_reuse_fract_type,
	make_or_reuse_accum_type): Declare.
	(make_signed_fract_type, make_unsigned_fract_type,
	make_sat_signed_fract_type, make_sat_unsigned_fract_type,
	make_signed_accum_type, make_unsigned_accum_type,
	make_sat_signed_accum_type, make_sat_unsigned_accum_type,
	make_or_reuse_signed_fract_type, make_or_reuse_unsigned_fract_type,
	make_or_reuse_sat_signed_fract_type,
	make_or_reuse_sat_unsigned_fract_type, make_or_reuse_signed_accum_type,
	make_or_reuse_unsigned_accum_type, make_or_reuse_sat_signed_accum_type,
	make_or_reuse_sat_unsigned_accum_type): New macro.

	* tree.c (make_or_reuse_fract_type, make_or_reuse_accum_type): New.
	(build_common_tree_nodes_2): Add fixed-point type nodes.

	* stor-layout.c (int_mode_for_mode): Handle MODE_FRACT, MODE_UFRACT,
	MODE_ACCUM, MODE_UACCUM, MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT,
	MODE_VECTOR_ACCUM, MODE_VECTOR_UACCUM.
	(layout_type): Handle FIXED_POINT_TYPE.
	(make_fract_type, make_accum_type): New.

	* c-common.h (enum rid): Add new enumeration values RID_FRACT,
	RID_ACCUM, RID_SAT.

	* c-parser.c (reswords): Add _Fract, _Accum, _Sat.
	(c_token_starts_typename): Handle RID_FRACT, RID_ACCUM, RID_SAT.
	(c_token_starts_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_qual): Handle RID_SAT.
	(declspecs_add_type): Avoid using complex with _Fract or _Accum.
	Handle RID_FRACT and RID_ACCUM.
	(finish_declspecs): Handle cts_fract and cts_accum.

	* dwarf2out.c (base_type_die): Use DW_ATE_signed_fixed or
	DW_ATE_unsigned_fixed to describe FIXED_POINT_TYPE.
	(is_base_type): Add FIXED_POINT_TYPE.
	(add_type_attribute): Handle FIXED_POINT_TYPE.
	(gen_type_die): Handle FIXED_POINT_TYPE.

	* targhooks.c (default_scalar_mode_supported_p): Handle
	MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM.

	* doc/c-tree.texi (Types): Document FIXED_POINT_TYPE.

Attachment: gcc.diff
Description: gcc.diff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]