aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/driver/cc1_main.cpp
diff options
context:
space:
mode:
authorLucas Duarte Prates <lucas.prates@arm.com>2024-06-26 14:59:01 +0100
committerGitHub <noreply@github.com>2024-06-26 14:59:01 +0100
commitb579aacc30bc02e8430c0b59af644f52ece71160 (patch)
tree999d20d9addd831449b8b786c06c0e4a4f8d93ca /clang/tools/driver/cc1_main.cpp
parent161e1689ba98fabba71cac21f536708c78e9d7b0 (diff)
downloadllvm-b579aacc30bc02e8430c0b59af644f52ece71160.zip
llvm-b579aacc30bc02e8430c0b59af644f52ece71160.tar.gz
llvm-b579aacc30bc02e8430c0b59af644f52ece71160.tar.bz2
Revert "[AArch64] Add ability to list extensions enabled for a target" (#96768)
Reverts llvm/llvm-project#95805 due to test failures caught by the buildbots.
Diffstat (limited to 'clang/tools/driver/cc1_main.cpp')
-rw-r--r--clang/tools/driver/cc1_main.cpp46
1 files changed, 1 insertions, 45 deletions
diff --git a/clang/tools/driver/cc1_main.cpp b/clang/tools/driver/cc1_main.cpp
index 3c0599c..2aebc6d 100644
--- a/clang/tools/driver/cc1_main.cpp
+++ b/clang/tools/driver/cc1_main.cpp
@@ -26,7 +26,6 @@
#include "clang/Frontend/Utils.h"
#include "clang/FrontendTool/Utils.h"
#include "llvm/ADT/Statistic.h"
-#include "llvm/ADT/StringExtras.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/LinkAllPasses.h"
#include "llvm/MC/MCSubtargetInfo.h"
@@ -149,7 +148,7 @@ static int PrintSupportedExtensions(std::string TargetStr) {
if (MachineTriple.isRISCV())
llvm::riscvExtensionsHelp(DescMap);
else if (MachineTriple.isAArch64())
- llvm::AArch64::PrintSupportedExtensions();
+ llvm::AArch64::PrintSupportedExtensions(DescMap);
else if (MachineTriple.isARM())
llvm::ARM::PrintSupportedExtensions(DescMap);
else {
@@ -162,45 +161,6 @@ static int PrintSupportedExtensions(std::string TargetStr) {
return 0;
}
-static int PrintEnabledExtensions(const TargetOptions& TargetOpts) {
- std::string Error;
- const llvm::Target *TheTarget =
- llvm::TargetRegistry::lookupTarget(TargetOpts.Triple, Error);
- if (!TheTarget) {
- llvm::errs() << Error;
- return 1;
- }
-
- // Create a target machine using the input features, the triple information
- // and a dummy instance of llvm::TargetOptions. Note that this is _not_ the
- // same as the `clang::TargetOptions` instance we have access to here.
- llvm::TargetOptions BackendOptions;
- std::string FeaturesStr = llvm::join(TargetOpts.FeaturesAsWritten, ",");
- std::unique_ptr<llvm::TargetMachine> TheTargetMachine(
- TheTarget->createTargetMachine(TargetOpts.Triple, TargetOpts.CPU, FeaturesStr, BackendOptions, std::nullopt));
- const llvm::Triple &MachineTriple = TheTargetMachine->getTargetTriple();
- const llvm::MCSubtargetInfo *MCInfo = TheTargetMachine->getMCSubtargetInfo();
-
- // Extract the feature names that are enabled for the given target.
- // We do that by capturing the key from the set of SubtargetFeatureKV entries
- // provided by MCSubtargetInfo, which match the '-target-feature' values.
- const std::vector<llvm::SubtargetFeatureKV> Features =
- MCInfo->getEnabledProcessorFeatures();
- std::set<llvm::StringRef> EnabledFeatureNames;
- for (const llvm::SubtargetFeatureKV &feature : Features)
- EnabledFeatureNames.insert(feature.Key);
-
- if (!MachineTriple.isAArch64()) {
- // The option was already checked in Driver::HandleImmediateArgs,
- // so we do not expect to get here if we are not a supported architecture.
- assert(0 && "Unhandled triple for --print-enabled-extensions option.");
- return 1;
- }
- llvm::AArch64::printEnabledExtensions(EnabledFeatureNames);
-
- return 0;
-}
-
int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
ensureSufficientStack();
@@ -244,10 +204,6 @@ int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
if (Clang->getFrontendOpts().PrintSupportedExtensions)
return PrintSupportedExtensions(Clang->getTargetOpts().Triple);
- // --print-enabled-extensions takes priority over the actual compilation.
- if (Clang->getFrontendOpts().PrintEnabledExtensions)
- return PrintEnabledExtensions(Clang->getTargetOpts());
-
// Infer the builtin include path if unspecified.
if (Clang->getHeaderSearchOpts().UseBuiltinIncludes &&
Clang->getHeaderSearchOpts().ResourceDir.empty())