diff options
author | Vedant Kumar <vsk@apple.com> | 2019-11-14 13:11:34 -0800 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2020-01-10 14:30:52 -0800 |
commit | a9052b4dfc1b25bd58480668d221365495fa9101 (patch) | |
tree | babac2558e87d0ffe67b34eca8edb02a520811ed /llvm/unittests | |
parent | 7c47a3719a9e587fdf993637dc09d97b5397483b (diff) | |
download | bcm5719-llvm-a9052b4dfc1b25bd58480668d221365495fa9101.tar.gz bcm5719-llvm-a9052b4dfc1b25bd58480668d221365495fa9101.zip |
[AArch64] Add isAuthenticated predicate to MCInstDesc
Add a predicate to MCInstDesc that allows tools to determine whether an
instruction authenticates a pointer. This can be used by diagnostic
tools to hint at pointer authentication failures.
Differential Revision: https://reviews.llvm.org/D70329
rdar://55089604
Diffstat (limited to 'llvm/unittests')
-rw-r--r-- | llvm/unittests/Target/AArch64/InstSizes.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/llvm/unittests/Target/AArch64/InstSizes.cpp b/llvm/unittests/Target/AArch64/InstSizes.cpp index 8214d4f4113..74c5d383d8f 100644 --- a/llvm/unittests/Target/AArch64/InstSizes.cpp +++ b/llvm/unittests/Target/AArch64/InstSizes.cpp @@ -78,6 +78,38 @@ void runChecks( } // anonymous namespace +TEST(InstSizes, Authenticated) { + std::unique_ptr<LLVMTargetMachine> TM = createTargetMachine(); + ASSERT_TRUE(TM); + std::unique_ptr<AArch64InstrInfo> II = createInstrInfo(TM.get()); + + auto isAuthInst = [](AArch64InstrInfo &II, MachineFunction &MF) { + auto I = MF.begin()->begin(); + EXPECT_EQ(4u, II.getInstSizeInBytes(*I)); + EXPECT_TRUE(I->getDesc().isAuthenticated()); + }; + + runChecks(TM.get(), II.get(), "", + " \n" + " BLRAA $x10, $x9\n", + isAuthInst); + + runChecks(TM.get(), II.get(), "", + " \n" + " RETAB implicit $lr, implicit $sp, implicit killed $x0\n", + isAuthInst); + + runChecks(TM.get(), II.get(), "", + " \n" + " frame-destroy AUTIASP implicit-def $lr, implicit killed $lr, implicit $sp\n", + isAuthInst); + + runChecks(TM.get(), II.get(), "", + " \n" + " frame-destroy AUTIBSP implicit-def $lr, implicit killed $lr, implicit $sp\n", + isAuthInst); +} + TEST(InstSizes, STACKMAP) { std::unique_ptr<LLVMTargetMachine> TM = createTargetMachine(); ASSERT_TRUE(TM); |