blob: 51b6d68dccdf78ea4b574bf2763c7dd0ec5b00fb [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,
Bill Buzbeea114add2012-05-03 15:00:40 -070044 kPromoteRegs,
45 kTrackLiveTemps,
Bill Buzbeea114add2012-05-03 15:00:40 -070046 kSafeOptimizations,
47 kBBOpt,
48 kMatch,
49 kPromoteCompilerTemps,
buzbee1fd33462013-03-25 13:40:45 -070050 kBranchFusing,
buzbee17189ac2013-11-08 11:07:02 -080051 kSuppressExceptionEdges,
Vladimir Marko9820b7c2014-01-02 16:40:37 +000052 kSuppressMethodInlining,
buzbeece302932011-10-04 14:32:18 -070053};
54
buzbee02031b12012-11-23 09:41:35 -080055// Force code generation paths for testing.
buzbeece302932011-10-04 14:32:18 -070056enum debugControlVector {
Bill Buzbeea114add2012-05-03 15:00:40 -070057 kDebugVerbose,
58 kDebugDumpCFG,
59 kDebugSlowFieldPath,
60 kDebugSlowInvokePath,
61 kDebugSlowStringPath,
62 kDebugSlowTypePath,
63 kDebugSlowestFieldPath,
64 kDebugSlowestStringPath,
65 kDebugExerciseResolveMethod,
66 kDebugVerifyDataflow,
67 kDebugShowMemoryUsage,
68 kDebugShowNops,
69 kDebugCountOpcodes,
buzbeed1643e42012-09-05 14:06:51 -070070 kDebugDumpCheckStats,
buzbeead8f15e2012-06-18 14:49:45 -070071 kDebugDumpBitcodeFile,
Bill Buzbeec9f40dd2012-08-15 11:35:25 -070072 kDebugVerifyBitcode,
buzbeea5abf702013-04-12 14:39:29 -070073 kDebugShowSummaryMemoryUsage,
buzbeeee17e0a2013-07-31 10:47:37 -070074 kDebugShowFilterStats,
buzbeeb01bf152014-05-13 15:59:07 -070075 kDebugTimings,
76 kDebugCodegenDump
buzbeece302932011-10-04 14:32:18 -070077};
78
Andreas Gampe53c913b2014-08-12 23:19:23 -070079CompiledMethod* CompileOneMethod(CompilerDriver* driver,
80 const Compiler* compiler,
81 const DexFile::CodeItem* code_item,
82 uint32_t access_flags,
83 InvokeType invoke_type,
84 uint16_t class_def_idx,
85 uint32_t method_idx,
86 jobject class_loader,
87 const DexFile& dex_file,
88 void* compilation_unit);
buzbee67bf8852011-08-17 17:51:35 -070089
Elliott Hughes11d1b0c2012-01-23 16:57:47 -080090} // namespace art
91
Brian Carlstromfc0e3212013-07-17 14:40:12 -070092#endif // ART_COMPILER_DEX_FRONTEND_H_