MLIR  22.0.0git
LLVMAttrs.h
Go to the documentation of this file.
1 //===- LLVMDialect.h - MLIR LLVM IR dialect ---------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the LLVM IR dialect in MLIR, containing LLVM operations and
10 // LLVM type system.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef MLIR_DIALECT_LLVMIR_LLVMATTRS_H_
15 #define MLIR_DIALECT_LLVMIR_LLVMATTRS_H_
16 
21 #include <optional>
22 
23 #include "mlir/Dialect/LLVMIR/LLVMOpsEnums.h.inc"
24 
25 namespace mlir {
26 namespace LLVM {
27 
28 /// This class represents the base attribute for all debug info attributes.
29 class DINodeAttr : public Attribute {
30 public:
32 
33  // Support LLVM type casting.
34  static bool classof(Attribute attr);
35 };
36 
37 /// This class represents a LLVM attribute that describes a debug info scope.
38 class DIScopeAttr : public DINodeAttr {
39 public:
40  using DINodeAttr::DINodeAttr;
41 
42  /// Support LLVM type casting.
43  static bool classof(Attribute attr);
44 };
45 
46 /// This class represents a LLVM attribute that describes a local debug info
47 /// scope.
48 class DILocalScopeAttr : public DIScopeAttr {
49 public:
50  using DIScopeAttr::DIScopeAttr;
51 
52  /// Support LLVM type casting.
53  static bool classof(Attribute attr);
54 };
55 
56 /// This class represents a LLVM attribute that describes a debug info type.
57 class DITypeAttr : public DINodeAttr {
58 public:
59  using DINodeAttr::DINodeAttr;
60 
61  /// Support LLVM type casting.
62  static bool classof(Attribute attr);
63 };
64 
65 /// This class represents a LLVM attribute that describes a debug info variable.
66 class DIVariableAttr : public DINodeAttr {
67 public:
68  using DINodeAttr::DINodeAttr;
69 
70  /// Support LLVM type casting.
71  static bool classof(Attribute attr);
72 };
73 
74 /// Base class for LLVM attributes participating in the TBAA graph.
75 class TBAANodeAttr : public Attribute {
76 public:
78 
79  /// Support LLVM type casting.
80  static bool classof(Attribute attr);
81 
82  /// Required by DenseMapInfo to create empty and tombstone key.
83  static TBAANodeAttr getFromOpaquePointer(const void *pointer) {
84  return TBAANodeAttr(reinterpret_cast<const ImplType *>(pointer));
85  }
86 };
87 
88 // Inline the LLVM generated Linkage enum and utility.
89 // This is only necessary to isolate the "enum generated code" from the
90 // attribute definition itself.
91 // TODO: this shouldn't be needed after we unify the attribute generation, i.e.
92 // --gen-attr-* and --gen-attrdef-*.
93 using cconv::CConv;
94 using linkage::Linkage;
95 using tailcallkind::TailCallKind;
96 } // namespace LLVM
97 } // namespace mlir
98 
99 #include "mlir/Dialect/LLVMIR/LLVMAttrInterfaces.h.inc"
100 
101 #define GET_ATTRDEF_CLASSES
102 #include "mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.h.inc"
103 
104 #endif // MLIR_DIALECT_LLVMIR_LLVMATTRS_H_
Base storage class appearing in an attribute.
Attributes are known-constant values of operations.
Definition: Attributes.h:25
constexpr Attribute()=default
This class represents a LLVM attribute that describes a local debug info scope.
Definition: LLVMAttrs.h:48
static bool classof(Attribute attr)
Support LLVM type casting.
Definition: LLVMAttrs.cpp:182
This class represents the base attribute for all debug info attributes.
Definition: LLVMAttrs.h:29
static bool classof(Attribute attr)
Definition: LLVMAttrs.cpp:157
This class represents a LLVM attribute that describes a debug info scope.
Definition: LLVMAttrs.h:38
static bool classof(Attribute attr)
Support LLVM type casting.
Definition: LLVMAttrs.cpp:172
This class represents a LLVM attribute that describes a debug info type.
Definition: LLVMAttrs.h:57
static bool classof(Attribute attr)
Support LLVM type casting.
Definition: LLVMAttrs.cpp:199
This class represents a LLVM attribute that describes a debug info variable.
Definition: LLVMAttrs.h:66
static bool classof(Attribute attr)
Support LLVM type casting.
Definition: LLVMAttrs.cpp:191
Base class for LLVM attributes participating in the TBAA graph.
Definition: LLVMAttrs.h:75
static TBAANodeAttr getFromOpaquePointer(const void *pointer)
Required by DenseMapInfo to create empty and tombstone key.
Definition: LLVMAttrs.h:83
static bool classof(Attribute attr)
Support LLVM type casting.
Definition: LLVMAttrs.cpp:209
Include the generated interface declarations.