Files
gps/tools/local/circt/include/mlir/Dialect/LLVMIR/LLVMAttrs.h
T
2026-07-12 11:01:51 +03:00

118 lines
3.6 KiB
C++

//===- LLVMDialect.h - MLIR LLVM IR dialect ---------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines the LLVM IR dialect in MLIR, containing LLVM operations and
// LLVM type system.
//
//===----------------------------------------------------------------------===//
#ifndef MLIR_DIALECT_LLVMIR_LLVMATTRS_H_
#define MLIR_DIALECT_LLVMIR_LLVMATTRS_H_
#include "mlir/Dialect/LLVMIR/LLVMTypes.h"
#include "mlir/Dialect/Ptr/IR/MemorySpaceInterfaces.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/Interfaces/DataLayoutInterfaces.h"
#include <optional>
#include "mlir/Dialect/LLVMIR/LLVMOpsEnums.h.inc"
namespace mlir {
namespace LLVM {
/// This class represents the base attribute for all debug info attributes.
class DINodeAttr : public Attribute {
public:
using Attribute::Attribute;
// Support LLVM type casting.
static bool classof(Attribute attr);
};
/// This class represents a LLVM attribute that describes a debug info scope.
class DIScopeAttr : public DINodeAttr {
public:
using DINodeAttr::DINodeAttr;
/// Support LLVM type casting.
static bool classof(Attribute attr);
};
/// This class represents a LLVM attribute that describes a local debug info
/// scope.
class DILocalScopeAttr : public DIScopeAttr {
public:
using DIScopeAttr::DIScopeAttr;
/// Support LLVM type casting.
static bool classof(Attribute attr);
};
/// This class represents a LLVM attribute that describes a debug info type.
class DITypeAttr : public DINodeAttr {
public:
using DINodeAttr::DINodeAttr;
/// Support LLVM type casting.
static bool classof(Attribute attr);
};
/// This class represents a LLVM attribute that describes a debug info variable.
class DIVariableAttr : public DINodeAttr {
public:
using DINodeAttr::DINodeAttr;
/// Support LLVM type casting.
static bool classof(Attribute attr);
};
/// Base class for LLVM attributes participating in the TBAA graph.
class TBAANodeAttr : public Attribute {
public:
using Attribute::Attribute;
/// Support LLVM type casting.
static bool classof(Attribute attr);
/// Required by DenseMapInfo to create the empty key.
static TBAANodeAttr getFromOpaquePointer(const void *pointer) {
return TBAANodeAttr(reinterpret_cast<const ImplType *>(pointer));
}
};
// Inline the LLVM generated Linkage enum and utility.
// This is only necessary to isolate the "enum generated code" from the
// attribute definition itself.
// TODO: this shouldn't be needed after we unify the attribute generation, i.e.
// --gen-attr-* and --gen-attrdef-*.
using cconv::CConv;
using linkage::Linkage;
using tailcallkind::TailCallKind;
namespace detail {
/// Checks whether the given type is an LLVM type that can be loaded or stored.
bool isValidLoadStoreImpl(Type type, ptr::AtomicOrdering ordering,
std::optional<int64_t> alignment,
const ::mlir::DataLayout *dataLayout,
function_ref<InFlightDiagnostic()> emitError);
/// Verifies that a module flag value can be exported to LLVM IR.
LogicalResult
verifyModuleFlagValue(StringAttr key, Attribute value,
function_ref<InFlightDiagnostic()> emitError);
} // namespace detail
} // namespace LLVM
} // namespace mlir
#include "mlir/Dialect/LLVMIR/LLVMAttrInterfaces.h.inc"
#define GET_ATTRDEF_CLASSES
#include "mlir/Dialect/LLVMIR/LLVMOpsAttrDefs.h.inc"
#endif // MLIR_DIALECT_LLVMIR_LLVMATTRS_H_