Reduce PassDriver overhead, clean up Pass and PassDriver.
Remove name lookup map and use vector for the pass list.
Add traversal mode kNoNodes to skip BasicBlock traversal.
Replace the warn_override parameter with a DCHECK.
Move iterators from arena to the stack. Style cleanup.
Change-Id: I4bf10e28caa65efb98ce82a4d7486d803ceca535
diff --git a/compiler/dex/pass.h b/compiler/dex/pass.h
index c52ddf5..255892e 100644
--- a/compiler/dex/pass.h
+++ b/compiler/dex/pass.h
@@ -41,6 +41,7 @@
kRepeatingPostOrderDFSTraversal, /**< @brief Depth-First-Search / Repeating Post-Order. */
kRepeatingReversePostOrderDFSTraversal, /**< @brief Depth-First-Search / Repeating Reverse Post-Order. */
kPostOrderDOMTraversal, /**< @brief Dominator tree / Post-Order. */
+ kNoNodes, /**< @brief Skip BasicBlock traversal. */
};
/**
@@ -50,20 +51,22 @@
*/
class Pass {
public:
- Pass(const char *name, DataFlowAnalysisMode type, bool freed, const unsigned int f, const char *dump): pass_name_(name), traversal_type_(type), flags_(f), dump_cfg_folder_(dump) {
+ explicit Pass(const char* name, DataFlowAnalysisMode type = kAllNodes,
+ unsigned int flags = 0u, const char* dump = "")
+ : pass_name_(name), traversal_type_(type), flags_(flags), dump_cfg_folder_(dump) {
}
- Pass(const char *name, const char *dump): pass_name_(name), traversal_type_(kAllNodes), flags_(0), dump_cfg_folder_(dump) {
+ Pass(const char* name, DataFlowAnalysisMode type, const char* dump)
+ : pass_name_(name), traversal_type_(type), flags_(0), dump_cfg_folder_(dump) {
}
- explicit Pass(const char *name):pass_name_(name), traversal_type_(kAllNodes), flags_(0), dump_cfg_folder_("") {
+ Pass(const char* name, const char* dump)
+ : pass_name_(name), traversal_type_(kAllNodes), flags_(0), dump_cfg_folder_(dump) {
}
- Pass(const char *name, DataFlowAnalysisMode type, const char *dump):pass_name_(name), traversal_type_(type), flags_(false), dump_cfg_folder_(dump) {
+ virtual ~Pass() {
}
- virtual ~Pass() {}
-
virtual const char* GetName() const {
return pass_name_;
}
@@ -76,14 +79,16 @@
return (flags_ & flag);
}
- const char* GetDumpCFGFolder() const {return dump_cfg_folder_;}
+ const char* GetDumpCFGFolder() const {
+ return dump_cfg_folder_;
+ }
/**
* @brief Gate for the pass: determines whether to execute the pass or not considering a CompilationUnit
* @param c_unit the CompilationUnit.
* @return whether or not to execute the pass
*/
- virtual bool Gate(const CompilationUnit *c_unit) const {
+ virtual bool Gate(const CompilationUnit* c_unit) const {
// Unused parameter.
UNUSED(c_unit);
@@ -95,7 +100,7 @@
* @brief Start of the pass: called before the WalkBasicBlocks function
* @param c_unit the considered CompilationUnit.
*/
- virtual void Start(CompilationUnit *c_unit) const {
+ virtual void Start(CompilationUnit* c_unit) const {
// Unused parameter.
UNUSED(c_unit);
}
@@ -104,7 +109,7 @@
* @brief End of the pass: called after the WalkBasicBlocks function
* @param c_unit the considered CompilationUnit.
*/
- virtual void End(CompilationUnit *c_unit) const {
+ virtual void End(CompilationUnit* c_unit) const {
// Unused parameter.
UNUSED(c_unit);
}
@@ -115,7 +120,7 @@
* @param bb the BasicBlock.
* @return whether or not there is a change when walking the BasicBlock
*/
- virtual bool WalkBasicBlocks(CompilationUnit *c_unit, BasicBlock *bb) const {
+ virtual bool WalkBasicBlocks(CompilationUnit* c_unit, BasicBlock* bb) const {
// Unused parameters.
UNUSED(c_unit);
UNUSED(bb);