9 #ifndef MLIR_IR_MLIRCONTEXT_H 10 #define MLIR_IR_MLIRCONTEXT_H 23 class DebugActionManager;
24 class DiagnosticEngine;
26 class DialectRegistry;
27 class InFlightDiagnostic;
29 class MLIRContextImpl;
30 class RegisteredOperationName;
61 Threading multithreading = Threading::ENABLED);
65 std::vector<Dialect *> getLoadedDialects();
76 std::vector<StringRef> getAvailableDialects();
80 Dialect *getLoadedDialect(StringRef name);
86 return static_cast<T *
>(getLoadedDialect(T::getDialectNamespace()));
93 return static_cast<T *
>(
94 getOrLoadDialect(T::getDialectNamespace(), TypeID::get<T>(), [
this]() {
95 std::unique_ptr<T> dialect(
new T(
this));
101 template <
typename Dialect>
103 getOrLoadDialect<Dialect>();
107 template <
typename Dialect,
typename OtherDialect,
typename... MoreDialects>
109 getOrLoadDialect<Dialect>();
110 loadDialect<OtherDialect, MoreDialects...>();
114 void loadAllAvailableDialects();
120 Dialect *getOrLoadDialect(StringRef name);
123 bool allowsUnregisteredDialects();
126 void allowUnregisteredDialects(
bool allow =
true);
129 bool isMultithreadingEnabled();
134 void disableMultithreading(
bool disable =
true);
136 disableMultithreading(!enable);
148 void setThreadPool(llvm::ThreadPool &pool);
155 unsigned getNumThreads();
161 llvm::ThreadPool &getThreadPool();
165 bool shouldPrintOpOnDiagnostic();
169 void printOpOnDiagnostic(
bool enable);
173 bool shouldPrintStackTraceOnDiagnostic();
177 void printStackTraceOnDiagnostic(
bool enable);
184 bool isOperationRegistered(StringRef name);
210 void enterMultiThreadedExecution();
211 void exitMultiThreadedExecution();
220 Dialect *getOrLoadDialect(StringRef dialectNamespace,
TypeID dialectID,
227 llvm::hash_code getRegistryHash();
230 const std::unique_ptr<MLIRContextImpl>
impl;
247 #endif // MLIR_IR_MLIRCONTEXT_H TODO: Remove this file when SCCP and integer range analysis have been ported to the new framework...
The OpAsmOpInterface, see OpAsmInterface.td for more details.
This is the implementation of the MLIRContext class, using the pImpl idiom.
void registerMLIRContextCLOptions()
Register a set of useful command-line options that can be used to configure various flags within the ...
void loadDialect()
Load a dialect in the context.
void enableMultithreading(bool enable=true)
This class provides an efficient unique identifier for a specific C++ type.
Dialects are groups of MLIR operations, types and attributes, as well as behavior associated with the...
A utility class to get or create instances of "storage classes".
T * getLoadedDialect()
Get a registered IR dialect for the given derived dialect type.
This class is the main interface for diagnostics.
void loadDialect()
Load a list dialects in the context.
T * getOrLoadDialect()
Get (or create) a dialect for the given derived dialect type.
MLIRContextImpl & getImpl()
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
MLIRContext is the top-level object for a collection of MLIR operations.
This class represents manages debug actions, and orchestrates the communication between action querie...