blob: 8223d2a9f34e5dae73ace12cc002ad1dcb74601a [file] [log] [blame]
Ben Chengba4fc8b2009-06-01 13:00:29 -07001/*
2 * Copyright (C) 2009 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
Ben Chengba4fc8b2009-06-01 13:00:29 -070017#ifndef _DALVIK_VM_COMPILERCODEGEN_H_
18#define _DALVIK_VM_COMPILERCODEGEN_H_
19
Ben Cheng4238ec22009-08-24 16:32:22 -070020#include "compiler/CompilerIR.h"
21
Carl Shapiro5d5b94c2011-04-19 17:34:24 -070022#ifdef __cplusplus
23extern "C" {
24#endif
25
Ben Cheng6c10a972009-10-29 14:39:18 -070026/* Maximal number of switch cases to have inline chains */
27#define MAX_CHAINED_SWITCH_CASES 64
28
Ben Chengba4fc8b2009-06-01 13:00:29 -070029/* Work unit is architecture dependent */
Bill Buzbee716f1202009-07-23 13:22:09 -070030bool dvmCompilerDoWork(CompilerWorkOrder *work);
Ben Chengba4fc8b2009-06-01 13:00:29 -070031
32/* Lower middle-level IR to low-level IR */
33void dvmCompilerMIR2LIR(CompilationUnit *cUnit);
34
Ben Chengcfdeca32011-01-14 11:36:46 -080035/* Lower middle-level IR to low-level IR for the whole method */
36void dvmCompilerMethodMIR2LIR(CompilationUnit *cUnit);
37
Ben Chengba4fc8b2009-06-01 13:00:29 -070038/* Assemble LIR into machine code */
Bill Buzbee716f1202009-07-23 13:22:09 -070039void dvmCompilerAssembleLIR(CompilationUnit *cUnit, JitTranslationInfo *info);
Ben Chengba4fc8b2009-06-01 13:00:29 -070040
Carl Shapiro5d5b94c2011-04-19 17:34:24 -070041/* Perform translation chain operation. */
42void* dvmJitChain(void* tgtAddr, u4* branchAddr);
43
Ben Cheng385828e2011-03-04 16:48:33 -080044/* Install class objects in the literal pool */
45void dvmJitInstallClassObjectPointers(CompilationUnit *cUnit,
46 char *codeAddress);
47
Ben Cheng60c24f42010-01-04 12:29:56 -080048/* Patch inline cache content for polymorphic callsites */
49bool dvmJitPatchInlineCache(void *cellPtr, void *contentPtr);
50
Ben Chengba4fc8b2009-06-01 13:00:29 -070051/* Implemented in the codegen/<target>/ArchUtility.c */
52void dvmCompilerCodegenDump(CompilationUnit *cUnit);
53
54/* Implemented in the codegen/<target>/Assembler.c */
Ben Cheng6999d842010-01-26 16:46:15 -080055void dvmCompilerPatchInlineCache(void);
Bill Buzbee716f1202009-07-23 13:22:09 -070056
Bill Buzbee1465db52009-09-23 17:17:35 -070057/* Implemented in codegen/<target>/Ralloc.c */
buzbee23d95d02010-12-14 13:16:43 -080058void dvmCompilerLocalRegAlloc(CompilationUnit *cUnit);
Bill Buzbee1465db52009-09-23 17:17:35 -070059
60/* Implemented in codegen/<target>/Thumb<version>Util.c */
61void dvmCompilerInitializeRegAlloc(CompilationUnit *cUnit);
62
Bill Buzbee716f1202009-07-23 13:22:09 -070063/* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */
Ben Cheng5d90c202009-11-22 23:31:11 -080064JitInstructionSetType dvmCompilerInstructionSet(void);
65
66/*
67 * Implemented in codegen/<target>/<target_variant>/ArchVariant.c
68 * Architecture-specific initializations and checks
69 */
70bool dvmCompilerArchVariantInit(void);
Ben Chengba4fc8b2009-06-01 13:00:29 -070071
Bill Buzbee1f748632010-03-02 16:14:41 -080072/* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */
73int dvmCompilerTargetOptHint(int key);
74
buzbeeecf8f6e2010-07-20 14:53:42 -070075/* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */
buzbee2ce33c92010-11-01 15:53:27 -070076void dvmCompilerGenMemBarrier(CompilationUnit *cUnit, int barrierKind);
buzbeeecf8f6e2010-07-20 14:53:42 -070077
Carl Shapiro5d5b94c2011-04-19 17:34:24 -070078#ifdef __cplusplus
79}
80#endif
81
Ben Chengba4fc8b2009-06-01 13:00:29 -070082#endif /* _DALVIK_VM_COMPILERCODEGEN_H_ */