blob: bed3b973049f9949217dd40b09e25be71551227a [file] [log] [blame]
buzbee67bf8852011-08-17 17:51:35 -07001/*
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 Carlstromfc0e3212013-07-17 14:40:12 -070017#ifndef ART_COMPILER_DEX_FRONTEND_H_
18#define ART_COMPILER_DEX_FRONTEND_H_
buzbee67bf8852011-08-17 17:51:35 -070019
Ian Rogers0571d352011-11-03 19:51:38 -070020#include "dex_file.h"
Vladimir Marko05bded22014-01-21 11:38:17 +000021#include "invoke_type.h"
Dragos Sbirlea7467ee02013-06-21 09:20:34 -070022
Elliott Hughes11d1b0c2012-01-23 16:57:47 -080023namespace art {
Andreas Gampe53c913b2014-08-12 23:19:23 -070024
25class CompiledMethod;
26class Compiler;
27class CompilerDriver;
Elliott Hughes11d1b0c2012-01-23 16:57:47 -080028
buzbeee3acd072012-02-25 17:03:10 -080029/*
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
buzbee02031b12012-11-23 09:41:35 -080036// Suppress optimization if corresponding bit set.
buzbeefa57c472012-11-21 12:06:18 -080037enum opt_control_vector {
Bill Buzbeea114add2012-05-03 15:00:40 -070038 kLoadStoreElimination = 0,
39 kLoadHoisting,
40 kSuppressLoads,
41 kNullCheckElimination,
Vladimir Markobfea9c22014-01-17 17:49:33 +000042 kClassInitCheckElimination,
Vladimir Marko95a05972014-05-30 10:01:32 +010043 kGlobalValueNumbering,
Vladimir Marko415ac882014-09-30 18:09:14 +010044 kLocalValueNumbering,
Bill Buzbeea114add2012-05-03 15:00:40 -070045 kPromoteRegs,
46 kTrackLiveTemps,
Bill Buzbeea114add2012-05-03 15:00:40 -070047 kSafeOptimizations,
48 kBBOpt,
49 kMatch,
50 kPromoteCompilerTemps,
buzbee1fd33462013-03-25 13:40:45 -070051 kBranchFusing,
buzbee17189ac2013-11-08 11:07:02 -080052 kSuppressExceptionEdges,
Vladimir Marko9820b7c2014-01-02 16:40:37 +000053 kSuppressMethodInlining,
buzbeece302932011-10-04 14:32:18 -070054};
55
buzbee02031b12012-11-23 09:41:35 -080056// Force code generation paths for testing.
buzbeece302932011-10-04 14:32:18 -070057enum debugControlVector {
Bill Buzbeea114add2012-05-03 15:00:40 -070058 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,
buzbeed1643e42012-09-05 14:06:51 -070071 kDebugDumpCheckStats,
buzbeead8f15e2012-06-18 14:49:45 -070072 kDebugDumpBitcodeFile,
Bill Buzbeec9f40dd2012-08-15 11:35:25 -070073 kDebugVerifyBitcode,
buzbeea5abf702013-04-12 14:39:29 -070074 kDebugShowSummaryMemoryUsage,
buzbeeee17e0a2013-07-31 10:47:37 -070075 kDebugShowFilterStats,
buzbeeb01bf152014-05-13 15:59:07 -070076 kDebugTimings,
77 kDebugCodegenDump
buzbeece302932011-10-04 14:32:18 -070078};
79
Andreas Gampe53c913b2014-08-12 23:19:23 -070080CompiledMethod* 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);
buzbee67bf8852011-08-17 17:51:35 -070090
Elliott Hughes11d1b0c2012-01-23 16:57:47 -080091} // namespace art
92
Brian Carlstromfc0e3212013-07-17 14:40:12 -070093#endif // ART_COMPILER_DEX_FRONTEND_H_