MLIR  19.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 
19 #include <optional>
20 
21 #include "mlir/Dialect/LLVMIR/LLVMOpsEnums.h.inc"
22 
23 namespace mlir {
24 namespace LLVM {
25 
26 /// This class represents the base attribute for all debug info attributes.
27 class DINodeAttr : public Attribute {
28 public:
30 
31  // Support LLVM type casting.
32  static bool classof(Attribute attr);
33 };
34 
35 /// This class represents a LLVM attribute that describes a debug info scope.
36 class DIScopeAttr : public DINodeAttr {
37 public:
38  using DINodeAttr::DINodeAttr;
39 
40  /// Support LLVM type casting.
41  static bool classof(Attribute attr);
42 };
43 
44 /// This class represents a LLVM attribute that describes a local debug info
45 /// scope.
46 class DILocalScopeAttr : public DIScopeAttr {
47 public:
48  using DIScopeAttr::DIScopeAttr;
49 
50  /// Support LLVM type casting.
51  static bool classof(Attribute attr);
52 };
53 
54 /// This class represents a LLVM attribute that describes a debug info type.
55 class DITypeAttr : public DINodeAttr {
56 public:
57  using DINodeAttr::DINodeAttr;
58 
59  /// Support LLVM type casting.
60  static bool classof(Attribute attr);
61 };
62 
63 /// Base class for LLVM attributes participating in the TBAA graph.
64 class TBAANodeAttr : public Attribute {
65 public:
67 
68  /// Support LLVM type casting.
69  static bool classof(Attribute attr);
70 
71  /// Required by DenseMapInfo to create empty and tombstone key.
72  static TBAANodeAttr getFromOpaquePointer(const void *pointer) {
73  return TBAANodeAttr(reinterpret_cast<const ImplType *>(pointer));
74  }
75 };
76 
77 // Inline the LLVM generated Linkage enum and utility.
78 // This is only necessary to isolate the "enum generated code" from the
79 // attribute definition itself.
80 // TODO: this shouldn't be needed after we unify the attribute generation, i.e.
81 // --gen-attr-* and --gen-attrdef-*.
82 using cconv::CConv;
83 using linkage::Linkage;
84 } // namespace LLVM
85 } // namespace mlir
86 
87 #define GET_ATTRDEF_CLASSES
88 #include "mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.h.inc"
89 
90 #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:46
static bool classof(Attribute attr)
Support LLVM type casting.
Definition: LLVMAttrs.cpp:79
This class represents the base attribute for all debug info attributes.
Definition: LLVMAttrs.h:27
static bool classof(Attribute attr)
Definition: LLVMAttrs.cpp:57
This class represents a LLVM attribute that describes a debug info scope.
Definition: LLVMAttrs.h:36
static bool classof(Attribute attr)
Support LLVM type casting.
Definition: LLVMAttrs.cpp:70
This class represents a LLVM attribute that describes a debug info type.
Definition: LLVMAttrs.h:55
static bool classof(Attribute attr)
Support LLVM type casting.
Definition: LLVMAttrs.cpp:88
Base class for LLVM attributes participating in the TBAA graph.
Definition: LLVMAttrs.h:64
static TBAANodeAttr getFromOpaquePointer(const void *pointer)
Required by DenseMapInfo to create empty and tombstone key.
Definition: LLVMAttrs.h:72
static bool classof(Attribute attr)
Support LLVM type casting.
Definition: LLVMAttrs.cpp:97
Include the generated interface declarations.