Skip to content

Commit d2c8609

Browse files
pratlucasAlexisPerry
authored andcommitted
Revert "[AArch64] Add ability to list extensions enabled for a target" (llvm#96768)
Reverts llvm#95805 due to test failures caught by the buildbots.
1 parent ca9990a commit d2c8609

35 files changed

+422
-1302
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5710,11 +5710,6 @@ def print_supported_extensions : Flag<["-", "--"], "print-supported-extensions">
57105710
Visibility<[ClangOption, CC1Option, CLOption]>,
57115711
HelpText<"Print supported -march extensions (RISC-V, AArch64 and ARM only)">,
57125712
MarshallingInfoFlag<FrontendOpts<"PrintSupportedExtensions">>;
5713-
def print_enabled_extensions : Flag<["-", "--"], "print-enabled-extensions">,
5714-
Visibility<[ClangOption, CC1Option, CLOption]>,
5715-
HelpText<"Print the extensions enabled by the given target and -march/-mcpu options."
5716-
" (AArch64 only)">,
5717-
MarshallingInfoFlag<FrontendOpts<"PrintEnabledExtensions">>;
57185713
def : Flag<["-"], "mcpu=help">, Alias<print_supported_cpus>;
57195714
def : Flag<["-"], "mtune=help">, Alias<print_supported_cpus>;
57205715
def time : Flag<["-"], "time">,

clang/include/clang/Frontend/FrontendOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,6 @@ class FrontendOptions {
306306
LLVM_PREFERRED_TYPE(bool)
307307
unsigned PrintSupportedExtensions : 1;
308308

309-
/// Print the extensions enabled for the current target.
310-
LLVM_PREFERRED_TYPE(bool)
311-
unsigned PrintEnabledExtensions : 1;
312-
313309
/// Show the -version text.
314310
LLVM_PREFERRED_TYPE(bool)
315311
unsigned ShowVersion : 1;

clang/lib/Driver/Driver.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,6 @@ phases::ID Driver::getFinalPhase(const DerivedArgList &DAL,
363363
// -{fsyntax-only,-analyze,emit-ast} only run up to the compiler.
364364
} else if ((PhaseArg = DAL.getLastArg(options::OPT_fsyntax_only)) ||
365365
(PhaseArg = DAL.getLastArg(options::OPT_print_supported_cpus)) ||
366-
(PhaseArg = DAL.getLastArg(options::OPT_print_enabled_extensions)) ||
367366
(PhaseArg = DAL.getLastArg(options::OPT_module_file_info)) ||
368367
(PhaseArg = DAL.getLastArg(options::OPT_verify_pch)) ||
369368
(PhaseArg = DAL.getLastArg(options::OPT_rewrite_objc)) ||
@@ -2164,8 +2163,7 @@ bool Driver::HandleImmediateArgs(const Compilation &C) {
21642163
if (C.getArgs().hasArg(options::OPT_v) ||
21652164
C.getArgs().hasArg(options::OPT__HASH_HASH_HASH) ||
21662165
C.getArgs().hasArg(options::OPT_print_supported_cpus) ||
2167-
C.getArgs().hasArg(options::OPT_print_supported_extensions) ||
2168-
C.getArgs().hasArg(options::OPT_print_enabled_extensions)) {
2166+
C.getArgs().hasArg(options::OPT_print_supported_extensions)) {
21692167
PrintVersion(C, llvm::errs());
21702168
SuppressMissingInputWarning = true;
21712169
}
@@ -4349,14 +4347,13 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
43494347
}
43504348

43514349
for (auto Opt : {options::OPT_print_supported_cpus,
4352-
options::OPT_print_supported_extensions,
4353-
options::OPT_print_enabled_extensions}) {
4350+
options::OPT_print_supported_extensions}) {
43544351
// If --print-supported-cpus, -mcpu=? or -mtune=? is specified, build a
43554352
// custom Compile phase that prints out supported cpu models and quits.
43564353
//
4357-
// If either --print-supported-extensions or --print-enabled-extensions is
4358-
// specified, call the corresponding helper function that prints out the
4359-
// supported/enabled extensions and quits.
4354+
// If --print-supported-extensions is specified, call the helper function
4355+
// RISCVMarchHelp in RISCVISAInfo.cpp that prints out supported extensions
4356+
// and quits.
43604357
if (Arg *A = Args.getLastArg(Opt)) {
43614358
if (Opt == options::OPT_print_supported_extensions &&
43624359
!C.getDefaultToolChain().getTriple().isRISCV() &&
@@ -4366,12 +4363,6 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
43664363
<< "--print-supported-extensions";
43674364
return;
43684365
}
4369-
if (Opt == options::OPT_print_enabled_extensions &&
4370-
!C.getDefaultToolChain().getTriple().isAArch64()) {
4371-
C.getDriver().Diag(diag::err_opt_not_valid_on_target)
4372-
<< "--print-enabled-extensions";
4373-
return;
4374-
}
43754366

43764367
// Use the -mcpu=? flag as the dummy input to cc1.
43774368
Actions.clear();

clang/lib/Driver/ToolChain.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ static void getAArch64MultilibFlags(const Driver &D,
195195
UnifiedFeatures.end());
196196
std::vector<std::string> MArch;
197197
for (const auto &Ext : AArch64::Extensions)
198-
if (FeatureSet.contains(Ext.PosTargetFeature))
199-
MArch.push_back(Ext.UserVisibleName.str());
198+
if (FeatureSet.contains(Ext.Feature))
199+
MArch.push_back(Ext.Name.str());
200200
for (const auto &Ext : AArch64::Extensions)
201-
if (FeatureSet.contains(Ext.NegTargetFeature))
202-
MArch.push_back(("no" + Ext.UserVisibleName).str());
201+
if (FeatureSet.contains(Ext.NegFeature))
202+
MArch.push_back(("no" + Ext.Name).str());
203203
StringRef ArchName;
204204
for (const auto &ArchInfo : AArch64::ArchInfos)
205205
if (FeatureSet.contains(ArchInfo->ArchFeature))

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ static void CollectARMPACBTIOptions(const ToolChain &TC, const ArgList &Args,
15241524
auto isPAuthLR = [](const char *member) {
15251525
llvm::AArch64::ExtensionInfo pauthlr_extension =
15261526
llvm::AArch64::getExtensionByID(llvm::AArch64::AEK_PAUTHLR);
1527-
return pauthlr_extension.PosTargetFeature == member;
1527+
return pauthlr_extension.Feature == member;
15281528
};
15291529

15301530
if (std::any_of(CmdArgs.begin(), CmdArgs.end(), isPAuthLR))

clang/test/CodeGen/aarch64-targetattr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,14 +196,14 @@ void minusarch() {}
196196
// CHECK: attributes #[[ATTR1]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rdm,+sve,+v8.1a,+v8.2a,+v8a" }
197197
// CHECK: attributes #[[ATTR2]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+crc,+fp-armv8,+fullfp16,+lse,+neon,+ras,+rdm,+sve,+sve2,+v8.1a,+v8.2a,+v8a" }
198198
// CHECK: attributes #[[ATTR3]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+bf16,+complxnum,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+ras,+rcpc,+rdm,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a" }
199-
// CHECK: attributes #[[ATTR4]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a710" "target-features"="+bf16,+complxnum,+crc,+dotprod,+ete,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+mte,+neon,+pauth,+perfmon,+ras,+rcpc,+rdm,+sb,+sve,+sve2,+sve2-bitperm,+trbe,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+v9a" }
199+
// CHECK: attributes #[[ATTR4]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="cortex-a710" "target-features"="+bf16,+complxnum,+crc,+dotprod,+flagm,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+mte,+neon,+pauth,+perfmon,+ras,+rcpc,+rdm,+sb,+sve,+sve2,+sve2-bitperm,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8a,+v9a" }
200200
// CHECK: attributes #[[ATTR5]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "tune-cpu"="cortex-a710" }
201-
// CHECK: attributes #[[ATTR6]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+ete,+fp-armv8,+neon,+trbe,+v8a" }
201+
// CHECK: attributes #[[ATTR6]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+fp-armv8,+neon,+v8a" }
202202
// CHECK: attributes #[[ATTR7]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "tune-cpu"="generic" }
203203
// CHECK: attributes #[[ATTR8]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-n1" "target-features"="+aes,+crc,+dotprod,+fp-armv8,+fullfp16,+lse,+neon,+perfmon,+ras,+rcpc,+rdm,+sha2,+spe,+ssbs,+v8.1a,+v8.2a,+v8a" "tune-cpu"="cortex-a710" }
204204
// CHECK: attributes #[[ATTR9]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+sve" "tune-cpu"="cortex-a710" }
205-
// CHECK: attributes #[[ATTR10]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-v1" "target-features"="+aes,+bf16,+ccdp,+complxnum,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" }
206-
// CHECK: attributes #[[ATTR11]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-v1" "target-features"="+aes,+bf16,+ccdp,+complxnum,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,-sve" }
205+
// CHECK: attributes #[[ATTR10]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-v1" "target-features"="+aes,+bf16,+complxnum,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a" }
206+
// CHECK: attributes #[[ATTR11]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-v1" "target-features"="+aes,+bf16,+complxnum,+crc,+dotprod,+fp-armv8,+fp16fml,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+rand,+ras,+rcpc,+rdm,+sha2,+sha3,+sm4,+spe,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,-sve" }
207207
// CHECK: attributes #[[ATTR12]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+sve" }
208208
// CHECK: attributes #[[ATTR13]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16" }
209209
// CHECK: attributes #[[ATTR14]] = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="neoverse-n1" "target-features"="+aes,+bf16,+complxnum,+crc,+dotprod,+fp-armv8,+fullfp16,+i8mm,+jsconv,+lse,+neon,+pauth,+perfmon,+ras,+rcpc,+rdm,+sha2,+spe,+ssbs,+sve,+sve2,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8.5a,+v8.6a,+v8a" "tune-cpu"="cortex-a710" }

0 commit comments

Comments
 (0)