CIRCT  20.0.0git
HandshakeToDC.h
Go to the documentation of this file.
1 //===- HandshakeToDC.h ------------------------------------------*- C++ -*-===//
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 // This file declares passes which together will lower the Handshake dialect to
10 // CIRCT RTL dialects.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef CIRCT_CONVERSION_HANDSHAKETODC_H
15 #define CIRCT_CONVERSION_HANDSHAKETODC_H
16 
17 #include "circt/Dialect/HW/HWOps.h"
18 #include "mlir/IR/Builders.h"
19 #include <memory>
20 
21 namespace mlir {
22 class Pass;
23 } // namespace mlir
24 
25 namespace circt {
26 
27 #define GEN_PASS_DECL_HANDSHAKETODC
28 #include "circt/Conversion/Passes.h.inc"
29 
30 std::unique_ptr<mlir::Pass> createHandshakeToDCPass();
31 
32 namespace handshaketodc {
33 using ConvertedOps = DenseSet<Operation *>;
34 
35 // Runs Handshake to DC conversion on the provided op. `patternBuilder` can be
36 // used to describe additional patterns to run - typically this will be a
37 // pattern that converts the container operation (e.g. `op`).
38 // `configureTarget` can be provided to specialize legalization.
39 LogicalResult runHandshakeToDC(
40  mlir::Operation *op,
41  llvm::function_ref<void(TypeConverter &typeConverter,
42  ConvertedOps &convertedOps,
43  RewritePatternSet &patterns)>
44  patternBuilder,
45  llvm::function_ref<void(mlir::ConversionTarget &)> configureTarget = {});
46 } // namespace handshaketodc
47 
48 namespace handshake {
49 
50 // Converts 't' into a valid HW type. This is strictly used for converting
51 // 'index' types into a fixed-width type.
52 Type toValidType(Type t);
53 
54 } // namespace handshake
55 } // namespace circt
56 
57 #endif // CIRCT_CONVERSION_HANDSHAKETODC_H
Type toValidType(Type t)
Converts 't' into a valid HW type.
DenseSet< Operation * > ConvertedOps
Definition: HandshakeToDC.h:33
LogicalResult runHandshakeToDC(mlir::Operation *op, llvm::function_ref< void(TypeConverter &typeConverter, ConvertedOps &convertedOps, RewritePatternSet &patterns)> patternBuilder, llvm::function_ref< void(mlir::ConversionTarget &)> configureTarget={})
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
std::unique_ptr< mlir::Pass > createHandshakeToDCPass()