CIRCT  19.0.0git
PassDetails.h
Go to the documentation of this file.
1 //===- PassDetails.h - MSFT pass class details ------------------*- 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 // Stuff shared between the different MSFT passes.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 // clang-tidy seems to expect the absolute path in the header guard on some
14 // systems, so just disable it.
15 // NOLINTNEXTLINE(llvm-header-guard)
16 #ifndef DIALECT_MSFT_TRANSFORMS_PASSDETAILS_H
17 #define DIALECT_MSFT_TRANSFORMS_PASSDETAILS_H
18 
21 #include "circt/Dialect/SV/SVOps.h"
23 #include "mlir/Pass/Pass.h"
24 #include "mlir/Transforms/DialectConversion.h"
25 
26 namespace circt {
27 namespace msft {
28 
29 /// Utility for creating {0, 1, 2, ..., size}.
30 SmallVector<unsigned> makeSequentialRange(unsigned size);
31 
32 /// Try to get a "good" name for the given Value.
33 StringRef getValueName(Value v, const SymbolCache &syms, std::string &buff);
34 
35 /// Generic pattern for removing an op during pattern conversion.
36 template <typename OpTy>
37 struct RemoveOpLowering : public OpConversionPattern<OpTy> {
40 
41  LogicalResult
42  matchAndRewrite(OpTy op, OpAdaptor adaptor,
43  ConversionPatternRewriter &rewriter) const final {
44  rewriter.eraseOp(op);
45  return success();
46  }
47 };
48 
49 #define GEN_PASS_CLASSES
50 #include "circt/Dialect/MSFT/MSFTPasses.h.inc"
51 
52 } // namespace msft
53 } // namespace circt
54 
55 #endif // DIALECT_MSFT_TRANSFORMS_PASSDETAILS_H
StringRef getValueName(Value v, const SymbolCache &syms, std::string &buff)
Try to get a "good" name for the given Value.
Definition: PassCommon.cpp:24
SmallVector< unsigned > makeSequentialRange(unsigned size)
Utility for creating {0, 1, 2, ..., size}.
Definition: PassCommon.cpp:17
This file defines an intermediate representation for circuits acting as an abstraction for constraint...
Definition: DebugAnalysis.h:21
Definition: msft.py:1
Generic pattern for removing an op during pattern conversion.
Definition: PassDetails.h:37
typename OpConversionPattern< OpTy >::OpAdaptor OpAdaptor
Definition: PassDetails.h:39
LogicalResult matchAndRewrite(OpTy op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const final
Definition: PassDetails.h:42