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
25namespace mlir {
26namespace LLVM {
27
28/// This class represents the base attribute for all debug info attributes.
29class DINodeAttr : public Attribute {
30public:
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.
38class DIScopeAttr : public DINodeAttr {
39public:
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.
49public:
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.
57class DITypeAttr : public DINodeAttr {
58public:
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.
66class DIVariableAttr : public DINodeAttr {
67public:
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.
75class TBAANodeAttr : public Attribute {
76public:
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-*.
93using cconv::CConv;
94using linkage::Linkage;
95using tailcallkind::TailCallKind;
96
97namespace detail {
98/// Checks whether the given type is an LLVM type that can be loaded or stored.
99bool isValidLoadStoreImpl(Type type, ptr::AtomicOrdering ordering,
100 std::optional<int64_t> alignment,
101 const ::mlir::DataLayout *dataLayout,
103} // namespace detail
104} // namespace LLVM
105} // namespace mlir
106
107#include "mlir/Dialect/LLVMIR/LLVMAttrInterfaces.h.inc"
108
109#define GET_ATTRDEF_CLASSES
110#include "mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.h.inc"
111
112#endif // MLIR_DIALECT_LLVMIR_LLVMATTRS_H_
constexpr Attribute()=default
AttributeStorage ImplType
Definition Attributes.h:33
This class represents a diagnostic that is inflight and set to be reported.
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.
This class represents the base attribute for all debug info attributes.
Definition LLVMAttrs.h:29
constexpr Attribute()=default
static bool classof(Attribute attr)
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.
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.
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.
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.
constexpr Attribute()=default
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
Definition Types.h:74
bool isValidLoadStoreImpl(Type type, ptr::AtomicOrdering ordering, std::optional< int64_t > alignment, const ::mlir::DataLayout *dataLayout, function_ref< InFlightDiagnostic()> emitError)
Checks whether the given type is an LLVM type that can be loaded or stored.
Definition LLVMAttrs.cpp:60
AttrTypeReplacer.
Include the generated interface declarations.
InFlightDiagnostic emitError(Location loc)
Utility method to emit an error message using this location.
llvm::function_ref< Fn > function_ref
Definition LLVM.h:152