[cfe-commits] r156630 - in /cfe/trunk: include/clang/Basic/BuiltinsHexagon.def lib/CodeGen/CGBuiltin.cpp

Bob Wilson bob.wilson at apple.com
Tue May 15 16:40:53 PDT 2012


On May 11, 2012, at 11:13 PM, John McCall <rjmccall at apple.com> wrote:

> On May 11, 2012, at 8:57 PM, Sirish Pande wrote:
>> I would love to have a macro-generated switch statement - but that would
>> require a target dependent file - which I don't think clang folks would like
>> in lib/CodeGen. Since most of the architectures are doing the same thing, I
>> adopted the style. But it's a pain for me as well. The whole switch block is
>> auto-generated by my other script, and I have to copy/paste. So yes, I would
>> love to have macro generated switch case. Clang folks, can I have a target
>> dependent file there?
> 
> I have nothing against macro metaprogramming and would much prefer a
> macro-generated switch over this enormous blob of code.
> 
> Bob, you had some experience doing this with the Neon intrinsics;  is there
> reusable infrastructure there, or at least useful lessons that apply?

This should really be handled with TableGen, especially because the Hexagon builtins look simpler than Neon, at least in the sense that they appear to be mapped one-to-one to LLVM intrinsics without a lot of special cases.

It might need a custom TableGen backend, but it should be a very simple one.  Look at the include/clang/Basic/arm_neon.td file and utils/TableGen/NeonEmitter.* files.  You can see some examples of how the results are used in lib/Sema/SemaChecking.cpp -- look for the includes of clang/Basic/arm_neon.inc.





More information about the cfe-commits mailing list