[llvm] [NFC][llvm] Drop isOsWindowsOrUEFI API (PR #138733)
Prabhu Rajasekaran via llvm-commits
llvm-commits at lists.llvm.org
Tue May 6 11:22:52 PDT 2025
https://github.com/Prabhuk created https://github.com/llvm/llvm-project/pull/138733
The Triple and SubTarget API functions isOsWindowsOrUEFI is not
preferred. Dropping them.
>From ed3f17d6b3dd8a9a285b110664c4f46973a64118 Mon Sep 17 00:00:00 2001
From: prabhukr <prabhukr at google.com>
Date: Tue, 6 May 2025 18:20:42 +0000
Subject: [PATCH] [NFC][llvm] Drop isOsWindowsOrUEFI API
The Triple and SubTarget API functions isOsWindowsOrUEFI is not
preferred. Dropping them.
---
llvm/include/llvm/TargetParser/Triple.h | 3 ---
llvm/lib/IR/DataLayout.cpp | 2 +-
llvm/lib/MC/MCContext.cpp | 2 +-
llvm/lib/MC/TargetRegistry.cpp | 3 ++-
llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp | 2 +-
llvm/lib/Target/X86/X86MCInstLower.cpp | 2 +-
llvm/lib/Target/X86/X86Subtarget.h | 2 --
7 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index fb6bbc0163701..dae6cdab0d964 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -659,9 +659,6 @@ class Triple {
return getOS() == Triple::Win32;
}
- /// Tests whether the OS is Windows or UEFI.
- bool isOSWindowsOrUEFI() const { return isOSWindows() || isUEFI(); }
-
/// Checks if the environment is MSVC.
bool isKnownWindowsMSVCEnvironment() const {
return isOSWindows() && getEnvironment() == Triple::MSVC;
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp
index 0cf0bfc9702d3..95a5e5989ad00 100644
--- a/llvm/lib/IR/DataLayout.cpp
+++ b/llvm/lib/IR/DataLayout.cpp
@@ -178,7 +178,7 @@ const char *DataLayout::getManglingComponent(const Triple &T) {
return "-m:l";
if (T.isOSBinFormatMachO())
return "-m:o";
- if (T.isOSWindowsOrUEFI() && T.isOSBinFormatCOFF())
+ if ((T.isOSWindows() || T.isUEFI()) && T.isOSBinFormatCOFF())
return T.getArch() == Triple::x86 ? "-m:x" : "-m:w";
if (T.isOSBinFormatXCOFF())
return "-m:a";
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index d35b14735e5b3..f70087e14f702 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -85,7 +85,7 @@ MCContext::MCContext(const Triple &TheTriple, const MCAsmInfo *mai,
Env = IsMachO;
break;
case Triple::COFF:
- if (!TheTriple.isOSWindowsOrUEFI())
+ if (!TheTriple.isOSWindows() && !TheTriple.isUEFI())
report_fatal_error(
"Cannot initialize MC for non-Windows COFF object files.");
diff --git a/llvm/lib/MC/TargetRegistry.cpp b/llvm/lib/MC/TargetRegistry.cpp
index dde3612b9d184..9263dda65a8b0 100644
--- a/llvm/lib/MC/TargetRegistry.cpp
+++ b/llvm/lib/MC/TargetRegistry.cpp
@@ -32,7 +32,8 @@ MCStreamer *Target::createMCObjectStreamer(
case Triple::UnknownObjectFormat:
llvm_unreachable("Unknown object format");
case Triple::COFF:
- assert(T.isOSWindowsOrUEFI() && "only Windows and UEFI COFF are supported");
+ assert((T.isOSWindows() || T.isUEFI()) &&
+ "only Windows and UEFI COFF are supported");
S = COFFStreamerCtorFn(Ctx, std::move(TAB), std::move(OW),
std::move(Emitter));
break;
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
index 7858475d9ac71..8702638564bcb 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
@@ -185,7 +185,7 @@ X86MCAsmInfoMicrosoftMASM::X86MCAsmInfoMicrosoftMASM(const Triple &Triple)
void X86MCAsmInfoGNUCOFF::anchor() { }
X86MCAsmInfoGNUCOFF::X86MCAsmInfoGNUCOFF(const Triple &Triple) {
- assert(Triple.isOSWindowsOrUEFI() &&
+ assert((Triple.isOSWindows() || Triple.isUEFI()) &&
"Windows and UEFI are the only supported COFF targets");
if (Triple.getArch() == Triple::x86_64) {
PrivateGlobalPrefix = ".L";
diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp
index d9945bdf2db60..f50d3fa527742 100644
--- a/llvm/lib/Target/X86/X86MCInstLower.cpp
+++ b/llvm/lib/Target/X86/X86MCInstLower.cpp
@@ -1709,7 +1709,7 @@ static void printZeroExtend(const MachineInstr *MI, MCStreamer &OutStreamer,
void X86AsmPrinter::EmitSEHInstruction(const MachineInstr *MI) {
assert(MF->hasWinCFI() && "SEH_ instruction in function without WinCFI?");
- assert(getSubtarget().isOSWindowsOrUEFI() &&
+ assert((getSubtarget().isOSWindows() || getSubtarget().isUEFI()) &&
"SEH_ instruction Windows and UEFI only");
// Use the .cv_fpo directives if we're emitting CodeView on 32-bit x86.
diff --git a/llvm/lib/Target/X86/X86Subtarget.h b/llvm/lib/Target/X86/X86Subtarget.h
index a0b182d3f4c9b..f813fc3485efb 100644
--- a/llvm/lib/Target/X86/X86Subtarget.h
+++ b/llvm/lib/Target/X86/X86Subtarget.h
@@ -331,8 +331,6 @@ class X86Subtarget final : public X86GenSubtargetInfo {
bool isOSWindows() const { return TargetTriple.isOSWindows(); }
- bool isOSWindowsOrUEFI() const { return TargetTriple.isOSWindowsOrUEFI(); }
-
bool isTargetUEFI64() const { return Is64Bit && isUEFI(); }
bool isTargetWin64() const { return Is64Bit && isOSWindows(); }
More information about the llvm-commits
mailing list