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