Add Block::successors.
diff --git a/SPIRV/spvIR.h b/SPIRV/spvIR.h
index e763dbb..38e5197 100755
--- a/SPIRV/spvIR.h
+++ b/SPIRV/spvIR.h
@@ -162,9 +162,10 @@
Function& getParent() const { return parent; }
void addInstruction(std::unique_ptr<Instruction> inst);
- void addPredecessor(Block* pred) { predecessors.push_back(pred); }
+ void addPredecessor(Block* pred) { predecessors.push_back(pred); pred->successors.push_back(this);}
void addLocalVariable(std::unique_ptr<Instruction> inst) { localVariables.push_back(std::move(inst)); }
- int getNumPredecessors() const { return (int)predecessors.size(); }
+ const std::vector<Block*> getPredecessors() const { return predecessors; }
+ const std::vector<Block*> getSuccessors() const { return successors; }
void setUnreachable() { unreachable = true; }
bool isUnreachable() const { return unreachable; }
@@ -206,7 +207,7 @@
friend Function;
std::vector<std::unique_ptr<Instruction> > instructions;
- std::vector<Block*> predecessors;
+ std::vector<Block*> predecessors, successors;
std::vector<std::unique_ptr<Instruction> > localVariables;
Function& parent;