This implements minimum support in clang for default HBC/MOPS features
on v8.8-a/v9.3-a or later architectures.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Driver/ToolChains/Arch/AArch64.cpp | ||
---|---|---|
463–482 | This is not relevant anymore, but for the initial code, I guess we can't reuse ItBegin/End because Features has been changed since then (a lot of push_back). The reason why we need to keep these default features (+hbc, +mops, ...) right after the architecture feature is that we want to be able to disable the default features X if +noX option is given in the command line, knowing that +noX features will come after the architecture feature in the Features list. | |
465–474 | I cached the architecture feature when it is defined to avoid these calls to std::find. |
clang/lib/Driver/ToolChains/Arch/AArch64.cpp | ||
---|---|---|
265 | Looks like you could do AF = Features.back() below all these if/else conditions (where it is first used) based on the value of success. Maybe there is no need to pass it into getAArch64MicroArchFeaturesFromMcpu and the other functions? Adding an extra output parameter to each of these functions (which duplicates an existing output parameter) seems unnecessary and makes the interfaces more complicated. |
clang/lib/Driver/ToolChains/Arch/AArch64.cpp | ||
---|---|---|
265 | we can't do AF = Features.back() below all the if/else conditions because getAArch64MicroArchFeaturesFromM* adds (usually) the architecture feature first, followed by a bunch of other features, so when it returns, Features.back() is not the architecture feature anymore. I see your point about complicating the interfaces, maybe @nickdesaulniers can help us here? |
Taking into account remarks from @tmatheson, I'm reverting my latest changes
consisting in caching architecture feature into a variable, which makes the
getAArch64ArchFeaturesFrom* interfaces more complicated.
I'd propose we move forward with this patch, and the performance issue raised by
@nickdesaulniers will be addressed properly in a separate one.
LGTM, please give @nickdesaulniers some time to respond though. I do agree that iterating over the features repeatedly is less than ideal, but also that this patch is probably not the place to try to fix it.
I'm not exactly thrilled about continuing to kick the can down the road on this; consider making a child revision that fixes that first, then landing this patch. Otherwise that never gets cleaned up.
clang/lib/Driver/ToolChains/Arch/AArch64.cpp | ||
---|---|---|
468–480 | Is Pos ever read later, or simply compared to std::end(Features)? If not, consider simplifying removing Pos outright and simply calling std::find_first_of in an if predicate. |
Looks like you could do AF = Features.back() below all these if/else conditions (where it is first used) based on the value of success. Maybe there is no need to pass it into getAArch64MicroArchFeaturesFromMcpu and the other functions?
Adding an extra output parameter to each of these functions (which duplicates an existing output parameter) seems unnecessary and makes the interfaces more complicated.