blob: 81217ce79eb1cb8642932e2ce80193442bbdf685 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include "node.h"
#include "data.h"
#include <boost/endian/conversion.hpp>
using namespace FlowGraph;
// 4 byte for now
Data FlowGraph::MakeConstantInt(int i)
{
std::vector<uint8_t> value(size_t(4));
*(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));
}
Data FlowGraph::MakeLocalPointer(const std::string& name)
{
return Data(DataType::Pointer, std::make_shared<LocalStorage>(name));
}
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));
}
|