[llvm-dev] Per-function subtargets

via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 13 13:50:42 PDT 2019


I've been trying to understand the current state of subtargets and 
subtarget features in LLVM. It seems like the presence of "target-cpu" 
and "target-features" attributes on IR functions are currently intended 
to take precedence over the module-level (TargetMachine) versions. See 
X86TargetMachine::getSubtargetImpl for an example of this. However, this 
feels like it is half-way between two solutions (either all-module-wide, 
or all-function-specific), and some previous discussions like 
https://groups.google.com/forum/#!topic/llvm-dev/2hp9aARHEJA ([LLVMdev] 
Embedding cpu and feature strings into IR and enabling switching 
subtarget on a per function basis) seem to reinforce that feeling.

Is the intent still to eventually remove the module-level subtarget 
options entirely? Or will the two continue to coexist? Is it up to the 
target to decide how to "merge" the two, or is the "all or nothing" 
approach the right one?

-- 
Scott


More information about the llvm-dev mailing list