| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52: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 | |
| 17 | #ifndef _DALVIK_VM_COMPILER_CODEGEN_ARM_CODEGEN_H |
| 18 | #define _DALVIK_VM_COMPILER_CODEGEN_ARM_CODEGEN_H |
| 19 | |
| 20 | /* |
| 21 | * Forward declarations for common routines in Codegen.c used by ISA |
| 22 | * variant code such as ThumbUtilty.c |
| 23 | */ |
| 24 | |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 25 | static void annotateDalvikRegAccess(ArmLIR *lir, int regId, bool isLoad); |
| Ben Cheng | dcf3e5d | 2009-09-11 13:42:05 -0700 | [diff] [blame] | 26 | static void setupResourceMasks(ArmLIR *lir); |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 27 | static ArmLIR *newLIR0(CompilationUnit *cUnit, ArmOpCode opCode); |
| 28 | static ArmLIR *newLIR1(CompilationUnit *cUnit, ArmOpCode opCode, |
| 29 | int dest); |
| 30 | static ArmLIR *newLIR2(CompilationUnit *cUnit, ArmOpCode opCode, |
| 31 | int dest, int src1); |
| 32 | static ArmLIR *newLIR3(CompilationUnit *cUnit, ArmOpCode opCode, |
| 33 | int dest, int src1, int src2); |
| Bill Buzbee | 270c1d6 | 2009-08-13 16:58:07 -0700 | [diff] [blame] | 34 | static ArmLIR *newLIR4(CompilationUnit *cUnit, ArmOpCode opCode, |
| 35 | int dest, int src1, int src2, int info); |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 36 | static ArmLIR *scanLiteralPool(CompilationUnit *cUnit, int value, |
| 37 | unsigned int delta); |
| 38 | static ArmLIR *addWordData(CompilationUnit *cUnit, int value, bool inPlace); |
| 39 | static inline ArmLIR *genCheckCommon(CompilationUnit *cUnit, int dOffset, |
| 40 | ArmLIR *branch, |
| 41 | ArmLIR *pcrLabel); |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 42 | static void genBarrier(CompilationUnit *cUnit); |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 43 | static RegLocation loadValue(CompilationUnit *cUnit, RegLocation rlSrc, |
| 44 | RegisterClass opKind); |
| 45 | static RegLocation loadValueWide(CompilationUnit *cUnit, RegLocation rlSrc, |
| 46 | RegisterClass opKind); |
| 47 | static ArmLIR *loadConstant(CompilationUnit *cUnit, int rDest, int value); |
| 48 | static void storeValue(CompilationUnit *cUnit, RegLocation rlDst, |
| 49 | RegLocation rlSrc); |
| 50 | static void storeValueWide(CompilationUnit *cUnit, RegLocation rlDst, |
| 51 | RegLocation rlSrc); |
| 52 | static void loadValueDirectFixed(CompilationUnit *cUnit, RegLocation rlSrc, |
| 53 | int reg1); |
| 54 | static void loadValueDirectWide(CompilationUnit *cUnit, RegLocation rlSrc, |
| 55 | int regLo, int regHi); |
| 56 | static void loadValueDirectWideFixed(CompilationUnit *cUnit, RegLocation rlSrc, |
| 57 | int regLo, int regHi); |
| 58 | static ArmLIR *genNullCheck(CompilationUnit *cUnit, int sReg, int mReg, |
| 59 | int dOffset, ArmLIR *pcrLabel); |
| 60 | static ArmLIR *loadWordDisp(CompilationUnit *cUnit, int rBase, |
| 61 | int displacement, int rDest); |
| 62 | static ArmLIR *storeWordDisp(CompilationUnit *cUnit, int rBase, |
| 63 | int displacement, int rDest); |
| 64 | static RegLocation inlinedTarget(CompilationUnit *cUnit, MIR *mir, bool fpHint); |
| 65 | static RegLocation inlinedTargetWide(CompilationUnit *cUnit, MIR *mir, |
| 66 | bool fpHint); |
| 67 | static ArmLIR *genBoundsCheck(CompilationUnit *cUnit, int rIndex, |
| 68 | int rBound, int dOffset, ArmLIR *pcrLabel); |
| 69 | static void handleMonitorPortable(CompilationUnit *cUnit, MIR *mir); |
| 70 | static inline ArmLIR *genRegRegCheck(CompilationUnit *cUnit, |
| 71 | ArmConditionCode cond, |
| 72 | int reg1, int reg2, int dOffset, |
| 73 | ArmLIR *pcrLabel); |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 74 | |
| 75 | /* Routines which must be supplied by the variant-specific code */ |
| 76 | static void genDispatchToHandler(CompilationUnit *cUnit, TemplateOpCode opCode); |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 77 | static bool genInlineSqrt(CompilationUnit *cUnit, MIR *mir); |
| 78 | static bool genInlineCos(CompilationUnit *cUnit, MIR *mir); |
| 79 | static bool genInlineSin(CompilationUnit *cUnit, MIR *mir); |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 80 | static bool handleConversion(CompilationUnit *cUnit, MIR *mir); |
| Ben Cheng | d7d426a | 2009-09-22 11:23:36 -0700 | [diff] [blame] | 81 | static bool compilerArchVariantInit(); |
| Bill Buzbee | 1465db5 | 2009-09-23 17:17:35 -0700 | [diff] [blame] | 82 | static bool handleArithOpFloat(CompilationUnit *cUnit, MIR *mir, |
| 83 | RegLocation rlDest, RegLocation rlSrc1, |
| 84 | RegLocation rlSrc2); |
| 85 | static bool handleArithOpDouble(CompilationUnit *cUnit, MIR *mir, |
| 86 | RegLocation rlDest, RegLocation rlSrc1, |
| 87 | RegLocation rlSrc2); |
| 88 | static bool handleCmpFP(CompilationUnit *cUnit, MIR *mir, RegLocation rlDest, |
| 89 | RegLocation rlSrc1, RegLocation rlSrc2); |
| Bill Buzbee | 9bc3df3 | 2009-07-30 10:52:29 -0700 | [diff] [blame] | 90 | |
| 91 | #endif /* _DALVIK_VM_COMPILER_CODEGEN_ARM_CODEGEN_H */ |