summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing/inliner.h
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-12-01 10:31:54 +0000
committerNicolas Geoffray <ngeoffray@google.com>2014-12-15 22:52:27 +0000
commite53798a7e3267305f696bf658e418c92e63e0834 (patch)
tree8979bbed96b107a5a6bbae9285ff4e0c362dad95 /compiler/optimizing/inliner.h
parente6c0cdd11097dd72275ac24f1e98217c299d973e (diff)
downloadart-e53798a7e3267305f696bf658e418c92e63e0834.tar.gz
art-e53798a7e3267305f696bf658e418c92e63e0834.tar.bz2
art-e53798a7e3267305f696bf658e418c92e63e0834.zip
Inlining support in optimizing.
Currently only inlines simple things that don't require an environment, such as: - Returning a constant. - Returning a parameter. - Returning an arithmetic operation. Change-Id: Ie844950cb44f69e104774a3cf7a8dea66bc85661
Diffstat (limited to 'compiler/optimizing/inliner.h')
-rw-r--r--compiler/optimizing/inliner.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/compiler/optimizing/inliner.h b/compiler/optimizing/inliner.h
new file mode 100644
index 000000000..370e33c2a
--- /dev/null
+++ b/compiler/optimizing/inliner.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_COMPILER_OPTIMIZING_INLINER_H_
+#define ART_COMPILER_OPTIMIZING_INLINER_H_
+
+#include "invoke_type.h"
+#include "optimization.h"
+
+namespace art {
+
+class CompilerDriver;
+class DexCompilationUnit;
+class HGraph;
+class HInvoke;
+class OptimizingCompilerStats;
+
+class HInliner : public HOptimization {
+ public:
+ HInliner(HGraph* outer_graph,
+ const DexCompilationUnit& outer_compilation_unit,
+ CompilerDriver* compiler_driver,
+ OptimizingCompilerStats* stats)
+ : HOptimization(outer_graph, true, "inliner"),
+ outer_compilation_unit_(outer_compilation_unit),
+ compiler_driver_(compiler_driver),
+ outer_stats_(stats) {}
+
+ void Run() OVERRIDE;
+
+ private:
+ bool TryInline(HInvoke* invoke_instruction, uint32_t method_index, InvokeType invoke_type) const;
+
+ const DexCompilationUnit& outer_compilation_unit_;
+ CompilerDriver* const compiler_driver_;
+ OptimizingCompilerStats* const outer_stats_;
+
+ DISALLOW_COPY_AND_ASSIGN(HInliner);
+};
+
+} // namespace art
+
+#endif // ART_COMPILER_OPTIMIZING_INLINER_H_