<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi all,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
    I am handling some arbitrary precision integers (e.g. 13-bit) in the source code with Clang. Temporary, I declare them as structs like:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
              struct APINT13 VarA;</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
    and during parsing the AST and generating IR, I transform the type of these variables into arbitrary precision integers.
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
    I read some other documentations and find that adding attributes for variables could be a nicer way to handle arbitrary precision integer.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
    However, as default, there is no such attribute as "bitwidth" in Clang. I found the following link and get some hints but the instructions listed in the website require me to modify the source code of Clang ("Attr.td", "include/clang/Sema/ParsedAttr.h"
 and "utils/TableGen/ClangAttrEmitter.cpp").</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
    <a href="http://clang.llvm.org/docs/InternalsManual.html#how-to-add-an-attribute" id="LPlnk337070">
http://clang.llvm.org/docs/InternalsManual.html#how-to-add-an-attribute</a><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
    I just wonder whether there is any way to add attributes like plugins without touching the source code of Clang, because to rebuild Clang could be time-consuming. As I know, LLVM passes can work as plugins and I guess there could be the similar way to handle
 attribute addition with Clang.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
    Thanks in advance for your time and suggestion! \^_^/<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<span id="ms-rterangepaste-start"></span>
<div><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">Best regards,</span></font><span style="font-size:12pt">
</span><span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">------------------------------------------</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">Tingyuan LIANG</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">MPhil Student</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">Department of Electronic and Computer Engineering</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span>
<div><span style="font-size:12pt"></span>
<div style="margin:0"><font size="2" face="Calibri,sans-serif"><span style="font-size:12pt">The Hong Kong University of Science and Technology</span></font></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span><span style="font-size:12pt"></span><span id="ms-rterangepaste-end"></span></div>
</div>
<div id="appendonsend"></div>
<span style="font-size:12pt"></span>
<div dir="ltr">
<div id="x_signature">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<div><span style="font-size:12pt"></span></div>
<span style="font-size:12pt"></span><span style="font-size:12pt"></span><span id="x_ms-rterangepaste-end"></span></div>
</div>
</div>
</body>
</html>