Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support LLVM subtargets #1879

Closed
graydon opened this issue Feb 22, 2012 · 2 comments
Closed

support LLVM subtargets #1879

graydon opened this issue Feb 22, 2012 · 2 comments
Labels
A-codegen Area: Code generation A-driver Area: rustc_driver that ties everything together into the `rustc` compiler A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@graydon
Copy link
Contributor

graydon commented Feb 22, 2012

Currently we generate code for LLVM targets with target-specific features (subtargets, use of specific ISA features) on or off based on defaults. In some cases the defaults are ok, sometimes they're sniffed from the host (!) but in any case the user has no way to do something like "build me an x86 binary with no SSE".

This matters for old hardware, and will matter much more when targeting phones.

Also the bots should be modified to build snapshots using the narrowest subtarget they can specify, so we can support self-hosting on the oldest hardware people happen to have. This was hit when @andrewjbaker tried to build stage1 on an older AMD Socket-A (pre-SSE2) chip. It's old but it's not that old. We should continue to at least work there.

This piece has some driver work and some convert-to-strings-that-LLVM-understands work.

The driver work consists of taking -m<foo> and -mno-<foo> flags on the command line for individual CPU features, as well as -march=<foo>, -mcpu=<cpu> and -mabi=<abi> abbreviations that set -m<foo> feature flags collectively by more friendly arch/cpu names.

Take a look in clang's command-line options file as well as its target file that translates down to LLVM-specific features. This is currently a jumble. Everyone knows it's a jumble. Rationalizing it will take a lot of work and we can't do it ahead of a drive to do so on the part of the LLVM and clang maintainers. We're along for the ride.

Look at, say, X86TargetInfo in:

http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?view=markup

And the various -mfoo flags in:
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?view=markup

http://nondot.org/sabre/LLVMNotes/TargetSpec.txt

@graydon
Copy link
Contributor Author

graydon commented May 1, 2012

In 079c3b0 I changed the CPU string to "generic" which triggers the most-conservative subtarget mode on LLVM (rather than sniffing the host). This was necessary to get our builds.

This should help a bit on the subtarget-related bugs linked above (at least after the next snapshot) but it doesn't really fix the ability-to-specify-subtarget problem. Just makes it hurt less.

@pnkfelix
Copy link
Member

Not critical for 0.6; de-milestoning

@sanxiyn sanxiyn closed this as completed Apr 23, 2013
@graydon graydon removed their assignment Jun 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-driver Area: rustc_driver that ties everything together into the `rustc` compiler A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

3 participants