diff options
Diffstat (limited to 'flowgraph/node.h')
-rw-r--r-- | flowgraph/node.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/flowgraph/node.h b/flowgraph/node.h index 77395f0..5ea194d 100644 --- a/flowgraph/node.h +++ b/flowgraph/node.h @@ -19,8 +19,11 @@ namespace FlowGraph { public: Node(){} Node(std::vector<Data> operands): mOperands(operands) {} - std::vector<Data>& operands() { return mOperands; } virtual ~Node() {}; // force class to be polymorphic (e.g. in a container) + + std::vector<Data>& operands() { return mOperands; } + Data& destination(); // best-effort return of result/destination; else throw + private: std::vector<Data> mOperands; }; @@ -115,7 +118,6 @@ namespace FlowGraph { Increment, Decrement, Negate, - Store // just take Data as-is to store it at destination }; class UnaryOperation: public Node @@ -130,6 +132,16 @@ namespace FlowGraph { UnaryOperationType m_type; }; + // Just take a value e.g. Immediate and store it for later use. + // Should be optimized out later. + class DataNode: public Node + { + public: + DataNode(Data& value): + Node(std::vector<Data>({value})) + {} + }; + enum class BinaryOperationType: int { Add, |