[llvm] [IR][AArch64] Add "ptrauth(...)" Constant to represent signed pointers. (PR #85738)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 04:14:32 PDT 2024


================
@@ -3596,6 +3609,21 @@ Error BitcodeReader::parseConstants() {
                                   Record[1]);
       break;
     }
+    case bitc::CST_CODE_SIGNED_PTR: {
+      if (Record.size() < 6)
+        return error("Invalid record");
+      Type *PtrTy = getTypeByID(Record[0]);
+      if (!PtrTy)
+        return error("Invalid record");
+
+      // PtrTy, Ptr, Key, AddrDiscTy, AddrDisc, Disc
+      V = BitcodeConstant::create(
+        Alloc, CurTy, BitcodeConstant::ConstantPtrAuthOpcode,
+        {(unsigned)Record[1], (unsigned)Record[2], (unsigned)Record[4],
+         (unsigned)Record[5]});
----------------
nikic wrote:

Okay, I see that this is the addr discriminator type. But does it need to be explicitly encoded, given that you don't actually use it here?

https://github.com/llvm/llvm-project/pull/85738


More information about the llvm-commits mailing list