Skip to content

Commit c752791

Browse files
committed
[mlir][smt] add arith-to-smt
1 parent bba4ded commit c752791

File tree

8 files changed

+498
-0
lines changed

8 files changed

+498
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//===- ArithToSMT.h - Arith to SMT dialect conversion ---------*- 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+
#ifndef MLIR_CONVERSION_ARITHTOSMT_H
10+
#define MLIR_CONVERSION_ARITHTOSMT_H
11+
12+
#include "mlir/Pass/Pass.h"
13+
#include <memory>
14+
15+
namespace mlir {
16+
17+
class TypeConverter;
18+
class RewritePatternSet;
19+
20+
#define GEN_PASS_DECL_CONVERTARITHTOSMT
21+
#include "mlir/Conversion/Passes.h.inc"
22+
23+
namespace arith {
24+
/// Get the Arith to SMT conversion patterns.
25+
void populateArithToSMTConversionPatterns(TypeConverter &converter,
26+
RewritePatternSet &patterns);
27+
} // namespace arith
28+
} // namespace mlir
29+
30+
#endif // MLIR_CONVERSION_ARITHTOSMT_H

mlir/include/mlir/Conversion/Passes.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "mlir/Conversion/ArithToArmSME/ArithToArmSME.h"
1616
#include "mlir/Conversion/ArithToEmitC/ArithToEmitCPass.h"
1717
#include "mlir/Conversion/ArithToLLVM/ArithToLLVM.h"
18+
#include "mlir/Conversion/ArithToSMT/ArithToSMT.h"
1819
#include "mlir/Conversion/ArithToSPIRV/ArithToSPIRV.h"
1920
#include "mlir/Conversion/ArmNeon2dToIntr/ArmNeon2dToIntr.h"
2021
#include "mlir/Conversion/ArmSMEToLLVM/ArmSMEToLLVM.h"

mlir/include/mlir/Conversion/Passes.td

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,4 +1493,17 @@ def ConvertVectorToXeGPU : Pass<"convert-vector-to-xegpu"> {
14931493
];
14941494
}
14951495

1496+
//===----------------------------------------------------------------------===//
1497+
// ConvertArithToSMT
1498+
//===----------------------------------------------------------------------===//
1499+
1500+
def ConvertArithToSMT : Pass<"convert-arith-to-smt"> {
1501+
let summary = "Convert arith ops and constants to SMT ops";
1502+
let dependentDialects = [
1503+
"smt::SMTDialect",
1504+
"arith::ArithDialect",
1505+
"mlir::func::FuncDialect"
1506+
];
1507+
}
1508+
14961509
#endif // MLIR_CONVERSION_PASSES

mlir/include/mlir/InitAllPasses.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ inline void registerAllPasses() {
9595
arm_sve::registerArmSVEPasses();
9696
emitc::registerEmitCPasses();
9797
xegpu::registerXeGPUPasses();
98+
registerConvertArithToSMTPass();
9899

99100
// Dialect pipelines
100101
bufferization::registerBufferizationPipelines();

0 commit comments

Comments
 (0)