diff options
| author | Rusty Wagner <rusty@vector35.com> | 2017-06-27 22:44:07 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2017-06-27 22:44:07 -0400 |
| commit | 5352b89b827c4f33fadbb21be19222eb2b714cc4 (patch) | |
| tree | da453e497860a69af149b64b2b23ba750bd56007 /basicblock.cpp | |
| parent | cca0fe6ea60eb7f6b35cc433a6fff96cc65b3ff8 (diff) | |
Compute back edges in the core
Diffstat (limited to 'basicblock.cpp')
| -rw-r--r-- | basicblock.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/basicblock.cpp b/basicblock.cpp index 7eb37c57..c2a2bddf 100644 --- a/basicblock.cpp +++ b/basicblock.cpp @@ -125,6 +125,7 @@ vector<BasicBlockEdge> BasicBlock::GetOutgoingEdges() const BasicBlockEdge edge; edge.type = array[i].type; edge.target = array[i].target ? new BasicBlock(BNNewBasicBlockReference(array[i].target)) : nullptr; + edge.backEdge = array[i].backEdge; result.push_back(edge); } @@ -144,6 +145,7 @@ vector<BasicBlockEdge> BasicBlock::GetIncomingEdges() const BasicBlockEdge edge; edge.type = array[i].type; edge.target = array[i].target ? new BasicBlock(BNNewBasicBlockReference(array[i].target)) : nullptr; + edge.backEdge = array[i].backEdge; result.push_back(edge); } @@ -397,5 +399,10 @@ void BasicBlock::SetUserBasicBlockHighlight(uint8_t r, uint8_t g, uint8_t b, uin bool BasicBlock::IsBackEdge(BasicBlock* source, BasicBlock* target) { - return source->GetDominators().count(target) != 0; + for (auto& i : source->GetOutgoingEdges()) + { + if (i.target->GetObject() == target->GetObject()) + return i.backEdge; + } + return false; } |
