[llvm-dev] Add Bitwidth Attribute in Clang without Modification in Source Code of Clang
Tingyuan LIANG via llvm-dev
llvm-dev at lists.llvm.org
Sun Mar 3 04:48:27 PST 2019
Hi all,
I am handling some arbitrary precision integers (e.g. 13-bit) in the source code with Clang. Temporary, I declare them as structs like:
struct APINT13 VarA;
and during parsing the AST and generating IR, I transform the type of these variables into arbitrary precision integers.
I read some other documentations and find that adding attributes for variables could be a nicer way to handle arbitrary precision integer.
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").
http://clang.llvm.org/docs/InternalsManual.html#how-to-add-an-attribute
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.
Thanks in advance for your time and suggestion! \^_^/
Best regards,
------------------------------------------
Tingyuan LIANG
MPhil Student
Department of Electronic and Computer Engineering
The Hong Kong University of Science and Technology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190303/c8b77345/attachment.html>
More information about the llvm-dev
mailing list