From ff69e8cab318101843cd8b49a0cb04df9763e10f Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 22 Nov 2020 22:14:23 +0100 Subject: Generalize Add / Mul, Integer promotion, tests --- flowgraph/node.cpp | 7 +++++++ flowgraph/node.h | 3 +++ 2 files changed, 10 insertions(+) (limited to 'flowgraph') diff --git a/flowgraph/node.cpp b/flowgraph/node.cpp index cb7677a..27310a9 100644 --- a/flowgraph/node.cpp +++ b/flowgraph/node.cpp @@ -16,6 +16,13 @@ FlowGraph::Data& Node::destination() return mOperands[0]; } +Data FlowGraph::MakeTemporary(std::shared_ptr scope, DataType type) +{ + Data data{type, std::make_shared()}; + scope->push_back(std::make_shared(data)); + return data; +} + // 4 byte for now Data FlowGraph::MakeConstantInt(int i) { diff --git a/flowgraph/node.h b/flowgraph/node.h index 34e937b..f653096 100644 --- a/flowgraph/node.h +++ b/flowgraph/node.h @@ -47,6 +47,8 @@ namespace FlowGraph { {} }; + Data MakeTemporary(std::shared_ptr scope, DataType type); + Data MakeConstantInt(int i); Data MakeLocalInt(std::shared_ptr scope, const std::string& name); Data MakeLocalPointer(std::shared_ptr scope, const std::string& name); @@ -120,6 +122,7 @@ namespace FlowGraph { LogicalNot, BitwiseNot, Minus, + Resize, // Promote / narrow a value }; class UnaryOperation: public Node -- cgit v1.2.3