[llvm-branch-commits] [clang] [flang] [llvm] CodeGen: Remove TargetOptions::EABIVersion (PR #222672)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Sep 10 07:48:31 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-aarch64

@llvm/pr-subscribers-backend-arm

Author: Matt Arsenault (arsenm)

<details>
<summary>Changes</summary>

The field's only effect was gating the __aeabi_mem*[4|8] libcalls via the
IsEABI4/IsEABI5 predicates. That distinction is derivable from the triple's
environment, so replace the two predicates with a single
triple-derived IsEABIVersion and delete the field.

The clang -meabi option and clang::TargetOptions::EABIVersion are
retained (now codegen-inert); the llc/opt -meabi flag is removed. -meabi
now only takes effect on triples with a bare-EABI/GNU environment pair
(arm-none-eabi <-> gnueabi), which is the only case with a triple
representation.

Co-authored-by: Claude (Claude-Opus-4.8) <noreply@<!-- -->anthropic.com>

---

Patch is 47.11 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/222672.diff


37 Files Affected:

- (modified) clang/lib/Basic/Targets/AArch64.cpp (+1-5) 
- (modified) clang/lib/Basic/Targets/ARM.cpp (+1-4) 
- (modified) clang/lib/CodeGen/BackendUtil.cpp (-3) 
- (modified) clang/lib/Driver/ToolChain.cpp (+1) 
- (modified) clang/lib/Driver/ToolChains/Arch/ARM.cpp (+32) 
- (modified) clang/lib/Driver/ToolChains/Arch/ARM.h (+2) 
- (modified) clang/lib/Driver/ToolChains/Clang.cpp (+7-3) 
- (modified) clang/test/CodeGen/arm-eabi.c (+2-4) 
- (modified) clang/test/Driver/eabi.c (+13-6) 
- (modified) flang/lib/Frontend/FrontendActions.cpp (+5-6) 
- (modified) llvm/docs/ReleaseNotes.md (+4) 
- (modified) llvm/include/llvm/Analysis/RuntimeLibcallInfo.h (+2-5) 
- (modified) llvm/include/llvm/CodeGen/CommandFlags.h (-2) 
- (modified) llvm/include/llvm/IR/RuntimeLibcalls.h (+7-11) 
- (modified) llvm/include/llvm/IR/RuntimeLibcalls.td (+5-3) 
- (modified) llvm/include/llvm/Target/TargetOptions.h (-3) 
- (modified) llvm/lib/Analysis/RuntimeLibcallInfo.cpp (+3-5) 
- (modified) llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp (+2-3) 
- (modified) llvm/lib/CodeGen/CommandFlags.cpp (-12) 
- (modified) llvm/lib/CodeGen/TargetLoweringBase.cpp (-1) 
- (modified) llvm/lib/IR/RuntimeLibcalls.cpp (+7-7) 
- (modified) llvm/lib/LTO/LTOBackend.cpp (+2-2) 
- (modified) llvm/lib/Passes/RunCodeGen.cpp (+2-3) 
- (modified) llvm/lib/Target/ARM/ARMTargetMachine.cpp (-17) 
- (modified) llvm/test/CodeGen/ARM/arm-eabi.ll (+4-21) 
- (modified) llvm/test/CodeGen/ARM/float-helpers.ll (+4-4) 
- (modified) llvm/test/TableGen/RuntimeLibcallEmitter-calling-conv.td (+1-1) 
- (modified) llvm/test/TableGen/RuntimeLibcallEmitter-library-dispatch.td (+3-3) 
- (modified) llvm/test/TableGen/RuntimeLibcallEmitter-library-grouping.td (+2-2) 
- (modified) llvm/test/TableGen/RuntimeLibcallEmitter-library-name-merge.td (+2-2) 
- (modified) llvm/test/TableGen/RuntimeLibcallEmitter.td (+1-1) 
- (modified) llvm/test/Transforms/Util/DeclareRuntimeLibcalls/codegen-opt-flags.ll (+1-1) 
- (modified) llvm/tools/llc/NewPMDriver.cpp (+1-1) 
- (modified) llvm/tools/llc/llcdriver.cpp (+3-3) 
- (modified) llvm/tools/opt/NewPMDriver.cpp (+2-3) 
- (modified) llvm/tools/opt/optdriver.cpp (+4-6) 
- (modified) llvm/utils/TableGen/Basic/RuntimeLibcallsEmitter.cpp (+4-4) 


``````````diff
diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp
index 0f36f87806e43..a4841514be35e 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -204,11 +204,7 @@ AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple &Triple,
   if (Triple.getOS() == llvm::Triple::Linux)
     this->MCountName = "\01_mcount";
   else if (Triple.getOS() == llvm::Triple::UnknownOS)
-    this->MCountName =
-        (Opts.EABIVersion == llvm::EABI::GNU ||
-         (Opts.EABIVersion == llvm::EABI::Default && Triple.isGNUEnvironment()))
-            ? "\01_mcount"
-            : "mcount";
+    this->MCountName = Triple.isGNUEnvironment() ? "\01_mcount" : "mcount";
 }
 
 StringRef AArch64TargetInfo::getABI() const { return ABI; }
diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp
index 2df1837aa0621..0e424d031700b 100644
--- a/clang/lib/Basic/Targets/ARM.cpp
+++ b/clang/lib/Basic/Targets/ARM.cpp
@@ -326,10 +326,7 @@ ARMTargetInfo::ARMTargetInfo(const llvm::Triple &Triple,
   if (Triple.getOS() == llvm::Triple::Linux ||
       Triple.getOS() == llvm::Triple::UnknownOS)
     this->MCountName =
-        (Opts.EABIVersion == llvm::EABI::GNU ||
-         (Opts.EABIVersion == llvm::EABI::Default && Triple.isGNUEnvironment()))
-            ? "llvm.arm.gnu.eabi.mcount"
-            : "\01mcount";
+        Triple.isGNUEnvironment() ? "llvm.arm.gnu.eabi.mcount" : "\01mcount";
 
   SoftFloatABI = llvm::is_contained(Opts.FeaturesAsWritten, "+soft-float-abi");
 }
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index c09a8f7c0d679..b58c4a392a97a 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -409,9 +409,6 @@ static bool initTargetOptions(const CompilerInstance &CI,
   Options.UseInitArray = CodeGenOpts.UseInitArray;
   Options.MCOptions.DisableIntegratedAS = CodeGenOpts.DisableIntegratedAS;
 
-  // Set EABI version.
-  Options.EABIVersion = TargetOpts.EABIVersion;
-
   if (CodeGenOpts.hasSjLjExceptions())
     Options.ExceptionModel = llvm::ExceptionHandling::SjLj;
   if (CodeGenOpts.hasSEHExceptions())
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 2a17df5ff9132..7ea1080a3812d 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -1525,6 +1525,7 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args, BoundArch BA,
     llvm::Triple Triple = getTriple();
     tools::arm::setArchNameInTriple(getDriver(), Args, InputType, Triple);
     tools::arm::setFloatABIInTriple(getDriver(), Args, Triple);
+    tools::arm::setEABIInTriple(getDriver(), Args, Triple);
     return Triple.getTriple();
   }
   }
diff --git a/clang/lib/Driver/ToolChains/Arch/ARM.cpp b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
index 7d9c1f0bd3d40..f06483880358f 100644
--- a/clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -400,6 +400,38 @@ void arm::setFloatABIInTriple(const Driver &D, const ArgList &Args,
   }
 }
 
+void arm::setEABIInTriple(const Driver &D, const ArgList &Args,
+                          llvm::Triple &Triple) {
+  Arg *A = Args.getLastArg(options::OPT_meabi);
+  if (!A)
+    return;
+
+  StringRef Value = A->getValue();
+  if (Value == "gnu") {
+    switch (Triple.getEnvironment()) {
+    case llvm::Triple::EABI:
+      Triple.setEnvironment(llvm::Triple::GNUEABI);
+      break;
+    case llvm::Triple::EABIHF:
+      Triple.setEnvironment(llvm::Triple::GNUEABIHF);
+      break;
+    default:
+      break;
+    }
+  } else if (Value == "4" || Value == "5") {
+    switch (Triple.getEnvironment()) {
+    case llvm::Triple::GNUEABI:
+      Triple.setEnvironment(llvm::Triple::EABI);
+      break;
+    case llvm::Triple::GNUEABIHF:
+      Triple.setEnvironment(llvm::Triple::EABIHF);
+      break;
+    default:
+      break;
+    }
+  }
+}
+
 arm::FloatABI arm::getARMFloatABI(const ToolChain &TC, const ArgList &Args) {
   return arm::getARMFloatABI(TC.getDriver(), TC.getEffectiveTriple(), Args);
 }
