| 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 | |
| 31 | /* Assemble LIR into machine code */ |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 32 | void dvmCompilerAssembleLIR(CompilationUnit *cUnit, JitTranslationInfo *info); |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 33 | |
| Ben Cheng | 60c24f4 | 2010-01-04 12:29:56 -0800 | [diff] [blame] | 34 | /* Patch inline cache content for polymorphic callsites */ |
| 35 | bool dvmJitPatchInlineCache(void *cellPtr, void *contentPtr); |
| 36 | |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 37 | /* Implemented in the codegen/<target>/ArchUtility.c */ |
| 38 | void dvmCompilerCodegenDump(CompilationUnit *cUnit); |
| 39 | |
| 40 | /* Implemented in the codegen/<target>/Assembler.c */ |
| 41 | void* dvmJitChain(void *tgtAddr, u4* branchAddr); |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 42 | u4* dvmJitUnchain(void *codeAddr); |
| 43 | void dvmJitUnchainAll(void); |
| Ben Cheng | 6999d84 | 2010-01-26 16:46:15 -0800 | [diff] [blame] | 44 | void dvmCompilerPatchInlineCache(void); |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 45 | |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 46 | /* Implemented in codegen/<target>/Ralloc.c */ |
| buzbee | 23d95d0 | 2010-12-14 13:16:43 -0800 | [diff] [blame] | 47 | void dvmCompilerLocalRegAlloc(CompilationUnit *cUnit); |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 48 | |
| 49 | /* Implemented in codegen/<target>/Thumb<version>Util.c */ |
| 50 | void dvmCompilerInitializeRegAlloc(CompilationUnit *cUnit); |
| 51 | |
| Bill Buzbee | 716f120 | 2009-07-23 13:22:09 -0700 | [diff] [blame] | 52 | /* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */ |
| Ben Cheng | 5d90c20 | 2009-11-22 23:31:11 -0800 | [diff] [blame] | 53 | JitInstructionSetType dvmCompilerInstructionSet(void); |
| 54 | |
| 55 | /* |
| 56 | * Implemented in codegen/<target>/<target_variant>/ArchVariant.c |
| 57 | * Architecture-specific initializations and checks |
| 58 | */ |
| 59 | bool dvmCompilerArchVariantInit(void); |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 60 | |
| Bill Buzbee | 1f74863 | 2010-03-02 16:14:41 -0800 | [diff] [blame] | 61 | /* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */ |
| 62 | int dvmCompilerTargetOptHint(int key); |
| 63 | |
| buzbee | ecf8f6e | 2010-07-20 14:53:42 -0700 | [diff] [blame] | 64 | /* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */ |
| buzbee | 2ce33c9 | 2010-11-01 15:53:27 -0700 | [diff] [blame] | 65 | void dvmCompilerGenMemBarrier(CompilationUnit *cUnit, int barrierKind); |
| buzbee | ecf8f6e | 2010-07-20 14:53:42 -0700 | [diff] [blame] | 66 | |
| Ben Cheng | ba4fc8b | 2009-06-01 13:00:29 -0700 | [diff] [blame] | 67 | #endif /* _DALVIK_VM_COMPILERCODEGEN_H_ */ |