blob: 45084167ac3e8d411f5d787f96806c60d4f8c92e [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
17#ifndef ART_SRC_COMPILER_COMPILERCODEGEN_H_
18#define ART_SRC_COMPILER_COMPILERCODEGEN_H_
19
20#include "../CompilerIR.h"
21
Elliott Hughes11d1b0c2012-01-23 16:57:47 -080022namespace art {
23
buzbeea2ebdd72012-03-04 14:57:06 -080024LIR* rawLIR(CompilationUnit* cUnit, int dalvikOffset, int opcode, int op0 = 0,
Bill Buzbeea114add2012-05-03 15:00:40 -070025 int op1 = 0, int op2 = 0, int op3 = 0, int op4 = 0,
26 LIR* target = NULL);
buzbeea2ebdd72012-03-04 14:57:06 -080027
buzbeee88dfbf2012-03-05 11:19:57 -080028int oatGetInsnSize(LIR* lir);
29
buzbee84fd6932012-03-29 16:44:16 -070030void genFusedLongCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir);
31void genFusedFPCmpBranch(CompilationUnit* cUnit, BasicBlock* bb, MIR* mir,
32 bool gtBias, bool isDouble);
33
34
buzbee67bf8852011-08-17 17:51:35 -070035/* Lower middle-level IR to low-level IR for the whole method */
36void oatMethodMIR2LIR(CompilationUnit* cUnit);
37
buzbee2cfc6392012-05-07 14:51:40 -070038/* Bitcode conversions */
39void oatMethodMIR2Bitcode(CompilationUnit* cUnit);
40void oatMethodBitcode2LIR(CompilationUnit* cUnit);
41
buzbee16da88c2012-03-20 10:38:17 -070042/* Lower middle-level IR to low-level IR for the simple methods */
43void oatSpecialMIR2LIR(CompilationUnit* cUnit, SpecialCaseHandler specialCase );
44
buzbee67bf8852011-08-17 17:51:35 -070045/* Assemble LIR into machine code */
46void oatAssembleLIR(CompilationUnit* cUnit);
buzbeee3acd072012-02-25 17:03:10 -080047AssemblerStatus oatAssembleInstructions(CompilationUnit* cUnit,
48 intptr_t startAddr);
49void oatAssignOffsets(CompilationUnit* cUnit);
50int oatAssignInsnOffsets(CompilationUnit* cUnit);
buzbee67bf8852011-08-17 17:51:35 -070051
52/* Implemented in the codegen/<target>/ArchUtility.c */
53void oatCodegenDump(CompilationUnit* cUnit);
buzbee67bc2362011-10-11 18:08:40 -070054void oatDumpPromotionMap(CompilationUnit* cUnit);
buzbee5de34942012-03-01 14:51:57 -080055std::string buildInsnString(const char* fmt, LIR* lir,
56 unsigned char* baseAddr);
57
buzbee67bf8852011-08-17 17:51:35 -070058
59/* Implemented in codegen/<target>/Ralloc.c */
60void oatSimpleRegAlloc(CompilationUnit* cUnit);
61
62/* Implemented in codegen/<target>/Thumb<version>Util.c */
63void oatInitializeRegAlloc(CompilationUnit* cUnit);
64
65/* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */
Elliott Hughesb3bd5f02012-03-08 21:05:27 -080066InstructionSet oatInstructionSet();
buzbee67bf8852011-08-17 17:51:35 -070067
68/*
69 * Implemented in codegen/<target>/<target_variant>/ArchVariant.c
70 * Architecture-specific initializations and checks
71 */
72bool oatArchVariantInit(void);
73
74/* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */
75int oatTargetOptHint(int key);
76
77/* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */
78void oatGenMemBarrier(CompilationUnit* cUnit, int barrierKind);
79
Elliott Hughes11d1b0c2012-01-23 16:57:47 -080080} // namespace art
81
buzbee67bf8852011-08-17 17:51:35 -070082#endif // ART_SRC_COMPILER_COMPILERCODEGEN_H_