Added pass framework

The patch adds a Middle-End pass system and normalizes the current
 passes into the pass framework.

Passes have:
 - A start, work, and end functions.
 - A gate to determine to apply the pass.
 - Can provide a CFG dump folder.

mir_dataflow.cc, mir_graph.cc, mir_optimization.cc, ssa_transformation.cc:
 - Changed due to moving code into bb_optimizations.cc.
 - Moved certain functions from private to public due to needed from the passes.

pass.cc, pass.h:
 - Pass base class

pass_driver.cc, pass_driver.h:
 - The pass driver implementation.

frontend.cc:
 - Replace the function calls to the passes with the pass driver.

Change-Id: I88cd82efbf6499df9e6c7f135d7e294dd724a079
Signed-off-by: Jean Christophe Beyler <jean.christophe.beyler@intel.com>
diff --git a/compiler/dex/dataflow_iterator.h b/compiler/dex/dataflow_iterator.h
index 12f924e..658a9b1 100644
--- a/compiler/dex/dataflow_iterator.h
+++ b/compiler/dex/dataflow_iterator.h
@@ -138,6 +138,21 @@
 
         return ForwardSingleNext();
       }
+
+      /**
+       * @brief Redefine the new operator to use the arena
+       * @param size actually unused, we use our own class size
+       * @param arena the arena to perform the actual allocation
+       * @return the pointer to the newly allocated object
+       */
+      static void* operator new(size_t size, ArenaAllocator* arena) {
+        return arena->Alloc(sizeof(PreOrderDfsIterator), ArenaAllocator::kAllocGrowableBitMap);
+      }
+
+      /**
+       * @brief Redefine delete to not actually delete anything since we are using the arena
+       */
+      static void operator delete(void* p) {}
   };
 
   /**
@@ -169,6 +184,21 @@
 
         return ForwardRepeatNext();
       }
+
+      /**
+       * @brief Redefine the new operator to use the arena
+       * @param size actually unused, we use our own class size
+       * @param arena the arena to perform the actual allocation
+       * @return the pointer to the newly allocated object
+       */
+      static void* operator new(size_t size, ArenaAllocator* arena) {
+        return arena->Alloc(sizeof(RepeatingPreOrderDfsIterator), ArenaAllocator::kAllocGrowableBitMap);
+      }
+
+      /**
+       * @brief Redefine delete to not actually delete anything since we are using the arena
+       */
+      static void operator delete(void* p) {}
   };
 
   /**
@@ -200,6 +230,21 @@
 
         return ForwardRepeatNext();
       }
+
+      /**
+       * @brief Redefine the new operator to use the arena
+       * @param size actually unused, we use our own class size
+       * @param arena the arena to perform the actual allocation
+       * @return the pointer to the newly allocated object
+       */
+      static void* operator new(size_t size, ArenaAllocator* arena) {
+        return arena->Alloc(sizeof(RepeatingPostOrderDfsIterator), ArenaAllocator::kAllocGrowableBitMap);
+      }
+
+      /**
+       * @brief Redefine delete to not actually delete anything since we are using the arena
+       */
+      static void operator delete(void* p) {}
   };
 
   /**
@@ -230,6 +275,21 @@
 
         return ReverseSingleNext();
       }
+
+      /**
+       * @brief Redefine the new operator to use the arena
+       * @param size actually unused, we use our own class size
+       * @param arena the arena to perform the actual allocation
+       * @return the pointer to the newly allocated object
+       */
+      static void* operator new(size_t size, ArenaAllocator* arena) {
+        return arena->Alloc(sizeof(ReversePostOrderDfsIterator), ArenaAllocator::kAllocGrowableBitMap);
+      }
+
+      /**
+       * @brief Redefine delete to not actually delete anything since we are using the arena
+       */
+      static void operator delete(void* p) {}
   };
 
   /**
@@ -261,6 +321,21 @@
 
         return ReverseRepeatNext();
       }
+
+      /**
+       * @brief Redefine the new operator to use the arena
+       * @param size actually unused, we use our own class size
+       * @param arena the arena to perform the actual allocation
+       * @return the pointer to the newly allocated object
+       */
+      static void* operator new(size_t size, ArenaAllocator* arena) {
+        return arena->Alloc(sizeof(RepeatingReversePostOrderDfsIterator), ArenaAllocator::kAllocGrowableBitMap);
+      }
+
+      /**
+       * @brief Redefine delete to not actually delete anything since we are using the arena
+       */
+      static void operator delete(void* p) {}
   };
 
   /**
@@ -291,6 +366,21 @@
 
         return ForwardSingleNext();
       }
+
+      /**
+       * @brief Redefine the new operator to use the arena
+       * @param size actually unused, we use our own class size
+       * @param arena the arena to perform the actual allocation
+       * @return the pointer to the newly allocated object
+       */
+      static void* operator new(size_t size, ArenaAllocator* arena) {
+        return arena->Alloc(sizeof(PostOrderDOMIterator), ArenaAllocator::kAllocGrowableBitMap);
+      }
+
+      /**
+       * @brief Redefine delete to not actually delete anything since we are using the arena
+       */
+      static void operator delete(void* p) {}
   };
 
   /**
@@ -323,6 +413,21 @@
        */
       virtual BasicBlock* Next(bool had_change = false) ALWAYS_INLINE;
 
+      /**
+       * @brief Redefine the new operator to use the arena
+       * @param size actually unused, we use our own class size
+       * @param arena the arena to perform the actual allocation
+       * @return the pointer to the newly allocated object
+       */
+      static void* operator new(size_t size, ArenaAllocator* arena) {
+        return arena->Alloc(sizeof(AllNodesIterator), ArenaAllocator::kAllocGrowableBitMap);
+      }
+
+      /**
+       * @brief Redefine delete to not actually delete anything since we are using the arena
+       */
+      static void operator delete(void* p) {}
+
     private:
       GrowableArray<BasicBlock*>::Iterator* all_nodes_iterator_;    /**< @brief The list of all the nodes */
   };