CIRCT  19.0.0git
CHIRRTL.cpp
Go to the documentation of this file.
1 //===- CHIRRTL.cpp - C interface for the CHIRRTL dialect ------------------===//
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 
11 #include "mlir/CAPI/IR.h"
12 #include "mlir/CAPI/Registration.h"
13 #include "mlir/CAPI/Support.h"
14 
15 using namespace circt;
16 using namespace chirrtl;
17 
18 //===----------------------------------------------------------------------===//
19 // Dialect API.
20 //===----------------------------------------------------------------------===//
21 
23  circt::chirrtl::CHIRRTLDialect)
24 
25 //===----------------------------------------------------------------------===//
26 // Type API.
27 //===----------------------------------------------------------------------===//
28 
29 MlirType chirrtlTypeGetCMemory(MlirContext ctx, MlirType elementType,
30  uint64_t numElements) {
31  auto baseType = unwrap(elementType).cast<firrtl::FIRRTLBaseType>();
32  assert(baseType && "element must be base type");
33 
34  return wrap(CMemoryType::get(unwrap(ctx), baseType, numElements));
35 }
36 
37 MlirType chirrtlTypeGetCMemoryPort(MlirContext ctx) {
38  return wrap(CMemoryPortType::get(unwrap(ctx)));
39 }
assert(baseType &&"element must be base type")
return wrap(CMemoryType::get(unwrap(ctx), baseType, numElements))
MlirType uint64_t numElements
Definition: CHIRRTL.cpp:30
MlirType elementType
Definition: CHIRRTL.cpp:29
MlirType chirrtlTypeGetCMemoryPort(MlirContext ctx)
Definition: CHIRRTL.cpp:37
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(CHIRRTL, chirrtl, circt::chirrtl::CHIRRTLDialect) MlirType chirrtlTypeGetCMemory(MlirContext ctx
MLIR_CAPI_EXPORTED MlirType chirrtlTypeGetCMemory(MlirContext ctx, MlirType elementType, uint64_t numElements)
static EvaluatorValuePtr unwrap(OMEvaluatorValue c)
Definition: OM.cpp:96
Direction get(bool isOutput)
Returns an output direction if isOutput is true, otherwise returns an input direction.
Definition: CalyxOps.cpp:54
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21