summaryrefslogtreecommitdiffhomepage
path: root/flowgraph/node.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-11-16 12:48:44 +0100
committerRoland Reichwein <mail@reichwein.it>2020-11-16 12:48:44 +0100
commitc9cb051fae190acfc36813e4a23759fb9b9c3df3 (patch)
treefcd8c93cd5dc2a3272eac253b0291611e16ea13f /flowgraph/node.cpp
parent300219dc8519720a36525c7b40c6a327580fe0bd (diff)
Implement hierarchical evaluation (WIP)
Diffstat (limited to 'flowgraph/node.cpp')
-rw-r--r--flowgraph/node.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/flowgraph/node.cpp b/flowgraph/node.cpp
index e0912dc..2d757f9 100644
--- a/flowgraph/node.cpp
+++ b/flowgraph/node.cpp
@@ -4,6 +4,8 @@
#include <boost/endian/conversion.hpp>
+#include <memory>
+
using namespace FlowGraph;
FlowGraph::Data& Node::destination()
@@ -19,22 +21,28 @@ Data FlowGraph::MakeConstantInt(int i)
{
std::vector<uint8_t> value(size_t(4), uint8_t(0));
*(reinterpret_cast<int32_t*>(value.data())) = boost::endian::native_to_little(static_cast<int32_t>(i));
- return Data(DataType::Int, std::make_shared<Constant>(value));
+ return Data{DataType::Int, std::make_shared<Constant>(value)};
}
Data FlowGraph::MakeLocalPointer(FlowGraph::LocalScope& scope, const std::string& name)
{
- return Data(DataType::Pointer, std::make_shared<LocalStorage>(scope, name));
+ Data data{DataType::Pointer, std::make_shared<LocalStorage>(scope, name)};
+ scope.push_back(std::make_shared<Data>(data));
+ return data;
}
Data FlowGraph::MakeLocalSize(FlowGraph::LocalScope& scope, const std::string& name)
{
- return Data(DataType::Size, std::make_shared<LocalStorage>(scope, name));
+ Data data{DataType::Size, std::make_shared<LocalStorage>(scope, name)};
+ scope.push_back(std::make_shared<Data>(data));
+ return data;
}
Data FlowGraph::MakeTemporaryInt(FlowGraph::LocalScope& scope)
{
- return Data(DataType::Int, std::make_shared<TemporaryStorage>(scope));
+ Data data{DataType::Int, std::make_shared<TemporaryStorage>(scope)};
+ scope.push_back(std::make_shared<Data>(data));
+ return data;
}
LocalScope& CreateScopeOp::scope()