diff --git a/clang/lib/Driver/ToolChains/Arch/ARM.h b/clang/lib/Driver/ToolChains/Arch/ARM.h
index a23a8793a89e2..180db7612a488 100644
--- a/clang/lib/Driver/ToolChains/Arch/ARM.h
+++ b/clang/lib/Driver/ToolChains/Arch/ARM.h
@@ -56,6 +56,8 @@ FloatABI getARMFloatABI(const Driver &D, const llvm::Triple &Triple,
                         const llvm::opt::ArgList &Args);
 void setFloatABIInTriple(const Driver &D, const llvm::opt::ArgList &Args,
                          llvm::Triple &triple);
+void setEABIInTriple(const Driver &D, const llvm::opt::ArgList &Args,
+                     llvm::Triple &triple);
 bool isHardTPSupported(const llvm::Triple &Triple);
 ReadTPMode getReadTPMode(const Driver &D, const llvm::opt::ArgList &Args,
                          const llvm::Triple &Triple, bool ForAS);
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index ab852bf0e0043..3f6efe5b6c453 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -1361,7 +1361,6 @@ namespace {
 void RenderARMABI(const Driver &D, const llvm::Triple &Triple,
                   const ArgList &Args, ArgStringList &CmdArgs) {
   // Select the ABI to use.
-  // FIXME: Support -meabi.
   // FIXME: Parts of this are duplicated in the backend, unify this somehow.
   const char *ABIName = nullptr;
   if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ))
@@ -5960,9 +5959,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
       RelocationModel == llvm::Reloc::ROPI_RWPI)
     CmdArgs.push_back("-frwpi");
 
+  // -meabi=gnu/5 are encoded in the cc1 -triple environment; forward only other
+  // values (e.g. 4, which has no triple representation, and invalid values).
   if (Arg *A = Args.getLastArg(options::OPT_meabi)) {
-    CmdArgs.push_back("-meabi");
-    CmdArgs.push_back(A->getValue());
+    StringRef Value = A->getValue();
+    if (Value != "gnu" && Value != "5") {
+      CmdArgs.push_back("-meabi");
+      CmdArgs.push_back(A->getValue());
+    }
   }
 
   // -fsemantic-interposition is forwarded to CC1: set the
diff --git a/clang/test/CodeGen/arm-eabi.c b/clang/test/CodeGen/arm-eabi.c
index 3a651feafbccd..9653717926c0a 100644
--- a/clang/test/CodeGen/arm-eabi.c
+++ b/clang/test/CodeGen/arm-eabi.c
@@ -9,12 +9,10 @@
 // RUN: %clang -target arm-none-gnueabihf -S -meabi 5 -o - %s | FileCheck -check-prefix=CHECK-EABI %s
 // RUN: %clang -target arm-none-musleabi -S -o - %s \
 // RUN:   | FileCheck -check-prefix=CHECK-GNUEABI %s
-// RUN: %clang -target arm-none-musleabi -S -o - %s -meabi 5 \
-// RUN:   | FileCheck -check-prefix=CHECK-EABI %s
 // RUN: %clang -target arm-none-musleabihf -S -o - %s \
 // RUN:   | FileCheck -check-prefix=CHECK-GNUEABI %s
