MLIR  20.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 /// This class represents a LLVM attribute that describes a debug info variable.
64 class DIVariableAttr : public DINodeAttr {
65 public:
66  using DINodeAttr::DINodeAttr;
67 
68  /// Support LLVM type casting.
69  static bool classof(Attribute attr);
70 };
71 
72 /// Base class for LLVM attributes participating in the TBAA graph.
73 class TBAANodeAttr : public Attribute {
74 public:
76 
77  /// Support LLVM type casting.
78  static bool classof(Attribute attr);
79 
80  /// Required by DenseMapInfo to create empty and tombstone key.
81  static TBAANodeAttr getFromOpaquePointer(const void *pointer) {
82  return TBAANodeAttr(reinterpret_cast<const ImplType *>(pointer));
83  }
84 };
85 
86 // Inline the LLVM generated Linkage enum and utility.
87 // This is only necessary to isolate the "enum generated code" from the
88 // attribute definition itself.
89 // TODO: this shouldn't be needed after we unify the attribute generation, i.e.
90 // --gen-attr-* and --gen-attrdef-*.
91 using cconv::CConv;
92 using tailcallkind::TailCallKind;
93 using linkage::Linkage;
94 } // namespace LLVM
95 } // namespace mlir
96 
97 #include "mlir/Dialect/LLVMIR/LLVMAttrInterfaces.h.inc"
98 
99 #define GET_ATTRDEF_CLASSES
100 #include "mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.h.inc"
101 
102 #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:84
This class represents the base attribute for all debug info attributes.
Definition: LLVMAttrs.h:27
static bool classof(Attribute attr)
Definition: LLVMAttrs.cpp:59
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:74
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:101
This class represents a LLVM attribute that describes a debug info variable.
Definition: LLVMAttrs.h:64
static bool classof(Attribute attr)
Support LLVM type casting.
Definition: LLVMAttrs.cpp:93
Base class for LLVM attributes participating in the TBAA graph.
Definition: LLVMAttrs.h:73
static TBAANodeAttr getFromOpaquePointer(const void *pointer)
Required by DenseMapInfo to create empty and tombstone key.
Definition: LLVMAttrs.h:81
static bool classof(Attribute attr)
Support LLVM type casting.
Definition: LLVMAttrs.cpp:111
Include the generated interface declarations.