buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_COMPILER_DEX_FRONTEND_H_ |
| 18 | #define ART_COMPILER_DEX_FRONTEND_H_ |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 19 | |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 20 | #include "dex_file.h" |
Vladimir Marko | 05bded2 | 2014-01-21 11:38:17 +0000 | [diff] [blame] | 21 | #include "invoke_type.h" |
Dragos Sbirlea | 7467ee0 | 2013-06-21 09:20:34 -0700 | [diff] [blame] | 22 | |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 23 | namespace art { |
Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 24 | |
| 25 | class CompiledMethod; |
| 26 | class Compiler; |
| 27 | class CompilerDriver; |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 28 | |
buzbee | e3acd07 | 2012-02-25 17:03:10 -0800 | [diff] [blame] | 29 | /* |
| 30 | * Assembly is an iterative process, and usually terminates within |
| 31 | * two or three passes. This should be high enough to handle bizarre |
| 32 | * cases, but detect an infinite loop bug. |
| 33 | */ |
| 34 | #define MAX_ASSEMBLER_RETRIES 50 |
| 35 | |
buzbee | 02031b1 | 2012-11-23 09:41:35 -0800 | [diff] [blame] | 36 | // Suppress optimization if corresponding bit set. |
buzbee | fa57c47 | 2012-11-21 12:06:18 -0800 | [diff] [blame] | 37 | enum opt_control_vector { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 38 | kLoadStoreElimination = 0, |
| 39 | kLoadHoisting, |
| 40 | kSuppressLoads, |
| 41 | kNullCheckElimination, |
Vladimir Marko | bfea9c2 | 2014-01-17 17:49:33 +0000 | [diff] [blame] | 42 | kClassInitCheckElimination, |
Vladimir Marko | 95a0597 | 2014-05-30 10:01:32 +0100 | [diff] [blame] | 43 | kGlobalValueNumbering, |
Vladimir Marko | 415ac88 | 2014-09-30 18:09:14 +0100 | [diff] [blame] | 44 | kLocalValueNumbering, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 45 | kPromoteRegs, |
| 46 | kTrackLiveTemps, |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 47 | kSafeOptimizations, |
| 48 | kBBOpt, |
| 49 | kMatch, |
| 50 | kPromoteCompilerTemps, |
buzbee | 1fd3346 | 2013-03-25 13:40:45 -0700 | [diff] [blame] | 51 | kBranchFusing, |
buzbee | 17189ac | 2013-11-08 11:07:02 -0800 | [diff] [blame] | 52 | kSuppressExceptionEdges, |
Vladimir Marko | 9820b7c | 2014-01-02 16:40:37 +0000 | [diff] [blame] | 53 | kSuppressMethodInlining, |
buzbee | ce30293 | 2011-10-04 14:32:18 -0700 | [diff] [blame] | 54 | }; |
| 55 | |
buzbee | 02031b1 | 2012-11-23 09:41:35 -0800 | [diff] [blame] | 56 | // Force code generation paths for testing. |
buzbee | ce30293 | 2011-10-04 14:32:18 -0700 | [diff] [blame] | 57 | enum debugControlVector { |
Bill Buzbee | a114add | 2012-05-03 15:00:40 -0700 | [diff] [blame] | 58 | kDebugVerbose, |
| 59 | kDebugDumpCFG, |
| 60 | kDebugSlowFieldPath, |
| 61 | kDebugSlowInvokePath, |
| 62 | kDebugSlowStringPath, |
| 63 | kDebugSlowTypePath, |
| 64 | kDebugSlowestFieldPath, |
| 65 | kDebugSlowestStringPath, |
| 66 | kDebugExerciseResolveMethod, |
| 67 | kDebugVerifyDataflow, |
| 68 | kDebugShowMemoryUsage, |
| 69 | kDebugShowNops, |
| 70 | kDebugCountOpcodes, |
buzbee | d1643e4 | 2012-09-05 14:06:51 -0700 | [diff] [blame] | 71 | kDebugDumpCheckStats, |
buzbee | ad8f15e | 2012-06-18 14:49:45 -0700 | [diff] [blame] | 72 | kDebugDumpBitcodeFile, |
Bill Buzbee | c9f40dd | 2012-08-15 11:35:25 -0700 | [diff] [blame] | 73 | kDebugVerifyBitcode, |
buzbee | a5abf70 | 2013-04-12 14:39:29 -0700 | [diff] [blame] | 74 | kDebugShowSummaryMemoryUsage, |
buzbee | ee17e0a | 2013-07-31 10:47:37 -0700 | [diff] [blame] | 75 | kDebugShowFilterStats, |
buzbee | b01bf15 | 2014-05-13 15:59:07 -0700 | [diff] [blame] | 76 | kDebugTimings, |
| 77 | kDebugCodegenDump |
buzbee | ce30293 | 2011-10-04 14:32:18 -0700 | [diff] [blame] | 78 | }; |
| 79 | |
Andreas Gampe | 53c913b | 2014-08-12 23:19:23 -0700 | [diff] [blame] | 80 | CompiledMethod* CompileOneMethod(CompilerDriver* driver, |
| 81 | const Compiler* compiler, |
| 82 | const DexFile::CodeItem* code_item, |
| 83 | uint32_t access_flags, |
| 84 | InvokeType invoke_type, |
| 85 | uint16_t class_def_idx, |
| 86 | uint32_t method_idx, |
| 87 | jobject class_loader, |
| 88 | const DexFile& dex_file, |
| 89 | void* compilation_unit); |
buzbee | 67bf885 | 2011-08-17 17:51:35 -0700 | [diff] [blame] | 90 | |
Elliott Hughes | 11d1b0c | 2012-01-23 16:57:47 -0800 | [diff] [blame] | 91 | } // namespace art |
| 92 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 93 | #endif // ART_COMPILER_DEX_FRONTEND_H_ |