Home | History | Annotate | Download | only in codegen
      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 
     17 #ifndef DALVIK_VM_COMPILERCODEGEN_H_
     18 #define DALVIK_VM_COMPILERCODEGEN_H_
     19 
     20 #include "compiler/CompilerIR.h"
     21 
     22 /* Maximal number of switch cases to have inline chains */
     23 #define MAX_CHAINED_SWITCH_CASES 64
     24 
     25 /* Work unit is architecture dependent */
     26 bool dvmCompilerDoWork(CompilerWorkOrder *work);
     27 
     28 /* Lower middle-level IR to low-level IR */
     29 #ifndef ARCH_IA32
     30 void dvmCompilerMIR2LIR(CompilationUnit *cUnit);
     31 #else /* ARCH_IA32 */
     32 void dvmCompilerMIR2LIR(CompilationUnit *cUnit, JitTranslationInfo* info);
     33 #endif
     34 
     35 /* Lower middle-level IR to low-level IR for the whole method */
     36 void dvmCompilerMethodMIR2LIR(CompilationUnit *cUnit);
     37 
     38 /* Assemble LIR into machine code */
     39 void dvmCompilerAssembleLIR(CompilationUnit *cUnit, JitTranslationInfo *info);
     40 
     41 /* Perform translation chain operation. */
     42 extern "C" void* dvmJitChain(void* tgtAddr, u4* branchAddr);
     43 
     44 /* Install class objects in the literal pool */
     45 void dvmJitInstallClassObjectPointers(CompilationUnit *cUnit,
     46                                       char *codeAddress);
     47 
     48 /* Patch inline cache content for polymorphic callsites */
     49 bool dvmJitPatchInlineCache(void *cellPtr, void *contentPtr);
     50 
     51 /* Implemented in the codegen/<target>/ArchUtility.c */
     52 void dvmCompilerCodegenDump(CompilationUnit *cUnit);
     53 
     54 /* Implemented in the codegen/<target>/Assembler.c */
     55 void dvmCompilerPatchInlineCache(void);
     56 
     57 /* Implemented in codegen/<target>/Ralloc.c */
     58 void dvmCompilerLocalRegAlloc(CompilationUnit *cUnit);
     59 
     60 /* Implemented in codegen/<target>/Thumb<version>Util.c */
     61 void dvmCompilerInitializeRegAlloc(CompilationUnit *cUnit);
     62 
     63 /* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */
     64 JitInstructionSetType dvmCompilerInstructionSet(void);
     65 
     66 /*
     67  * Implemented in codegen/<target>/<target_variant>/ArchVariant.c
     68  * Architecture-specific initializations and checks
     69  */
     70 bool dvmCompilerArchVariantInit(void);
     71 
     72 /* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */
     73 int dvmCompilerTargetOptHint(int key);
     74 
     75 /* Implemented in codegen/<target>/<target_variant>/ArchVariant.c */
     76 void dvmCompilerGenMemBarrier(CompilationUnit *cUnit, int barrierKind);
     77 
     78 #endif  // DALVIK_VM_COMPILERCODEGEN_H_
     79