These flags control the lowering of switch statements to lookup tables.
When "-fno-lookup-tables" is passed, the function attribute "no-lookup-tables"
is set to "true"
Details
Diff Detail
Event Timeline
So, what's the overall logical idea behind the need for this option? While I understand that you don't want people just doing this via the -mllvm set of options, but if you're just doing this to provide a temporary option rather than turning it off in the backend I'm not sure what the point is.
Can you elaborate more on why you need to expose this via the front end?
The discussion is scattered across these patches https://reviews.llvm.org/D35578 and https://reviews.llvm.org/D35579.
I will provide a brief summary here:
The idea is to control the generation of data (lookup table) generated from a function, specifically when the user is not expecting it.
For hexagon, there is tightly coupled memory and the customers usually place "text" in it.
For functions, which generate lookup tables, it is very very expensive to read the table from a far away non-TCM data section.
This option will disable the generation of lookup tables at the expense of code bloat. This is really driven by the customers of hexagon backend.
I don't think we're communicating effectively. Let me try another way:
"Is there any reason why a user of the hexagon backend will ever not want to set these options to a particular value"
in other words:
"Should this just be part of the tuning for the hexagon backend and not options at all"
Thanks.
"Should this just be part of the tuning for the hexagon backend and not options at all"
This will be useful to all the backends/archs that support a tightly coupled memory.
AFAIK, hexagon is not the only target that has a TCM.
The ultimate decision as to what kind of code to generate out of a switch statement belongs to the customer. The reasons to choose one way over another may involve factors that the compiler has no knowledge of (such as details of the target hardware). I don't think we need separate options to control jump tables and lookup tables: one option to enable/disable the use of memory tables would be sufficient.
If it is okay for the reviewers, I have no problem using -fno-jump-tables to this effect.
I need to update https://reviews.llvm.org/D35578 and https://reviews.llvm.org/D35579
I don't have an objection to this direction (i.e., disable the lookup-table optimization when -fno-jump-tables is specified), so long as other are in agreement.
The only change that is needed is to disable lookup-tables based on the attribute "no-jump-tables" set by "-fno-jump-tables" clang flag.
It implies that this change is not required.
Check positive flag and the default case as well.