Nicolas Geoffray | e53798a | 2014-12-01 10:31:54 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_COMPILER_OPTIMIZING_INLINER_H_ |
| 18 | #define ART_COMPILER_OPTIMIZING_INLINER_H_ |
| 19 | |
| 20 | #include "invoke_type.h" |
| 21 | #include "optimization.h" |
| 22 | |
| 23 | namespace art { |
| 24 | |
| 25 | class CompilerDriver; |
| 26 | class DexCompilationUnit; |
| 27 | class HGraph; |
| 28 | class HInvoke; |
| 29 | class OptimizingCompilerStats; |
| 30 | |
| 31 | class HInliner : public HOptimization { |
| 32 | public: |
| 33 | HInliner(HGraph* outer_graph, |
| 34 | const DexCompilationUnit& outer_compilation_unit, |
| 35 | CompilerDriver* compiler_driver, |
Nicolas Geoffray | ef87c5d | 2015-01-30 12:41:14 +0000 | [diff] [blame^] | 36 | OptimizingCompilerStats* stats, |
| 37 | size_t depth = 0) |
Nicolas Geoffray | e53798a | 2014-12-01 10:31:54 +0000 | [diff] [blame] | 38 | : HOptimization(outer_graph, true, "inliner"), |
| 39 | outer_compilation_unit_(outer_compilation_unit), |
| 40 | compiler_driver_(compiler_driver), |
Nicolas Geoffray | ef87c5d | 2015-01-30 12:41:14 +0000 | [diff] [blame^] | 41 | outer_stats_(stats), |
| 42 | depth_(depth) {} |
Nicolas Geoffray | e53798a | 2014-12-01 10:31:54 +0000 | [diff] [blame] | 43 | |
| 44 | void Run() OVERRIDE; |
| 45 | |
| 46 | private: |
| 47 | bool TryInline(HInvoke* invoke_instruction, uint32_t method_index, InvokeType invoke_type) const; |
| 48 | |
| 49 | const DexCompilationUnit& outer_compilation_unit_; |
| 50 | CompilerDriver* const compiler_driver_; |
| 51 | OptimizingCompilerStats* const outer_stats_; |
Nicolas Geoffray | ef87c5d | 2015-01-30 12:41:14 +0000 | [diff] [blame^] | 52 | const size_t depth_; |
Nicolas Geoffray | e53798a | 2014-12-01 10:31:54 +0000 | [diff] [blame] | 53 | |
| 54 | DISALLOW_COPY_AND_ASSIGN(HInliner); |
| 55 | }; |
| 56 | |
| 57 | } // namespace art |
| 58 | |
| 59 | #endif // ART_COMPILER_OPTIMIZING_INLINER_H_ |