[LLVMdev] Proposal: Move host CPU auto-detection out of the TargetMachine
Jim Grosbach
grosbach at apple.com
Mon Apr 7 17:59:46 PDT 2014
All,
Currently the X86 backend does CPU auto-detection and subtarget feature detection when the TargetMachine is created if no explicit CPU was specified. It's counterintuitive for low level tools like ‘llc’ to do this, as it means the same .ll file compiled on heterogenous machines generates different results from the same ‘llc’ command line. It is still useful to be able to opt-in to such behavior to, for example, replicate clang’s behavior when -mcpu=native is supplied to clang. My thought is to do something similar here and teach ‘llc’ to recognize -mcpu=native and probe the host CPU if that is given. The subtarget features will then be filled in according to the feature string for that CPU. This (a) changes the auto-detection from opt-out to opt-in and (b) moves the logic out of the core target backend and into the tools drivers.
Attached are draft patches that do this for X86. Similar but smaller cleanups can also be done for SystemZ and PowerPC if it’s agreed this is a good idea.
-Jim
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-X86-Remove-TargetMachine-CPU-auto-detection.patch
Type: application/octet-stream
Size: 12006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140407/9f62b25c/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-llc-Add-support-for-mcpu-native.patch
Type: application/octet-stream
Size: 1136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140407/9f62b25c/attachment-0001.obj>
More information about the llvm-dev
mailing list