diff options
Diffstat (limited to 'flowgraph')
-rw-r--r-- | flowgraph/node.cpp | 4 | ||||
-rw-r--r-- | flowgraph/node.h | 7 | ||||
-rw-r--r-- | flowgraph/storage.h | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/flowgraph/node.cpp b/flowgraph/node.cpp index f81a7e1..81217ce 100644 --- a/flowgraph/node.cpp +++ b/flowgraph/node.cpp @@ -24,3 +24,7 @@ Data FlowGraph::MakeLocalSize(const std::string& name) return Data(DataType::Size, std::make_shared<LocalStorage>(name)); } +Data FlowGraph::MakeTemporaryInt(FlowGraph::LocalScope& scope) +{ + return Data(DataType::Int, std::make_shared<TemporaryStorage>(scope)); +} diff --git a/flowgraph/node.h b/flowgraph/node.h index aa9d333..c1b7380 100644 --- a/flowgraph/node.h +++ b/flowgraph/node.h @@ -41,6 +41,7 @@ namespace FlowGraph { Data MakeConstantInt(int i); Data MakeLocalPointer(const std::string& name); Data MakeLocalSize(const std::string& name); + Data MakeTemporaryInt(LocalScope& scope); class MemCopy: public Node { @@ -117,8 +118,9 @@ namespace FlowGraph { class UnaryOperation: public Node { public: - UnaryOperation(Data& destination, Data& source): m_destination(destination), m_source(source) {} + UnaryOperation(UnaryOperationType type, Data& destination, Data& source): m_type(type), m_destination(destination), m_source(source) {} private: + UnaryOperationType m_type; Data m_destination; Data m_source; }; @@ -143,8 +145,9 @@ namespace FlowGraph { class BinaryOperation: public Node { public: - BinaryOperation(Data& destination, Data& source0, Data& source1): m_destination(destination), m_source0(source0), m_source1(source1) {} + BinaryOperation(BinaryOperationType type, Data& destination, Data& source0, Data& source1): m_type(type), m_destination(destination), m_source0(source0), m_source1(source1) {} private: + BinaryOperationType m_type; Data m_destination; Data m_source0; Data m_source1; diff --git a/flowgraph/storage.h b/flowgraph/storage.h index efd7d52..28aae1e 100644 --- a/flowgraph/storage.h +++ b/flowgraph/storage.h @@ -50,6 +50,7 @@ namespace FlowGraph { class LocalScope { public: + LocalScope() = default; size_t getNewIndex() { return m_index++; } private: size_t m_index{ 0 }; |