Early inlining of simple methods.
Inlining "special" methods: empty methods, methods returning
constants or their arguments, simple getters and setters.
Bug: 8164439
Change-Id: I8c7fa9c14351fbb2470000b378a22974daaef236
diff --git a/compiler/dex/bb_optimizations.h b/compiler/dex/bb_optimizations.h
index fb482bf..6d500a5 100644
--- a/compiler/dex/bb_optimizations.h
+++ b/compiler/dex/bb_optimizations.h
@@ -59,6 +59,34 @@
};
/**
+ * @class CallInlining
+ * @brief Perform method inlining pass.
+ */
+class CallInlining : public Pass {
+ public:
+ CallInlining() : Pass("CallInlining") {
+ }
+
+ bool Gate(const CompilationUnit* cUnit) const {
+ return cUnit->mir_graph->InlineCallsGate();
+ }
+
+ void Start(CompilationUnit* cUnit) const {
+ cUnit->mir_graph->InlineCallsStart();
+ }
+
+ bool WalkBasicBlocks(CompilationUnit* cUnit, BasicBlock* bb) const {
+ cUnit->mir_graph->InlineCalls(bb);
+ // No need of repeating, so just return false.
+ return false;
+ }
+
+ void End(CompilationUnit* cUnit) const {
+ cUnit->mir_graph->InlineCallsEnd();
+ }
+};
+
+/**
* @class CodeLayout
* @brief Perform the code layout pass.
*/