Skip to content

Commit ad84c94

Browse files
committed
[llvm][X86] REX profile for UEFI
Use the appropriate REX profile for UEFI X86_64 target.
1 parent 123758b commit ad84c94

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

llvm/lib/Target/X86/X86ExpandPseudo.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ bool X86ExpandPseudo::expandMI(MachineBasicBlock &MBB,
302302
}
303303

304304
// Jump to label or value in register.
305-
bool IsWin64 = STI->isTargetWin64();
305+
bool IsWinOrUEFI64 = STI->isTargetWin64() || STI->isTargetUEFI64();
306306
if (Opcode == X86::TCRETURNdi || Opcode == X86::TCRETURNdicc ||
307307
Opcode == X86::TCRETURNdi64 || Opcode == X86::TCRETURNdi64cc) {
308308
unsigned Op;
@@ -339,16 +339,17 @@ bool X86ExpandPseudo::expandMI(MachineBasicBlock &MBB,
339339
}
340340

341341
} else if (Opcode == X86::TCRETURNmi || Opcode == X86::TCRETURNmi64) {
342-
unsigned Op = (Opcode == X86::TCRETURNmi)
343-
? X86::TAILJMPm
344-
: (IsWin64 ? X86::TAILJMPm64_REX : X86::TAILJMPm64);
342+
unsigned Op =
343+
(Opcode == X86::TCRETURNmi)
344+
? X86::TAILJMPm
345+
: (IsWinOrUEFI64 ? X86::TAILJMPm64_REX : X86::TAILJMPm64);
345346
MachineInstrBuilder MIB = BuildMI(MBB, MBBI, DL, TII->get(Op));
346347
for (unsigned i = 0; i != X86::AddrNumOperands; ++i)
347348
MIB.add(MBBI->getOperand(i));
348349
} else if (Opcode == X86::TCRETURNri64) {
349350
JumpTarget.setIsKill();
350351
BuildMI(MBB, MBBI, DL,
351-
TII->get(IsWin64 ? X86::TAILJMPr64_REX : X86::TAILJMPr64))
352+
TII->get(IsWinOrUEFI64 ? X86::TAILJMPr64_REX : X86::TAILJMPr64))
352353
.add(JumpTarget);
353354
} else {
354355
JumpTarget.setIsKill();

0 commit comments

Comments
 (0)