-// RUN: %clang -target arm-none-musleabihf -S -o - %s -meabi 5 \
-// RUN:   | FileCheck -check-prefix=CHECK-EABI %s
+
+// Musl has no bare-EABI triple environment, so -meabi=5 has no effect there.
 
 struct my_s {
   unsigned long a[18];
diff --git a/clang/test/Driver/eabi.c b/clang/test/Driver/eabi.c
index 4fd8ee8344e6c..c77fb76c4cc29 100644
--- a/clang/test/Driver/eabi.c
+++ b/clang/test/Driver/eabi.c
@@ -1,13 +1,20 @@
-// RUN: %clang %s -meabi 4 -### 2>&1 \
+// -meabi=4 has no triple environment, so it is forwarded to cc1.
+// RUN: %clang %s -target arm-none-eabi -meabi 4 -### 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-EABI4 %s
-// RUN: %clang %s -meabi 5 -### 2>&1 \
-// RUN:   | FileCheck -check-prefix=CHECK-EABI5 %s
-// RUN: %clang %s -meabi gnu -### 2>&1 \
+
+// -meabi=gnu/5 are encoded in the cc1 -triple environment, not forwarded.
+// RUN: %clang %s -target arm-none-eabi -meabi gnu -### 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-GNUEABI %s
+// RUN: %clang %s -target arm-none-gnueabi -meabi 5 -### 2>&1 \
+// RUN:   | FileCheck -check-prefix=CHECK-EABI5 %s
+
 // RUN: not %clang %s -meabi unknown 2>&1 \
 // RUN:   | FileCheck -check-prefix=CHECK-UNKNOWN %s
 
+// CHECK-EABI4: "-triple" "armv{{.*}}-unknown-none-eabi"
 // CHECK-EABI4: "-meabi" "4"
-// CHECK-EABI5: "-meabi" "5"
-// CHECK-GNUEABI: "-meabi" "gnu"
+// CHECK-GNUEABI: "-triple" "armv{{.*}}-unknown-none-gnueabi"
+// CHECK-GNUEABI-NOT: "-meabi"
+// CHECK-EABI5: "-triple" "armv{{.*}}-unknown-none-eabi"
+// CHECK-EABI5-NOT: "-meabi"
 // CHECK-UNKNOWN: error: invalid value 'unknown' in '-meabi unknown'
diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp
index 648574fae18cf..9404c34271003 100644
--- a/flang/lib/Frontend/FrontendActions.cpp
+++ b/flang/lib/Frontend/FrontendActions.cpp
@@ -313,9 +313,9 @@ bool CodeGenAction::beginSourceFileAction() {
   bool isOpenMPEnabled =
       ci.getInvocation().getFrontendOpts().features.IsEnabled(
           Fortran::common::LanguageFeature::OpenMP);
+  bool isOpenMPSimd = ci.getInvocation().getLangOpts().OpenMPSimd;
 
   fir::OpenMPFIRPassPipelineOpts opts;
-  opts.isSimdOnly = ci.getInvocation().getLangOpts().OpenMPSimd;
 
   using DoConcurrentMappingKind =
       Fortran::frontend::CodeGenOptions::DoConcurrentMappingKind;
@@ -343,7 +343,7 @@ bool CodeGenAction::beginSourceFileAction() {
   // WARNING: This pipeline must be run immediately after the lowering to
   // ensure that the FIR is correct with respect to OpenMP operations/
   // attributes.
-  if (isOpenMPEnabled || opts.isSimdOnly)
+  if (isOpenMPEnabled || isOpenMPSimd)
     fir::createOpenMPFIRPassPipeline(pm, opts);
 
   pm.enableVerifier(/*verifyPasses=*/true);
@@ -1029,7 +1029,6 @@ void CodeGenAction::runOptimizationPipeline(llvm::raw_pwrite_stream &os) {
   mam.registerPass([&] {
     return llvm::RuntimeLibraryAnalysis(
         targetMachine->Options.ExceptionModel,
-        targetMachine->Options.EABIVersion,
         targetMachine->Options.MCOptions.ABIName,
         targetMachine->Options.VecLib);
   });
@@ -1080,9 +1079,9 @@ void CodeGenAction::runOptimizationPipeline(llvm::raw_pwrite_stream &os) {
             os, /*ShouldPreserveUseListOrder=*/false, emitSummary));
       }
     } else if (action == BackendActionTy::Backend_EmitLL) {
-      mpm.addPass(llvm::PrintModulePass(
-          os, /*Banner=*/"", /*ShouldPreserveUseListOrder=*/false, emitSummary,
-          /*ShouldRenumberMetadata=*/true));
+      mpm.addPass(llvm::PrintModulePass(os, /*Banner=*/"",
+                                        /*ShouldPreserveUseListOrder=*/false,
+                                        emitSummary));
     }
   }
 
diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index 739cf86ad54bb..22afaebdc52ff 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -164,6 +164,10 @@ Makes programs 10x faster by doing Special New Thing.
 * Removed `TargetOptions::FloatABIType`. The soft float ABI should be
   controlled by setting the `"float-abi"` module flag.
 
+* Removed `TargetOptions::EABIVersion` and the `llc`/`opt` `-meabi` flag. The
+  GNU-vs-EABI distinction is now derived entirely from the target triple's
+  environment (e.g. `arm-none-gnueabi` vs `arm-none-eabi`).
+
 ### Changes to building LLVM
 
 * The DirectX backend is now an official target and has moved from
diff --git a/llvm/include/llvm/Analysis/RuntimeLibcallInfo.h b/llvm/include/llvm/Analysis/RuntimeLibcallInfo.h
index f4d81b2f1e057..2742e5ba4a348 100644
--- a/llvm/include/llvm/Analysis/RuntimeLibcallInfo.h
+++ b/llvm/include/llvm/Analysis/RuntimeLibcallInfo.h
@@ -23,11 +23,10 @@ class LLVM_ABI RuntimeLibraryAnalysis
 
   RuntimeLibraryAnalysis() = default;
   RuntimeLibraryAnalysis(ExceptionHandling ExceptionModel,
-                         EABI EABIVersion = EABI::Default,
                          StringRef ABIName = "",
                          VectorLibrary VecLib = VectorLibrary::NoLibrary)
-      : ExceptionModel(ExceptionModel), EABIVersion(EABIVersion),
-        ABIName(ABIName.str()), VecLib(VecLib) {}
+      : ExceptionModel(ExceptionModel), ABIName(ABIName.str()), VecLib(VecLib) {
+  }
 
   RTLIB::RuntimeLibcallsInfo run(const Module &M, ModuleAnalysisManager &);
 
@@ -39,7 +38,6 @@ class LLVM_ABI RuntimeLibraryAnalysis
   // IR, copied here so run() can forward them to the RuntimeLibcallsInfo Module
   // constructor. Delete each one as they are migrated to module flags.
   ExceptionHandling ExceptionModel = ExceptionHandling::None;
-  EABI EABIVersion = EABI::Default;
   std::string ABIName;
   VectorLibrary VecLib = VectorLibrary::NoLibrary;
 };
