[cfe-dev] Adding new data type

kalyan ponnala ponnala.kalyan at gmail.com
Thu Apr 29 23:08:22 PDT 2010


hi,

Thanks for the replies. @john :  I am looking into "typedef int int_4
__attribute__((ext_vector_type(4)));" way of adding the vector data type. I
do not want to change the array type to vector type. Right now I am trying
to add this as a header file into the clang architecture so that it won't
look bad and at the same time it would make the new data type "int_4" look
like its a built in data type in clang when we write code at source level. I
am still trying to figure it out. It looks like headers added to
clang/lib/Headers are not recognized as I thought they would be. I am using
visual studio 2008 on windows 7.

Thanks.


On Thu, Apr 29, 2010 at 7:29 PM, Douglas Gregor <dgregor at apple.com> wrote:

>
> On Apr 29, 2010, at 4:28 PM, kalyan ponnala wrote:
>
> Thanks for letting me know about the vector types Douglas. I think I can
> use this to implement the new vector datatype. Can you tell me a better way
> to add this as a header file to Clang. I dont want this typedef way to be
> visible on the source side. (I dont want to add this as a header file on the
> source side.). If I wanted the header file to contain something like
> typedef int int_4 __attribute__((ext_vector_type(4)));
>
> Where can I add this header file inside clang so that it can understand
> something like int_4 on the source code, i mean to which target should I add
> it?
>
>
> Look in clang/libs/Headers for other Clang-supplied headers.
>
> - Doug
>
> Thanks again.
>
> On Thu, Apr 29, 2010 at 4:59 PM, Douglas Gregor <dgregor at apple.com> wrote:
>
>>
>> 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
>
>
>
>
> --
> Kalyan Ponnala
> phone: 8163772059
>
>
>


-- 
Kalyan Ponnala
phone: 8163772059
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100430/42bdf3bc/attachment.html>


More information about the cfe-dev mailing list