MLIR  20.0.0git
QuerySession.h
Go to the documentation of this file.
1 //===--- QuerySession.h -----------------------------------------*- 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 #ifndef MLIR_TOOLS_MLIRQUERY_QUERYSESSION_H
10 #define MLIR_TOOLS_MLIRQUERY_QUERYSESSION_H
11 
12 #include "mlir/IR/Operation.h"
14 #include "llvm/ADT/StringMap.h"
15 #include "llvm/Support/SourceMgr.h"
16 
17 namespace mlir::query {
18 
19 class Registry;
20 // Represents the state for a particular mlir-query session.
21 class QuerySession {
22 public:
23  QuerySession(Operation *rootOp, llvm::SourceMgr &sourceMgr, unsigned bufferId,
24  const matcher::Registry &matcherRegistry)
25  : rootOp(rootOp), sourceMgr(sourceMgr), bufferId(bufferId),
26  matcherRegistry(matcherRegistry) {}
27 
28  Operation *getRootOp() { return rootOp; }
29  llvm::SourceMgr &getSourceManager() const { return sourceMgr; }
30  unsigned getBufferId() { return bufferId; }
31  const matcher::Registry &getRegistryData() const { return matcherRegistry; }
32 
33  llvm::StringMap<matcher::VariantValue> namedValues;
34  bool terminate = false;
35 
36 private:
37  Operation *rootOp;
38  llvm::SourceMgr &sourceMgr;
39  unsigned bufferId;
40  const matcher::Registry &matcherRegistry;
41 };
42 
43 } // namespace mlir::query
44 
45 #endif // MLIR_TOOLS_MLIRQUERY_QUERYSESSION_H
Operation is the basic unit of execution within MLIR.
Definition: Operation.h:88
const matcher::Registry & getRegistryData() const
Definition: QuerySession.h:31
llvm::SourceMgr & getSourceManager() const
Definition: QuerySession.h:29
QuerySession(Operation *rootOp, llvm::SourceMgr &sourceMgr, unsigned bufferId, const matcher::Registry &matcherRegistry)
Definition: QuerySession.h:23
llvm::StringMap< matcher::VariantValue > namedValues
Definition: QuerySession.h:33