Sumanth Gundapaneni via llvm-dev
2017-Jul-10 15:55 UTC
[llvm-dev] "no-jump-table": Attribute vs flag
The clang flag "-fno-jump-table" adds the function attribute "no-jump-table=true" to IR. What are facts that need to take in to consideration whether to pass an llvm flag to the clang driver (assuming we have an llvm flag that turns off jump tables ) vs adding an attribute? --Sumanth -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170710/b5e942c8/attachment.html>
Friedman, Eli via llvm-dev
2017-Jul-10 19:41 UTC
[llvm-dev] "no-jump-table": Attribute vs flag
On 7/10/2017 8:55 AM, Sumanth Gundapaneni via llvm-dev wrote:> > The clang flag “-fno-jump-table” adds the function attribute > “no-jump-table=true” to IR. > > What are facts that need to take in to consideration whether to pass > an llvm flag to the clang driver (assuming we have an llvm flag that > turns off jump tables ) vs adding an attribute? >There are essentially four ways to change the way code generation works for a function: 1. Function attributes (http://llvm.org/docs/LangRef.html#function-attributes) 2. Module flags (http://llvm.org/docs/LangRef.html#module-flags-metadata) 3. Options passed directly to the target (include/llvm/Target/TargetOptions.h etc.) 4. LLVM flags ("-mllvm"). Historically, LLVM flags were the primary way to configure the compiler; they're very easy to add, and straightforward to use. But they don't really work well if you aren't just invoking a compiler to build an object file. Options are global, so they apply to the entire process, which is inconvenient for compiling multiple modules in the same process (e.g. a JIT). And they aren't recorded into IR, so in an LTO workflow you have to pass the option to the linker rather than the compiler. If you expect an option is useful outside of developing LLVM itself, you should provide some other way to configure it. -Eli -- Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170710/48dbff11/attachment.html>