summaryrefslogtreecommitdiffhomepage
path: root/flowgraph/node.h
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-11-09 14:35:34 +0100
committerRoland Reichwein <mail@reichwein.it>2020-11-09 14:35:34 +0100
commitfc1461874a6bcecc919f650d1bfb6bf37161c413 (patch)
tree0295888945de1716d17cd180d8dd3ff00315e2bd /flowgraph/node.h
parent414953eba1b1cc3570da1e59dc2392ce1b1ae5ef (diff)
Fix warnings, consolidate flowgraph/node.h
Diffstat (limited to 'flowgraph/node.h')
-rw-r--r--flowgraph/node.h57
1 files changed, 28 insertions, 29 deletions
diff --git a/flowgraph/node.h b/flowgraph/node.h
index 853b017..d4a1306 100644
--- a/flowgraph/node.h
+++ b/flowgraph/node.h
@@ -29,18 +29,17 @@ namespace FlowGraph {
class AllocateDynamic: public Node
{
public:
- AllocateDynamic(Data& location, Data& size): m_location(location), m_size(size) {}
- private:
- Data m_location; // in/out: Pointer
- Data m_size; // in: Size
+ AllocateDynamic(Data& location, Data& size):
+ Node(std::vector<Data>({location, size})) // in/out: Pointer; in: Size
+ {}
};
class DeallocateDynamic: public Node
{
public:
- DeallocateDynamic(Data& location) : m_location(location) {} // in
- private:
- Data m_location; // in: Pointer
+ DeallocateDynamic(Data& location):
+ Node(std::vector<Data>({location})) // in: Pointer
+ {}
};
Data MakeConstantInt(int i);
@@ -51,20 +50,17 @@ namespace FlowGraph {
class MemCopy: public Node
{
public:
- MemCopy(Data& destination, Data& source, Data& size): m_destination(destination), m_source(source), m_size(size) {}
- private:
- Data m_destination; // Pointer
- Data m_source; // Pointer
- Data m_size; // in bytes
+ MemCopy(Data& destination, Data& source, Data& size): // Pointer, Pointer, size in bytes
+ Node(std::vector<Data>({destination, source, size}))
+ {}
};
class Move: public Node
{
public:
- Move(Data& destination, Data& source): m_destination(destination), m_source(source) {}
- private:
- Data m_destination;
- Data m_source;
+ Move(Data& destination, Data& source):
+ Node(std::vector<Data>({destination, source}))
+ {}
};
enum class JumpVariant
@@ -83,15 +79,13 @@ namespace FlowGraph {
{
public:
Jump(JumpVariant variant, Data& source0, Data& source1, std::shared_ptr<Node> destination):
+ Node(std::vector<Data>({source0, source1})),
m_variant(variant),
- m_source0(source0),
- m_source1(source1),
m_destination(destination)
{}
+ JumpVariant variant() { return m_variant; }
private:
JumpVariant m_variant;
- Data m_source0;
- Data m_source1;
std::shared_ptr<Node> m_destination; // successor on branch
};
@@ -99,19 +93,21 @@ namespace FlowGraph {
class Call: public Node
{
public:
- Call(std::shared_ptr<Node> destination, std::vector<Data> arguments): m_destination(destination), m_arguments(arguments) {}
+ Call(std::shared_ptr<Node> destination, std::vector<Data> arguments):
+ Node(arguments),
+ m_destination(destination)
+ {}
private:
std::shared_ptr<Node> m_destination;
- std::vector<Data> m_arguments;
};
// Return from Subroutine
class Return: public Node
{
public:
- Return(std::vector<Data> returnValues): m_returnValues(returnValues) {}
- private:
- std::vector<Data> m_returnValues;
+ Return(std::vector<Data> returnValues):
+ Node(returnValues)
+ {}
};
enum class UnaryOperationType {
@@ -123,11 +119,13 @@ namespace FlowGraph {
class UnaryOperation: public Node
{
public:
- UnaryOperation(UnaryOperationType type, Data& destination, Data& source): m_type(type), m_destination(destination), m_source(source) {}
+ UnaryOperation(UnaryOperationType type, Data& destination, Data& source):
+ Node(std::vector<Data>({destination, source})),
+ m_type(type)
+ {}
+ UnaryOperationType type() { return m_type; }
private:
UnaryOperationType m_type;
- Data m_destination;
- Data m_source;
};
enum class BinaryOperationType {
@@ -151,7 +149,8 @@ namespace FlowGraph {
{
public:
BinaryOperation(BinaryOperationType type, Data& destination, Data& source0, Data& source1):
- Node(std::vector<Data>({destination, source0, source1})), m_type(type)
+ Node(std::vector<Data>({destination, source0, source1})),
+ m_type(type)
{}
BinaryOperationType type() {return m_type;}
private: