CIRCT  19.0.0git
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 
18 using 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 
26 std::unique_ptr<AcceleratorConnection>
27 Context::connect(std::string backend, std::string connection) {
28  return registry::connect(*this, backend, connection);
29 }
TypeCache types
Definition: Context.h:49
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, std::string backend, std::string connection)
Definition: esi.py:1