MLIR  19.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 "llvm/ADT/StringMap.h"
13 
14 namespace mlir::query {
15 
16 class Registry;
17 // Represents the state for a particular mlir-query session.
18 class QuerySession {
19 public:
20  QuerySession(Operation *rootOp, llvm::SourceMgr &sourceMgr, unsigned bufferId,
21  const matcher::Registry &matcherRegistry)
22  : rootOp(rootOp), sourceMgr(sourceMgr), bufferId(bufferId),
23  matcherRegistry(matcherRegistry) {}
24 
25  Operation *getRootOp() { return rootOp; }
26  llvm::SourceMgr &getSourceManager() const { return sourceMgr; }
27  unsigned getBufferId() { return bufferId; }
28  const matcher::Registry &getRegistryData() const { return matcherRegistry; }
29 
30  llvm::StringMap<matcher::VariantValue> namedValues;
31  bool terminate = false;
32 
33 private:
34  Operation *rootOp;
35  llvm::SourceMgr &sourceMgr;
36  unsigned bufferId;
37  const matcher::Registry &matcherRegistry;
38 };
39 
40 } // namespace mlir::query
41 
42 #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:28
llvm::SourceMgr & getSourceManager() const
Definition: QuerySession.h:26
QuerySession(Operation *rootOp, llvm::SourceMgr &sourceMgr, unsigned bufferId, const matcher::Registry &matcherRegistry)
Definition: QuerySession.h:20
llvm::StringMap< matcher::VariantValue > namedValues
Definition: QuerySession.h:30