[cfe-dev] Adding new data type

John McCall rjmccall at apple.com
Thu Apr 29 14:00:48 PDT 2010


On Apr 29, 2010, at 1:35 PM, kalyan ponnala wrote:
> Thanks for the replies. I am trying to add support to a new architecture called Line Associative Registers. It has vector registers in it. I would like to add a vector data type such as int[4] which could access a register with a width of 4 integers in it (max).

Clang already has support for vector types based off the gcc vector_size and ext_vector attributes, as well as some support for altivec-style vectors;  before you start hacking in a new type with associated syntax, I would suggesting investigating whether any of those would be sufficient or at least provide a better baseline to begin with.

> Since it has to be mentioned in the source as
> 
> int[4] = {1, 2, 3, 4}
> 
> I am not sure about how to proceed. This form looks like an array with 4 elements but I want it to be a datatype. 

Do you mean something like this?

  int myVector[4] = { 1, 2, 3, 4 };

Making that a vector will break existing C code.

Unless you *really* need new syntax, I would strongly suggest sticking with one of the existing vector types.

John.



More information about the cfe-dev mailing list