Loading [MathJax]/extensions/tex2jax.js
CIRCT 22.0.0git
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InstanceGraph.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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
10
12#include "mlir/CAPI/IR.h"
13#include "mlir/CAPI/Support.h"
14#include "mlir/CAPI/Utils.h"
15#include <string>
16
17using namespace circt;
18
19//===----------------------------------------------------------------------===//
20// C API Helpers
21//===----------------------------------------------------------------------===//
22
23ArrayRef<igraph::InstanceOpInterface> unwrap(IgraphInstancePath instancePath) {
24 return ArrayRef(
25 reinterpret_cast<igraph::InstanceOpInterface *>(instancePath.ptr),
26 instancePath.size);
27}
28
29IgraphInstancePath wrap(ArrayRef<igraph::InstanceOpInterface> instancePath) {
30 return IgraphInstancePath{
31 const_cast<igraph::InstanceOpInterface *>(instancePath.data()),
32 instancePath.size()};
33}
34
35//===----------------------------------------------------------------------===//
36// InstancePath
37//===----------------------------------------------------------------------===//
38
40 return unwrap(instancePath).size();
41}
42
43MlirOperation igraphInstancePathGet(IgraphInstancePath instancePath,
44 size_t index) {
45 assert(instancePath.ptr);
46 auto path = unwrap(instancePath);
47 Operation *operation = path[index];
48 return wrap(operation);
49}
ArrayRef< igraph::InstanceOpInterface > unwrap(IgraphInstancePath instancePath)
size_t igraphInstancePathSize(IgraphInstancePath instancePath)
MlirOperation igraphInstancePathGet(IgraphInstancePath instancePath, size_t index)
IgraphInstancePath wrap(ArrayRef< igraph::InstanceOpInterface > instancePath)
assert(baseType &&"element must be base type")
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.