2 * Copyright (C) 2009 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * This file contains register alloction support and is intended to be
21 * Codegen-$(TARGET_ARCH_VARIANT).c
25 #include "compiler/CompilerIR.h"
26 #include "CalloutHelper.h"
28 #if defined(_CODEGEN_C)
30 * loadConstant() sometimes needs to add a small imm to a pre-existing constant
32 static MipsLIR *opRegImm(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
34 static MipsLIR *opRegReg(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
37 /* Forward-declare the portable versions due to circular dependency */
38 static bool genArithOpFloatPortable(CompilationUnit *cUnit, MIR *mir,
39 RegLocation rlDest, RegLocation rlSrc1,
42 static bool genArithOpDoublePortable(CompilationUnit *cUnit, MIR *mir,
43 RegLocation rlDest, RegLocation rlSrc1,
46 static bool genConversionPortable(CompilationUnit *cUnit, MIR *mir);
48 static void genMonitorPortable(CompilationUnit *cUnit, MIR *mir);
50 static void genInterpSingleStep(CompilationUnit *cUnit, MIR *mir);
55 #if defined(WITH_SELF_VERIFICATION)
56 /* Self Verification memory instruction decoder */
57 extern "C" void dvmSelfVerificationMemOpDecode(int lr, int* sp);
61 * Architecture-dependent register allocation routines implemented in
64 extern int dvmCompilerAllocTypedTempPair(CompilationUnit *cUnit,
65 bool fpHint, int regClass);
67 extern int dvmCompilerAllocTypedTemp(CompilationUnit *cUnit, bool fpHint,
70 extern MipsLIR* dvmCompilerRegCopyNoInsert(CompilationUnit *cUnit, int rDest,
73 extern MipsLIR* dvmCompilerRegCopy(CompilationUnit *cUnit, int rDest, int rSrc);
75 extern void dvmCompilerRegCopyWide(CompilationUnit *cUnit, int destLo,
76 int destHi, int srcLo, int srcHi);
78 extern void dvmCompilerSetupResourceMasks(MipsLIR *lir);
80 extern void dvmCompilerFlushRegImpl(CompilationUnit *cUnit, int rBase,
81 int displacement, int rSrc, OpSize size);
83 extern void dvmCompilerFlushRegWideImpl(CompilationUnit *cUnit, int rBase,
84 int displacement, int rSrcLo,