CIRCT 20.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
18using namespace esi;
19
21 if (types.count(type->getID()))
22 throw std::runtime_error("Type already exists in context");
23 types.emplace(type->getID(), std::unique_ptr<Type>(type));
24}
25
26std::unique_ptr<AcceleratorConnection>
27Context::connect(std::string backend, std::string connection) {
28 return registry::connect(*this, backend, connection);
29}
TypeCache types
Definition Context.h:69
std::unique_ptr< AcceleratorConnection > connect(std::string backend, std::string connection)
Connect to an accelerator backend.
Definition Context.cpp:27
void registerType(Type *type)
Register a type with the context. Takes ownership of the pointer type.
Definition Context.cpp:20
Root class of the ESI type system.
Definition Types.h:27
ID getID() const
Definition Types.h:33
std::unique_ptr< AcceleratorConnection > connect(Context &ctxt, const std::string &backend, const std::string &connection)
Definition esi.py:1