Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -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 | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 17 | #ifndef _DALVIK_VM_COMPILER_OPTIMIZATION_H |
| 18 | #define _DALVIK_VM_COMPILER_OPTIMIZATION_H |
| 19 | |
Ben Cheng | 4238ec2 | 2009-08-24 16:32:22 -0700 | [diff] [blame] | 20 | #include "Dalvik.h" |
| 21 | |
Ben Cheng | e9695e5 | 2009-06-16 16:11:47 -0700 | [diff] [blame] | 22 | /* Forward declarations */ |
| 23 | struct CompilationUnit; |
| 24 | struct LIR; |
| 25 | |
| 26 | /* |
| 27 | * Data structure tracking the mapping between a Dalvik register (pair) and a |
| 28 | * native register (pair). The idea is to reuse the previously loaded value |
| 29 | * if possible, otherwise to keep the value in a native register as long as |
| 30 | * possible. |
| 31 | */ |
| 32 | typedef struct RegisterScoreboard { |
| 33 | BitVector *nullCheckedRegs; // Track which registers have been null-checked |
| 34 | int liveDalvikReg; // Track which Dalvik register is live |
| 35 | int nativeReg; // And the mapped native register |
| 36 | int nativeRegHi; // And the mapped native register |
| 37 | bool isWide; // Whether a pair of registers are alive |
| 38 | } RegisterScoreboard; |
| 39 | |
| 40 | void dvmCompilerApplyLocalOptimizations(struct CompilationUnit *cUnit, |
| 41 | struct LIR *head, |
| 42 | struct LIR *tail); |
| 43 | |
| 44 | void dvmCompilerApplyGlobalOptimizations(struct CompilationUnit *cUnit); |
| 45 | |
| 46 | #endif /* _DALVIK_VM_COMPILER_OPTIMIZATION_H */ |