annotate graal/com.oracle.jvmci.hotspot.sparc/src/com/oracle/jvmci/hotspot/sparc/SPARCHotSpotRegisterConfig.java @ 21703:b939ee385ae4

mx fsckprojects: exclude .workspace/
author Andreas Woess <andreas.woess@oracle.com>
date Wed, 03 Jun 2015 17:43:21 +0200
parents e0b5d4fcd929
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
1 /*
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15345
diff changeset
2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
4 *
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
7 * published by the Free Software Foundation.
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
8 *
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
13 * accompanied this code).
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
14 *
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
18 *
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
21 * questions.
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
22 */
21674
e0b5d4fcd929 moved HotSpotTargetDescription and [AMD64|SPARC]HotSpotRegisterConfig into JVMCI namespace (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21673
diff changeset
23 package com.oracle.jvmci.hotspot.sparc;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
24
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
25 import com.oracle.jvmci.code.Architecture;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
26 import com.oracle.jvmci.code.TargetDescription;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
27 import com.oracle.jvmci.code.CallingConvention;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
28 import com.oracle.jvmci.code.CalleeSaveLayout;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
29 import com.oracle.jvmci.code.RegisterAttributes;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
30 import com.oracle.jvmci.code.StackSlot;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
31 import com.oracle.jvmci.code.RegisterConfig;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
32 import com.oracle.jvmci.code.Register;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
33 import com.oracle.jvmci.meta.Kind;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
34 import com.oracle.jvmci.meta.JavaType;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
35 import com.oracle.jvmci.meta.PlatformKind;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
36 import com.oracle.jvmci.meta.Value;
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
37 import com.oracle.jvmci.meta.AllocatableValue;
21673
5024c80224c7 moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
38 import com.oracle.jvmci.sparc.*;
5024c80224c7 moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
39
5024c80224c7 moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
40 import static com.oracle.jvmci.sparc.SPARC.*;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
41
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
42 import java.util.*;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
43
21556
48c1ebd24120 renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21551
diff changeset
44 import com.oracle.jvmci.code.CallingConvention.Type;
21543
93c50cefb9e8 moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
45 import com.oracle.jvmci.common.*;
21551
5324104ac4f3 moved com.oracle.graal.hotspot.jvmci classes to com.oracle.jvmci.hotspot module (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21543
diff changeset
46 import com.oracle.jvmci.hotspot.*;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
47
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
48 public class SPARCHotSpotRegisterConfig implements RegisterConfig {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
49
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
50 private final Architecture architecture;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
51
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
52 private final Register[] allocatable;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
53
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
54 private final RegisterAttributes[] attributesMap;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
55
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
56 @Override
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
57 public Register[] getAllocatableRegisters() {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
58 return allocatable.clone();
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
59 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
60
20916
661ed7d3d10d RegisterConfig: rename getAllocatableRegisters(PK,R[) to filterAllocatableRegisters and remove caching from implementors.
Josef Eisl <josef.eisl@jku.at>
parents: 20913
diff changeset
61 public Register[] filterAllocatableRegisters(PlatformKind kind, Register[] registers) {
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
62 ArrayList<Register> list = new ArrayList<>();
20913
9b6ea36013c4 RegisterConfig: pass registers array to getAllocatableRegisters(PlatformKind).
Josef Eisl <josef.eisl@jku.at>
parents: 20149
diff changeset
63 for (Register reg : registers) {
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
64 if (architecture.canStoreValue(reg.getRegisterCategory(), kind)) {
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
65 // Special treatment for double precision
16664
62f295bdea36 [SPARC] Fixing compare of short/char with constants, using half of single float registers as of now, otherwise it would overlap with double registers
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16654
diff changeset
66 // TODO: This is wasteful it uses only half of the registers as float.
16995
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
67 if (kind == Kind.Double) {
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
68 if (reg.name.startsWith("d")) {
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
69 list.add(reg);
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
70 }
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
71 } else if (kind == Kind.Float) {
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
72 if (reg.name.startsWith("f")) {
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
73 list.add(reg);
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
74 }
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
75 } else {
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
76 list.add(reg);
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
77 }
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
78 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
79 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
80
18355
9a11c4086341 size array appropriately when creating categorized register array
Doug Simon <doug.simon@oracle.com>
parents: 16995
diff changeset
81 Register[] ret = list.toArray(new Register[list.size()]);
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
82 return ret;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
83 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
84
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
85 @Override
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
86 public RegisterAttributes[] getAttributesMap() {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
87 return attributesMap.clone();
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
88 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
89
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10686
diff changeset
90 private final Register[] cpuCallerParameterRegisters = {o0, o1, o2, o3, o4, o5};
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10686
diff changeset
91 private final Register[] cpuCalleeParameterRegisters = {i0, i1, i2, i3, i4, i5};
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10686
diff changeset
92
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
93 private final Register[] fpuParameterRegisters = {f0, f1, f2, f3, f4, f5, f6, f7};
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19531
diff changeset
94 private final Register[] fpuDoubleParameterRegisters = {d0, null, d2, null, d4, null, d6, null};
16929
5dc533f7565a [SPARC] Adding registers f0...f31 to callee saved; fixing allocator test, removing direct acquisition of Unsafe from SPARCHotspotBackend
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16664
diff changeset
95 // @formatter:off
5dc533f7565a [SPARC] Adding registers f0...f31 to callee saved; fixing allocator test, removing direct acquisition of Unsafe from SPARCHotspotBackend
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16664
diff changeset
96 private final Register[] callerSaveRegisters =
19531
9299e71df12a [SPARC] Save all registers for foreign calls
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18630
diff changeset
97 {g1, g2, g3, g4, g5, g6, g7,
9299e71df12a [SPARC] Save all registers for foreign calls
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 18630
diff changeset
98 o0, o1, o2, o3, o4, o5, o7,
16929
5dc533f7565a [SPARC] Adding registers f0...f31 to callee saved; fixing allocator test, removing direct acquisition of Unsafe from SPARCHotspotBackend
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16664
diff changeset
99 f0, f1, f2, f3, f4, f5, f6, f7,
5dc533f7565a [SPARC] Adding registers f0...f31 to callee saved; fixing allocator test, removing direct acquisition of Unsafe from SPARCHotspotBackend
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16664
diff changeset
100 f8, f9, f10, f11, f12, f13, f14, f15,
5dc533f7565a [SPARC] Adding registers f0...f31 to callee saved; fixing allocator test, removing direct acquisition of Unsafe from SPARCHotspotBackend
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16664
diff changeset
101 f16, f17, f18, f19, f20, f21, f22, f23,
16995
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
102 f24, f25, f26, f27, f28, f29, f30, f31,
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
103 d32, d34, d36, d38, d40, d42, d44, d46,
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
104 d48, d50, d52, d54, d56, d58, d60, d62};
16929
5dc533f7565a [SPARC] Adding registers f0...f31 to callee saved; fixing allocator test, removing direct acquisition of Unsafe from SPARCHotspotBackend
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16664
diff changeset
105 // @formatter:on
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
106
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
107 /**
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
108 * Registers saved by the callee. This lists all L and I registers which are saved in the
21674
e0b5d4fcd929 moved HotSpotTargetDescription and [AMD64|SPARC]HotSpotRegisterConfig into JVMCI namespace (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21673
diff changeset
109 * register window.
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
110 */
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
111 private final Register[] calleeSaveRegisters = {l0, l1, l2, l3, l4, l5, l6, l7, i0, i1, i2, i3, i4, i5, i6, i7};
10686
73122b5edf6a SPARC: Can compile simple methods and do static calls.
twisti
parents: 10459
diff changeset
112
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
113 private final CalleeSaveLayout csl;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
114
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
115 private static Register[] initAllocatable(boolean reserveForHeapBase) {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
116 Register[] registers = null;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
117 if (reserveForHeapBase) {
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15259
diff changeset
118 // @formatter:off
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15259
diff changeset
119 registers = new Register[]{
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
120 // TODO this is not complete
16524
a08a58d0736b [SPARC] Emit compareAndSwap for AtomicInteger and AtomicLong, Removing o7 register from usable ones, as this register is always overwritten, when using Call or JumpAndLink instructions in SPARC, even callee does not overwrite explicitly, implicit exception is defined when doing integer division, parameter constraint narrowed to only register on Unary2Op, Fix SPARCTestOp, as it did a compare instead of an and with condition codes
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16430
diff changeset
121 // o7 cannot be used as register because it is always overwritten on call
a08a58d0736b [SPARC] Emit compareAndSwap for AtomicInteger and AtomicLong, Removing o7 register from usable ones, as this register is always overwritten, when using Call or JumpAndLink instructions in SPARC, even callee does not overwrite explicitly, implicit exception is defined when doing integer division, parameter constraint narrowed to only register on Unary2Op, Fix SPARCTestOp, as it did a compare instead of an and with condition codes
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16430
diff changeset
122 // and the current register handler would ignore this fact if the called
a08a58d0736b [SPARC] Emit compareAndSwap for AtomicInteger and AtomicLong, Removing o7 register from usable ones, as this register is always overwritten, when using Call or JumpAndLink instructions in SPARC, even callee does not overwrite explicitly, implicit exception is defined when doing integer division, parameter constraint narrowed to only register on Unary2Op, Fix SPARCTestOp, as it did a compare instead of an and with condition codes
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16430
diff changeset
123 // method still does not modify registers, in fact o7 is modified by the Call instruction
a08a58d0736b [SPARC] Emit compareAndSwap for AtomicInteger and AtomicLong, Removing o7 register from usable ones, as this register is always overwritten, when using Call or JumpAndLink instructions in SPARC, even callee does not overwrite explicitly, implicit exception is defined when doing integer division, parameter constraint narrowed to only register on Unary2Op, Fix SPARCTestOp, as it did a compare instead of an and with condition codes
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16430
diff changeset
124 // There would be some extra handlin necessary to be able to handle the o7 properly for local usage
a08a58d0736b [SPARC] Emit compareAndSwap for AtomicInteger and AtomicLong, Removing o7 register from usable ones, as this register is always overwritten, when using Call or JumpAndLink instructions in SPARC, even callee does not overwrite explicitly, implicit exception is defined when doing integer division, parameter constraint narrowed to only register on Unary2Op, Fix SPARCTestOp, as it did a compare instead of an and with condition codes
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16430
diff changeset
125 o0, o1, o2, o3, o4, o5, /*o6, o7,*/
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
126 l0, l1, l2, l3, l4, l5, l6, l7,
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
127 i0, i1, i2, i3, i4, i5, /*i6,*/ /*i7,*/
16995
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
128 //f0, f1, f2, f3, f4, f5, f6, f7,
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
129 f8, f9, f10, f11, f12, f13, f14, f15,
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
130 f16, f17, f18, f19, f20, f21, f22, f23,
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
131 f24, f25, f26, f27, f28, f29, f30, f31,
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
132 d32, d34, d36, d38, d40, d42, d44, d46,
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
133 d48, d50, d52, d54, d56, d58, d60, d62
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15259
diff changeset
134 };
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15259
diff changeset
135 // @formatter:on
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
136 } else {
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15259
diff changeset
137 // @formatter:off
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15259
diff changeset
138 registers = new Register[]{
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10792
diff changeset
139 // TODO this is not complete
16524
a08a58d0736b [SPARC] Emit compareAndSwap for AtomicInteger and AtomicLong, Removing o7 register from usable ones, as this register is always overwritten, when using Call or JumpAndLink instructions in SPARC, even callee does not overwrite explicitly, implicit exception is defined when doing integer division, parameter constraint narrowed to only register on Unary2Op, Fix SPARCTestOp, as it did a compare instead of an and with condition codes
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16430
diff changeset
140 o0, o1, o2, o3, o4, o5, /*o6, o7,*/
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
141 l0, l1, l2, l3, l4, l5, l6, l7,
11233
5a9d68c3a7d7 SPARC: a lot of fixes and more
twisti
parents: 10871
diff changeset
142 i0, i1, i2, i3, i4, i5, /*i6,*/ /*i7,*/
16995
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
143 // f0, f1, f2, f3, f4, f5, f6, f7
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
144 f8, f9, f10, f11, f12, f13, f14, f15,
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
145 f16, f17, f18, f19, f20, f21, f22, f23,
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
146 f24, f25, f26, f27, f28, f29, f30, f31,
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
147 d32, d34, d36, d38, d40, d42, d44, d46,
4feac7e51f42 [SPARC] Fixing float register allocation
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16932
diff changeset
148 d48, d50, d52, d54, d56, d58, d60, d62
15345
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15259
diff changeset
149 };
109d6c7c40b5 implement SPARC uncommon trap stub
twisti
parents: 15259
diff changeset
150 // @formatter:on
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
151 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
152
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
153 return registers;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
154 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
155
14559
883fbd3e06e0 Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14003
diff changeset
156 public SPARCHotSpotRegisterConfig(TargetDescription target, HotSpotVMConfig config) {
15011
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
157 this(target, initAllocatable(config.useCompressedOops));
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
158 }
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
159
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
160 public SPARCHotSpotRegisterConfig(TargetDescription target, Register[] allocatable) {
14559
883fbd3e06e0 Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14003
diff changeset
161 this.architecture = target.arch;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
162
14559
883fbd3e06e0 Make size of PlatformKind overridable by VM specific code.
Roland Schatz <roland.schatz@oracle.com>
parents: 14003
diff changeset
163 csl = new CalleeSaveLayout(target, -1, -1, target.arch.getWordSize(), calleeSaveRegisters);
15011
c8e575742f36 allow compilation with custom RegisterConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 14991
diff changeset
164 this.allocatable = allocatable.clone();
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
165 attributesMap = RegisterAttributes.createMap(this, SPARC.allRegisters);
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
166 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
167
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
168 @Override
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
169 public Register[] getCallerSaveRegisters() {
10686
73122b5edf6a SPARC: Can compile simple methods and do static calls.
twisti
parents: 10459
diff changeset
170 return callerSaveRegisters;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
171 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
172
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
173 @Override
14614
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14559
diff changeset
174 public boolean areAllAllocatableRegistersCallerSaved() {
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14559
diff changeset
175 return false;
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14559
diff changeset
176 }
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14559
diff changeset
177
abf7cf57df5e added RegisterConfig.areAllAllocatableRegistersCallerSaved()
Doug Simon <doug.simon@oracle.com>
parents: 14559
diff changeset
178 @Override
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
179 public Register getRegisterForRole(int index) {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
180 throw new UnsupportedOperationException();
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
181 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
182
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
183 @Override
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
184 public CallingConvention getCallingConvention(Type type, JavaType returnType, JavaType[] parameterTypes, TargetDescription target, boolean stackOnly) {
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10686
diff changeset
185 if (type == Type.JavaCall || type == Type.NativeCall) {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10686
diff changeset
186 return callingConvention(cpuCallerParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
187 }
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10686
diff changeset
188 if (type == Type.JavaCallee) {
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10686
diff changeset
189 return callingConvention(cpuCalleeParameterRegisters, returnType, parameterTypes, type, target, stackOnly);
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10686
diff changeset
190 }
21543
93c50cefb9e8 moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
191 throw JVMCIError.shouldNotReachHere();
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
192 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
193
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
194 public Register[] getCallingConventionRegisters(Type type, Kind kind) {
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19531
diff changeset
195 if (architecture.canStoreValue(FPUs, kind) || architecture.canStoreValue(FPUd, kind)) {
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
196 return fpuParameterRegisters;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
197 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
198 assert architecture.canStoreValue(CPU, kind);
10792
7a8d6ba83a04 SPARC: fixes and more stuff works
twisti
parents: 10686
diff changeset
199 return type == Type.JavaCallee ? cpuCalleeParameterRegisters : cpuCallerParameterRegisters;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
200 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
201
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
202 private CallingConvention callingConvention(Register[] generalParameterRegisters, JavaType returnType, JavaType[] parameterTypes, Type type, TargetDescription target, boolean stackOnly) {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
203 AllocatableValue[] locations = new AllocatableValue[parameterTypes.length];
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
204
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
205 int currentGeneral = 0;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
206 int currentFloating = 0;
16637
eda09bc52ab9 [SPARC] Fix handling of overflow parameter on stack.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16634
diff changeset
207 int currentStackOffset = 0;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
208
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
209 for (int i = 0; i < parameterTypes.length; i++) {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
210 final Kind kind = parameterTypes[i].getKind();
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
211
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
212 switch (kind) {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
213 case Byte:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
214 case Boolean:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
215 case Short:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
216 case Char:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
217 case Int:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
218 case Long:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
219 case Object:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
220 if (!stackOnly && currentGeneral < generalParameterRegisters.length) {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
221 Register register = generalParameterRegisters[currentGeneral++];
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15345
diff changeset
222 locations[i] = register.asValue(target.getLIRKind(kind));
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
223 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
224 break;
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
225 case Double:
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
226 if (!stackOnly && currentFloating < fpuParameterRegisters.length) {
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
227 if (currentFloating % 2 != 0) {
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
228 // Make register number even to be a double reg
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
229 currentFloating++;
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
230 }
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19531
diff changeset
231 Register register = fpuDoubleParameterRegisters[currentFloating];
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
232 currentFloating += 2; // Only every second is a double register
16327
5f01f7c48d40 Merge with 5cdcb94a7cf7d9782107cc582f3e4b50000d5d1f
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16321 16094
diff changeset
233 locations[i] = register.asValue(target.getLIRKind(kind));
16321
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
234 }
fac4af29aeb8 [SPARC] Fixing lots of float and double issues.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15345
diff changeset
235 break;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
236 case Float:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
237 if (!stackOnly && currentFloating < fpuParameterRegisters.length) {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
238 Register register = fpuParameterRegisters[currentFloating++];
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15345
diff changeset
239 locations[i] = register.asValue(target.getLIRKind(kind));
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
240 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
241 break;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
242 default:
21543
93c50cefb9e8 moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
243 throw JVMCIError.shouldNotReachHere();
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
244 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
245
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
246 if (locations[i] == null) {
16654
8aa938ab4ac8 [SPARC] Spill slots must be 4 byte aligned
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16637
diff changeset
247 // Stack slot is always aligned to its size in bytes but minimum wordsize
8aa938ab4ac8 [SPARC] Spill slots must be 4 byte aligned
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16637
diff changeset
248 int typeSize = SPARC.spillSlotSize(target, kind);
21674
e0b5d4fcd929 moved HotSpotTargetDescription and [AMD64|SPARC]HotSpotRegisterConfig into JVMCI namespace (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21673
diff changeset
249 currentStackOffset = roundUp(currentStackOffset, typeSize);
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15345
diff changeset
250 locations[i] = StackSlot.get(target.getLIRKind(kind.getStackKind()), currentStackOffset, !type.out);
16637
eda09bc52ab9 [SPARC] Fix handling of overflow parameter on stack.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 16634
diff changeset
251 currentStackOffset += typeSize;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
252 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
253 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
254
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
255 Kind returnKind = returnType == null ? Kind.Void : returnType.getKind();
16094
c0b8d395368b Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 15345
diff changeset
256 AllocatableValue returnLocation = returnKind == Kind.Void ? Value.ILLEGAL : getReturnRegister(returnKind, type).asValue(target.getLIRKind(returnKind.getStackKind()));
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
257 return new CallingConvention(currentStackOffset, returnLocation, locations);
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
258 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
259
21674
e0b5d4fcd929 moved HotSpotTargetDescription and [AMD64|SPARC]HotSpotRegisterConfig into JVMCI namespace (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21673
diff changeset
260 private static int roundUp(int number, int mod) {
e0b5d4fcd929 moved HotSpotTargetDescription and [AMD64|SPARC]HotSpotRegisterConfig into JVMCI namespace (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21673
diff changeset
261 return ((number + mod - 1) / mod) * mod;
e0b5d4fcd929 moved HotSpotTargetDescription and [AMD64|SPARC]HotSpotRegisterConfig into JVMCI namespace (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21673
diff changeset
262 }
e0b5d4fcd929 moved HotSpotTargetDescription and [AMD64|SPARC]HotSpotRegisterConfig into JVMCI namespace (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21673
diff changeset
263
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
264 @Override
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
265 public Register getReturnRegister(Kind kind) {
10871
c3b09d69dfde SPARC: fixes and more implementation; can now allocate objects
twisti
parents: 10854
diff changeset
266 return getReturnRegister(kind, Type.JavaCallee);
c3b09d69dfde SPARC: fixes and more implementation; can now allocate objects
twisti
parents: 10854
diff changeset
267 }
c3b09d69dfde SPARC: fixes and more implementation; can now allocate objects
twisti
parents: 10854
diff changeset
268
c3b09d69dfde SPARC: fixes and more implementation; can now allocate objects
twisti
parents: 10854
diff changeset
269 private static Register getReturnRegister(Kind kind, Type type) {
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
270 switch (kind) {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
271 case Boolean:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
272 case Byte:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
273 case Char:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
274 case Short:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
275 case Int:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
276 case Long:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
277 case Object:
10871
c3b09d69dfde SPARC: fixes and more implementation; can now allocate objects
twisti
parents: 10854
diff changeset
278 return type == Type.JavaCallee ? i0 : o0;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
279 case Float:
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19531
diff changeset
280 return f0;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
281 case Double:
20149
b1a8928fc4b9 [SPARC] Implement new instructions in assembler/enhance assertion error-message in MoveResolver
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 19531
diff changeset
282 return d0;
10459
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
283 case Void:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
284 case Illegal:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
285 return null;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
286 default:
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
287 throw new UnsupportedOperationException("no return register for type " + kind);
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
288 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
289 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
290
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
291 @Override
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
292 public Register getFrameRegister() {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
293 return sp;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
294 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
295
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
296 public CalleeSaveLayout getCalleeSaveLayout() {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
297 return csl;
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
298 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
299
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
300 @Override
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
301 public String toString() {
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
302 return String.format("Allocatable: " + Arrays.toString(getAllocatableRegisters()) + "%n" + "CallerSave: " + Arrays.toString(getCallerSaveRegisters()) + "%n");
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
303 }
f78079947084 some basic SPARC arithmetic works
twisti
parents:
diff changeset
304 }