[mlir][NFC] Move MlirOptMain to the Tools/ directory
authorRiver Riddle <riddleriver@gmail.com>
Fri, 4 Mar 2022 21:49:30 +0000 (13:49 -0800)
committerRiver Riddle <riddleriver@gmail.com>
Mon, 7 Mar 2022 09:05:38 +0000 (01:05 -0800)
MlirOptMain is currently awkwardly shoved into mlir/Support. This commit
moves it to the Tools/ directory, which is intended for libraries used to
implement tools.

Differential Revision: https://reviews.llvm.org/D121025

flang/tools/fir-opt/fir-opt.cpp
mlir/examples/standalone/standalone-opt/standalone-opt.cpp
mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h [moved from mlir/include/mlir/Support/MlirOptMain.h with 97% similarity]
mlir/lib/Support/CMakeLists.txt
mlir/lib/Tools/CMakeLists.txt
mlir/lib/Tools/mlir-opt/CMakeLists.txt [new file with mode: 0644]
mlir/lib/Tools/mlir-opt/MlirOptMain.cpp [moved from mlir/lib/Support/MlirOptMain.cpp with 99% similarity]
mlir/tools/mlir-opt/mlir-opt.cpp

index 2a0fb7d..dc3a0a4 100644 (file)
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "mlir/Support/MlirOptMain.h"
+#include "mlir/Tools/mlir-opt/MlirOptMain.h"
 #include "flang/Optimizer/CodeGen/CodeGen.h"
 #include "flang/Optimizer/Support/InitFIR.h"
 #include "flang/Optimizer/Transforms/Passes.h"
index 5a1354d..e84628f 100644 (file)
@@ -14,7 +14,7 @@
 #include "mlir/Pass/Pass.h"
 #include "mlir/Pass/PassManager.h"
 #include "mlir/Support/FileUtilities.h"
-#include "mlir/Support/MlirOptMain.h"
+#include "mlir/Tools/mlir-opt/MlirOptMain.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/SourceMgr.h"
similarity index 97%
rename from mlir/include/mlir/Support/MlirOptMain.h
rename to mlir/include/mlir/Tools/mlir-opt/MlirOptMain.h
index 666d83a..7446455 100644 (file)
@@ -10,8 +10,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef MLIR_SUPPORT_MLIROPTMAIN_H
-#define MLIR_SUPPORT_MLIROPTMAIN_H
+#ifndef MLIR_TOOLS_MLIROPT_MLIROPTMAIN_H
+#define MLIR_TOOLS_MLIROPT_MLIROPTMAIN_H
 
 #include "mlir/Support/LogicalResult.h"
 #include "llvm/ADT/StringRef.h"
@@ -95,4 +95,4 @@ inline int asMainReturnCode(LogicalResult r) {
 
 } // namespace mlir
 
-#endif // MLIR_SUPPORT_MLIROPTMAIN_H
+#endif // MLIR_TOOLS_MLIROPT_MLIROPTMAIN_H
index 9e5d039..aae0257 100644 (file)
@@ -3,7 +3,6 @@ set(LLVM_OPTIONAL_SOURCES
   FileUtilities.cpp
   IndentedOstream.cpp
   InterfaceSupport.cpp
-  MlirOptMain.cpp
   StorageUniquer.cpp
   Timing.cpp
   ToolUtilities.cpp
@@ -24,18 +23,6 @@ add_mlir_library(MLIRSupport
   LINK_LIBS PUBLIC
   ${LLVM_PTHREAD_LIB})
 
-add_mlir_library(MLIROptLib
-  MlirOptMain.cpp
-
-  ADDITIONAL_HEADER_DIRS
-  ${MLIR_MAIN_INCLUDE_DIR}/mlir/Support
-
-  LINK_LIBS PUBLIC
-  MLIRPass
-  MLIRParser
-  MLIRSupport
-  )
-
 # This doesn't use add_mlir_library as it is used in mlir-tblgen and else
 # mlir-tblgen ends up depending on mlir-generic-headers.
 add_llvm_library(MLIRSupportIndentedOstream
index cf598f7..88c2b25 100644 (file)
@@ -1,3 +1,4 @@
 add_subdirectory(mlir-lsp-server)
+add_subdirectory(mlir-opt)
 add_subdirectory(mlir-reduce)
 add_subdirectory(PDLL)
diff --git a/mlir/lib/Tools/mlir-opt/CMakeLists.txt b/mlir/lib/Tools/mlir-opt/CMakeLists.txt
new file mode 100644 (file)
index 0000000..318eb0a
--- /dev/null
@@ -0,0 +1,11 @@
+add_mlir_library(MLIROptLib
+  MlirOptMain.cpp
+
+  ADDITIONAL_HEADER_DIRS
+  ${MLIR_MAIN_INCLUDE_DIR}/mlir/Tools/mlir-opt
+
+  LINK_LIBS PUBLIC
+  MLIRPass
+  MLIRParser
+  MLIRSupport
+  )
similarity index 99%
rename from mlir/lib/Support/MlirOptMain.cpp
rename to mlir/lib/Tools/mlir-opt/MlirOptMain.cpp
index 1926edc..ccfc1a5 100644 (file)
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "mlir/Support/MlirOptMain.h"
+#include "mlir/Tools/mlir-opt/MlirOptMain.h"
 #include "mlir/IR/AsmState.h"
 #include "mlir/IR/Attributes.h"
 #include "mlir/IR/BuiltinOps.h"
index 2bb690b..7336980 100644 (file)
@@ -18,7 +18,7 @@
 #include "mlir/Pass/Pass.h"
 #include "mlir/Pass/PassManager.h"
 #include "mlir/Support/FileUtilities.h"
-#include "mlir/Support/MlirOptMain.h"
+#include "mlir/Tools/mlir-opt/MlirOptMain.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/SourceMgr.h"