[Scummvm-cvs-logs] SF.net SVN: scummvm:[51286] tools/branches/gsoc2010-decompiler/decompiler
pidgeot at users.sourceforge.net
pidgeot at users.sourceforge.net
Mon Jul 26 00:32:55 CEST 2010
Revision: 51286
http://scummvm.svn.sourceforge.net/scummvm/?rev=51286&view=rev
Author: pidgeot
Date: 2010-07-25 22:32:54 +0000 (Sun, 25 Jul 2010)
Log Message:
-----------
Allow engines to stop decompilation between steps
Engines can state they do not support code flow analysis or code
generation, and the decompiler will then stop before the unsupported
step.
This makes it easier to add and debug engines, as you don't have to
add the right command line parameter every time you run the program.
If the methods are not overridden, the default is to proceed.
Modified Paths:
--------------
tools/branches/gsoc2010-decompiler/decompiler/decompiler.cpp
tools/branches/gsoc2010-decompiler/decompiler/engine.h
tools/branches/gsoc2010-decompiler/decompiler/kyra/engine.h
Modified: tools/branches/gsoc2010-decompiler/decompiler/decompiler.cpp
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/decompiler.cpp 2010-07-25 22:16:50 UTC (rev 51285)
+++ tools/branches/gsoc2010-decompiler/decompiler/decompiler.cpp 2010-07-25 22:32:54 UTC (rev 51286)
@@ -120,7 +120,7 @@
disassembler->dumpDisassembly(out);
}
- if (vm.count("only-disassembly") || insts.empty()) {
+ if (!engine->supportsCodeFlow() || vm.count("only-disassembly") || insts.empty()) {
if (!vm.count("dump-disassembly")) {
disassembler->dumpDisassembly(std::cout);
}
@@ -150,7 +150,7 @@
boost::write_graphviz(out, g, boost::make_label_writer(get(boost::vertex_name, g)), boost::makeArrowheadWriter(get(boost::edge_attribute, g)), GraphProperties());
}
- if (vm.count("only-graph")) {
+ if (!engine->supportsCodeGen() || vm.count("only-graph")) {
if (!vm.count("dump-graph")) {
boost::write_graphviz(std::cout, g, boost::make_label_writer(get(boost::vertex_name, g)), boost::makeArrowheadWriter(get(boost::edge_attribute, g)), GraphProperties());
}
Modified: tools/branches/gsoc2010-decompiler/decompiler/engine.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/engine.h 2010-07-25 22:16:50 UTC (rev 51285)
+++ tools/branches/gsoc2010-decompiler/decompiler/engine.h 2010-07-25 22:32:54 UTC (rev 51286)
@@ -55,6 +55,20 @@
* @return Pointer to a CodeGenerator for the engine.
*/
virtual CodeGenerator *getCodeGenerator(std::ostream &output) = 0;
+
+ /**
+ * Whether or not code flow analysis is supported for this engine.
+ *
+ * @return True if supported, false if not. If false is returned, code flow analysis should not take place, and -D should be implied.
+ */
+ virtual bool supportsCodeFlow() { return true; }
+
+ /**
+ * Whether or not code generation is supported for this engine.
+ *
+ * @return True if supported, false if not. If false is returned, code generation should not take place, and -G should be implied.
+ */
+ virtual bool supportsCodeGen() { return true; }
};
#endif
Modified: tools/branches/gsoc2010-decompiler/decompiler/kyra/engine.h
===================================================================
--- tools/branches/gsoc2010-decompiler/decompiler/kyra/engine.h 2010-07-25 22:16:50 UTC (rev 51285)
+++ tools/branches/gsoc2010-decompiler/decompiler/kyra/engine.h 2010-07-25 22:32:54 UTC (rev 51286)
@@ -35,6 +35,8 @@
::Disassembler *getDisassembler() const;
uint32 getDestAddress(ConstInstIterator it) const;
::CodeGenerator *getCodeGenerator(std::ostream &output);
+ bool supportsCodeFlow() { return false; }
+ bool supportsCodeGen() { return false; }
};
} // End of namespace KYRA
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