[cfe-dev] Bitwidth attribute in clang
Nadav
nadav256 at gmail.com
Thu Aug 7 23:49:46 PDT 2008
Hello,
I am working on adding attribute support for arbitrary integer bit
width for clang. This is useful for hardware synthesis where smaller
integers translate to smaller circuits.
There is a similar open bug against llvm-gcc which explains this.
http://llvm.org/bugs/show_bug.cgi?id=1284
Example:
typedef int int5 __attribute__((bitwidth(5)));
I followed efriedma's 51577 patch and added the new attribute syntax
without a problem.
http://llvm.org/viewvc/llvm-project?view=rev&revision=51577
I wanted to consult with the list on the best way to implement this.
It looks like the current type classes cannot support arbitrary
bitlength integers. The BuiltinType class supports only the standard
types (UChar, UInt, Int, etc). Would you suggest deriving another new
type from Type (similar to complex, pointer, etc). After I do this I
will have to change many other places in the code.
Is there another better way to implement this ?
Thank you,
Nadav Rotem
More information about the cfe-dev
mailing list