OSDN Git Service

IRProcessor を追加
authorstarg <starg@users.osdn.me>
Sat, 20 Aug 2016 11:07:25 +0000 (20:07 +0900)
committerstarg <starg@users.osdn.me>
Sat, 20 Aug 2016 11:20:22 +0000 (20:20 +0900)
include/irprocessor/irprocessor.hpp [new file with mode: 0644]
src/CMakeLists.txt
src/driver/CMakeLists.txt
src/driver/driver.cpp
src/irprocessor/CMakeLists.txt [new file with mode: 0644]
src/irprocessor/irprocessor.cpp [new file with mode: 0644]
src/irprocessor/pch.cpp [new file with mode: 0644]
src/irprocessor/pch.hpp [new file with mode: 0644]

diff --git a/include/irprocessor/irprocessor.hpp b/include/irprocessor/irprocessor.hpp
new file mode 100644 (file)
index 0000000..442ae16
--- /dev/null
@@ -0,0 +1,31 @@
+
+#pragma once
+
+#include <compiler/base.hpp>
+#include <ir/module.hpp>
+
+namespace YAMML
+{
+
+namespace IRProcessor
+{
+
+class IRCompiler : public Compiler::CompilerBase
+{
+public:
+    template<typename T>
+    IRCompiler(const IR::Module& ir, T func) : CompilerBase(func), m_IR(ir)
+    {
+    }
+
+    bool Compile();
+
+    const IR::Module& GetIR() const;
+
+private:
+    IR::Module m_IR;
+};
+
+} // namespace IRProcessor
+
+} // namespace YAMML
index ad95c12..092387e 100644 (file)
@@ -2,5 +2,6 @@
 add_subdirectory(ast2ir)
 add_subdirectory(driver)
 add_subdirectory(ir2midi)
+add_subdirectory(irprocessor)
 add_subdirectory(midiwriter)
 add_subdirectory(parser)
index d9a91dd..6e9e529 100644 (file)
@@ -21,5 +21,5 @@ else()
 endif()
 
 yamml_add_executable(yamml DriverSources DriverHeaders)
-target_link_libraries(yamml AST2IR IR2MIDI MIDIWriter Parser Boost::program_options)
+target_link_libraries(yamml AST2IR IR2MIDI IRProcessor MIDIWriter Parser Boost::program_options)
 
index 598fb57..7dc79cb 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <ast2ir/ast2ir.hpp>
 #include <ir2midi/ir2midi.hpp>
+#include <irprocessor/irprocessor.hpp>
 #include <midiwriter/midiwriter.hpp>
 #include <parser/parser.hpp>
 
@@ -36,7 +37,14 @@ boost::optional<std::vector<std::uint8_t>> CompileYAMML(
             return {};
         }
 
-        IR2MIDI::IR2MIDICompiler ir2midi(ast2ir.GetIR().value(), callback);
+        IRProcessor::IRCompiler irProc(ast2ir.GetIR().value(), callback);
+
+        if (!irProc.Compile())
+        {
+            return {};
+        }
+
+        IR2MIDI::IR2MIDICompiler ir2midi(irProc.GetIR(), callback);
 
         if (!ir2midi.Compile(entryPoint))
         {
diff --git a/src/irprocessor/CMakeLists.txt b/src/irprocessor/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c3da93d
--- /dev/null
@@ -0,0 +1,10 @@
+
+set(IRProcessorHeaders
+    ../../include/irprocessor/irprocessor.hpp
+)
+
+set(IRProcessorSources
+    irprocessor.cpp
+)
+
+yamml_add_library(IRProcessor STATIC IRProcessorSources IRProcessorHeaders)
diff --git a/src/irprocessor/irprocessor.cpp b/src/irprocessor/irprocessor.cpp
new file mode 100644 (file)
index 0000000..19a9f9a
--- /dev/null
@@ -0,0 +1,22 @@
+
+#include <irprocessor/irprocessor.hpp>
+
+namespace YAMML
+{
+
+namespace IRProcessor
+{
+
+bool IRCompiler::Compile()
+{
+    return true;
+}
+
+const IR::Module& IRCompiler::GetIR() const
+{
+    return m_IR;
+}
+
+} // namespace IRProcessor
+
+} // namespace YAMML
diff --git a/src/irprocessor/pch.cpp b/src/irprocessor/pch.cpp
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/irprocessor/pch.hpp b/src/irprocessor/pch.hpp
new file mode 100644 (file)
index 0000000..82b185e
--- /dev/null
@@ -0,0 +1,11 @@
+
+#pragma once
+
+#include <algorithm>
+#include <functional>
+#include <string>
+#include <unordered_map>
+#include <utility>
+#include <vector>
+
+#include <boost/variant.hpp>