blob: da65bb5d3d4e3ed8069db61811a3c39ca9e782da [file] [log] [blame]
Bill Buzbee9bc3df32009-07-30 10:52:29 -07001/*
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
Bill Buzbee9bc3df32009-07-30 10:52:29 -070017/*
Ben Cheng5d90c202009-11-22 23:31:11 -080018 * This file contains register alloction support and is intended to be
19 * included by:
20 *
21 * Codegen-$(TARGET_ARCH_VARIANT).c
22 *
Bill Buzbee9bc3df32009-07-30 10:52:29 -070023 */
24
Ben Cheng5d90c202009-11-22 23:31:11 -080025#include "compiler/CompilerIR.h"
Ben Chengbd1326d2010-04-02 15:04:53 -070026#include "CalloutHelper.h"
Bill Buzbee9bc3df32009-07-30 10:52:29 -070027
Ben Cheng5d90c202009-11-22 23:31:11 -080028/*
29 * loadConstant() sometimes needs to add a small imm to a pre-existing constant
30 */
31static ArmLIR *opRegImm(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
32 int value);
33static ArmLIR *opRegReg(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
34 int rSrc2);
Bill Buzbee9bc3df32009-07-30 10:52:29 -070035
Ben Cheng5d90c202009-11-22 23:31:11 -080036/* Forward decalraton the portable versions due to circular dependency */
37static bool genArithOpFloatPortable(CompilationUnit *cUnit, MIR *mir,
38 RegLocation rlDest, RegLocation rlSrc1,
39 RegLocation rlSrc2);
40
41static bool genArithOpDoublePortable(CompilationUnit *cUnit, MIR *mir,
42 RegLocation rlDest, RegLocation rlSrc1,
43 RegLocation rlSrc2);
44
45static bool genConversionPortable(CompilationUnit *cUnit, MIR *mir);
46
47static void genMonitorPortable(CompilationUnit *cUnit, MIR *mir);
48
Bill Buzbee434bae62010-03-27 10:58:03 -070049static void genInterpSingleStep(CompilationUnit *cUnit, MIR *mir);
50
jeffhao9e45c0b2010-02-03 10:24:05 -080051#if defined(WITH_SELF_VERIFICATION)
52/* Self Verification memory instruction decoder */
53void dvmSelfVerificationMemOpDecode(int lr, int* sp);
54#endif
Ben Cheng5d90c202009-11-22 23:31:11 -080055
56/*
57 * Architecture-dependent register allocation routines implemented in
58 * Thumb[2]/Ralloc.c
59 */
60extern int dvmCompilerAllocTypedTempPair(CompilationUnit *cUnit,
61 bool fpHint, int regClass);
62
63extern int dvmCompilerAllocTypedTemp(CompilationUnit *cUnit, bool fpHint,
64 int regClass);
65
66extern ArmLIR* dvmCompilerRegCopyNoInsert(CompilationUnit *cUnit, int rDest,
67 int rSrc);
68
69extern ArmLIR* dvmCompilerRegCopy(CompilationUnit *cUnit, int rDest, int rSrc);
70
71extern void dvmCompilerRegCopyWide(CompilationUnit *cUnit, int destLo,
72 int destHi, int srcLo, int srcHi);
73
74extern void dvmCompilerFlushRegImpl(CompilationUnit *cUnit, int rBase,
75 int displacement, int rSrc, OpSize size);
76
77extern void dvmCompilerFlushRegWideImpl(CompilationUnit *cUnit, int rBase,
78 int displacement, int rSrcLo,
79 int rSrcHi);