@@ -52,7 +50,6 @@ class LLVM_ABI RuntimeLibraryInfoWrapper : public ImmutablePass {
   static char ID;
   RuntimeLibraryInfoWrapper();
   RuntimeLibraryInfoWrapper(ExceptionHandling ExceptionModel,
-                            EABI EABIVersion = EABI::Default,
                             StringRef ABIName = "",
                             VectorLibrary VecLib = VectorLibrary::NoLibrary);
 
diff --git a/llvm/include/llvm/CodeGen/CommandFlags.h b/llvm/include/llvm/CodeGen/CommandFlags.h
index 134990cec151f..0bc3b9f43149e 100644
--- a/llvm/include/llvm/CodeGen/CommandFlags.h
+++ b/llvm/include/llvm/CodeGen/CommandFlags.h
@@ -111,8 +111,6 @@ LLVM_ABI bool getUniqueBasicBlockSectionNames();
 
 LLVM_ABI bool getSeparateNamedSections();
 
-LLVM_ABI llvm::EABI getEABIVersion();
-
 LLVM_ABI llvm::DebuggerKind getDebuggerTuningOpt();
 
 LLVM_ABI llvm::VectorLibrary getVectorLibrary();
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.h b/llvm/include/llvm/IR/RuntimeLibcalls.h
index b864e68611337..4d119c5494b43 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.h
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.h
@@ -88,20 +88,17 @@ struct RuntimeLibcallsInfo {
   LLVM_ABI explicit RuntimeLibcallsInfo(
       const Triple &TT,
       ExceptionHandling ExceptionModel = ExceptionHandling::None,
-      FloatABI::ABIType FloatABI = FloatABI::Default,
-      EABI EABIVersion = EABI::Default, StringRef ABIName = "",
+      FloatABI::ABIType FloatABI = FloatABI::Default, StringRef ABIName = "",
       VectorLibrary VecLib = VectorLibrary::NoLibrary);
 
   // FIXME: The floating-point ABI is read from the "float-abi" module flag, but
-  // the ExceptionModel/EABIVersion/ABIName/VecLib parameters are still
-  // TargetOptions values that are not yet represented in the IR. Delete these
-  // parameters (and build everything from the Module) once those fields are
-  // migrated to module flags.
+  // the ExceptionModel/ABIName/VecLib parameters are still TargetOptions values
+  // that are not yet represented in the IR. Delete these parameters (and build
+  // everything from the Module) once those fields are migrated to module flags.
   LLVM_ABI explicit RuntimeLibcallsInfo(
       const Module &M,
       ExceptionHandling ExceptionModel = ExceptionHandling::None,
-      EABI EABIVersion = EABI::Default, StringRef ABIName = "",
-      VectorLibrary VecLib = VectorLibrary::NoLibrary);
+      StringRef ABIName = "", VectorLibrary VecLib = VectorLibrary::NoLibrary);
 
   LLVM_ABI bool invalidate(Module &M, const PreservedAnalyses &PA,
                            ModuleAnalysisManager::Invalidator &);
@@ -246,15 +243,14 @@ struct RuntimeLibcallsInfo {
   /// Generated by tablegen.
   void setTargetRuntimeLibcallSets(const Triple &TT,
                                    ExceptionHandling ExceptionModel,
-                                   FloatABI::ABIType FloatABI, EABI ABIType,
+                                   FloatABI::ABIType FloatABI,
                                    StringRef ABIName,
                                    LongDoubleFormat LongDoubleFormat);
 
   /// Set default libcall names. If a target wants to opt-out of a libcall it
   /// should be placed here.
   LLVM_ABI void initLibcalls(const Triple &TT, ExceptionHandling ExceptionModel,
-                             FloatABI::ABIType FloatABI, EABI ABIType,
-                             StringRef ABIName,
+                             FloatABI::ABIType FloatABI, StringRef ABIName,
                              LongDoubleFormat LongDoubleFormat);
 };
 
diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 14dda6baf5a53..46b9aba86ddd6 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -56,8 +56,10 @@ class OSVersionAtLeast<int major, int minor>
                      # [{, }] # !cast<string>(minor) # [{)}]>;
 
 def IsAAPCS_ABI : LibcallPredicate<[{isAAPCS_ABI(TT, ABIName)}]>;
-def IsEABI4 : LibcallPredicate<[{EABIVersion == EABI::EABI4}]>;
-def IsEABI5 : LibcallPredicate<[{EABIVersion == EABI::EABI5}]>;
+
+// A numbered EABI (4/5) rather than GNU, i.e. not GNU/Musl AEABI.
+def IsEABIVersion
+  : LibcallPredicate<[{!TT.isTargetGNUAEABI() && !TT.isTargetMuslAEABI()}]>;
 
 def IsLongDoubleF128 : LibcallPredicate<[{LongDoubleFormat == LongDoubleFormat::IEEEquad}]>;
 def IsLongDoubleX87 : LibcallPredicate<[{LongDoubleFormat == LongDoubleFormat::X87DoubleExtended}]>;
@@ -2722,7 +2724,7 @@ def AEABI45MemCalls : LibcallImpls<
        __aeabi_memset, __aeabi_memset4, __aeabi_memset8,
        __aeabi_memclr, __aeabi_memclr4, __aeabi_memclr8),
   RuntimeLibcallAvailability<
