blob: 59c1aa68de0d06c335962ed5415316e88155965b [file] [log] [blame]
buzbee67bf8852011-08-17 17:51:35 -07001/*
2 * Copyright (C) 2011 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
Elliott Hughes11d1b0c2012-01-23 16:57:47 -080017namespace art {
18
buzbee67bf8852011-08-17 17:51:35 -070019/*
20 * This file contains codegen for the Thumb 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, int regClass)
32{
33 int highReg;
34 int lowReg;
35 int res = 0;
36
37 if (((regClass == kAnyReg) && fpHint) || (regClass == kFPReg)) {
38 lowReg = oatAllocTempDouble(cUnit);
39 highReg = lowReg + 1;
40 } else {
41 lowReg = oatAllocTemp(cUnit);
42 highReg = oatAllocTemp(cUnit);
43 }
44 res = (lowReg & 0xff) | ((highReg & 0xff) << 8);
45 return res;
46}
47
48int oatAllocTypedTemp(CompilationUnit* cUnit, bool fpHint, int regClass)
49{
50 if (((regClass == kAnyReg) && fpHint) || (regClass == kFPReg))
51 return oatAllocTempFloat(cUnit);
52 return oatAllocTemp(cUnit);
53}
Elliott Hughes11d1b0c2012-01-23 16:57:47 -080054
55} // namespace art