blob: e0912d77b8e4edd5c4a767b710ae657eff37cd97 [file] [log] [blame]
buzbeee3acd072012-02-25 17:03:10 -08001/*
2 * Copyright (C) 2012 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
17namespace art {
18
19/*
20 * This file contains codegen for the Mips ISA and is intended to be
21 * includes by:
22 *
23 * Codegen-$(TARGET_ARCH_VARIANT).c
24 *
25 */
26
27/*
28 * Alloc a pair of core registers, or a double. Low reg in low byte,
29 * high reg in next byte.
30 */
31int oatAllocTypedTempPair(CompilationUnit *cUnit, bool fpHint,
32 int regClass)
33{
34 int highReg;
35 int lowReg;
36 int res = 0;
37
38#ifdef __mips_hard_float
39 if (((regClass == kAnyReg) && fpHint) || (regClass == kFPReg)) {
40 lowReg = oatAllocTempDouble(cUnit);
41 highReg = lowReg + 1;
42 res = (lowReg & 0xff) | ((highReg & 0xff) << 8);
43 return res;
44 }
45#endif
46
47 lowReg = oatAllocTemp(cUnit);
48 highReg = oatAllocTemp(cUnit);
49 res = (lowReg & 0xff) | ((highReg & 0xff) << 8);
50 return res;
51}
52
53int oatAllocTypedTemp(CompilationUnit *cUnit, bool fpHint, int regClass)
54{
55#ifdef __mips_hard_float
56 if (((regClass == kAnyReg) && fpHint) || (regClass == kFPReg))
57{
58 return oatAllocTempFloat(cUnit);
59}
60#endif
61 return oatAllocTemp(cUnit);
62}
63
64} // namespace art