From b2a64aeb8419813d4aaa4e49a7448abc62481219 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Fri, 28 Sep 2018 15:09:46 +0900 Subject: [PATCH] [enco] Introduce make_backend function (#1667) This commit introduces make_backend function which will abstract Backend instance creation. Signed-off-by: Jonghyun Park --- contrib/enco/core/CMakeLists.txt | 1 + contrib/enco/core/include/enco/Backend.h | 5 +++++ contrib/enco/core/src/Backend.cpp | 11 +++++++++++ 3 files changed, 17 insertions(+) diff --git a/contrib/enco/core/CMakeLists.txt b/contrib/enco/core/CMakeLists.txt index a4ceaf4..38debe7 100644 --- a/contrib/enco/core/CMakeLists.txt +++ b/contrib/enco/core/CMakeLists.txt @@ -6,6 +6,7 @@ add_library(enco_core STATIC ${SOURCES}) set_target_properties(enco_core PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(enco_core PRIVATE src) target_include_directories(enco_core PUBLIC include) +target_link_libraries(enco_core enco_intf_cmdline) target_link_libraries(enco_core coco_core) target_link_libraries(enco_core coco_generic) target_link_libraries(enco_core pp) diff --git a/contrib/enco/core/include/enco/Backend.h b/contrib/enco/core/include/enco/Backend.h index d4531f8..23e57ef 100644 --- a/contrib/enco/core/include/enco/Backend.h +++ b/contrib/enco/core/include/enco/Backend.h @@ -1,10 +1,13 @@ #ifndef __ENCO_BACKEND_H__ #define __ENCO_BACKEND_H__ +#include "cmdline/View.h" + #include "coco/IR/Module.h" #include "coco/IR/Data.h" #include +#include namespace enco { @@ -26,4 +29,6 @@ private: } // namespace enco +extern "C" std::unique_ptr make_backend(const cmdline::View &); + #endif // __ENCO_BACKEND_H__ diff --git a/contrib/enco/core/src/Backend.cpp b/contrib/enco/core/src/Backend.cpp index d3a7bb2..afdc3e5 100644 --- a/contrib/enco/core/src/Backend.cpp +++ b/contrib/enco/core/src/Backend.cpp @@ -11,8 +11,12 @@ #include "Lower.h" +#include + #include +using nncc::foundation::make_unique; + namespace { @@ -82,3 +86,10 @@ void Backend::compile(coco::Module *m, coco::Data *d) } } // namespace enco + +#include + +std::unique_ptr make_backend(const cmdline::View &) +{ + return make_unique(std::cout); +} -- 2.7.4