CIRCT 22.0.0git
Loading...
Searching...
No Matches
Context.cpp
Go to the documentation of this file.
1//===- Context.cpp --------------------------------------------------------===//
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// DO NOT EDIT!
10// This file is distributed as part of an ESI package. The source for this file
11// should always be modified within CIRCT (lib/dialect/ESI/runtime/cpp/).
12//
13//===----------------------------------------------------------------------===//
14
15#include "esi/Context.h"
16#include "esi/Accelerator.h"
17#include <format>
18#include <sstream>
19
20using namespace esi;
21
23 : logger(std::make_unique<ConsoleLogger>(Logger::Level::Warning)) {}
24Context::Context(std::unique_ptr<Logger> logger) : logger(std::move(logger)) {}
26
28 for (auto &conn : connections)
29 conn->disconnect();
30 connections.clear();
31}
32
34 if (types.count(type->getID()))
35 throw std::runtime_error(
36 std::format("Type '{}' already registered in context (type is '{}')",
37 type->getID(), type->toString()));
38 types.emplace(type->getID(), std::unique_ptr<Type>(type));
39}
Context(igraph::InstanceGraph *instanceGraph, const LongestPathAnalysisOptions &option)
A logger that writes to the console. Includes color support.
Definition Logging.h:205
void disconnectAll()
Disconnect from all accelerators associated with this context.
Definition Context.cpp:27
TypeCache types
Definition Context.h:77
std::vector< std::unique_ptr< AcceleratorConnection > > connections
Definition Context.h:73
void registerType(Type *type)
Register a type with the context. Takes ownership of the pointer type.
Definition Context.cpp:33
Root class of the ESI type system.
Definition Types.h:34
ID getID() const
Definition Types.h:40
std::string toString()
Definition Types.cpp:71
Definition esi.py:1