From fc1461874a6bcecc919f650d1bfb6bf37161c413 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Mon, 9 Nov 2020 14:35:34 +0100 Subject: Fix warnings, consolidate flowgraph/node.h --- flowgraph/node.h | 57 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) (limited to 'flowgraph/node.h') 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({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({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({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({destination, source})) + {} }; enum class JumpVariant @@ -83,15 +79,13 @@ namespace FlowGraph { { public: Jump(JumpVariant variant, Data& source0, Data& source1, std::shared_ptr destination): + Node(std::vector({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 m_destination; // successor on branch }; @@ -99,19 +93,21 @@ namespace FlowGraph { class Call: public Node { public: - Call(std::shared_ptr destination, std::vector arguments): m_destination(destination), m_arguments(arguments) {} + Call(std::shared_ptr destination, std::vector arguments): + Node(arguments), + m_destination(destination) + {} private: std::shared_ptr m_destination; - std::vector m_arguments; }; // Return from Subroutine class Return: public Node { public: - Return(std::vector returnValues): m_returnValues(returnValues) {} - private: - std::vector m_returnValues; + Return(std::vector 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({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({destination, source0, source1})), m_type(type) + Node(std::vector({destination, source0, source1})), + m_type(type) {} BinaryOperationType type() {return m_type;} private: -- cgit v1.2.3