[llvm] [llvm][X86] REX profile for UEFI (PR #138362)
Prabhu Rajasekaran via llvm-commits
llvm-commits at lists.llvm.org
Fri May 2 16:29:11 PDT 2025
https://github.com/Prabhuk created https://github.com/llvm/llvm-project/pull/138362
Use the appropriate REX profile for UEFI X86_64 target.
>From ad84c943ffc3e4a8ef7fc534636a5bb548e646e3 Mon Sep 17 00:00:00 2001
From: prabhukr <prabhukr at google.com>
Date: Fri, 2 May 2025 23:26:45 +0000
Subject: [PATCH] [llvm][X86] REX profile for UEFI
Use the appropriate REX profile for UEFI X86_64 target.
---
llvm/lib/Target/X86/X86ExpandPseudo.cpp | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/llvm/lib/Target/X86/X86ExpandPseudo.cpp b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
index 398b738b85697..5d1f7f7f0fe9d 100644
--- a/llvm/lib/Target/X86/X86ExpandPseudo.cpp
+++ b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
@@ -302,7 +302,7 @@ bool X86ExpandPseudo::expandMI(MachineBasicBlock &MBB,
}
// Jump to label or value in register.
- bool IsWin64 = STI->isTargetWin64();
+ bool IsWinOrUEFI64 = STI->isTargetWin64() || STI->isTargetUEFI64();
if (Opcode == X86::TCRETURNdi || Opcode == X86::TCRETURNdicc ||
Opcode == X86::TCRETURNdi64 || Opcode == X86::TCRETURNdi64cc) {
unsigned Op;
@@ -339,16 +339,17 @@ bool X86ExpandPseudo::expandMI(MachineBasicBlock &MBB,
}
} else if (Opcode == X86::TCRETURNmi || Opcode == X86::TCRETURNmi64) {
- unsigned Op = (Opcode == X86::TCRETURNmi)
- ? X86::TAILJMPm
- : (IsWin64 ? X86::TAILJMPm64_REX : X86::TAILJMPm64);
+ unsigned Op =
+ (Opcode == X86::TCRETURNmi)
+ ? X86::TAILJMPm
+ : (IsWinOrUEFI64 ? X86::TAILJMPm64_REX : X86::TAILJMPm64);
MachineInstrBuilder MIB = BuildMI(MBB, MBBI, DL, TII->get(Op));
for (unsigned i = 0; i != X86::AddrNumOperands; ++i)
MIB.add(MBBI->getOperand(i));
} else if (Opcode == X86::TCRETURNri64) {
JumpTarget.setIsKill();
BuildMI(MBB, MBBI, DL,
- TII->get(IsWin64 ? X86::TAILJMPr64_REX : X86::TAILJMPr64))
+ TII->get(IsWinOrUEFI64 ? X86::TAILJMPr64_REX : X86::TAILJMPr64))
.add(JumpTarget);
} else {
JumpTarget.setIsKill();
More information about the llvm-commits
mailing list