CIRCT 24.0.0git
Loading...
Searching...
No Matches
HWArithToHW.h
Go to the documentation of this file.
1//===- HWArithToHW.h - HWArith to HW conversions ----------------*- 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 header file defines prototypes that expose the HWArithToHW pass
10// constructor.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef CIRCT_CONVERSION_HWARITHTOHW_HWARITHTOHW_H
15#define CIRCT_CONVERSION_HWARITHTOHW_HWARITHTOHW_H
16
17#include "circt/Support/LLVM.h"
18#include "mlir/IR/AttrTypeSubElements.h"
19#include "mlir/Transforms/DialectConversion.h"
20#include <memory>
21
22namespace mlir {
23class Pass;
24} // namespace mlir
25
26namespace circt {
27
28#define GEN_PASS_DECL_HWARITHTOHW
29#include "circt/Conversion/Passes.h.inc"
30
31/// A helper type converter class that automatically populates the relevant
32/// materializations and type conversions for converting HWArith to HW.
33class HWArithToHWTypeConverter : public mlir::TypeConverter {
34public:
36
37 // A function which recursively converts any integer type with signedness
38 // semantics to a signless counterpart.
39 mlir::Type removeSignedness(mlir::Type type);
40
41 // Returns true if any subtype in 'type' has signedness semantics.
42 bool hasSignednessSemantics(mlir::Type type);
43 bool hasSignednessSemantics(mlir::TypeRange types);
44
45private:
46 mlir::AttrTypeReplacer signednessReplacer;
47};
48
49/// Get the HWArith to HW conversion patterns.
51 HWArithToHWTypeConverter &typeConverter, RewritePatternSet &patterns);
52
53std::unique_ptr<mlir::Pass> createHWArithToHWPass();
54} // namespace circt
55
56#endif // CIRCT_CONVERSION_HWARITHTOHW_HWARITHTOHW_H
A helper type converter class that automatically populates the relevant materializations and type con...
Definition HWArithToHW.h:33
bool hasSignednessSemantics(mlir::Type type)
mlir::AttrTypeReplacer signednessReplacer
Definition HWArithToHW.h:46
mlir::Type removeSignedness(mlir::Type type)
bool hasSignednessSemantics(mlir::TypeRange types)
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
void populateHWArithToHWConversionPatterns(HWArithToHWTypeConverter &typeConverter, RewritePatternSet &patterns)
Get the HWArith to HW conversion patterns.
std::unique_ptr< mlir::Pass > createHWArithToHWPass()