CIRCT  20.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 
22 #include "circt/Dialect/SV/SVOps.h"
24 #include "mlir/Pass/Pass.h"
25 #include "mlir/Transforms/DialectConversion.h"
26 
27 namespace circt {
28 namespace msft {
29 
30 /// Utility for creating {0, 1, 2, ..., size}.
31 SmallVector<unsigned> makeSequentialRange(unsigned size);
32 
33 /// Try to get a "good" name for the given Value.
34 StringRef getValueName(Value v, const SymbolCache &syms, std::string &buff);
35 
36 /// Generic pattern for removing an op during pattern conversion.
37 template <typename OpTy>
38 struct RemoveOpLowering : public OpConversionPattern<OpTy> {
41 
42  LogicalResult
43  matchAndRewrite(OpTy op, OpAdaptor adaptor,
44  ConversionPatternRewriter &rewriter) const final {
45  rewriter.eraseOp(op);
46  return success();
47  }
48 };
49 
50 } // namespace msft
51 } // namespace circt
52 
53 #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
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
Definition: DebugAnalysis.h:21
Definition: msft.py:1
Generic pattern for removing an op during pattern conversion.
Definition: PassDetails.h:38
typename OpConversionPattern< OpTy >::OpAdaptor OpAdaptor
Definition: PassDetails.h:40
LogicalResult matchAndRewrite(OpTy op, OpAdaptor adaptor, ConversionPatternRewriter &rewriter) const final
Definition: PassDetails.h:43