Changeset View
Changeset View
Standalone View
Standalone View
mlir/lib/IR/MLIRContext.cpp
Show All 18 Lines | |||||
#include "mlir/IR/BuiltinDialect.h" | #include "mlir/IR/BuiltinDialect.h" | ||||
#include "mlir/IR/Diagnostics.h" | #include "mlir/IR/Diagnostics.h" | ||||
#include "mlir/IR/Dialect.h" | #include "mlir/IR/Dialect.h" | ||||
#include "mlir/IR/Identifier.h" | #include "mlir/IR/Identifier.h" | ||||
#include "mlir/IR/IntegerSet.h" | #include "mlir/IR/IntegerSet.h" | ||||
#include "mlir/IR/Location.h" | #include "mlir/IR/Location.h" | ||||
#include "mlir/IR/OpImplementation.h" | #include "mlir/IR/OpImplementation.h" | ||||
#include "mlir/IR/Types.h" | #include "mlir/IR/Types.h" | ||||
#include "mlir/Support/DebugAction.h" | |||||
#include "mlir/Support/ThreadLocalCache.h" | #include "mlir/Support/ThreadLocalCache.h" | ||||
#include "llvm/ADT/DenseMap.h" | #include "llvm/ADT/DenseMap.h" | ||||
#include "llvm/ADT/DenseSet.h" | #include "llvm/ADT/DenseSet.h" | ||||
#include "llvm/ADT/SetVector.h" | #include "llvm/ADT/SetVector.h" | ||||
#include "llvm/ADT/StringSet.h" | #include "llvm/ADT/StringSet.h" | ||||
#include "llvm/ADT/Twine.h" | #include "llvm/ADT/Twine.h" | ||||
#include "llvm/Support/Allocator.h" | #include "llvm/Support/Allocator.h" | ||||
#include "llvm/Support/CommandLine.h" | #include "llvm/Support/CommandLine.h" | ||||
▲ Show 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | |||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
namespace mlir { | namespace mlir { | ||||
/// This is the implementation of the MLIRContext class, using the pImpl idiom. | /// This is the implementation of the MLIRContext class, using the pImpl idiom. | ||||
/// This class is completely private to this file, so everything is public. | /// This class is completely private to this file, so everything is public. | ||||
class MLIRContextImpl { | class MLIRContextImpl { | ||||
public: | public: | ||||
//===--------------------------------------------------------------------===// | //===--------------------------------------------------------------------===// | ||||
// Debugging | |||||
//===--------------------------------------------------------------------===// | |||||
/// An action manager for use within the context. | |||||
DebugActionManager debugActionManager; | |||||
//===--------------------------------------------------------------------===// | |||||
// Identifier uniquing | // Identifier uniquing | ||||
//===--------------------------------------------------------------------===// | //===--------------------------------------------------------------------===// | ||||
// Identifier allocator and mutex for thread safety. | // Identifier allocator and mutex for thread safety. | ||||
llvm::BumpPtrAllocator identifierAllocator; | llvm::BumpPtrAllocator identifierAllocator; | ||||
llvm::sys::SmartRWMutex<true> identifierMutex; | llvm::sys::SmartRWMutex<true> identifierMutex; | ||||
//===--------------------------------------------------------------------===// | //===--------------------------------------------------------------------===// | ||||
▲ Show 20 Lines • Show All 192 Lines • ▼ Show 20 Lines | |||||
static ArrayRef<T> copyArrayRefInto(llvm::BumpPtrAllocator &allocator, | static ArrayRef<T> copyArrayRefInto(llvm::BumpPtrAllocator &allocator, | ||||
ArrayRef<T> elements) { | ArrayRef<T> elements) { | ||||
auto result = allocator.Allocate<T>(elements.size()); | auto result = allocator.Allocate<T>(elements.size()); | ||||
std::uninitialized_copy(elements.begin(), elements.end(), result); | std::uninitialized_copy(elements.begin(), elements.end(), result); | ||||
return ArrayRef<T>(result, elements.size()); | return ArrayRef<T>(result, elements.size()); | ||||
} | } | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// Debugging | |||||
//===----------------------------------------------------------------------===// | |||||
DebugActionManager &MLIRContext::getDebugActionManager() { | |||||
return getImpl().debugActionManager; | |||||
} | |||||
//===----------------------------------------------------------------------===// | |||||
// Diagnostic Handlers | // Diagnostic Handlers | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
/// Returns the diagnostic engine for this context. | /// Returns the diagnostic engine for this context. | ||||
DiagnosticEngine &MLIRContext::getDiagEngine() { return getImpl().diagEngine; } | DiagnosticEngine &MLIRContext::getDiagEngine() { return getImpl().diagEngine; } | ||||
//===----------------------------------------------------------------------===// | //===----------------------------------------------------------------------===// | ||||
// Dialect and Operation Registration | // Dialect and Operation Registration | ||||
▲ Show 20 Lines • Show All 590 Lines • Show Last 20 Lines |