Hi guys,<br>
<br>
I was trying to add this header file named "NEW_DATATYPES.h"  with the 
following information into clang.<br>
<br>
typedef int int_2 __attribute__((ext_vector_type(2)));<br>
<br>I added it to clang\lib\Headers. And in the source program when I 
try to do:<br>
>>code-1:<br><br>
int main()<br>
{<br>
    int_2 abc = { 1, 2 };<br>
    int_2 bbc = { 3, 4} ;<br>
    abc.x = bbc.y;<br>
return 0;<br>
}<br>
<br>
clang gives me an error. saying that it does not identify int_2. <br>
When I add the header file's name "NEW_DATATYPES.h" to the source like 
below, clang compiles the code fine. <br>
>>code2:<br><br>
#include "NEW_DATATYPES.h"<br>

int main()<br>

{<br>

    int_2 abc = { 1, 2 };<br>

    int_2 bbc = { 3, 4} ;<br>

    abc.x = bbc.y;<br>

return 0;<br>

}<br>

<br>
But what I want is that the clang should be able to compile the code-1 
fine where I dont have to add the header file explicitly. Can someone 
please tell me how to do this without actually making any changes to the
 existing clang architecture. I am trying not to disturb the code. <br>
<br>
Thanks a ton.<br><br>Kalyan<br><br>
<div class="gmail_quote">On Fri, Apr 30, 2010 at 2:08 AM, kalyan ponnala <span dir="ltr"><<a href="mailto:ponnala.kalyan@gmail.com" target="_blank">ponnala.kalyan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<br>hi, <br><br>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. <br>


<br>Thanks.<div><div></div><div><br><br><br><div class="gmail_quote">On Thu, Apr 29, 2010 at 7:29 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div style="word-wrap: break-word;"><br><div><div><div>On Apr 29, 2010, at 4:28 PM, kalyan ponnala wrote:</div><br><blockquote type="cite">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 <br>



typedef int int_4 __attribute__((ext_vector_type(4)));<br><br>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? <br></blockquote>


<div><br></div></div><div>Look in clang/libs/Headers for other Clang-supplied headers.</div><div><br></div><div><span style="white-space: pre;">    </span>- Doug</div><div><br><blockquote type="cite">
Thanks again. <br><br><div class="gmail_quote">On Thu, Apr 29, 2010 at 4:59 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">



<div><br>
On Apr 29, 2010, at 1:35 PM, kalyan ponnala wrote:<br>
<br>
> Hi guys,<br>
><br>
> 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<br>




><br>
> int[4] = {1, 2, 3, 4}<br>
><br>
> 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.<br>
> 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.<br>
><br>
> Any advices about how to proceed would be really appreciated.<br>
<br>
</div>Clang already has vector types (VectorType) and "extended" vector types (ExtVectorType). They're created using attributes, e.g.,<br>
<br>
        typedef int v4si __attribute__ ((vector_size (16)));<br>
<br>
You could probably just re-use these vector types, possibly tweaking their semantics a bit, for your architecture.<br>
<br>
        - Doug</blockquote></div><br><br clear="all"><br>-- <br>Kalyan Ponnala<br>phone: 8163772059<br>
<div style="display: inline;"></div>
</blockquote></div></div><br></div></blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br>Kalyan Ponnala<br>phone: 8163772059<br>
<div style="display: inline;"></div>
</font></blockquote></div><br><br clear="all"><br>-- <br>Kalyan Ponnala<br>phone: 8163772059<br>
<div style="display: inline;"></div>
<div style="visibility: hidden; display: inline;" id="avg_ls_inline_popup"></div><style type="text/css">#avg_ls_inline_popup {  position:absolute;  z-index:9999;  padding: 0px 0px;  margin-left: 0px;  margin-top: 0px;  width: 240px;  overflow: hidden;  word-wrap: break-word;  color: black;  font-size: 10px;  text-align: left;  line-height: 13px;}</style>