Commit 4f2a71af authored by Paul's avatar Paul
Browse files

Track the ouput of instructions

parent 323f2714
...@@ -22,6 +22,7 @@ struct instruction ...@@ -22,6 +22,7 @@ struct instruction
operation op; operation op;
shape result; shape result;
std::vector<instruction_ref> output;
std::vector<instruction_ref> arguments; std::vector<instruction_ref> arguments;
literal lit; literal lit;
}; };
......
...@@ -29,7 +29,9 @@ instruction_ref program::add_instruction(operation op, std::vector<instruction_r ...@@ -29,7 +29,9 @@ instruction_ref program::add_instruction(operation op, std::vector<instruction_r
shape r = op.compute_shape(shapes); shape r = op.compute_shape(shapes);
impl->instructions.push_back({op, r, args}); impl->instructions.push_back({op, r, args});
assert(impl->instructions.back().arguments == args); assert(impl->instructions.back().arguments == args);
return std::prev(impl->instructions.end()); auto result = std::prev(impl->instructions.end());
for(auto&& arg:args) arg->output.push_back(result);
return result;
} }
instruction_ref program::add_literal(literal l) instruction_ref program::add_literal(literal l)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment