File tree Expand file tree Collapse file tree 6 files changed +465
-0
lines changed
Expand file tree Collapse file tree 6 files changed +465
-0
lines changed Original file line number Diff line number Diff line change 1+ // RUN: mlir-format %s --mlir-use-nameloc-as-prefix --insert-name-loc-only | FileCheck %s
2+
3+ // Append NameLocs (`loc("[ssa_name]")`) to operations and block arguments
4+
5+ // CHECK: func.func @add_one(%my_input: f64 loc("my_input"), %my_input2: f64 loc("my_input2")) -> f64 {
6+ func.func @add_one (%my_input: f64 , %my_input2: f64 ) -> f64 {
7+ // CHECK: %my_constant = arith.constant 1.00000e+00 : f64 loc("my_constant")
8+ %my_constant = arith.constant 1.00000e+00 : f64
9+
10+ %my_output = arith.addf %my_input , %my_constant : f64
11+ // CHECK: %my_output = arith.addf %my_input, %my_constant : f64 loc("my_output")
12+ return %my_output : f64
13+ }
Original file line number Diff line number Diff line change 1+ // RUN: mlir-format %s --mlir-use-nameloc-as-prefix | FileCheck %s
2+
3+ // CHECK: func.func @add_one(%my_input: f64) -> f64 {
4+ func.func @add_one (%my_input: f64 ) -> f64 {
5+ // CHECK: %my_constant = arith.constant 1.00000e+00 : f64
6+ %my_constant = arith.constant 1.00000e+00 : f64
7+ // CHECK: // Dinnae drop this comment!
8+ // Dinnae drop this comment!
9+ %my_output = arith.addf
10+ %my_input ,
11+ %my_constant : f64
12+ // CHECK-STRICT: %my_output = arith.addf %my_input, %my_constant : f64
13+ return %my_output : f64
14+ // CHECK: return %my_output : f64
15+ }
Original file line number Diff line number Diff line change 1+ // RUN: mlir-format %s --mlir-use-nameloc-as-prefix | FileCheck %s
2+
3+ // CHECK: func.func @my_func(%x: f64, %y: f64) -> f64 {
4+ func.func @my_func (%x: f64 , %y: f64 ) -> f64 {
5+ // CHECK: %cst1 = arith.constant 1.00000e+00 : f64
6+ %cst1 = arith.constant 1.00000e+00 : f64
7+ // CHECK: %cst2 = arith.constant 2.00000e+00 : f64
8+ %cst2 = arith.constant 2.00000e+00 : f64
9+ // CHECK-STRICT: %x1 = arith.addf %x, %cst1 : f64
10+ %x1 = arith.addf
11+ %x ,
12+ %cst1 : f64
13+ // CHECK-STRICT: %y2 = arith.addf %y, %cst2 : f64
14+ %y2 = arith.addf %y , %cst2 : f64
15+ // CHECK: %z = arith.addf %x1, %y2 : f64
16+ %z = arith.addf %x1 , %y2 : f64
17+ // return %z : f64
18+ return %z : f64
19+ }
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ add_subdirectory(mlir-pdll-lsp-server)
55add_subdirectory (mlir-query)
66add_subdirectory (mlir-reduce)
77add_subdirectory (mlir-rewrite)
8+ add_subdirectory (mlir-format)
89add_subdirectory (mlir-shlib)
910add_subdirectory (mlir-translate)
1011add_subdirectory (mlir-vulkan-runner)
Original file line number Diff line number Diff line change 1+ get_property (dialect_libs GLOBAL PROPERTY MLIR_DIALECT_LIBS)
2+ set (LLVM_LINK_COMPONENTS
3+ Support
4+ )
5+
6+ set (LIBS
7+ ${dialect_libs}
8+
9+ MLIRAffineAnalysis
10+ MLIRAnalysis
11+ MLIRCastInterfaces
12+ MLIRDialect
13+ MLIRParser
14+ MLIRPass
15+ MLIRTransforms
16+ MLIRTransformUtils
17+ MLIRSupport
18+ MLIRIR
19+ )
20+
21+ include_directories (../../../clang/include )
22+
23+ add_mlir_tool(mlir-format
24+ mlir-format.cpp
25+
26+ SUPPORT_PLUGINS
27+ )
28+ mlir_target_link_libraries(mlir-format PRIVATE ${LIBS} )
29+ llvm_update_compile_flags(mlir-format)
30+
31+ mlir_check_all_link_libraries(mlir-format)
32+ export_executable_symbols_for_plugins(mlir-format)
You can’t perform that action at this time.
0 commit comments