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]

[Ada] introduce a vector_type Machine_Attribute


Hello,

This patch introduces a "vector_type" attribute for Ada, to facilitate
bindings to GCC VECTOR_TYPE entities and operations, for example:

      type m128 is array (1 .. 4) of Float;
      for m128'Alignment use 16;
      pragma Machine_Attribute (m128, "vector_type");

      function mm_add_ss (A, B : m128) return m128;
      pragma Import (Intrinsic, mm_add_ss, "__builtin_ia32_addss");

The motivation to use this instead of vector_size is to have the Ada type's
characteristics (in particular size and alignment) much closer to the
corresponding GCC type ones in the end, so that the Ada part of the front-end
has a more realistic view of what objects of this type look like.

The patch fixes a misuse of qE format specifiers in attribute handlers along
the way.

Tested on x86_64-suse-linux. Applying to mainline.

Olivier

2009-09-25  Olivier Hainquqe  <hainque@adacore.com>
            Eric Botcazou <botcazou@adacore.com>

	ada/
	* gcc-interface/ada-tree.h (TYPE_REPRESENTATIVE_ARRAY): New language
	specific node.	Representative array type for VECTOR_TYPE entities.
	* gcc-interface/utils.c (handle_vector_type_attribute): New handler.
	Turn an ARRAY_TYPE entity into a VECTOR_TYPE.	
	(gnat_types_compatible_p): Handle VECTOR_TYPEs.
	(convert): Likewise.  Arrange to produce VECTOR_CST out of constant
	array aggregates for VECTOR_TYPE entities.
	(unchecked_convert): Likewise.
	(maybe_vector_array): New function. If EXP has VECTOR_TYPE, return EXP
	converted to the associated TYPE_REPRESENTATIVE_ARRAY.
	(handle_pure_attribute, handle_sentinel_attribute,
	handle_noreturn_attribute, handle_malloc_attribute,
	handle_vector_size_attribute): Replace uses of qE format by qs.
	Remove GCC_DIAG_STYLE definition.
	* gcc-interface/trans.c (gnat_to_gnu) <N_Indexed_Component>: Convert
	vector input to representative array type on entry.
	<N_Op_Eq, etc>: Likewise.
	* gcc-interface/gigi.h (maybe_vector_array): Declare.
	(VECTOR_TYPE_P): New predicate.
	* gcc-interface/misc.c (gnat_print_type): Handle VECTOR_TYPE.

	testsuite/
	* gnat.dg/sse_nolib.adb: New testcase.

Attachment: ada-vector_type.dif
Description: Text document


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