"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?


There are essentially four ways to change the way code generation works for a function: 1. Function attributes () 2. Module flags () 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