[PATCH] D126810: [ARM64EC 9/?] Implement CFGuard convention.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 1 12:41:25 PDT 2022
efriedma created this revision.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
efriedma requested review of this revision.
Herald added a project: LLVM.
Part of initial Arm64EC patchset.
CFG checkers on ARM64EC take two arguments: the callee, and an exit thunk to translate. The values are passed in x11 and x10. The function to call is then returned in x11.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D126810
Files:
llvm/lib/Target/AArch64/AArch64CallingConvention.h
llvm/lib/Target/AArch64/AArch64CallingConvention.td
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -5531,6 +5531,8 @@
}
return CC_AArch64_AAPCS;
case CallingConv::CFGuard_Check:
+ if (Subtarget->isWindowsArm64EC())
+ return CC_AArch64_Arm64EC_CFGuard_Check;
return CC_AArch64_Win64_CFGuard_Check;
case CallingConv::AArch64_VectorCall:
case CallingConv::AArch64_SVE_VectorCall:
@@ -5551,6 +5553,10 @@
return RetCC_AArch64_WebKit_JS;
case CallingConv::ARM64EC_Thunk_X64:
return RetCC_AArch64_Arm64EC_Thunk;
+ case CallingConv::CFGuard_Check:
+ if (Subtarget->isWindowsArm64EC())
+ return RetCC_AArch64_Arm64EC_CFGuard_Check;
+ return RetCC_AArch64_AAPCS;
}
}
Index: llvm/lib/Target/AArch64/AArch64CallingConvention.td
===================================================================
--- llvm/lib/Target/AArch64/AArch64CallingConvention.td
+++ llvm/lib/Target/AArch64/AArch64CallingConvention.td
@@ -327,6 +327,16 @@
CCIfType<[i64], CCAssignToReg<[X15]>>
]>;
+let Entry = 1 in
+def CC_AArch64_Arm64EC_CFGuard_Check : CallingConv<[
+ CCIfType<[i64], CCAssignToReg<[X11, X10]>>
+]>;
+
+let Entry = 1 in
+def RetCC_AArch64_Arm64EC_CFGuard_Check : CallingConv<[
+ CCIfType<[i64], CCAssignToReg<[X11]>>
+]>;
+
// Darwin uses a calling convention which differs in only two ways
// from the standard one at this level:
Index: llvm/lib/Target/AArch64/AArch64CallingConvention.h
===================================================================
--- llvm/lib/Target/AArch64/AArch64CallingConvention.h
+++ llvm/lib/Target/AArch64/AArch64CallingConvention.h
@@ -43,6 +43,9 @@
bool CC_AArch64_Win64_CFGuard_Check(unsigned ValNo, MVT ValVT, MVT LocVT,
CCValAssign::LocInfo LocInfo,
ISD::ArgFlagsTy ArgFlags, CCState &State);
+bool CC_AArch64_Arm64EC_CFGuard_Check(unsigned ValNo, MVT ValVT, MVT LocVT,
+ CCValAssign::LocInfo LocInfo,
+ ISD::ArgFlagsTy ArgFlags, CCState &State);
bool CC_AArch64_WebKit_JS(unsigned ValNo, MVT ValVT, MVT LocVT,
CCValAssign::LocInfo LocInfo,
ISD::ArgFlagsTy ArgFlags, CCState &State);
@@ -55,6 +58,10 @@
bool RetCC_AArch64_Arm64EC_Thunk(unsigned ValNo, MVT ValVT, MVT LocVT,
CCValAssign::LocInfo LocInfo,
ISD::ArgFlagsTy ArgFlags, CCState &State);
+bool RetCC_AArch64_Arm64EC_CFGuard_Check(unsigned ValNo, MVT ValVT, MVT LocVT,
+ CCValAssign::LocInfo LocInfo,
+ ISD::ArgFlagsTy ArgFlags,
+ CCState &State);
bool RetCC_AArch64_WebKit_JS(unsigned ValNo, MVT ValVT, MVT LocVT,
CCValAssign::LocInfo LocInfo,
ISD::ArgFlagsTy ArgFlags, CCState &State);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126810.433497.patch
Type: text/x-patch
Size: 3126 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220601/5507915f/attachment.bin>
More information about the llvm-commits
mailing list