Skip to content

Commit 18ac334

Browse files
committed
[llvm][AsmPrinter] Extend Constant Pool Handling for UEFI
Constant pool handling must be supported for UEFI targets. Currently, the only target that is actively worked on is UEFI x86_64 and this patch adds a test for this target.
1 parent 6003c30 commit 18ac334

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4096,7 +4096,8 @@ const MCExpr *AsmPrinter::lowerBlockAddressConstant(const BlockAddress &BA) {
40964096

40974097
/// GetCPISymbol - Return the symbol for the specified constant pool entry.
40984098
MCSymbol *AsmPrinter::GetCPISymbol(unsigned CPID) const {
4099-
if (getSubtargetInfo().getTargetTriple().isWindowsMSVCEnvironment()) {
4099+
if (getSubtargetInfo().getTargetTriple().isWindowsMSVCEnvironment() ||
4100+
getSubtargetInfo().getTargetTriple().isUEFI()) {
41004101
const MachineConstantPoolEntry &CPE =
41014102
MF->getConstantPool()->getConstants()[CPID];
41024103
if (!CPE.isMachineConstantPoolEntry()) {

llvm/test/CodeGen/X86/win_cst_pool.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
; RUN: llc < %s -mattr=sse2 -mattr=avx | FileCheck %s
33
; RUN: llc < %s -mtriple=x86_64-win32 -mattr=sse2 -mattr=avx | FileCheck %s
44
; RUN: llc < %s -mtriple=x86_64-windows-msvc -mattr=sse2 -mattr=avx | FileCheck %s
5+
; UEFI environment.
6+
; RUN: llc < %s -mtriple=x86_64-uefi -mattr=sse2 -mattr=avx | FileCheck %s
57
; GNU environment.
68
; RUN: llc < %s -mtriple=x86_64-win32-gnu -mattr=sse2 -mattr=avx | FileCheck -check-prefix=MINGW %s
79
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"

0 commit comments

Comments
 (0)