diff options
-rw-r--r-- | CMakeLists.txt | 30 | ||||
-rw-r--r-- | toy/CMakeLists.txt | 6 | ||||
-rw-r--r-- | toy/EarlyLowering.cpp (renamed from mlir/EarlyLowering.cpp) | 0 | ||||
-rw-r--r-- | toy/LateLowering.cpp (renamed from mlir/LateLowering.cpp) | 0 | ||||
-rw-r--r-- | toy/MLIRGen.cpp (renamed from mlir/MLIRGen.cpp) | 0 | ||||
-rw-r--r-- | toy/RegisterDialects.cpp | 10 | ||||
-rw-r--r-- | toy/ShapeInferencePass.cpp (renamed from mlir/ShapeInferencePass.cpp) | 0 | ||||
-rw-r--r-- | toy/ToyCombine.cpp (renamed from mlir/ToyCombine.cpp) | 0 | ||||
-rw-r--r-- | toy/ToyDialect.cpp (renamed from mlir/ToyDialect.cpp) | 0 | ||||
-rw-r--r-- | toyc.cpp | 3 |
10 files changed, 31 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index f04ac1f..7c084ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,45 +11,40 @@ else() message(FATAL_ERROR "LLVM not found; it is derived from MLIR_INSTALL_PREFIX which has value of ${MLIR_INSTALL_PREFIX}") endif() +set (CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR};${CMAKE_MODULE_PATH}") +include(AddLLVM) + function(whole_archive_link target) if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") - set(link_flags "-L${CMAKE_BINARY_DIR}/lib ") + set(link_flags "") FOREACH(LIB ${ARGN}) string(CONCAT link_flags ${link_flags} "-Wl,-force_load ${CMAKE_BINARY_DIR}/lib/lib${LIB}.a ") ENDFOREACH(LIB) else() - set(link_flags "-L${CMAKE_BINARY_DIR}/lib -Wl,--whole-archive,") + set(link_flags "-Wl,--whole-archive,") FOREACH(LIB ${ARGN}) string(CONCAT link_flags ${link_flags} "-l${LIB},") ENDFOREACH(LIB) string(CONCAT link_flags ${link_flags} "--no-whole-archive") endif() - set_target_properties(${target} PROPERTIES LINK_FLAGS ${link_flags}) + set_target_properties(${target} PROPERTIES LINK_FLAGS "${link_flags}") endfunction(whole_archive_link) llvm_map_components_to_libnames(llvm_libs support) -if (NOT ${LLVM_ENABLE_RTTI}) - set(CMAKE_CXX_FLAGS "-fno-rtti ${CMAKE_CXX_FLAGS}") -endif() - include_directories( include ${LLVM_INCLUDE_DIR}) -link_directories(${LLVM_LIBRARY_DIR}) +link_directories( + ${LLVM_LIBRARY_DIR} + ${CMAKE_BINARY_DIR}) add_definitions(${LLVM_DEFINITIONS}) add_executable(toyc toyc.cpp parser/AST.cpp - mlir/EarlyLowering.cpp - mlir/LateLowering.cpp - mlir/MLIRGen.cpp - mlir/ShapeInferencePass.cpp - mlir/ToyDialect.cpp - mlir/ToyCombine.cpp ) target_link_libraries(toyc @@ -71,4 +66,9 @@ target_link_libraries(toyc MLIRSupport ) -whole_archive_link(toyc MLIRStandardOps MLIRAffineOps) +add_dependencies(toyc ToyDialect) + +llvm_update_compile_flags(toyc) +whole_archive_link(toyc ToyDialect MLIRStandardOps MLIRAffineOps) + +add_subdirectory(toy) diff --git a/toy/CMakeLists.txt b/toy/CMakeLists.txt new file mode 100644 index 0000000..1c7826e --- /dev/null +++ b/toy/CMakeLists.txt @@ -0,0 +1,6 @@ +file(GLOB globbed *.c *.cpp) +add_llvm_library(ToyDialect + ${globbed} + ) +#add_dependencies(MLIRStandardOps MLIRStandardOpsIncGen LLVMSupport) +#target_link_libraries(MLIRStandardOps LLVMSupport) diff --git a/mlir/EarlyLowering.cpp b/toy/EarlyLowering.cpp index 634c72e..634c72e 100644 --- a/mlir/EarlyLowering.cpp +++ b/toy/EarlyLowering.cpp diff --git a/mlir/LateLowering.cpp b/toy/LateLowering.cpp index eeae6ee..eeae6ee 100644 --- a/mlir/LateLowering.cpp +++ b/toy/LateLowering.cpp diff --git a/mlir/MLIRGen.cpp b/toy/MLIRGen.cpp index e2001fb..e2001fb 100644 --- a/mlir/MLIRGen.cpp +++ b/toy/MLIRGen.cpp diff --git a/toy/RegisterDialects.cpp b/toy/RegisterDialects.cpp new file mode 100644 index 0000000..7314cb2 --- /dev/null +++ b/toy/RegisterDialects.cpp @@ -0,0 +1,10 @@ +// +// Created by ztuowen on 4/27/19. +// + +#include "mlir/IR/Dialect.h" +#include "toy/Dialect.h" +#include "linalg1/Dialect.h" + +static mlir::DialectRegistration<toy::ToyDialect> Toy; +static mlir::DialectRegistration<linalg::LinalgDialect> Linalg; diff --git a/mlir/ShapeInferencePass.cpp b/toy/ShapeInferencePass.cpp index 7e3ea3f..7e3ea3f 100644 --- a/mlir/ShapeInferencePass.cpp +++ b/toy/ShapeInferencePass.cpp diff --git a/mlir/ToyCombine.cpp b/toy/ToyCombine.cpp index 8d6aed6..8d6aed6 100644 --- a/mlir/ToyCombine.cpp +++ b/toy/ToyCombine.cpp diff --git a/mlir/ToyDialect.cpp b/toy/ToyDialect.cpp index be117f5..be117f5 100644 --- a/mlir/ToyDialect.cpp +++ b/toy/ToyDialect.cpp @@ -297,9 +297,6 @@ int dumpAST() { int main(int argc, char **argv) { // Register our Dialects with MLIR - mlir::registerDialect<ToyDialect>(); - mlir::registerDialect<linalg::LinalgDialect>(); - mlir::registerPassManagerCLOptions(); cl::ParseCommandLineOptions(argc, argv, "toy compiler\n"); |