Skip to content

Commit 4c8304d

Browse files
committed
Add tests
1 parent d1c6b77 commit 4c8304d

File tree

5 files changed

+46
-1
lines changed

5 files changed

+46
-1
lines changed

llvm/lib/IR/Mangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void llvm::emitLinkerFlagsForGlobalCOFF(raw_ostream &OS, const GlobalValue *GV,
223223
bool NeedQuotes = GV->hasName() && !canBeUnquotedInDirective(GV->getName());
224224
if (NeedQuotes)
225225
OS << "\"";
226-
if (TT.isWindowsGNUEnvironment() || TT.isWindowsCygwinEnvironment() || TT.isUEFI()) {
226+
if (TT.isWindowsGNUEnvironment() || TT.isWindowsCygwinEnvironment()) {
227227
std::string Flag;
228228
raw_string_ostream FlagOS(Flag);
229229
Mangler.getNameWithPrefix(FlagOS, GV, false);

llvm/test/CodeGen/X86/dllexport-x86_64.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
; RUN: llc -mtriple x86_64-pc-win32 < %s | FileCheck -check-prefix=CHECK -check-prefix=WIN32 %s
2+
; RUN: llc -mtriple x86_64-pc-uefi < %s | FileCheck -check-prefix=CHECK -check-prefix=WIN32 %s
23
; RUN: llc -mtriple x86_64-pc-mingw32 < %s | FileCheck -check-prefix=CHECK -check-prefix=MINGW %s
34
; RUN: llc -mtriple x86_64-pc-win32 < %s | FileCheck -check-prefix=NOTEXPORTED %s
45
; RUN: llc -mtriple x86_64-pc-mingw32 < %s | FileCheck -check-prefix=NOTEXPORTED %s

llvm/test/CodeGen/X86/mangle-question-mark.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
; RUN: llc -mtriple i686-pc-win32 < %s | FileCheck %s --check-prefix=COFF
44
; RUN: llc -mtriple x86_64-pc-win32 < %s | FileCheck %s --check-prefix=COFF64
5+
; RUN: llc -mtriple x86_64-uefi < %s | FileCheck %s --check-prefix=COFF64
56
; RUN: llc -mtriple i686-linux-gnu < %s | FileCheck %s --check-prefix=ELF
67
; RUN: llc -mtriple i686-apple-darwin < %s | FileCheck %s --check-prefix=MACHO
78

llvm/test/CodeGen/X86/win32-preemption.ll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
; RUN: llc -mtriple x86_64-pc-win32 \
66
; RUN: -relocation-model=dynamic-no-pic < %s | FileCheck --check-prefix=COFF %s
77

8+
; RUN: llc -mtriple x86_64-uefi \
9+
; RUN: -relocation-model=static < %s | FileCheck --check-prefix=COFF_S %s
10+
; RUN: llc -mtriple x86_64-uefi \
11+
; RUN: -relocation-model=pic < %s | FileCheck --check-prefix=COFF %s
12+
; RUN: llc -mtriple x86_64-uefi \
13+
; RUN: -relocation-model=dynamic-no-pic < %s | FileCheck --check-prefix=COFF %s
14+
815

916
; 32 bits
1017

llvm/unittests/IR/ManglerTest.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,42 @@ TEST(ManglerTest, WindowsX64) {
134134
"?vectorcall");
135135
}
136136

137+
TEST(ManglerTest, UEFIX64) {
138+
LLVMContext Ctx;
139+
DataLayout DL("e-m:w-p270:32:32-p271:32:32-p272:64:64-"
140+
"i64:64-i128:128-f80:128-n8:16:32:64-S128"); // uefi X86_64
141+
Module Mod("test", Ctx);
142+
Mod.setDataLayout(DL);
143+
Mangler Mang;
144+
EXPECT_EQ(mangleStr("foo", Mang, DL), "foo");
145+
EXPECT_EQ(mangleStr("\01foo", Mang, DL), "foo");
146+
EXPECT_EQ(mangleStr("?foo", Mang, DL), "?foo");
147+
EXPECT_EQ(mangleFunc("foo", llvm::GlobalValue::ExternalLinkage,
148+
llvm::CallingConv::C, Mod, Mang),
149+
"foo");
150+
EXPECT_EQ(mangleFunc("?foo", llvm::GlobalValue::ExternalLinkage,
151+
llvm::CallingConv::C, Mod, Mang),
152+
"?foo");
153+
EXPECT_EQ(mangleFunc("foo", llvm::GlobalValue::PrivateLinkage,
154+
llvm::CallingConv::C, Mod, Mang),
155+
".Lfoo");
156+
// Test calling conv mangling.
157+
EXPECT_EQ(mangleFunc("stdcall", llvm::GlobalValue::ExternalLinkage,
158+
llvm::CallingConv::X86_StdCall, Mod, Mang),
159+
"stdcall");
160+
EXPECT_EQ(mangleFunc("fastcall", llvm::GlobalValue::ExternalLinkage,
161+
llvm::CallingConv::X86_FastCall, Mod, Mang),
162+
"fastcall");
163+
EXPECT_EQ(mangleFunc("vectorcall", llvm::GlobalValue::ExternalLinkage,
164+
llvm::CallingConv::X86_VectorCall, Mod, Mang),
165+
"vectorcall@@24");
166+
167+
// Adding a '?' prefix blocks calling convention mangling.
168+
EXPECT_EQ(mangleFunc("?vectorcall", llvm::GlobalValue::ExternalLinkage,
169+
llvm::CallingConv::X86_VectorCall, Mod, Mang),
170+
"?vectorcall");
171+
}
172+
137173
TEST(ManglerTest, XCOFF) {
138174
LLVMContext Ctx;
139175
DataLayout DL("m:a"); // XCOFF/AIX

0 commit comments

Comments
 (0)