-    (all_of (any_of IsEABI4, IsEABI5),
+    (all_of IsEABIVersion,
             (any_of IsTargetAEABI, IsTargetGNUAEABI, IsTargetMuslAEABI,
                     IsOSFuchsia, IsAndroid),
             IsAAPCS_ABI)>> {
diff --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h
index 0352662efcf27..d43b6a7b57c7a 100644
--- a/llvm/include/llvm/Target/TargetOptions.h
+++ b/llvm/include/llvm/Target/TargetOptions.h
@@ -343,9 +343,6 @@ class TargetOptions {
   /// for things like atomics
   ThreadModel::Model ThreadModel = ThreadModel::POSIX;
 
-  /// EABIVersion - This flag specifies the EABI version
-  EABI EABIVersion = EABI::Default;
-
   /// Which debugger to tune for.
   DebuggerKind DebuggerTuning = DebuggerKind::Default;
 
diff --git a/llvm/lib/Analysis/RuntimeLibcallInfo.cpp b/llvm/lib/Analysis/RuntimeLibcallInfo.cpp
index 23dca93c4d884..ce79008539ca3 100644
--- a/llvm/lib/Analysis/RuntimeLibcallInfo.cpp
+++ b/llvm/lib/Analysis/RuntimeLibcallInfo.cpp
@@ -15,8 +15,7 @@ AnalysisKey RuntimeLibraryAnalysis::Key;
 
 RTLIB::RuntimeLibcallsInfo
 RuntimeLibraryAnalysis::run(const Module &M, ModuleAnalysisManager &) {
-  return RTLIB::RuntimeLibcallsInfo(M, ExceptionModel, EABIVersion, ABIName,
-                                    VecLib);
+  return RTLIB::RuntimeLibcallsInfo(M, ExceptionModel, ABIName, VecLib);
 }
 
 INITIALIZE_PASS(RuntimeLibraryInfoWrapper, "runtime-library-info",
@@ -25,9 +24,8 @@ INITIALIZE_PASS(RuntimeLibraryInfoWrapper, "runtime-library-info",
 RuntimeLibraryInfoWrapper::RuntimeLibraryInfoWrapper() : ImmutablePass(ID) {}
 
 RuntimeLibraryInfoWrapper::RuntimeLibraryInfoWrapper(
-    ExceptionHandling ExceptionModel, EABI EABIVersion, StringRef ABIName,
-    VectorLibrary VecLib)
-    : ImmutablePass(ID), RTLA(ExceptionModel, EABIVersion, ABIName, VecLib) {}
+    ExceptionHandling ExceptionModel, StringRef ABIName, VectorLibrary VecLib)
+    : ImmutablePass(ID), RTLA(ExceptionModel, ABIName, VecLib) {}
 
 char RuntimeLibraryInfoWrapper::ID = 0;
 
diff --git a/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp b/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp
index 94e0dbeac6f35..b1657a9ea5583 100644
--- a/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp
+++ b/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp
@@ -126,9 +126,8 @@ addPassesToGenerateCode(CodeGenTargetMachineImpl &TM, PassManagerBase &PM,
   const TargetOptions &Options = TM.Options;
   TargetLibraryInfoImpl TLII(TM.getTargetTriple(), Options.VecLib);
   PM.add(new TargetLibraryInfoWrapperPass(TLII));
-  PM.add(
-      new RuntimeLibraryInfoWrapper(Options.ExceptionModel, Options.EABIVersion,
-                                    Options.MCOptions.ABIName, Options.VecLib));
+  PM.add(new RuntimeLibraryInfoWrapper(
+      Options.ExceptionModel, Options.MCOptions.ABIName, Options.VecLib));
 
   invokeGlobalTargetPassConfigCallbacks(TM, PM, PassConfig);
 
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp
index 21380f0cf7d2b..c58864f2a4adb 100644
--- a/llvm/lib/CodeGen/CommandFlags.cpp
+++ b/llvm/lib/CodeGen/CommandFlags.cpp
@@ -101,7 +101,6 @@ CGOPT_EXP(bool, EnableTLSDESC)
 CGOPT(bool, UniqueSectionNames)
 CGOPT(bool, UniqueBasicBlockSectionNames)
 CGOPT(bool, SeparateNamedSecti...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/222672


More information about the llvm-branch-commits mailing list