[llvm] [mlir] [Dwarf] Support `__ptrauth` qualifier in metadata nodes (PR #83862)
Daniil Kovalev via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 8 03:21:41 PST 2024
================
@@ -972,6 +972,35 @@ class DIStringType : public DIType {
///
/// TODO: Split out members (inheritance, fields, methods, etc.).
class DIDerivedType : public DIType {
+public:
+ /// Pointer authentication (__ptrauth) metadata.
+ struct PtrAuthData {
+ // RawData layout:
+ // - Bits 0..3: Key
+ // - Bit 4: IsAddressDiscriminated
+ // - Bits 5..20: ExtraDiscriminator
+ // - Bit 21: IsaPointer
+ // - Bit 22: AuthenticatesNullValues
+ unsigned RawData;
+
+ PtrAuthData(unsigned FromRawData) : RawData(FromRawData) {}
+ PtrAuthData(unsigned Key, bool IsDiscr, unsigned Discriminator,
+ bool IsaPointer, bool AuthenticatesNullValues) {
+ assert(Key < 16);
+ assert(Discriminator <= 0xffff);
+ RawData = (Key << 0) | (IsDiscr ? (1 << 4) : 0) | (Discriminator << 5) |
+ (IsaPointer ? (1 << 21) : 0) |
+ (AuthenticatesNullValues ? (1 << 22) : 0);
+ }
+
+ unsigned Key() { return (RawData >> 0) & 0b1111; }
+ bool IsAddressDiscriminated() { return (RawData >> 4) & 1; }
----------------
kovdan01 wrote:
Fixed, thanks, see 1adcade6f8d54d8e8ebebc52709e4b293450d117
https://github.com/llvm/llvm-project/pull/83862
More information about the llvm-commits
mailing list