-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[llvm][X86] REX profile for UEFI #138362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[llvm][X86] REX profile for UEFI #138362
Conversation
Use the appropriate REX profile for UEFI X86_64 target.
@llvm/pr-subscribers-backend-x86 Author: Prabhu Rajasekaran (Prabhuk) ChangesUse the appropriate REX profile for UEFI X86_64 target. Full diff: https://github.com/llvm/llvm-project/pull/138362.diff 1 Files Affected:
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();
|
Would it be possible to include a test? |
Added a new test for REX profile check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, one of the next things I'd like to see happen is if we can fix lld-link to actually link a libc and start file for UEFI using LLVM libc. Currently, we have to manually supply the paths. Ideally, this should be done automatically.
Use the appropriate REX profile for UEFI X86_64 target.