#include "node.h" #include "data.h" #include 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 value(size_t(4), uint8_t(0)); *(reinterpret_cast(value.data())) = boost::endian::native_to_little(static_cast(i)); return Data(DataType::Int, std::make_shared(value)); } Data FlowGraph::MakeLocalPointer(FlowGraph::LocalScope& scope, const std::string& name) { return Data(DataType::Pointer, std::make_shared(scope, name)); } Data FlowGraph::MakeLocalSize(FlowGraph::LocalScope& scope, const std::string& name) { return Data(DataType::Size, std::make_shared(scope, name)); } Data FlowGraph::MakeTemporaryInt(FlowGraph::LocalScope& scope) { return Data(DataType::Int, std::make_shared(scope)); } LocalScope& CreateScopeOp::scope() { return m_scope; }