-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
[AArch64][TargetParser] autogen ArchExtKind enum - renaming #90320
[AArch64][TargetParser] autogen ArchExtKind enum - renaming #90320
Conversation
Thanks to ExtensionSet::toLLVMFeatureList, all values of ArchExtKind should correspond to a particular -target-feature. The valid values of -target-feature are in turn defined by SubtargetFeature defs. Therefore we can generate ArchExtKind from the tablegen data. This is done by adding an Extension class which derives from SubtargetFeature. Because the Has* FieldNames do not always correspond to the AEK_ names ("extensions", as defined in TargetParser), and AEK_ names do not always correspond to -march strings, some additional enum entries have been added to remap the names. I have renamed these to make the naming consistent, but split them into a separate PR to keep the diff reasonable (#90320)
@tmatheson-arm This breaks builds without the |
Re-land 61b2a0e. Some Windows builds were failing because AArch64TargetParserDef.inc is a generated header which is included transitively into some clang components, but this information is not available to the build system and therefore there is a missing edge in the dependency graph. This patch incorporates the fixes described in ac1ffd3/D142403. Thanks to ExtensionSet::toLLVMFeatureList, all values of ArchExtKind should correspond to a particular -target-feature. The valid values of -target-feature are in turn defined by SubtargetFeature defs. Therefore we can generate ArchExtKind from the tablegen data. This is done by adding an Extension class which derives from SubtargetFeature. Because the Has* FieldNames do not always correspond to the AEK_ names ("extensions", as defined in TargetParser), and AEK_ names do not always correspond to -march strings, some additional enum entries have been added to remap the names. I have renamed these to make the naming consistent, but split them into a separate PR to keep the diff reasonable (#90320)
I could have instead renamed the target-feature to +simd, but +neon is present in so many files that it doesn't seem worth it.
1c97789
to
6bb213f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (presumably these were mechanically renamed, given the diff size).
IMO This patch looks far too large to sensibly review and needs to be split up. A lot of the changes don't really looks like mechanical renamings, and it is hard to see how they would not break existing uses of llvm arch64 target features? |
✅ With the latest revision this PR passed the C/C++ code formatter. |
@davemgreen This is already split into 18 commits, I don't think there's any reason to split it into 18 PRs, since comments on one of them likely apply to the others. @tmatheson-arm I don't know if there's any more specific precedent for changing target feature names, but I think this will be a breaking change for existing bitcode files, which we do try to maintain backward compatibility with: https://llvm.org/docs/DeveloperPolicy.html#ir-backwards-compatibility. Maybe we could add IR auto-upgrade code to handle old bitcode? |
I disagree. This is going to be awkward for a lot of users of llvm and contains at least some details I don't agree with. I think it will can cause a lot of subtle bugs and can end up wasting a lot of peoples time. It should at least be awkward for us too. |
@tmatheson-arm reached out and we have a bit of a conversation internally. I do think that there is too much going on in this one pr to be sensible to review, but from what I've looked at my main points I think are:
|
Yes, standardising on FEAT_* names would be good to match the TRM, so we avoid the |
Rust (https://github.com/rust-lang/rust/blob/79734f1db8dbe322192dea32c0f6b80ab14c4c1d/compiler/rustc_codegen_llvm/src/llvm_util.rs#L229) and zig (https://github.com/ziglang/zig/blob/44db92d1ca90c9cfdfb29fe46f04ff8f11c80901/lib/std/Target/aarch64.zig#L43) are two examples of what I meant by external dependencies. They can adapt, especially if there are release notes, but there may be many more projects out there using the old names and it would be good if they kept working, if we can. |
Thanks for the comments everyone. Given that this requires an IR break and additions to the importer, and there is still some question about which way to go with the renaming (i.e. FEAT_ names or user-facing names) I think it makes sense to defer renaming until later. For now, I will add mechanisms to handle the various inconsistencies as in #90987. |
Rename of several
SubtargetFeature
s orArmExtKind
(AEK_*
) enum values to bring them inline with the user-facing spelling on the command line.