#include "node.h" #include "byteorder.h" #include "data.h" #include "minicc.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) { return Data{DataType::Int, std::make_shared(endian::to_little(uint32_t(i)))}; } Data FlowGraph::MakeLocalPointer(std::shared_ptr scope, const std::string& name) { Data data{DataType::Pointer, std::make_shared(name)}; scope->push_back(std::make_shared(data)); return data; } Data FlowGraph::MakeLocalSize(std::shared_ptr scope, const std::string& name) { Data data{DataType::Size, std::make_shared(name)}; scope->push_back(std::make_shared(data)); return data; } Data FlowGraph::MakeTemporaryInt(std::shared_ptr scope) { Data data{DataType::Int, std::make_shared()}; scope->push_back(std::make_shared(data)); return data; } FlowGraph::CreateScopeOp::CreateScopeOp(): m_scope(std::make_shared()) { } std::shared_ptr FlowGraph::CreateScopeOp::scope() { return m_scope; } FlowGraph::DestroyScopeOp::DestroyScopeOp(std::shared_ptr scope): m_scope(std::make_shared()) { }