| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 1 | /* |
| 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 Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 17 | #ifndef _DALVIK_VM_COMPILERCODEGEN_H_ |
| 18 | #define _DALVIK_VM_COMPILERCODEGEN_H_ |
| 19 | |
| Ben Cheng | 4238ec2 | 2009-08-24 16:32:22 -0700 | [diff] [blame] | 20 | #include "compiler/CompilerIR.h" |
| 21 | |
| Ben Cheng | 6c10a97 | 2009-10-29 14:39:18 -0700 | [diff] [blame] | 22 | /* Maximal number of switch cases to have inline chains */ |
| 23 | #define MAX_CHAINED_SWITCH_CASES 64 |
| 24 | |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 25 | /* Work unit is architecture dependent */ |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 26 | bool dvmCompilerDoWork(CompilerWorkOrder *work); |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 27 | |
| 28 | /* Lower middle-level IR to low-level IR */ |
| 29 | void dvmCompilerMIR2LIR(CompilationUnit *cUnit); |
| 30 | |
| Ben Cheng | cfdeca3 | 2011-01-14 11:36:46 -0800 | [diff] [blame^] | 31 | /* Lower middle-level IR to low-level IR for the whole method */ |
| 32 | void dvmCompilerMethodMIR2LIR(CompilationUnit *cUnit); |
| 33 | |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 34 | /* Assemble LIR into machine code */ |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 35 | void dvmCompilerAssembleLIR(CompilationUnit *cUnit, JitTranslationInfo *info); |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 36 | |
| Ben Cheng | 60c24f4 | 2010-01-04 12:29:56 -0800 | [diff] [blame] | 37 | /* Patch inline cache content for polymorphic callsites */ |
| 38 | bool dvmJitPatchInlineCache(void *cellPtr, void *contentPtr); |
| 39 | |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 40 | /* Implemented in the codegen/<target>/ArchUtility.c */ |
| 41 | void dvmCompilerCodegenDump(CompilationUnit *cUnit); |
| 42 | |
| 43 | /* Implemented in the codegen/<target>/Assembler.c */ |
| 44 | void* dvmJitChain(void *tgtAddr, u4* branchAddr); |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 45 | u4* dvmJitUnchain(void *codeAddr); |
| 46 | void dvmJitUnchainAll(void); |
| Ben Cheng | 6999d84 | 2010-01-26 16:46:15 -0800 | [diff] [blame] | 47 | void dvmCompilerPatchInlineCache(void); |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 48 | |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 49 | /* Implemented in codegen/<target>/Ralloc.c */ |
| buzbee | 23d95d0 | 2010-12-14 13:16:43 -0800 | [diff] [blame] | 50 | void dvmCompilerLocalRegAlloc(CompilationUnit *cUnit); |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 51 | |
| 52 | /* Implemented in codegen/<target>/Thumb<version>Util.c */ |
| 53 | void dvmCompilerInitializeRegAlloc(CompilationUnit *cUnit); |
| 54 | |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 55 | /* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */ |
| Ben Cheng | 5d90c20 | 2009-11-22 23:31:11 -0800 | [diff] [blame] | 56 | JitInstructionSetType dvmCompilerInstructionSet(void); |
| 57 | |
| 58 | /* |
| 59 | * Implemented in codegen/<target>/<target_variant>/ArchVariant.c |
| 60 | * Architecture-specific initializations and checks |
| 61 | */ |
| 62 | bool dvmCompilerArchVariantInit(void); |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 63 | |
| Bill Buzbee | 1f74863 | 2010-03-02 16:14:41 -0800 | [diff] [blame] | 64 | /* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */ |
| 65 | int dvmCompilerTargetOptHint(int key); |
| 66 | |
| buzbee | ecf8f6e | 2010-07-20 14:53:42 -0700 | [diff] [blame] | 67 | /* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */ |
| buzbee | 2ce33c9 | 2010-11-01 15:53:27 -0700 | [diff] [blame] | 68 | void dvmCompilerGenMemBarrier(CompilationUnit *cUnit, int barrierKind); |
| buzbee | ecf8f6e | 2010-07-20 14:53:42 -0700 | [diff] [blame] | 69 | |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 70 | #endif /* _DALVIK_VM_COMPILERCODEGEN_H_ */ |