[cfe-dev] Adding new data type
Douglas Gregor
dgregor at apple.com
Thu Apr 29 13:59:55 PDT 2010
On Apr 29, 2010, at 1:35 PM, kalyan ponnala wrote:
> Hi guys,
>
> 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). 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.
> I was looking into targetinfo.h and initpreprocessor.cpp. it looks like I can add a new type here or change the existing one. And about the type.h in ClangAST target, will it work if I added this type here.
>
> Any advices about how to proceed would be really appreciated.
Clang already has vector types (VectorType) and "extended" vector types (ExtVectorType). They're created using attributes, e.g.,
typedef int v4si __attribute__ ((vector_size (16)));
You could probably just re-use these vector types, possibly tweaking their semantics a bit, for your architecture.
- Doug
More information about the cfe-dev
mailing list