[PATCH] D152206: [Basic] Support 64-bit x86 target for UEFI
Prabhu Karthikeyan Rajasekaran via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 21 13:49:58 PDT 2023
Prabhuk updated this revision to Diff 557202.
Prabhuk added a comment.
Splitting commit into 3 commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152206/new/
https://reviews.llvm.org/D152206
Files:
llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
llvm/lib/Target/X86/X86CallingConv.td
llvm/lib/Target/X86/X86RegisterInfo.h
llvm/lib/Target/X86/X86Subtarget.h
Index: llvm/lib/Target/X86/X86Subtarget.h
===================================================================
--- llvm/lib/Target/X86/X86Subtarget.h
+++ llvm/lib/Target/X86/X86Subtarget.h
@@ -334,6 +334,10 @@
bool isOSWindows() const { return TargetTriple.isOSWindows(); }
+ bool isUEFI() const { return TargetTriple.isUEFI(); }
+
+ bool isTargetUEFI64() const { return Is64Bit && isUEFI(); }
+
bool isTargetWin64() const { return Is64Bit && isOSWindows(); }
bool isTargetWin32() const { return !Is64Bit && isOSWindows(); }
@@ -349,7 +353,8 @@
bool isCallingConvWin64(CallingConv::ID CC) const {
switch (CC) {
- // On Win64, all these conventions just use the default convention.
+ // On Win64 and UEFI64, all these conventions just use the default
+ // convention.
case CallingConv::C:
case CallingConv::Fast:
case CallingConv::Tail:
@@ -360,7 +365,7 @@
case CallingConv::X86_ThisCall:
case CallingConv::X86_VectorCall:
case CallingConv::Intel_OCL_BI:
- return isTargetWin64();
+ return isTargetWin64() || isTargetUEFI64();
// This convention allows using the Win64 convention on other targets.
case CallingConv::Win64:
return true;
Index: llvm/lib/Target/X86/X86RegisterInfo.h
===================================================================
--- llvm/lib/Target/X86/X86RegisterInfo.h
+++ llvm/lib/Target/X86/X86RegisterInfo.h
@@ -27,7 +27,7 @@
///
bool Is64Bit;
- /// IsWin64 - Is the target on of win64 flavours
+ /// IsWin64 - Is the target one of win64 flavours
///
bool IsWin64;
Index: llvm/lib/Target/X86/X86CallingConv.td
===================================================================
--- llvm/lib/Target/X86/X86CallingConv.td
+++ llvm/lib/Target/X86/X86CallingConv.td
@@ -1127,6 +1127,9 @@
// Mingw64 and native Win64 use Win64 CC
CCIfSubtarget<"isTargetWin64()", CCDelegateTo<CC_X86_Win64_C>>,
+ // UEFI64 uses Win64 CC
+ CCIfSubtarget<"isTargetUEFI64()", CCDelegateTo<CC_X86_Win64_C>>,
+
// Otherwise, drop to normal X86-64 CC
CCDelegateTo<CC_X86_64_C>
]>;
Index: llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
===================================================================
--- llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
+++ llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
@@ -445,7 +445,7 @@
// Force the use of an ELF container.
MAI = new X86ELFMCAsmInfo(TheTriple);
} else if (TheTriple.isWindowsMSVCEnvironment() ||
- TheTriple.isWindowsCoreCLREnvironment()) {
+ TheTriple.isWindowsCoreCLREnvironment() || TheTriple.isUEFI()) {
if (Options.getAssemblyLanguage().equals_insensitive("masm"))
MAI = new X86MCAsmInfoMicrosoftMASM(TheTriple);
else
@@ -453,8 +453,6 @@
} else if (TheTriple.isOSCygMing() ||
TheTriple.isWindowsItaniumEnvironment()) {
MAI = new X86MCAsmInfoGNUCOFF(TheTriple);
- } else if (TheTriple.isUEFI()) {
- MAI = new X86MCAsmInfoGNUCOFF(TheTriple);
} else {
// The default is ELF.
MAI = new X86ELFMCAsmInfo(TheTriple);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152206.557202.patch
Type: text/x-patch
Size: 3105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230921/e7d06483/attachment.bin>
More information about the cfe-commits
mailing list