16 #include "mlir/Conversion/LLVMCommon/ConversionTarget.h"
17 #include "mlir/Conversion/LLVMCommon/Pattern.h"
18 #include "mlir/Dialect/LLVMIR/LLVMDialect.h"
19 #include "mlir/Pass/Pass.h"
20 #include "mlir/Transforms/DialectConversion.h"
23 using namespace circt;
27 struct CombParityOpConversion :
public ConvertToLLVMPattern {
28 explicit CombParityOpConversion(MLIRContext *ctx,
29 LLVMTypeConverter &typeConverter)
30 : ConvertToLLVMPattern(
comb::ParityOp::getOperationName(), ctx,
34 matchAndRewrite(Operation *op, ArrayRef<Value> operands,
35 ConversionPatternRewriter &rewriter)
const override {
36 auto parityOp = cast<comb::ParityOp>(op);
39 rewriter.create<LLVM::CtPopOp>(op->getLoc(), parityOp.getInput());
40 rewriter.replaceOpWithNewOp<LLVM::TruncOp>(
Direction get(bool isOutput)
Returns an output direction if isOutput is true, otherwise returns an input direction.
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
void populateCombToLLVMConversionPatterns(mlir::LLVMTypeConverter &converter, RewritePatternSet &patterns)
Get the Comb to LLVM conversion patterns.