blob: be74e3fd95f872c09f6a5fc7ca6a549e8ce2a068 [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 Chengfc075c22010-05-28 15:20:08 -070028#if defined(_CODEGEN_C)
Ben Cheng5d90c202009-11-22 23:31:11 -080029/*
30 * loadConstant() sometimes needs to add a small imm to a pre-existing constant
31 */
32static ArmLIR *opRegImm(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
33 int value);
34static ArmLIR *opRegReg(CompilationUnit *cUnit, OpKind op, int rDestSrc1,
35 int rSrc2);
Bill Buzbee9bc3df32009-07-30 10:52:29 -070036
Ben Cheng5d90c202009-11-22 23:31:11 -080037/* Forward decalraton the portable versions due to circular dependency */
38static bool genArithOpFloatPortable(CompilationUnit *cUnit, MIR *mir,
39 RegLocation rlDest, RegLocation rlSrc1,
40 RegLocation rlSrc2);
41
42static bool genArithOpDoublePortable(CompilationUnit *cUnit, MIR *mir,
43 RegLocation rlDest, RegLocation rlSrc1,
44 RegLocation rlSrc2);
45
46static bool genConversionPortable(CompilationUnit *cUnit, MIR *mir);
47
Ben Chengfc075c22010-05-28 15:20:08 -070048#if defined(WITH_DEADLOCK_PREDICTION) || defined(WITH_MONITOR_TRACKING) || \
49 defined(__ARM_ARCH_5__)
Ben Cheng5d90c202009-11-22 23:31:11 -080050static void genMonitorPortable(CompilationUnit *cUnit, MIR *mir);
Ben Chengfc075c22010-05-28 15:20:08 -070051#endif
Ben Cheng5d90c202009-11-22 23:31:11 -080052
Bill Buzbee434bae62010-03-27 10:58:03 -070053static void genInterpSingleStep(CompilationUnit *cUnit, MIR *mir);
54
Ben Chengfc075c22010-05-28 15:20:08 -070055#endif
56
57
jeffhao9e45c0b2010-02-03 10:24:05 -080058#if defined(WITH_SELF_VERIFICATION)
59/* Self Verification memory instruction decoder */
60void dvmSelfVerificationMemOpDecode(int lr, int* sp);
61#endif
Ben Cheng5d90c202009-11-22 23:31:11 -080062
63/*
64 * Architecture-dependent register allocation routines implemented in
65 * Thumb[2]/Ralloc.c
66 */
67extern int dvmCompilerAllocTypedTempPair(CompilationUnit *cUnit,
68 bool fpHint, int regClass);
69
70extern int dvmCompilerAllocTypedTemp(CompilationUnit *cUnit, bool fpHint,
71 int regClass);
72
73extern ArmLIR* dvmCompilerRegCopyNoInsert(CompilationUnit *cUnit, int rDest,
74 int rSrc);
75
76extern ArmLIR* dvmCompilerRegCopy(CompilationUnit *cUnit, int rDest, int rSrc);
77
78extern void dvmCompilerRegCopyWide(CompilationUnit *cUnit, int destLo,
79 int destHi, int srcLo, int srcHi);
80
buzbeebff121a2010-08-04 15:25:06 -070081extern void dvmCompilerSetupResourceMasks(ArmLIR *lir);
82
Ben Cheng5d90c202009-11-22 23:31:11 -080083extern void dvmCompilerFlushRegImpl(CompilationUnit *cUnit, int rBase,
84 int displacement, int rSrc, OpSize size);
85
86extern void dvmCompilerFlushRegWideImpl(CompilationUnit *cUnit, int rBase,
87 int displacement, int rSrcLo,
88 int rSrcHi);