[cfe-dev] Adding new data type

kalyan ponnala ponnala.kalyan at gmail.com
Thu Apr 29 13:35:56 PDT 2010


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.

Thanks again.

On Thu, Apr 29, 2010 at 12:45 PM, John McCall <rjmccall at apple.com> wrote:

>
> On Apr 29, 2010, at 1:06 AM, Renato Golin wrote:
>
> > On 28 April 2010 23:36, kalyan ponnala <ponnala.kalyan at gmail.com> wrote:
> >> Hello Group,
> >>
> >> I am trying to add a new data type to clang. Can someone tell me the
> >> important files and classes to look into and how to start in order to
> lex
> >> and parse and generate an AST node to this new data type.
> >
> > First you have to add the new type to the Type hierarchy. See
> > include/llvm/Type.h and its derived classes, find a suitable spot and
> > implement it.
>
> I think you mean include/clang/AST/Type.h.  But changes to the type system
> can be very subtle;  Kalyan, if you can be more specific about what type
> you're thinking of adding, we can give better advice.  There isn't much
> internal documentation on adding a type.
>
> John.




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


More information about the cfe-dev mailing list