blob: e0912dc97355545c1f0c0fe9b0e361fcf5c770c6 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include "node.h"
#include "data.h"
#include <boost/endian/conversion.hpp>
using namespace FlowGraph;
FlowGraph::Data& Node::destination()
{
if (mOperands.size() < 1)
throw std::runtime_error("ICE: No destination operand available");
return mOperands[0];
}
// 4 byte for now
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));
}
Data FlowGraph::MakeLocalPointer(FlowGraph::LocalScope& scope, const std::string& name)
{
return Data(DataType::Pointer, std::make_shared<LocalStorage>(scope, name));
}
Data FlowGraph::MakeLocalSize(FlowGraph::LocalScope& scope, const std::string& name)
{
return Data(DataType::Size, std::make_shared<LocalStorage>(scope, name));
}
Data FlowGraph::MakeTemporaryInt(FlowGraph::LocalScope& scope)
{
return Data(DataType::Int, std::make_shared<TemporaryStorage>(scope));
}
LocalScope& CreateScopeOp::scope()
{
return m_scope;
}
|