Rename target.abi to target.cfg_abi and enum-ify llvm_abiname#153857
Rename target.abi to target.cfg_abi and enum-ify llvm_abiname#153857RalfJung wants to merge 4 commits intorust-lang:mainfrom
target.abi to target.cfg_abi and enum-ify llvm_abiname#153857Conversation
…tie them to cfg(target_abi)
|
r? @jieyouxu rustbot has assigned @jieyouxu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
| // If llvm_abiname is empty, emit nothing. | ||
| let llvm_abiname = &sess.target.options.llvm_abiname; | ||
| if matches!(sess.target.arch, Arch::RiscV32 | Arch::RiscV64) && !llvm_abiname.is_empty() { | ||
| if matches!(sess.target.arch, Arch::RiscV32 | Arch::RiscV64) { |
There was a problem hiding this comment.
We force all riscv targets to set an ABI so no check for an empty ABI name is needed here.
| bug!("No ABI specified for this PPC64 ELF target"); | ||
| LlvmAbi::ElfV1 => EF_PPC64_ABI_ELF_V1, | ||
| LlvmAbi::ElfV2 => EF_PPC64_ABI_ELF_V2, | ||
| _ if sess.target.options.binary_format.to_object() == BinaryFormat::Elf => { |
There was a problem hiding this comment.
ElfV1 and ElfV2 are the only allowed ABI names here so we can error on everything else.
9cc36ca to
2b82fad
Compare
|
Also, to quote some of my arguments from #153769 where this change was first proposed (this was in reply to questions/comments by @madsmtm):
I agree that it is a bummer to lose this consistency, but I think it's the preferable outcome over people misunderstanding what
Yeah we just recently fixed a few of them
In both cases AFAIK all targets had a consistent value for
Yeah, agreed. has_reliable_f16_f128 is a hopefully temporary internal hack/heuristic so it's not very critical. I don't know anything about the SPE situation (hence the FIXME).
You mean instead of or on top of the field rename? I'd be fine with doing both, but I do think we should do the field rename.
Exactly.
We discussed this a bit on Zulip but it's not clear what one could do. I think even if we do that, a PR like this one is a helpful first step to map the territory. Personally I have no concrete plans to further cleanup after this PR (mostly due to a lack of good ideas, and also because I don't want to touch the hot potato of actually changing the user-visible |
Based on top of #153769. Also see Zulip for more context. Discussed a bit in #153769 (comment) too.
This renames
target.abitotarget.cfg_abito make it less likely that someone will use it to determine things about the actual ccABI, i.e. the calling convention used on the target.target.abidoes not control that calling convention, it just sometimes informs the user about that calling convention (and also about other aspects of the ABI).Also turn llvm_abiname into an enum to make it more natural to match on.
Cc @workingjubilee @madsmtm