[Scummvm-cvs-logs] SF.net SVN: scummvm:[50628] tools/branches/gsoc2010-decompiler/decompiler
pidgeot at users.sourceforge.net
pidgeot at users.sourceforge.net
Sat Jul 3 21:51:20 CEST 2010
Revision: 50628
http://scummvm.svn.sourceforge.net/scummvm/?rev=50628&view=rev
Author: pidgeot
Date: 2010-07-03 19:51:18 +0000 (Sat, 03 Jul 2010)
Log Message:
-----------
Rename EdgeRange to OutEdgeRange
Add some explanatory comments
Modified Paths:
--------------
tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp
tools/branches/gsoc2010-decompiler/decompiler/graph.h
Modified: tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp 2010-07-03 19:37:50 UTC (rev 50627)
+++ tools/branches/gsoc2010-decompiler/decompiler/control_flow.cpp 2010-07-03 19:51:18 UTC (rev 50628)
@@ -97,7 +97,7 @@
} while (gr2->_start != gr2->_end && it != gr2->_end);
// Add outgoing edges from g2
- EdgeRange r = boost::out_edges(g2, _g);
+ OutEdgeRange r = boost::out_edges(g2, _g);
for (OutEdgeIterator e = r.first; e != r.second; ++e) {
boost::add_edge(g1, boost::target(*e, _g), _g);
}
@@ -126,7 +126,7 @@
if (boost::out_degree(g, _g) == 0)
return;
- EdgeRange r = boost::out_edges(g, _g);
+ OutEdgeRange r = boost::out_edges(g, _g);
for (OutEdgeIterator e = r.first; e != r.second; ++e) {
setStackLevel(boost::target(*e, _g), level + gr->_start->_stackChange);
}
@@ -188,18 +188,19 @@
bool doMerge = false;
cur = find(gr->_start);
GraphVertex prev = find(gr->_prev->_start);
+ // Block is candidate for short-circuit merging if it and the preceding block both end with conditional jumps
if (out_degree(cur, _g) == 2 && out_degree(prev, _g) == 2) {
doMerge = true;
- EdgeRange rCur = boost::out_edges(cur, _g);
+ OutEdgeRange rCur = boost::out_edges(cur, _g);
std::vector<GraphVertex> succs;
- //Find possible target vertices
+ // Find possible target vertices
for (OutEdgeIterator it = rCur.first; it != rCur.second; ++it) {
succs.push_back(boost::target(*it, _g));
}
- //Check if vertex would add new targets - if yes, don't merge
- EdgeRange rPrev = boost::out_edges(prev, _g);
+ // Check if vertex would add new targets - if yes, don't merge
+ OutEdgeRange rPrev = boost::out_edges(prev, _g);
for (OutEdgeIterator it = rPrev.first; it != rPrev.second; ++it) {
GraphVertex target = boost::target(*it, _g);
doMerge &= (std::find(succs.begin(), succs.end(), target) != succs.end() || target == cur);
@@ -228,10 +229,12 @@
VertexRange vr = boost::vertices(_g);
for (VertexIterator v = vr.first; v != vr.second; ++v) {
Group *gr = GET(*v);
+ // Block ends with conditional jump and has not yet been determined
if (out_degree(*v, _g) == 2 && gr->_type == kNormal) {
InEdgeRange ier = boost::in_edges(*v, _g);
for (InEdgeIterator e = ier.first; e != ier.second; ++e) {
Group *sourceGr = GET(boost::source(*e, _g));
+ // Block has ingoing edge from later in the code
if (sourceGr->_start->_address > gr->_start->_address)
gr->_type = kWhileCond;
}
Modified: tools/branches/gsoc2010-decompiler/decompiler/graph.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/graph.h 2010-07-03 19:37:50 UTC (rev 50627)
+++ tools/branches/gsoc2010-decompiler/decompiler/graph.h 2010-07-03 19:51:18 UTC (rev 50628)
@@ -189,7 +189,7 @@
/**
* Type representing a range of edges from boost::out_edges.
*/
-typedef std::pair<OutEdgeIterator, OutEdgeIterator> EdgeRange;
+typedef std::pair<OutEdgeIterator, OutEdgeIterator> OutEdgeRange;
/**
* Type representing a range of edges from boost::in_edges.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list