Mercurial > hg > truffle
annotate graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCCall.java @ 19526:8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 20 Feb 2015 22:22:55 +0100 |
parents | 35ae3e916582 |
children | 96ab2078eeaf |
rev | line source |
---|---|
10686 | 1 /* |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
10686 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package com.oracle.graal.lir.sparc; | |
24 | |
25 import static com.oracle.graal.api.code.ValueUtil.*; | |
26 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; | |
27 import static com.oracle.graal.sparc.SPARC.*; | |
28 | |
29 import com.oracle.graal.api.code.*; | |
30 import com.oracle.graal.api.meta.*; | |
31 import com.oracle.graal.asm.sparc.*; | |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14031
diff
changeset
|
32 import com.oracle.graal.asm.sparc.SPARCAssembler.Call; |
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14031
diff
changeset
|
33 import com.oracle.graal.asm.sparc.SPARCAssembler.Jmpl; |
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14031
diff
changeset
|
34 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Jmp; |
17119
60844c15ab27
[SPARC] Add nop again otherwise the information on pc is not unique
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17118
diff
changeset
|
35 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Nop; |
14991
64dcb92ee75a
Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14031
diff
changeset
|
36 import com.oracle.graal.asm.sparc.SPARCMacroAssembler.Sethix; |
17177
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
37 import com.oracle.graal.compiler.common.*; |
10686 | 38 import com.oracle.graal.lir.*; |
39 import com.oracle.graal.lir.asm.*; | |
40 | |
41 public class SPARCCall { | |
42 | |
43 public abstract static class CallOp extends SPARCLIRInstruction { | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
44 public static final LIRInstructionClass<CallOp> TYPE = LIRInstructionClass.create(CallOp.class); |
10686 | 45 |
46 @Def({REG, ILLEGAL}) protected Value result; | |
47 @Use({REG, STACK}) protected Value[] parameters; | |
48 @Temp protected Value[] temps; | |
49 @State protected LIRFrameState state; | |
50 | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
51 protected CallOp(LIRInstructionClass<? extends CallOp> c, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
52 super(c); |
10686 | 53 this.result = result; |
54 this.parameters = parameters; | |
55 this.state = state; | |
56 this.temps = temps; | |
57 assert temps != null; | |
58 } | |
59 | |
60 @Override | |
61 public boolean destroysCallerSavedRegisters() { | |
11233 | 62 return true; |
10686 | 63 } |
64 } | |
65 | |
66 public abstract static class MethodCallOp extends CallOp { | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
67 public static final LIRInstructionClass<MethodCallOp> TYPE = LIRInstructionClass.create(MethodCallOp.class); |
10686 | 68 |
69 protected final ResolvedJavaMethod callTarget; | |
70 | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
71 protected MethodCallOp(LIRInstructionClass<? extends MethodCallOp> c, ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
72 super(c, result, parameters, temps, state); |
10686 | 73 this.callTarget = callTarget; |
74 } | |
75 | |
76 } | |
77 | |
78 @Opcode("CALL_DIRECT") | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
79 public abstract static class DirectCallOp extends MethodCallOp /* |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
80 * implements |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
81 * SPARCDelayedControlTransfer |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
82 */{ |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
83 public static final LIRInstructionClass<DirectCallOp> TYPE = LIRInstructionClass.create(DirectCallOp.class); |
17177
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
84 private boolean emitted = false; |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
85 private int before = -1; |
10686 | 86 |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
87 public DirectCallOp(LIRInstructionClass<? extends DirectCallOp> c, ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
88 super(c, callTarget, result, parameters, temps, state); |
10686 | 89 } |
90 | |
91 @Override | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
92 public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { |
17177
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
93 if (!emitted) { |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
94 emitCallPrefixCode(crb, masm); |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
95 directCall(crb, masm, callTarget, null, true, state); |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
96 } else { |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
97 int after = masm.position(); |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
98 if (after - before == 4) { |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
99 new Nop().emit(masm); |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
100 } else if (after - before == 8) { |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
101 // everything is fine; |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
102 } else { |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
103 GraalInternalError.shouldNotReachHere("" + (after - before)); |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
104 } |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
105 after = masm.position(); |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
106 crb.recordDirectCall(before, after, callTarget, state); |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
107 crb.recordExceptionHandlers(after, state); |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
108 masm.ensureUniquePC(); |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
109 } |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
110 } |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
111 |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
112 @SuppressWarnings("unused") |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
113 public void emitCallPrefixCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
114 // |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
115 } |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
116 |
17206
2d401b9ca70d
[SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17177
diff
changeset
|
117 public void emitControlTransfer(CompilationResultBuilder crb, SPARCMacroAssembler masm) { |
17177
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
118 assert !emitted; |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
119 emitCallPrefixCode(crb, masm); |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
120 before = masm.position(); |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
121 new Call(0).emit(masm); |
805a26002dc7
[SPARC] Implement stuffing of delay slots in branches and calls. Optimized the cmove for integer and fp ops
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17119
diff
changeset
|
122 emitted = true; |
10686 | 123 } |
17207
5a7b82c1514e
[SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17206
diff
changeset
|
124 |
5a7b82c1514e
[SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17206
diff
changeset
|
125 public void resetState() { |
5a7b82c1514e
[SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17206
diff
changeset
|
126 emitted = false; |
5a7b82c1514e
[SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17206
diff
changeset
|
127 before = -1; |
5a7b82c1514e
[SPARC] Add functionality to be able to do assembly in two passes (knowing offsets of forward branches)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17206
diff
changeset
|
128 } |
10686 | 129 } |
130 | |
131 @Opcode("CALL_INDIRECT") | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
132 public abstract static class IndirectCallOp extends MethodCallOp { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
133 public static final LIRInstructionClass<IndirectCallOp> TYPE = LIRInstructionClass.create(IndirectCallOp.class); |
10686 | 134 |
135 @Use({REG}) protected Value targetAddress; | |
136 | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
137 protected IndirectCallOp(LIRInstructionClass<? extends IndirectCallOp> c, ResolvedJavaMethod callTarget, Value result, Value[] parameters, Value[] temps, Value targetAddress, |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
138 LIRFrameState state) { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
139 super(c, callTarget, result, parameters, temps, state); |
10686 | 140 this.targetAddress = targetAddress; |
141 } | |
142 | |
143 @Override | |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
144 public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
145 indirectCall(crb, masm, asRegister(targetAddress), callTarget, state); |
10686 | 146 } |
147 | |
148 @Override | |
17604
35ae3e916582
Make LIRInstruction an interface.
Josef Eisl <josef.eisl@jku.at>
parents:
17207
diff
changeset
|
149 public void verify() { |
10686 | 150 super.verify(); |
151 assert isRegister(targetAddress) : "The current register allocator cannot handle variables to be used at call sites, it must be in a fixed register for now"; | |
152 } | |
153 } | |
154 | |
155 public abstract static class ForeignCallOp extends CallOp { | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
156 public static final LIRInstructionClass<ForeignCallOp> TYPE = LIRInstructionClass.create(ForeignCallOp.class); |
10686 | 157 |
158 protected final ForeignCallLinkage callTarget; | |
159 | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
160 public ForeignCallOp(LIRInstructionClass<? extends ForeignCallOp> c, ForeignCallLinkage callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
161 super(c, result, parameters, temps, state); |
10686 | 162 this.callTarget = callTarget; |
163 } | |
164 | |
165 @Override | |
166 public boolean destroysCallerSavedRegisters() { | |
11233 | 167 return callTarget.destroysRegisters(); |
10686 | 168 } |
169 } | |
170 | |
171 @Opcode("NEAR_FOREIGN_CALL") | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
172 public static final class DirectNearForeignCallOp extends ForeignCallOp { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
173 public static final LIRInstructionClass<DirectNearForeignCallOp> TYPE = LIRInstructionClass.create(DirectNearForeignCallOp.class); |
10686 | 174 |
175 public DirectNearForeignCallOp(ForeignCallLinkage linkage, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
176 super(TYPE, linkage, result, parameters, temps, state); |
10686 | 177 } |
178 | |
179 @Override | |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
180 public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
181 directCall(crb, masm, callTarget, null, false, state); |
10686 | 182 } |
183 } | |
184 | |
185 @Opcode("FAR_FOREIGN_CALL") | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
186 public static final class DirectFarForeignCallOp extends ForeignCallOp { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
187 public static final LIRInstructionClass<DirectFarForeignCallOp> TYPE = LIRInstructionClass.create(DirectFarForeignCallOp.class); |
10686 | 188 |
10871
c3b09d69dfde
SPARC: fixes and more implementation; can now allocate objects
twisti
parents:
10854
diff
changeset
|
189 public DirectFarForeignCallOp(ForeignCallLinkage callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState state) { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
17604
diff
changeset
|
190 super(TYPE, callTarget, result, parameters, temps, state); |
10686 | 191 } |
192 | |
193 @Override | |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
194 public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
195 directCall(crb, masm, callTarget, o7, false, state); |
10686 | 196 } |
197 } | |
198 | |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
199 public static void directCall(CompilationResultBuilder crb, SPARCMacroAssembler masm, InvokeTarget callTarget, Register scratch, boolean align, LIRFrameState info) { |
10686 | 200 if (align) { |
201 // We don't need alignment on SPARC. | |
202 } | |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
13227
diff
changeset
|
203 int before = masm.position(); |
10686 | 204 if (scratch != null) { |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10686
diff
changeset
|
205 // offset might not fit a 30-bit displacement, generate an |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10686
diff
changeset
|
206 // indirect call with a 64-bit immediate |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10686
diff
changeset
|
207 new Sethix(0L, scratch, true).emit(masm); |
10871
c3b09d69dfde
SPARC: fixes and more implementation; can now allocate objects
twisti
parents:
10854
diff
changeset
|
208 new Jmpl(scratch, 0, o7).emit(masm); |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10686
diff
changeset
|
209 } else { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10686
diff
changeset
|
210 new Call(0).emit(masm); |
10686 | 211 } |
17119
60844c15ab27
[SPARC] Add nop again otherwise the information on pc is not unique
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17118
diff
changeset
|
212 new Nop().emit(masm); // delay slot |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
13227
diff
changeset
|
213 int after = masm.position(); |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
214 crb.recordDirectCall(before, after, callTarget, info); |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
215 crb.recordExceptionHandlers(after, info); |
17119
60844c15ab27
[SPARC] Add nop again otherwise the information on pc is not unique
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17118
diff
changeset
|
216 masm.ensureUniquePC(); |
10686 | 217 } |
218 | |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
219 public static void indirectJmp(CompilationResultBuilder crb, SPARCMacroAssembler masm, Register dst, InvokeTarget target) { |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
13227
diff
changeset
|
220 int before = masm.position(); |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10686
diff
changeset
|
221 new Sethix(0L, dst, true).emit(masm); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10686
diff
changeset
|
222 new Jmp(new SPARCAddress(dst, 0)).emit(masm); |
17119
60844c15ab27
[SPARC] Add nop again otherwise the information on pc is not unique
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17118
diff
changeset
|
223 new Nop().emit(masm); // delay slot |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
13227
diff
changeset
|
224 int after = masm.position(); |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
225 crb.recordIndirectCall(before, after, target, null); |
17119
60844c15ab27
[SPARC] Add nop again otherwise the information on pc is not unique
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17118
diff
changeset
|
226 masm.ensureUniquePC(); |
10686 | 227 } |
228 | |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
229 public static void indirectCall(CompilationResultBuilder crb, SPARCMacroAssembler masm, Register dst, InvokeTarget callTarget, LIRFrameState info) { |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
13227
diff
changeset
|
230 int before = masm.position(); |
10871
c3b09d69dfde
SPARC: fixes and more implementation; can now allocate objects
twisti
parents:
10854
diff
changeset
|
231 new Jmpl(dst, 0, o7).emit(masm); |
17119
60844c15ab27
[SPARC] Add nop again otherwise the information on pc is not unique
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17118
diff
changeset
|
232 new Nop().emit(masm); // delay slot |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
13227
diff
changeset
|
233 int after = masm.position(); |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
234 crb.recordIndirectCall(before, after, callTarget, info); |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
235 crb.recordExceptionHandlers(after, info); |
17119
60844c15ab27
[SPARC] Add nop again otherwise the information on pc is not unique
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17118
diff
changeset
|
236 masm.ensureUniquePC(); |
10686 | 237 } |
238 } |