[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:33 PDT 2024
================
@@ -3998,6 +3998,48 @@ bool LLParser::parseValID(ValID &ID, PerFunctionState *PFS, Type *ExpectedTy) {
ID.NoCFI = true;
return false;
}
+ case lltok::kw_ptrauth: {
+ // ValID ::= 'ptrauth' '(' ptr @foo ',' i32 <key> ','
+ // ptr addrdisc ',' i64 <disc> ')'
+ Lex.Lex();
+
+ Constant *Ptr, *Key, *AddrDisc, *Disc;
+
+ if (parseToken(lltok::lparen,
+ "expected '(' in signed pointer expression") ||
+ parseGlobalTypeAndValue(Ptr) ||
+ parseToken(lltok::comma,
+ "expected comma in signed pointer expression") ||
+ parseGlobalTypeAndValue(Key) ||
+ parseToken(lltok::comma,
+ "expected comma in signed pointer expression") ||
+ parseGlobalTypeAndValue(AddrDisc) ||
+ parseToken(lltok::comma,
+ "expected comma in signed pointer expression") ||
+ parseGlobalTypeAndValue(Disc) ||
+ parseToken(lltok::rparen, "expected ')' in signed pointer expression"))
+ return true;
+
+ if (!Ptr->getType()->isPointerTy())
+ return error(ID.Loc, "signed pointer must be a pointer");
+
+ auto KeyC = dyn_cast<ConstantInt>(Key);
----------------
nikic wrote:
```suggestion
auto *KeyC = dyn_cast<ConstantInt>(Key);
```
Here and elsewhere.
https://github.com/llvm/llvm-project/pull/85738
More information about the llvm-commits
mailing list