Mercurial > hg > truffle
annotate graal/com.oracle.graal.compiler.sparc/src/com/oracle/graal/compiler/sparc/SPARCLIRGenerator.java @ 14820:2ff2a660c4d8
merge
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Wed, 19 Mar 2014 15:22:14 +0100 |
parents | 73774616a6b3 80147dac0d6e |
children | c132602c640e |
rev | line source |
---|---|
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
13541 | 2 * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved. |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 package com.oracle.graal.compiler.sparc; |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 |
9828
5aedcaed6ccf
Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
9825
diff
changeset
|
26 import static com.oracle.graal.api.code.ValueUtil.*; |
10686
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
27 import static com.oracle.graal.lir.sparc.SPARCArithmetic.*; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
28 import static com.oracle.graal.lir.sparc.SPARCBitManipulationOp.IntrinsicOpcode.*; |
10686
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
29 import static com.oracle.graal.lir.sparc.SPARCCompare.*; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
30 import static com.oracle.graal.lir.sparc.SPARCMathIntrinsicOp.IntrinsicOpcode.*; |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
31 |
10686
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
32 import com.oracle.graal.api.code.*; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
33 import com.oracle.graal.api.meta.*; |
11233 | 34 import com.oracle.graal.asm.*; |
10459 | 35 import com.oracle.graal.asm.sparc.*; |
10686
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
36 import com.oracle.graal.compiler.gen.*; |
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
37 import com.oracle.graal.graph.*; |
9845
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
38 import com.oracle.graal.lir.*; |
10686
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
39 import com.oracle.graal.lir.StandardOp.JumpOp; |
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
40 import com.oracle.graal.lir.sparc.*; |
11289
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
41 import com.oracle.graal.lir.sparc.SPARCArithmetic.BinaryCommutative; |
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
42 import com.oracle.graal.lir.sparc.SPARCArithmetic.BinaryRegConst; |
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
43 import com.oracle.graal.lir.sparc.SPARCArithmetic.BinaryRegReg; |
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
44 import com.oracle.graal.lir.sparc.SPARCArithmetic.Op1Stack; |
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
45 import com.oracle.graal.lir.sparc.SPARCArithmetic.Op2Stack; |
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
46 import com.oracle.graal.lir.sparc.SPARCArithmetic.RemOp; |
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
47 import com.oracle.graal.lir.sparc.SPARCArithmetic.Unary2Op; |
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
48 import com.oracle.graal.lir.sparc.SPARCCompare.CompareOp; |
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
49 import com.oracle.graal.lir.sparc.SPARCControlFlow.BranchOp; |
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
50 import com.oracle.graal.lir.sparc.SPARCControlFlow.CondMoveOp; |
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
51 import com.oracle.graal.lir.sparc.SPARCControlFlow.FloatCondMoveOp; |
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
52 import com.oracle.graal.lir.sparc.SPARCControlFlow.ReturnOp; |
13294
29907e69ae8d
rework of switch generation: move code into platform independent SwitchStrategy, add boolean switch strategy
Lukas Stadler <lukas.stadler@jku.at>
parents:
13268
diff
changeset
|
53 import com.oracle.graal.lir.sparc.SPARCControlFlow.StrategySwitchOp; |
11289
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
54 import com.oracle.graal.lir.sparc.SPARCControlFlow.TableSwitchOp; |
14121
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
55 import com.oracle.graal.lir.sparc.SPARCMove.LoadAddressOp; |
11289
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
56 import com.oracle.graal.lir.sparc.SPARCMove.MembarOp; |
14121
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
57 import com.oracle.graal.lir.sparc.SPARCMove.MoveFromRegOp; |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
58 import com.oracle.graal.lir.sparc.SPARCMove.MoveToRegOp; |
11289
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
59 import com.oracle.graal.lir.sparc.SPARCMove.NullCheckOp; |
2ad1435489d1
Use ArithmeticLIRGenerator in arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
11233
diff
changeset
|
60 import com.oracle.graal.lir.sparc.SPARCMove.StackLoadAddressOp; |
10686
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
61 import com.oracle.graal.nodes.*; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
62 import com.oracle.graal.nodes.calc.*; |
14000
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
63 import com.oracle.graal.nodes.calc.FloatConvertNode.FloatConvert; |
10686
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
64 import com.oracle.graal.nodes.java.*; |
14000
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
65 import com.oracle.graal.nodes.type.*; |
12363
78e5badf4b8e
moved lookupForeignCall() from CodeCacheProvider to ForeignCallsProvider (GRAAL-511)
Doug Simon <doug.simon@oracle.com>
parents:
11959
diff
changeset
|
66 import com.oracle.graal.phases.util.*; |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
67 |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
68 /** |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
69 * This class implements the SPARC specific portion of the LIR generator. |
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
70 */ |
10686
73122b5edf6a
SPARC: Can compile simple methods and do static calls.
twisti
parents:
10470
diff
changeset
|
71 public abstract class SPARCLIRGenerator extends LIRGenerator { |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
72 |
14121
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
73 private class SPARCSpillMoveFactory implements LIR.SpillMoveFactory { |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
74 |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
75 @Override |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
76 public LIRInstruction createMove(AllocatableValue result, Value input) { |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
77 return SPARCLIRGenerator.this.createMove(result, input); |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
78 } |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
79 } |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
80 |
14809
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
81 public SPARCLIRGenerator(StructuredGraph graph, Providers providers, CallingConvention cc, LIRGenerationResult lirGenRes) { |
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
82 super(graph, providers, cc, lirGenRes); |
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
83 lirGenRes.getLIR().setSpillMoveFactory(new SPARCSpillMoveFactory()); |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
84 } |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
85 |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
86 @Override |
13520
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13302
diff
changeset
|
87 public boolean canStoreConstant(Constant c, boolean isCompressed) { |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
88 // SPARC can only store integer null constants (via g0) |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
89 switch (c.getKind()) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
90 case Float: |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
91 case Double: |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
92 return false; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
93 default: |
11233 | 94 return c.isDefaultForKind(); |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
95 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
96 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
97 |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
98 @Override |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
99 public boolean canInlineConstant(Constant c) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
100 switch (c.getKind()) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
101 case Int: |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
102 return SPARCAssembler.isSimm13(c.asInt()) && !getCodeCache().needsDataPatch(c); |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
103 case Long: |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
104 return SPARCAssembler.isSimm13(c.asLong()) && !getCodeCache().needsDataPatch(c); |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
105 case Object: |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
106 return c.isNull(); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
107 default: |
11233 | 108 return false; |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
109 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
110 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
111 |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
112 @Override |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
113 public Variable emitMove(Value input) { |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
114 Variable result = newVariable(input.getKind()); |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
115 emitMove(result, input); |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
116 return result; |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
117 } |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
118 |
14121
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
119 protected SPARCLIRInstruction createMove(AllocatableValue dst, Value src) { |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
120 if (src instanceof SPARCAddressValue) { |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
121 return new LoadAddressOp(dst, (SPARCAddressValue) src); |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
122 } else if (isRegister(src) || isStackSlot(dst)) { |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
123 return new MoveFromRegOp(dst, src); |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
124 } else { |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
125 return new MoveToRegOp(dst, src); |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
126 } |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
127 } |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
128 |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
129 @Override |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
130 public void emitMove(AllocatableValue dst, Value src) { |
14121
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
131 append(createMove(dst, src)); |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
132 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
133 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
134 @Override |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
135 public SPARCAddressValue emitAddress(Value base, long displacement, Value index, int scale) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
136 AllocatableValue baseRegister; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
137 long finalDisp = displacement; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
138 if (isConstant(base)) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
139 if (asConstant(base).isNull()) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
140 baseRegister = Value.ILLEGAL; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
141 } else if (asConstant(base).getKind() != Kind.Object) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
142 finalDisp += asConstant(base).asLong(); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
143 baseRegister = Value.ILLEGAL; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
144 } else { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
145 baseRegister = load(base); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
146 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
147 } else { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
148 baseRegister = asAllocatable(base); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
149 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
150 |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
151 AllocatableValue indexRegister; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
152 if (!index.equals(Value.ILLEGAL) && scale != 0) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
153 if (isConstant(index)) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
154 finalDisp += asConstant(index).asLong() * scale; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
155 indexRegister = Value.ILLEGAL; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
156 } else { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
157 if (scale != 1) { |
14000
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
158 Value longIndex = emitSignExtend(index, 32, 64); |
11233 | 159 if (CodeUtil.isPowerOf2(scale)) { |
160 indexRegister = emitShl(longIndex, Constant.forLong(CodeUtil.log2(scale))); | |
161 } else { | |
162 indexRegister = emitMul(longIndex, Constant.forLong(scale)); | |
163 } | |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
164 } else { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
165 indexRegister = asAllocatable(index); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
166 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
167 |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
168 // if (baseRegister.equals(Value.ILLEGAL)) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
169 // baseRegister = asAllocatable(indexRegister); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
170 // } else { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
171 // Variable newBase = newVariable(Kind.Long); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
172 // emitMove(newBase, baseRegister); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
173 // baseRegister = newBase; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
174 // baseRegister = emitAdd(baseRegister, indexRegister); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
175 // } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
176 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
177 } else { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
178 indexRegister = Value.ILLEGAL; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
179 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
180 |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
181 int displacementInt; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
182 |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
183 // If we don't have an index register we can use a displacement, otherwise load the |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
184 // displacement into a register and add it to the base. |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
185 if (indexRegister.equals(Value.ILLEGAL)) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
186 // TODO What if displacement if too big? |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
187 displacementInt = (int) finalDisp; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
188 } else { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
189 displacementInt = 0; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
190 if (baseRegister.equals(Value.ILLEGAL)) { |
11233 | 191 baseRegister = load(Constant.forLong(finalDisp)); |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
192 } else { |
11233 | 193 Variable longBaseRegister = newVariable(Kind.Long); |
194 emitMove(longBaseRegister, baseRegister); // FIXME get rid of this move | |
195 baseRegister = emitAdd(longBaseRegister, Constant.forLong(finalDisp)); | |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
196 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
197 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
198 |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
199 return new SPARCAddressValue(target().wordKind, baseRegister, indexRegister, displacementInt); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
200 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
201 |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
202 protected SPARCAddressValue asAddressValue(Value address) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
203 if (address instanceof SPARCAddressValue) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
204 return (SPARCAddressValue) address; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
205 } else { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
206 return emitAddress(address, 0, Value.ILLEGAL, 0); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
207 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
208 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
209 |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
210 @Override |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
211 public Value emitAddress(StackSlot address) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
212 Variable result = newVariable(target().wordKind); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
213 append(new StackLoadAddressOp(result, address)); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
214 return result; |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
215 } |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
216 |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
217 @Override |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
218 protected boolean peephole(ValueNode valueNode) { |
9816
4e9854086532
Initial SPARC compilation test
Morris Meyer <morris.meyer@oracle.com>
parents:
9814
diff
changeset
|
219 // No peephole optimizations for now |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
220 return false; |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
221 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
222 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
223 @Override |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
224 protected void emitReturn(Value input) { |
9816
4e9854086532
Initial SPARC compilation test
Morris Meyer <morris.meyer@oracle.com>
parents:
9814
diff
changeset
|
225 append(new ReturnOp(input)); |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
226 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
227 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
228 @Override |
8293
ae7e78091f03
Cleanup branching and jumps in LIRGenerator: JumpOp/BranchOp do not need a state. In emitBranch, emitNullCheckBranch, emitCompareBranch, emitOverflowCheckBranch and emitIntegerTestBranch both targets are always provided.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8292
diff
changeset
|
229 public void emitJump(LabelRef label) { |
9828
5aedcaed6ccf
Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
9825
diff
changeset
|
230 append(new JumpOp(label)); |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
231 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
232 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
233 @Override |
13908
8f3cd93813f1
Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents:
13907
diff
changeset
|
234 public void emitCompareBranch(Value left, Value right, Condition cond, boolean unorderedIsTrue, LabelRef trueDestination, LabelRef falseDestination, double trueDestinationProbability) { |
10694
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
235 boolean mirrored = emitCompare(left, right); |
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
236 Condition finalCondition = mirrored ? cond.mirror() : cond; |
11233 | 237 Kind kind = left.getKind().getStackKind(); |
238 switch (kind) { | |
9831
705aca4ebf2f
SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9829
diff
changeset
|
239 case Int: |
705aca4ebf2f
SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9829
diff
changeset
|
240 case Long: |
10694
31266ceb86ef
SPARC: Can compile and run two or three methods of a bootstrap.
twisti
parents:
10686
diff
changeset
|
241 case Object: |
13268
68b964b6dc8e
introduced BlockEndOp interface and require that every LIR block is terminated by such an operation
Doug Simon <doug.simon@oracle.com>
parents:
12695
diff
changeset
|
242 append(new BranchOp(finalCondition, trueDestination, falseDestination, kind)); |
9831
705aca4ebf2f
SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9829
diff
changeset
|
243 break; |
12503
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
244 // case Float: |
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
245 // append(new CompareOp(FCMP, x, y)); |
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
246 // append(new BranchOp(condition, label)); |
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
247 // break; |
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
248 // case Double: |
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
249 // append(new CompareOp(DCMP, x, y)); |
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
250 // append(new BranchOp(condition, label)); |
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
251 // break; |
9825
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
252 default: |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
253 throw GraalInternalError.shouldNotReachHere("" + left.getKind()); |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
254 } |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
255 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
256 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
257 @Override |
13908
8f3cd93813f1
Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents:
13907
diff
changeset
|
258 public void emitOverflowCheckBranch(LabelRef overflow, LabelRef noOverflow, double overflowProbability) { |
9845
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
259 // append(new BranchOp(negated ? ConditionFlag.NoOverflow : ConditionFlag.Overflow, label)); |
11233 | 260 throw GraalInternalError.unimplemented(); |
8210
c64ecb1ef1a9
Create LIRGenerator.emitOverflowCheckBranch in preparation for emitDeoptimizeOnOverflow removal
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8127
diff
changeset
|
261 } |
c64ecb1ef1a9
Create LIRGenerator.emitOverflowCheckBranch in preparation for emitDeoptimizeOnOverflow removal
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8127
diff
changeset
|
262 |
c64ecb1ef1a9
Create LIRGenerator.emitOverflowCheckBranch in preparation for emitDeoptimizeOnOverflow removal
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8127
diff
changeset
|
263 @Override |
13908
8f3cd93813f1
Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents:
13907
diff
changeset
|
264 public void emitIntegerTestBranch(Value left, Value right, LabelRef trueDestination, LabelRef falseDestination, double trueDestinationProbability) { |
9845
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
265 emitIntegerTest(left, right); |
13907
6fc05ad86490
Remove unused 'negated' arguments.
Roland Schatz <roland.schatz@oracle.com>
parents:
13641
diff
changeset
|
266 append(new BranchOp(Condition.EQ, trueDestination, falseDestination, left.getKind().getStackKind())); |
9845
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
267 } |
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
268 |
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
269 private void emitIntegerTest(Value a, Value b) { |
12695
4aec62c32a82
Helper functions for identifying numeric kinds.
Roland Schatz <roland.schatz@oracle.com>
parents:
12656
diff
changeset
|
270 assert a.getKind().isNumericInteger(); |
9845
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
271 if (LIRValueUtil.isVariable(b)) { |
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
272 append(new SPARCTestOp(load(b), loadNonConst(a))); |
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
273 } else { |
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
274 append(new SPARCTestOp(load(a), loadNonConst(b))); |
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
275 } |
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
276 } |
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
277 |
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
278 @Override |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
279 public Variable emitConditionalMove(Value left, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue) { |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
280 boolean mirrored = emitCompare(left, right); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
281 Condition finalCondition = mirrored ? cond.mirror() : cond; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
282 |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
283 Variable result = newVariable(trueValue.getKind()); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
284 switch (left.getKind().getStackKind()) { |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
285 case Int: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
286 case Long: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
287 case Object: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
288 append(new CondMoveOp(result, finalCondition, load(trueValue), loadNonConst(falseValue))); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
289 break; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
290 case Float: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
291 case Double: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
292 append(new FloatCondMoveOp(result, finalCondition, unorderedIsTrue, load(trueValue), load(falseValue))); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
293 break; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
294 default: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
295 throw GraalInternalError.shouldNotReachHere("" + left.getKind()); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
296 } |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
297 return result; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
298 } |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
299 |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
300 /** |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
301 * This method emits the compare instruction, and may reorder the operands. It returns true if |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
302 * it did so. |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
303 * |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
304 * @param a the left operand of the comparison |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
305 * @param b the right operand of the comparison |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
306 * @return true if the left and right operands were switched, false otherwise |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
307 */ |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
308 private boolean emitCompare(Value a, Value b) { |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
309 Variable left; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
310 Value right; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
311 boolean mirrored; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
312 if (LIRValueUtil.isVariable(b)) { |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
313 left = load(b); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
314 right = loadNonConst(a); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
315 mirrored = true; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
316 } else { |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
317 left = load(a); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
318 right = loadNonConst(b); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
319 mirrored = false; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
320 } |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
321 switch (left.getKind().getStackKind()) { |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
322 case Int: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
323 append(new CompareOp(ICMP, left, right)); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
324 break; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
325 case Long: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
326 append(new CompareOp(LCMP, left, right)); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
327 break; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
328 case Object: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
329 append(new CompareOp(ACMP, left, right)); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
330 break; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
331 case Float: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
332 append(new CompareOp(FCMP, left, right)); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
333 break; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
334 case Double: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
335 append(new CompareOp(DCMP, left, right)); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
336 break; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
337 default: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
338 throw GraalInternalError.shouldNotReachHere(); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
339 } |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
340 return mirrored; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
341 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
342 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
343 @Override |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
344 public Variable emitIntegerTestMove(Value left, Value right, Value trueValue, Value falseValue) { |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
345 emitIntegerTest(left, right); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
346 Variable result = newVariable(trueValue.getKind()); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
347 append(new CondMoveOp(result, Condition.EQ, load(trueValue), loadNonConst(falseValue))); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
348 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
349 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
350 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
351 @Override |
9739
4cd4926ec683
rename: RuntimeCallTarget -> ForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9613
diff
changeset
|
352 protected void emitForeignCall(ForeignCallLinkage linkage, Value result, Value[] arguments, Value[] temps, LIRFrameState info) { |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
353 long maxOffset = linkage.getMaxCallTargetOffset(); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
354 if (SPARCAssembler.isWordDisp30(maxOffset)) { |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
355 append(new SPARCCall.DirectNearForeignCallOp(linkage, result, arguments, temps, info)); |
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
356 } else { |
10871
c3b09d69dfde
SPARC: fixes and more implementation; can now allocate objects
twisti
parents:
10854
diff
changeset
|
357 append(new SPARCCall.DirectFarForeignCallOp(linkage, result, arguments, temps, info)); |
10854
e1fcdda22831
SPARC: can compile some stubs now but they don't work yet
twisti
parents:
10850
diff
changeset
|
358 } |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
359 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
360 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
361 @Override |
13294
29907e69ae8d
rework of switch generation: move code into platform independent SwitchStrategy, add boolean switch strategy
Lukas Stadler <lukas.stadler@jku.at>
parents:
13268
diff
changeset
|
362 protected void emitStrategySwitch(SwitchStrategy strategy, Variable key, LabelRef[] keyTargets, LabelRef defaultTarget) { |
13302
094f4ee93977
some javadoc for switch strategies
Lukas Stadler <lukas.stadler@jku.at>
parents:
13294
diff
changeset
|
363 // a temp is needed for loading long and object constants |
13294
29907e69ae8d
rework of switch generation: move code into platform independent SwitchStrategy, add boolean switch strategy
Lukas Stadler <lukas.stadler@jku.at>
parents:
13268
diff
changeset
|
364 boolean needsTemp = key.getKind() == Kind.Long || key.getKind() == Kind.Object; |
29907e69ae8d
rework of switch generation: move code into platform independent SwitchStrategy, add boolean switch strategy
Lukas Stadler <lukas.stadler@jku.at>
parents:
13268
diff
changeset
|
365 append(new StrategySwitchOp(strategy, keyTargets, defaultTarget, key, needsTemp ? newVariable(key.getKind()) : Value.ILLEGAL)); |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
366 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
367 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
368 @Override |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
369 protected void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, Value key) { |
9828
5aedcaed6ccf
Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
9825
diff
changeset
|
370 // Making a copy of the switch value is necessary because jump table destroys the input |
5aedcaed6ccf
Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
9825
diff
changeset
|
371 // value |
5aedcaed6ccf
Initial SPARC control instructions
Morris Meyer <morris.meyer@oracle.com>
parents:
9825
diff
changeset
|
372 Variable tmp = emitMove(key); |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
373 append(new TableSwitchOp(lowKey, defaultTarget, targets, tmp, newVariable(target().wordKind))); |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
374 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
375 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
376 @Override |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
377 public void emitBitCount(Variable result, Value operand) { |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
378 if (operand.getKind().getStackKind() == Kind.Int) { |
11233 | 379 append(new SPARCBitManipulationOp(IPOPCNT, result, asAllocatable(operand), this)); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
380 } else { |
11233 | 381 append(new SPARCBitManipulationOp(LPOPCNT, result, asAllocatable(operand), this)); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
382 } |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
383 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
384 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
385 @Override |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
386 public void emitBitScanForward(Variable result, Value operand) { |
11233 | 387 append(new SPARCBitManipulationOp(BSF, result, asAllocatable(operand), this)); |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
388 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
389 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
390 @Override |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
391 public void emitBitScanReverse(Variable result, Value operand) { |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
392 if (operand.getKind().getStackKind() == Kind.Int) { |
11233 | 393 append(new SPARCBitManipulationOp(IBSR, result, asAllocatable(operand), this)); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
394 } else { |
11233 | 395 append(new SPARCBitManipulationOp(LBSR, result, asAllocatable(operand), this)); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
396 } |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
397 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
398 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
399 @Override |
11290
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
400 public Value emitMathAbs(Value input) { |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
401 Variable result = newVariable(input.getPlatformKind()); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
402 append(new BinaryRegConst(DAND, result, asAllocatable(input), Constant.forDouble(Double.longBitsToDouble(0x7FFFFFFFFFFFFFFFL)))); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
403 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
404 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
405 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
406 @Override |
11290
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
407 public Value emitMathSqrt(Value input) { |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
408 Variable result = newVariable(input.getPlatformKind()); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
409 append(new SPARCMathIntrinsicOp(SQRT, result, asAllocatable(input))); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
410 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
411 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
412 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
413 @Override |
11290
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
414 public Value emitMathLog(Value input, boolean base10) { |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
415 Variable result = newVariable(input.getPlatformKind()); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
416 append(new SPARCMathIntrinsicOp(LOG, result, asAllocatable(input))); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
417 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
418 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
419 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
420 @Override |
11290
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
421 public Value emitMathCos(Value input) { |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
422 Variable result = newVariable(input.getPlatformKind()); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
423 append(new SPARCMathIntrinsicOp(COS, result, asAllocatable(input))); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
424 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
425 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
426 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
427 @Override |
11290
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
428 public Value emitMathSin(Value input) { |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
429 Variable result = newVariable(input.getPlatformKind()); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
430 append(new SPARCMathIntrinsicOp(SIN, result, asAllocatable(input))); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
431 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
432 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
433 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
434 @Override |
11290
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
435 public Value emitMathTan(Value input) { |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
436 Variable result = newVariable(input.getPlatformKind()); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
437 append(new SPARCMathIntrinsicOp(TAN, result, asAllocatable(input))); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
438 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
439 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
440 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
441 @Override |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
442 public void emitByteSwap(Variable result, Value input) { |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
443 append(new SPARCByteSwapOp(result, input)); |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
444 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
445 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
446 @Override |
13973 | 447 public void emitArrayEquals(Kind kind, Variable result, Value array1, Value array2, Value length) { |
13541 | 448 // TODO Auto-generated method stub |
449 throw GraalInternalError.unimplemented(); | |
450 } | |
451 | |
452 @Override | |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
453 public Value emitNegate(Value input) { |
9825
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
454 Variable result = newVariable(input.getKind()); |
11233 | 455 switch (input.getKind().getStackKind()) { |
9825
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
456 case Int: |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
457 append(new Op1Stack(INEG, result, input)); |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
458 break; |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
459 case Float: |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
460 append(new Op1Stack(FNEG, result, input)); |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
461 break; |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
462 case Double: |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
463 append(new Op1Stack(DNEG, result, input)); |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
464 break; |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
465 default: |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
466 throw GraalInternalError.shouldNotReachHere(); |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
467 } |
81d5d8089cda
SPARC float arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9817
diff
changeset
|
468 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
469 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
470 |
11355
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
471 @Override |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
472 public Value emitNot(Value input) { |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
473 Variable result = newVariable(input.getKind()); |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
474 switch (input.getKind().getStackKind()) { |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
475 case Int: |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
476 append(new Op1Stack(INOT, result, input)); |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
477 break; |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
478 case Long: |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
479 append(new Op1Stack(LNOT, result, input)); |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
480 break; |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
481 default: |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
482 throw GraalInternalError.shouldNotReachHere(); |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
483 } |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
484 return result; |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
485 } |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
486 |
11233 | 487 private Variable emitBinary(SPARCArithmetic op, boolean commutative, Value a, Value b) { |
488 if (isConstant(b)) { | |
489 return emitBinaryConst(op, commutative, asAllocatable(a), asConstant(b)); | |
490 } else if (commutative && isConstant(a)) { | |
491 return emitBinaryConst(op, commutative, asAllocatable(b), asConstant(a)); | |
492 } else { | |
493 return emitBinaryVar(op, commutative, asAllocatable(a), asAllocatable(b)); | |
494 } | |
495 } | |
496 | |
497 private Variable emitBinaryConst(SPARCArithmetic op, boolean commutative, AllocatableValue a, Constant b) { | |
498 switch (op) { | |
499 case IADD: | |
500 case LADD: | |
501 case ISUB: | |
502 case LSUB: | |
503 case IAND: | |
504 case LAND: | |
505 case IOR: | |
506 case LOR: | |
507 case IXOR: | |
508 case LXOR: | |
509 case IMUL: | |
510 case LMUL: | |
511 if (NumUtil.isInt(b.asLong())) { | |
512 Variable result = newVariable(a.getKind()); | |
513 append(new BinaryRegConst(op, result, a, b)); | |
514 return result; | |
515 } | |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
516 break; |
11233 | 517 } |
518 | |
519 return emitBinaryVar(op, commutative, a, asAllocatable(b)); | |
520 } | |
521 | |
522 private Variable emitBinaryVar(SPARCArithmetic op, boolean commutative, AllocatableValue a, AllocatableValue b) { | |
523 Variable result = newVariable(a.getKind()); | |
524 if (commutative) { | |
525 append(new BinaryCommutative(op, result, a, b)); | |
526 } else { | |
527 append(new BinaryRegReg(op, result, a, b)); | |
9814
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
528 } |
e723f9031785
re-architected SPARC assembler to be Fmt class specific, initial arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9739
diff
changeset
|
529 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
530 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
531 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
532 @Override |
11233 | 533 public Variable emitAdd(Value a, Value b) { |
534 switch (a.getKind().getStackKind()) { | |
535 case Int: | |
536 return emitBinary(IADD, true, a, b); | |
537 case Long: | |
538 return emitBinary(LADD, true, a, b); | |
539 case Float: | |
540 return emitBinary(FADD, true, a, b); | |
541 case Double: | |
542 return emitBinary(DADD, true, a, b); | |
543 default: | |
544 throw GraalInternalError.shouldNotReachHere(); | |
545 } | |
546 } | |
547 | |
548 @Override | |
10792 | 549 public Variable emitSub(Value a, Value b) { |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
550 Variable result = newVariable(a.getKind()); |
11233 | 551 switch (a.getKind().getStackKind()) { |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
552 case Int: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
553 append(new Op2Stack(ISUB, result, a, loadNonConst(b))); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
554 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
555 case Long: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
556 append(new Op2Stack(LSUB, result, a, loadNonConst(b))); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
557 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
558 case Float: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
559 append(new Op2Stack(FSUB, result, a, loadNonConst(b))); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
560 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
561 case Double: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
562 append(new Op2Stack(DSUB, result, a, loadNonConst(b))); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
563 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
564 default: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
565 throw GraalInternalError.shouldNotReachHere("missing: " + a.getKind()); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
566 } |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
567 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
568 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
569 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
570 @Override |
10792 | 571 public Variable emitMul(Value a, Value b) { |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
572 Variable result = newVariable(a.getKind()); |
11233 | 573 switch (a.getKind().getStackKind()) { |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
574 case Int: |
11233 | 575 append(new BinaryRegReg(IMUL, result, a, loadNonConst(b))); |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
576 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
577 case Long: |
11233 | 578 append(new BinaryRegReg(LMUL, result, a, loadNonConst(b))); |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
579 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
580 case Float: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
581 append(new Op2Stack(FMUL, result, a, loadNonConst(b))); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
582 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
583 case Double: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
584 append(new Op2Stack(DMUL, result, a, loadNonConst(b))); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
585 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
586 default: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
587 throw GraalInternalError.shouldNotReachHere("missing: " + a.getKind()); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
588 } |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
589 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
590 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
591 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
592 @Override |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8643
diff
changeset
|
593 public Value emitDiv(Value a, Value b, DeoptimizingNode deopting) { |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
594 Variable result = newVariable(a.getKind()); |
11233 | 595 switch (a.getKind().getStackKind()) { |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
596 case Int: |
11233 | 597 append(new BinaryRegReg(IDIV, result, a, loadNonConst(b))); |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
598 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
599 case Long: |
11233 | 600 append(new BinaryRegReg(LDIV, result, a, loadNonConst(b))); |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
601 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
602 case Float: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
603 append(new Op2Stack(FDIV, result, a, loadNonConst(b))); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
604 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
605 case Double: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
606 append(new Op2Stack(DDIV, result, a, loadNonConst(b))); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
607 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
608 default: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
609 throw GraalInternalError.shouldNotReachHere("missing: " + a.getKind()); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
610 } |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
611 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
612 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
613 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
614 @Override |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8643
diff
changeset
|
615 public Value emitRem(Value a, Value b, DeoptimizingNode deopting) { |
11233 | 616 LIRFrameState state = state(deopting); |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
617 Variable result = newVariable(a.getKind()); |
11233 | 618 switch (a.getKind().getStackKind()) { |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
619 case Int: |
11233 | 620 append(new RemOp(IREM, result, a, loadNonConst(b), state, this)); |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
621 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
622 case Long: |
11233 | 623 append(new RemOp(LREM, result, a, loadNonConst(b), state, this)); |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
624 break; |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
625 default: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
626 throw GraalInternalError.shouldNotReachHere("missing: " + a.getKind()); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
627 } |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
628 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
629 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
630 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
631 @Override |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8643
diff
changeset
|
632 public Value emitUDiv(Value a, Value b, DeoptimizingNode deopting) { |
12503
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
633 // LIRFrameState state = state(deopting); |
11233 | 634 switch (a.getKind().getStackKind()) { |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
635 case Int: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
636 // emitDivRem(IUDIV, a, b, state); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
637 // return emitMove(RAX_I); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
638 case Long: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
639 // emitDivRem(LUDIV, a, b, state); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
640 // return emitMove(RAX_L); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
641 default: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
642 throw GraalInternalError.shouldNotReachHere(); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
643 } |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
644 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
645 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
646 @Override |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8643
diff
changeset
|
647 public Value emitURem(Value a, Value b, DeoptimizingNode deopting) { |
12503
d7f8dd4fe876
minor reformatting based on 'mx eclipseformat'
Doug Simon <doug.simon@oracle.com>
parents:
12429
diff
changeset
|
648 // LIRFrameState state = state(deopting); |
11233 | 649 switch (a.getKind().getStackKind()) { |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
650 case Int: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
651 // emitDivRem(IUREM, a, b, state); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
652 // return emitMove(RDX_I); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
653 case Long: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
654 // emitDivRem(LUREM, a, b, state); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
655 // return emitMove(RDX_L); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
656 default: |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
657 throw GraalInternalError.shouldNotReachHere(); |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
658 } |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
659 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
660 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
661 @Override |
10792 | 662 public Variable emitAnd(Value a, Value b) { |
9829
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
663 Variable result = newVariable(a.getKind()); |
11233 | 664 switch (a.getKind().getStackKind()) { |
9829
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
665 case Int: |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
666 append(new Op2Stack(IAND, result, a, loadNonConst(b))); |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
667 break; |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
668 case Long: |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
669 append(new Op2Stack(LAND, result, a, loadNonConst(b))); |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
670 break; |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
671 |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
672 default: |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
673 throw GraalInternalError.shouldNotReachHere("missing: " + a.getKind()); |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
674 } |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
675 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
676 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
677 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
678 @Override |
10792 | 679 public Variable emitOr(Value a, Value b) { |
9829
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
680 Variable result = newVariable(a.getKind()); |
11233 | 681 switch (a.getKind().getStackKind()) { |
9829
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
682 case Int: |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
683 append(new Op2Stack(IOR, result, a, loadNonConst(b))); |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
684 break; |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
685 case Long: |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
686 append(new Op2Stack(LOR, result, a, loadNonConst(b))); |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
687 break; |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
688 default: |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
689 throw GraalInternalError.shouldNotReachHere("missing: " + a.getKind()); |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
690 } |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
691 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
692 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
693 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
694 @Override |
10792 | 695 public Variable emitXor(Value a, Value b) { |
9829
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
696 Variable result = newVariable(a.getKind()); |
11233 | 697 switch (a.getKind().getStackKind()) { |
9829
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
698 case Int: |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
699 append(new Op2Stack(IXOR, result, a, loadNonConst(b))); |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
700 break; |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
701 case Long: |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
702 append(new Op2Stack(LXOR, result, a, loadNonConst(b))); |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
703 break; |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
704 default: |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
705 throw GraalInternalError.shouldNotReachHere(); |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
706 } |
04911dff1c66
SPARC logic and shift operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9828
diff
changeset
|
707 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
708 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
709 |
11233 | 710 private Variable emitShift(SPARCArithmetic op, Value a, Value b) { |
711 Variable result = newVariable(a.getPlatformKind()); | |
712 AllocatableValue input = asAllocatable(a); | |
713 if (isConstant(b)) { | |
714 append(new BinaryRegConst(op, result, input, asConstant(b))); | |
715 } else { | |
716 append(new BinaryRegReg(op, result, input, b)); | |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
717 } |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
718 return result; |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
719 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
720 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
721 @Override |
11233 | 722 public Variable emitShl(Value a, Value b) { |
723 switch (a.getKind().getStackKind()) { | |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
724 case Int: |
11233 | 725 return emitShift(ISHL, a, b); |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
726 case Long: |
11233 | 727 return emitShift(LSHL, a, b); |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
728 default: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
729 throw GraalInternalError.shouldNotReachHere(); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
730 } |
11233 | 731 } |
732 | |
733 @Override | |
734 public Variable emitShr(Value a, Value b) { | |
735 switch (a.getKind().getStackKind()) { | |
736 case Int: | |
737 return emitShift(ISHR, a, b); | |
738 case Long: | |
739 return emitShift(LSHR, a, b); | |
740 default: | |
741 throw GraalInternalError.shouldNotReachHere(); | |
742 } | |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
743 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
744 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
745 @Override |
10792 | 746 public Variable emitUShr(Value a, Value b) { |
11233 | 747 switch (a.getKind().getStackKind()) { |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
748 case Int: |
11233 | 749 return emitShift(IUSHR, a, b); |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
750 case Long: |
11233 | 751 return emitShift(LUSHR, a, b); |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
752 default: |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
753 throw GraalInternalError.shouldNotReachHere(); |
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
754 } |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
755 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
756 |
14003
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
757 private AllocatableValue emitConvertMove(PlatformKind kind, AllocatableValue input) { |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
758 Variable result = newVariable(kind); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
759 emitMove(result, input); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
760 return result; |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
761 } |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
762 |
14003
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
763 private AllocatableValue emitConvert2Op(PlatformKind kind, SPARCArithmetic op, AllocatableValue input) { |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
764 Variable result = newVariable(kind); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
765 append(new Unary2Op(op, result, input)); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
766 return result; |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
767 } |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
768 |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
769 @Override |
14000
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
770 public Value emitFloatConvert(FloatConvert op, Value inputVal) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
771 AllocatableValue input = asAllocatable(inputVal); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
772 switch (op) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
773 case D2F: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
774 return emitConvert2Op(Kind.Float, D2F, input); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
775 case D2I: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
776 return emitConvert2Op(Kind.Int, D2I, input); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
777 case D2L: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
778 return emitConvert2Op(Kind.Long, D2L, input); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
779 case F2D: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
780 return emitConvert2Op(Kind.Double, F2D, input); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
781 case F2I: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
782 return emitConvert2Op(Kind.Int, F2I, input); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
783 case F2L: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
784 return emitConvert2Op(Kind.Long, F2L, input); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
785 case I2D: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
786 return emitConvert2Op(Kind.Double, I2D, input); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
787 case I2F: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
788 return emitConvert2Op(Kind.Float, I2F, input); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
789 case L2D: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
790 return emitConvert2Op(Kind.Double, L2D, input); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
791 case L2F: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
792 return emitConvert2Op(Kind.Float, L2F, input); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
793 default: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
794 throw GraalInternalError.shouldNotReachHere(); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
795 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
796 } |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
797 |
14000
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
798 @Override |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
799 public Value emitNarrow(Value inputVal, int bits) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
800 if (inputVal.getKind() == Kind.Long && bits <= 32) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
801 return emitConvert2Op(Kind.Int, L2I, asAllocatable(inputVal)); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
802 } else { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
803 return inputVal; |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
804 } |
14000
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
805 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
806 |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
807 @Override |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
808 public Value emitSignExtend(Value inputVal, int fromBits, int toBits) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
809 assert fromBits <= toBits && toBits <= 64; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
810 if (fromBits == toBits) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
811 return inputVal; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
812 } else if (toBits > 32) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
813 // sign extend to 64 bits |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
814 if (fromBits == 32) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
815 return emitConvert2Op(Kind.Long, I2L, asAllocatable(inputVal)); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
816 } else if (fromBits < 32) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
817 // TODO implement direct x2L sign extension conversions |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
818 Value intVal = emitSignExtend(inputVal, fromBits, 32); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
819 return emitSignExtend(intVal, 32, toBits); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
820 } else { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
821 throw GraalInternalError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)"); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
822 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
823 } else { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
824 // sign extend to 32 bits (smaller values are internally represented as 32 bit values) |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
825 switch (fromBits) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
826 case 8: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
827 return emitConvert2Op(Kind.Int, I2B, asAllocatable(inputVal)); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
828 case 16: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
829 return emitConvert2Op(Kind.Int, I2S, asAllocatable(inputVal)); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
830 case 32: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
831 return inputVal; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
832 default: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
833 throw GraalInternalError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)"); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
834 } |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
835 } |
14000
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
836 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
837 |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
838 @Override |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
839 public Value emitZeroExtend(Value inputVal, int fromBits, int toBits) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
840 assert fromBits <= toBits && toBits <= 64; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
841 if (fromBits == toBits) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
842 return inputVal; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
843 } else if (fromBits > 32) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
844 assert inputVal.getKind() == Kind.Long; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
845 Variable result = newVariable(Kind.Long); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
846 long mask = IntegerStamp.defaultMask(fromBits); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
847 append(new BinaryRegConst(SPARCArithmetic.LAND, result, asAllocatable(inputVal), Constant.forLong(mask))); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
848 return result; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
849 } else { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
850 assert inputVal.getKind() == Kind.Int; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
851 Variable result = newVariable(Kind.Int); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
852 int mask = (int) IntegerStamp.defaultMask(fromBits); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
853 append(new BinaryRegConst(SPARCArithmetic.IAND, result, asAllocatable(inputVal), Constant.forInt(mask))); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
854 if (toBits > 32) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
855 Variable longResult = newVariable(Kind.Long); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
856 emitMove(longResult, result); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
857 return longResult; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
858 } else { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
859 return result; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
860 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
861 } |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
862 } |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
863 |
14003
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
864 @Override |
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
865 public AllocatableValue emitReinterpret(PlatformKind to, Value inputVal) { |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
866 Kind from = inputVal.getKind(); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
867 AllocatableValue input = asAllocatable(inputVal); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
868 |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
869 // These cases require a move between CPU and FPU registers: |
14003
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
870 switch ((Kind) to) { |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
871 case Int: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
872 switch (from) { |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
873 case Float: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
874 case Double: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
875 return emitConvert2Op(to, MOV_F2I, input); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
876 } |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
877 break; |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
878 case Long: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
879 switch (from) { |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
880 case Float: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
881 case Double: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
882 return emitConvert2Op(to, MOV_D2L, input); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
883 } |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
884 break; |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
885 case Float: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
886 switch (from) { |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
887 case Int: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
888 case Long: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
889 return emitConvert2Op(to, MOV_I2F, input); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
890 } |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
891 break; |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
892 case Double: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
893 switch (from) { |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
894 case Int: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
895 case Long: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
896 return emitConvert2Op(to, MOV_L2D, input); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
897 } |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
898 break; |
9817
26960d32552c
SPARC integer arithmetic
Morris Meyer <morris.meyer@oracle.com>
parents:
9816
diff
changeset
|
899 } |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
900 |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
901 // Otherwise, just emit an ordinary move instruction. |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
902 // Instructions that move or generate 32-bit register values also set the upper 32 |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
903 // bits of the register to zero. |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
904 // Consequently, there is no need for a special zero-extension move. |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12503
diff
changeset
|
905 return emitConvertMove(to, input); |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
906 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
907 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
908 @Override |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
909 public void emitMembar(int barriers) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
910 int necessaryBarriers = target().arch.requiredBarriers(barriers); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
911 if (target().isMP && necessaryBarriers != 0) { |
9845
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
912 append(new MembarOp(necessaryBarriers)); |
204e8f3209e9
SPARCMacroAssembler synthetic instructions and SPARCTestOp
Morris Meyer <morris.meyer@oracle.com>
parents:
9843
diff
changeset
|
913 } |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
914 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
915 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
916 @Override |
13641
5a9afbf72714
Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
13541
diff
changeset
|
917 public void emitDeoptimize(Value actionAndReason, Value speculation, DeoptimizingNode deopting) { |
9831
705aca4ebf2f
SPARC array, load / store and compare operations
Morris Meyer <morris.meyer@oracle.com>
parents:
9829
diff
changeset
|
918 append(new ReturnOp(Value.ILLEGAL)); |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
919 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
920 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
921 @Override |
10850
e7679ec4f27f
Lower CAS nodes to their lowered versions
Christos Kotselidis <christos.kotselidis@oracle.com>
parents:
10792
diff
changeset
|
922 public void visitCompareAndSwap(LoweredCompareAndSwapNode i, Value address) { |
9816
4e9854086532
Initial SPARC compilation test
Morris Meyer <morris.meyer@oracle.com>
parents:
9814
diff
changeset
|
923 throw new InternalError("NYI"); |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
924 } |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
925 |
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
926 @Override |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
927 public void visitBreakpointNode(BreakpointNode node) { |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
928 JavaType[] sig = new JavaType[node.arguments().size()]; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
929 for (int i = 0; i < sig.length; i++) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
930 sig[i] = node.arguments().get(i).stamp().javaType(getMetaAccess()); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
931 } |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
932 |
14809
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
933 Value[] parameters = visitInvokeArguments(res.getFrameMap().registerConfig.getCallingConvention(CallingConvention.Type.JavaCall, null, sig, target(), false), node.arguments()); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
934 append(new SPARCBreakpointOp(parameters)); |
7743
7732a91e5f6d
Added more skeleton code to SPARC projects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7740
diff
changeset
|
935 } |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7936
diff
changeset
|
936 |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7936
diff
changeset
|
937 @Override |
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7936
diff
changeset
|
938 public void emitUnwind(Value operand) { |
9816
4e9854086532
Initial SPARC compilation test
Morris Meyer <morris.meyer@oracle.com>
parents:
9814
diff
changeset
|
939 throw new InternalError("NYI"); |
8390
acc24060b64f
Use implicit null checks for all null checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8333
diff
changeset
|
940 } |
acc24060b64f
Use implicit null checks for all null checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8333
diff
changeset
|
941 |
acc24060b64f
Use implicit null checks for all null checks
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8333
diff
changeset
|
942 @Override |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8643
diff
changeset
|
943 public void emitNullCheck(ValueNode v, DeoptimizingNode deopting) { |
14817
80147dac0d6e
LIRFrameStateBuilder added
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
14796
diff
changeset
|
944 assert v.getKind() == Kind.Object; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
9845
diff
changeset
|
945 append(new NullCheckOp(load(operand(v)), state(deopting))); |
8127
3d41998c30de
Create new way of handling unwind that recalculates rbp from rsp. Remove unused instanceof slow path stub.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7936
diff
changeset
|
946 } |
9003
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8892
diff
changeset
|
947 |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8892
diff
changeset
|
948 @Override |
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8892
diff
changeset
|
949 public void visitInfopointNode(InfopointNode i) { |
9816
4e9854086532
Initial SPARC compilation test
Morris Meyer <morris.meyer@oracle.com>
parents:
9814
diff
changeset
|
950 throw new InternalError("NYI"); |
9003
a8fea2979e63
eager infopoint mode (fka debug mode)
Michael Haupt <michael.haupt@oracle.com>
parents:
8892
diff
changeset
|
951 } |
7740
5f8101629080
Add projects and skeletons for SPARC port.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
952 } |