Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java @ 7530:5e3d1a68664e
applied mx eclipseformat to all Java files
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 23 Jan 2013 16:34:57 +0100 |
parents | 3207ee96b659 |
children | 5f0876b77ca8 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
4181
319860ae697a
Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4142
diff
changeset
|
2 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
23 |
6532
0c6030872cd0
renamed package: com.oracle.graal.compiler.target.amd64 -> com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6531
diff
changeset
|
24 package com.oracle.graal.compiler.amd64; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
26 import static com.oracle.graal.api.code.ValueUtil.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
27 import static com.oracle.graal.lir.amd64.AMD64Arithmetic.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
28 import static com.oracle.graal.lir.amd64.AMD64Compare.*; |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
29 import static com.oracle.graal.lir.amd64.AMD64BitManipulationOp.IntrinsicOpcode.*; |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
30 import static com.oracle.graal.lir.amd64.AMD64MathIntrinsicOp.IntrinsicOpcode.*; |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
31 |
6580
d56d600819fe
moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
32 import com.oracle.graal.amd64.*; |
5510
426c605c9d3c
Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5507
diff
changeset
|
33 import com.oracle.graal.api.code.*; |
7144
ae69cd8c08a9
rename: RuntimeCall -> RuntimeCallTarget
Doug Simon <doug.simon@oracle.com>
parents:
7143
diff
changeset
|
34 import com.oracle.graal.api.code.RuntimeCallTarget.Descriptor; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5506
diff
changeset
|
35 import com.oracle.graal.api.meta.*; |
6531
4afe23aa0a00
renamed packages: com.oracle.max.asm... -> com.oracle.graal.asm...
Doug Simon <doug.simon@oracle.com>
parents:
6525
diff
changeset
|
36 import com.oracle.graal.asm.*; |
6675
6eb83c6eb177
change LIRGenerator to take StructuredGraph instead of Graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
6580
diff
changeset
|
37 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
38 import com.oracle.graal.compiler.gen.*; |
5320
e79727f1b3d0
rename: AMD64LIRLowerable -> LIRGenLowerable
Doug Simon <doug.simon@oracle.com>
parents:
5273
diff
changeset
|
39 import com.oracle.graal.compiler.target.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
40 import com.oracle.graal.graph.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
41 import com.oracle.graal.lir.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
42 import com.oracle.graal.lir.StandardOp.JumpOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
43 import com.oracle.graal.lir.amd64.AMD64Arithmetic.DivOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
44 import com.oracle.graal.lir.amd64.AMD64Arithmetic.Op1Reg; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
45 import com.oracle.graal.lir.amd64.AMD64Arithmetic.Op1Stack; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
46 import com.oracle.graal.lir.amd64.AMD64Arithmetic.Op2Reg; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
47 import com.oracle.graal.lir.amd64.AMD64Arithmetic.Op2Stack; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
48 import com.oracle.graal.lir.amd64.AMD64Arithmetic.ShiftOp; |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
49 import com.oracle.graal.lir.amd64.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
50 import com.oracle.graal.lir.amd64.AMD64Call.DirectCallOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
51 import com.oracle.graal.lir.amd64.AMD64Call.IndirectCallOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
52 import com.oracle.graal.lir.amd64.AMD64Compare.CompareOp; |
5798
2585af1e26ac
implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
53 import com.oracle.graal.lir.amd64.AMD64ControlFlow.BranchOp; |
2585af1e26ac
implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
54 import com.oracle.graal.lir.amd64.AMD64ControlFlow.CondMoveOp; |
2585af1e26ac
implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
55 import com.oracle.graal.lir.amd64.AMD64ControlFlow.FloatBranchOp; |
2585af1e26ac
implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
56 import com.oracle.graal.lir.amd64.AMD64ControlFlow.FloatCondMoveOp; |
2585af1e26ac
implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
57 import com.oracle.graal.lir.amd64.AMD64ControlFlow.ReturnOp; |
2585af1e26ac
implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
58 import com.oracle.graal.lir.amd64.AMD64ControlFlow.SequentialSwitchOp; |
2585af1e26ac
implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
59 import com.oracle.graal.lir.amd64.AMD64ControlFlow.SwitchRangesOp; |
2585af1e26ac
implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents:
5775
diff
changeset
|
60 import com.oracle.graal.lir.amd64.AMD64ControlFlow.TableSwitchOp; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
61 import com.oracle.graal.lir.amd64.AMD64Move.CompareAndSwapOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
62 import com.oracle.graal.lir.amd64.AMD64Move.LeaOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
63 import com.oracle.graal.lir.amd64.AMD64Move.LoadOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
64 import com.oracle.graal.lir.amd64.AMD64Move.MembarOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
65 import com.oracle.graal.lir.amd64.AMD64Move.MoveFromRegOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
66 import com.oracle.graal.lir.amd64.AMD64Move.MoveToRegOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
67 import com.oracle.graal.lir.amd64.AMD64Move.NullCheckOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
68 import com.oracle.graal.lir.amd64.AMD64Move.SpillMoveOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
69 import com.oracle.graal.lir.amd64.AMD64Move.StoreOp; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
70 import com.oracle.graal.nodes.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
71 import com.oracle.graal.nodes.calc.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
72 import com.oracle.graal.nodes.extended.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
73 import com.oracle.graal.nodes.java.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6521
diff
changeset
|
74 import com.oracle.graal.phases.util.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
76 /** |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
77 * This class implements the AMD64 specific portion of the LIR generator. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
78 */ |
5247
62bbfd78c703
removed mechanism for lowering ExceptionObjectNode via substitution; only LIR lowering by the runtime is now supported
Doug Simon <doug.simon@oracle.com>
parents:
5233
diff
changeset
|
79 public abstract class AMD64LIRGenerator extends LIRGenerator { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7280
diff
changeset
|
81 public static final Descriptor ARITHMETIC_FREM = new Descriptor("arithmeticFrem", false, float.class, float.class, float.class); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7280
diff
changeset
|
82 public static final Descriptor ARITHMETIC_DREM = new Descriptor("arithmeticDrem", false, double.class, double.class, double.class); |
6521
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6496
diff
changeset
|
83 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
84 private static final RegisterValue RAX_I = AMD64.rax.asValue(Kind.Int); |
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
85 private static final RegisterValue RAX_L = AMD64.rax.asValue(Kind.Long); |
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
86 private static final RegisterValue RDX_I = AMD64.rdx.asValue(Kind.Int); |
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
87 private static final RegisterValue RDX_L = AMD64.rdx.asValue(Kind.Long); |
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
88 private static final RegisterValue RCX_I = AMD64.rcx.asValue(Kind.Int); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
89 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
90 public static class AMD64SpillMoveFactory implements LIR.SpillMoveFactory { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
91 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
92 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
93 public LIRInstruction createMove(Value result, Value input) { |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
94 return new SpillMoveOp(result, input); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
95 } |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
96 |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
97 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
98 public LIRInstruction createExchange(Value input1, Value input2) { |
5056
2f2c6347fce4
comments cleanup/retagging
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
4705
diff
changeset
|
99 // TODO (cwimmer) implement XCHG operation for LIR |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
100 return null; |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
101 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
102 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
103 |
6675
6eb83c6eb177
change LIRGenerator to take StructuredGraph instead of Graph
Lukas Stadler <lukas.stadler@jku.at>
parents:
6580
diff
changeset
|
104 public AMD64LIRGenerator(StructuredGraph graph, CodeCacheProvider runtime, TargetDescription target, FrameMap frameMap, ResolvedJavaMethod method, LIR lir) { |
6462 | 105 super(graph, runtime, target, frameMap, method, lir); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
106 lir.spillMoveFactory = new AMD64SpillMoveFactory(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
107 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
108 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
109 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
110 protected void emitNode(ValueNode node) { |
5320
e79727f1b3d0
rename: AMD64LIRLowerable -> LIRGenLowerable
Doug Simon <doug.simon@oracle.com>
parents:
5273
diff
changeset
|
111 if (node instanceof LIRGenLowerable) { |
e79727f1b3d0
rename: AMD64LIRLowerable -> LIRGenLowerable
Doug Simon <doug.simon@oracle.com>
parents:
5273
diff
changeset
|
112 ((LIRGenLowerable) node).generate(this); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
113 } else { |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
114 super.emitNode(node); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
115 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
116 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
117 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 @Override |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
119 public boolean canStoreConstant(Constant c) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
120 // there is no immediate move of 64-bit constants on Intel |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
121 switch (c.getKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
122 case Long: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
123 return Util.isInt(c.asLong()) && !runtime.needsDataPatch(c); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
124 case Double: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
125 return false; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
126 case Object: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
127 return c.isNull(); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
128 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
129 return true; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
130 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
131 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
132 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
133 @Override |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
134 public boolean canInlineConstant(Constant c) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
135 switch (c.getKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
136 case Long: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
137 return NumUtil.isInt(c.asLong()) && !runtime.needsDataPatch(c); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
138 case Object: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
139 return c.isNull(); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
140 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
141 return true; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
142 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 |
4314
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
145 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
146 public Address makeAddress(LocationNode location, ValueNode object) { |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
147 Value base = operand(object); |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6534
diff
changeset
|
148 Value index = Value.ILLEGAL; |
4314
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
149 int scale = 1; |
5667
c5c02cd462db
Be abit more carefull about displacements in makeAddress
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5552
diff
changeset
|
150 int displacement = location.displacement(); |
4314
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
151 |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
152 if (isConstant(base)) { |
5667
c5c02cd462db
Be abit more carefull about displacements in makeAddress
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5552
diff
changeset
|
153 if (asConstant(base).isNull()) { |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6534
diff
changeset
|
154 base = Value.ILLEGAL; |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
155 } else if (asConstant(base).getKind() != Kind.Object) { |
5667
c5c02cd462db
Be abit more carefull about displacements in makeAddress
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5552
diff
changeset
|
156 long newDisplacement = displacement + asConstant(base).asLong(); |
c5c02cd462db
Be abit more carefull about displacements in makeAddress
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5552
diff
changeset
|
157 if (NumUtil.isInt(newDisplacement)) { |
7074
1361501d6bd5
added some more assertions to ensure that metadata constant are not emitted inline
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7073
diff
changeset
|
158 assert !runtime.needsDataPatch(asConstant(base)); |
5667
c5c02cd462db
Be abit more carefull about displacements in makeAddress
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5552
diff
changeset
|
159 displacement = (int) newDisplacement; |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6534
diff
changeset
|
160 base = Value.ILLEGAL; |
7072
5a3e048620d4
fix to avoid emitting a range switch for non-integer keys
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6950
diff
changeset
|
161 } else { |
5a3e048620d4
fix to avoid emitting a range switch for non-integer keys
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6950
diff
changeset
|
162 Value newBase = newVariable(Kind.Long); |
5a3e048620d4
fix to avoid emitting a range switch for non-integer keys
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6950
diff
changeset
|
163 emitMove(base, newBase); |
5a3e048620d4
fix to avoid emitting a range switch for non-integer keys
Christian Haeubl <haeubl@ssw.jku.at>
parents:
6950
diff
changeset
|
164 base = newBase; |
5667
c5c02cd462db
Be abit more carefull about displacements in makeAddress
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5552
diff
changeset
|
165 } |
4314
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
166 } |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
167 } |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
168 |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
169 if (location instanceof IndexedLocationNode) { |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
170 IndexedLocationNode indexedLoc = (IndexedLocationNode) location; |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
171 |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
172 index = operand(indexedLoc.index()); |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
173 if (indexedLoc.indexScalingEnabled()) { |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
174 scale = target().sizeInBytes(location.getValueKind()); |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
175 } |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
176 if (isConstant(index)) { |
4705
27397872945f
fix "integer overflow when computing constant displacement"
Lukas Stadler <lukas.stadler@jku.at>
parents:
4550
diff
changeset
|
177 long newDisplacement = displacement + asConstant(index).asLong() * scale; |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
178 // only use the constant index if the resulting displacement fits into a 32 bit |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
179 // offset |
4705
27397872945f
fix "integer overflow when computing constant displacement"
Lukas Stadler <lukas.stadler@jku.at>
parents:
4550
diff
changeset
|
180 if (NumUtil.isInt(newDisplacement)) { |
5667
c5c02cd462db
Be abit more carefull about displacements in makeAddress
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5552
diff
changeset
|
181 displacement = (int) newDisplacement; |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6534
diff
changeset
|
182 index = Value.ILLEGAL; |
4705
27397872945f
fix "integer overflow when computing constant displacement"
Lukas Stadler <lukas.stadler@jku.at>
parents:
4550
diff
changeset
|
183 } else { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
184 // create a temporary variable for the index, the pointer load cannot handle a |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
185 // constant index |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
186 Value newIndex = newVariable(Kind.Long); |
4705
27397872945f
fix "integer overflow when computing constant displacement"
Lukas Stadler <lukas.stadler@jku.at>
parents:
4550
diff
changeset
|
187 emitMove(index, newIndex); |
27397872945f
fix "integer overflow when computing constant displacement"
Lukas Stadler <lukas.stadler@jku.at>
parents:
4550
diff
changeset
|
188 index = newIndex; |
27397872945f
fix "integer overflow when computing constant displacement"
Lukas Stadler <lukas.stadler@jku.at>
parents:
4550
diff
changeset
|
189 } |
4314
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
190 } |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
191 } |
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
192 |
5667
c5c02cd462db
Be abit more carefull about displacements in makeAddress
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5552
diff
changeset
|
193 return new Address(location.getValueKind(), base, index, Address.Scale.fromInt(scale), displacement); |
4314
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
194 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
195 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
196 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
197 public Variable emitMove(Value input) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
198 Variable result = newVariable(input.getKind()); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
199 emitMove(input, result); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
200 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
201 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
202 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
203 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
204 public void emitMove(Value src, Value dst) { |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
205 if (isRegister(src) || isStackSlot(dst)) { |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
206 append(new MoveFromRegOp(dst, src)); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
207 } else { |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
208 append(new MoveToRegOp(dst, src)); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
209 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
210 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
211 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
212 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
213 public Variable emitLoad(Value loadAddress, boolean canTrap) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
214 Variable result = newVariable(loadAddress.getKind()); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
215 append(new LoadOp(result, loadAddress, canTrap ? state() : null)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
216 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
217 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
218 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
219 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
220 public void emitStore(Value storeAddress, Value inputVal, boolean canTrap) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
221 Value input = loadForStore(inputVal, storeAddress.getKind()); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
222 append(new StoreOp(storeAddress, input, canTrap ? state() : null)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
223 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
224 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
225 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
226 public Variable emitLea(Value address) { |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4199
diff
changeset
|
227 Variable result = newVariable(target().wordKind); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
228 append(new LeaOp(result, address)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
229 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
230 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
231 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
232 @Override |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5705
diff
changeset
|
233 public void emitJump(LabelRef label, LIRFrameState info) { |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
234 append(new JumpOp(label, info)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
235 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
236 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
237 @Override |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5705
diff
changeset
|
238 public void emitBranch(Value left, Value right, Condition cond, boolean unorderedIsTrue, LabelRef label, LIRFrameState info) { |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
239 boolean mirrored = emitCompare(left, right); |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
240 Condition finalCondition = mirrored ? cond.mirror() : cond; |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6534
diff
changeset
|
241 switch (left.getKind().getStackKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
242 case Int: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
243 case Long: |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
244 case Object: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
245 append(new BranchOp(finalCondition, label, info)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
246 break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
247 case Float: |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
248 case Double: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
249 append(new FloatBranchOp(finalCondition, unorderedIsTrue, label, info)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
250 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
251 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
252 throw GraalInternalError.shouldNotReachHere("" + left.getKind()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
255 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
256 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
257 public Variable emitCMove(Value left, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue) { |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
258 boolean mirrored = emitCompare(left, right); |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
259 Condition finalCondition = mirrored ? cond.mirror() : cond; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
260 |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
261 Variable result = newVariable(trueValue.getKind()); |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6534
diff
changeset
|
262 switch (left.getKind().getStackKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
263 case Int: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 case Long: |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
265 case Object: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
266 append(new CondMoveOp(result, finalCondition, load(trueValue), loadNonConst(falseValue))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
267 break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
268 case Float: |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
269 case Double: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
270 append(new FloatCondMoveOp(result, finalCondition, unorderedIsTrue, load(trueValue), load(falseValue))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
271 break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
272 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
273 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
274 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
275 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
276 |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
277 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
278 * This method emits the compare instruction, and may reorder the operands. It returns true if |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
279 * it did so. |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
280 * |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
281 * @param a the left operand of the comparison |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
282 * @param b the right operand of the comparison |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
283 * @return true if the left and right operands were switched, false otherwise |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
284 */ |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
285 private boolean emitCompare(Value a, Value b) { |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
286 Variable left; |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
287 Value right; |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
288 boolean mirrored; |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
289 if (LIRValueUtil.isVariable(b)) { |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
290 left = load(b); |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
291 right = loadNonConst(a); |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
292 mirrored = true; |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
293 } else { |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
294 left = load(a); |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
295 right = loadNonConst(b); |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
296 mirrored = false; |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
297 } |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6534
diff
changeset
|
298 switch (left.getKind().getStackKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
299 case Jsr: |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
300 case Int: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
301 append(new CompareOp(ICMP, left, right)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
302 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
303 case Long: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
304 append(new CompareOp(LCMP, left, right)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
305 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
306 case Object: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
307 append(new CompareOp(ACMP, left, right)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
308 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
309 case Float: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
310 append(new CompareOp(FCMP, left, right)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
311 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
312 case Double: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
313 append(new CompareOp(DCMP, left, right)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
314 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
315 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
316 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
317 } |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
318 return mirrored; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
319 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
320 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
321 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
322 public Variable emitNegate(Value input) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
323 Variable result = newVariable(input.getKind()); |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
324 switch (input.getKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
325 case Int: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
326 append(new Op1Stack(INEG, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
327 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
328 case Long: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
329 append(new Op1Stack(LNEG, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
330 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
331 case Float: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
332 append(new Op2Reg(FXOR, result, input, Constant.forFloat(Float.intBitsToFloat(0x80000000)))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
333 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
334 case Double: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
335 append(new Op2Reg(DXOR, result, input, Constant.forDouble(Double.longBitsToDouble(0x8000000000000000L)))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
336 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
337 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
338 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
339 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
340 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
341 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
342 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
343 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
344 public Variable emitAdd(Value a, Value b) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
345 Variable result = newVariable(a.getKind()); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
346 switch (a.getKind()) { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
347 case Int: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
348 append(new Op2Stack(IADD, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
349 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
350 case Long: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
351 append(new Op2Stack(LADD, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
352 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
353 case Float: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
354 append(new Op2Stack(FADD, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
355 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
356 case Double: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
357 append(new Op2Stack(DADD, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
358 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
359 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
360 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
361 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
362 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
363 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
364 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
365 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
366 public Variable emitSub(Value a, Value b) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
367 Variable result = newVariable(a.getKind()); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
368 switch (a.getKind()) { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
369 case Int: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
370 append(new Op2Stack(ISUB, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
371 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
372 case Long: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
373 append(new Op2Stack(LSUB, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
374 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
375 case Float: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
376 append(new Op2Stack(FSUB, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
377 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
378 case Double: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
379 append(new Op2Stack(DSUB, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
380 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
381 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
382 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
383 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
384 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
385 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
386 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
387 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
388 public Variable emitMul(Value a, Value b) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
389 Variable result = newVariable(a.getKind()); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
390 switch (a.getKind()) { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
391 case Int: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
392 append(new Op2Reg(IMUL, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
393 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
394 case Long: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
395 append(new Op2Reg(LMUL, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
396 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
397 case Float: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
398 append(new Op2Stack(FMUL, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
399 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
400 case Double: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
401 append(new Op2Stack(DMUL, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
402 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
403 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
404 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
405 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
406 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
407 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
408 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
409 @Override |
7380
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
410 protected boolean peephole(ValueNode valueNode) { |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
411 if ((valueNode instanceof IntegerDivNode) || (valueNode instanceof IntegerRemNode)) { |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
412 FixedBinaryNode divRem = (FixedBinaryNode) valueNode; |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
413 FixedNode node = divRem.next(); |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
414 while (node instanceof FixedWithNextNode) { |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
415 FixedWithNextNode fixedWithNextNode = (FixedWithNextNode) node; |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
416 if (((fixedWithNextNode instanceof IntegerDivNode) || (fixedWithNextNode instanceof IntegerRemNode)) && fixedWithNextNode.getClass() != divRem.getClass()) { |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
417 FixedBinaryNode otherDivRem = (FixedBinaryNode) fixedWithNextNode; |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
418 if (otherDivRem.x() == divRem.x() && otherDivRem.y() == divRem.y() && operand(otherDivRem) == null) { |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
419 Value[] results = emitIntegerDivRem(operand(divRem.x()), operand(divRem.y())); |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
420 if (divRem instanceof IntegerDivNode) { |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
421 setResult(divRem, results[0]); |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
422 setResult(otherDivRem, results[1]); |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
423 } else { |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
424 setResult(divRem, results[1]); |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
425 setResult(otherDivRem, results[0]); |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
426 } |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
427 return true; |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
428 } |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
429 } |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
430 node = fixedWithNextNode.next(); |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
431 } |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
432 } |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
433 return false; |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
434 } |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
435 |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
436 public Value[] emitIntegerDivRem(Value a, Value b) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
437 switch (a.getKind()) { |
7380
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
438 case Int: |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
439 emitMove(a, RAX_I); |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
440 append(new DivRemOp(IDIVREM, RAX_I, load(b), state())); |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
441 return new Value[]{emitMove(RAX_I), emitMove(RDX_I)}; |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
442 case Long: |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
443 emitMove(a, RAX_L); |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
444 append(new DivRemOp(LDIVREM, RAX_L, load(b), state())); |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
445 return new Value[]{emitMove(RAX_L), emitMove(RDX_L)}; |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
446 default: |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
447 throw GraalInternalError.shouldNotReachHere(); |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
448 } |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
449 } |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
450 |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
451 @Override |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
452 public Value emitDiv(Value a, Value b) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
453 switch (a.getKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
454 case Int: |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
455 emitMove(a, RAX_I); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
456 append(new DivOp(IDIV, RAX_I, RAX_I, load(b), state())); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
457 return emitMove(RAX_I); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
458 case Long: |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
459 emitMove(a, RAX_L); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
460 append(new DivOp(LDIV, RAX_L, RAX_L, load(b), state())); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
461 return emitMove(RAX_L); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
462 case Float: { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
463 Variable result = newVariable(a.getKind()); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
464 append(new Op2Stack(FDIV, result, a, loadNonConst(b))); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
465 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
466 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
467 case Double: { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
468 Variable result = newVariable(a.getKind()); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
469 append(new Op2Stack(DDIV, result, a, loadNonConst(b))); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
470 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
471 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
472 default: |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
473 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
474 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
475 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
476 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
477 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
478 public Value emitRem(Value a, Value b) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
479 switch (a.getKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
480 case Int: |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
481 emitMove(a, RAX_I); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
482 append(new DivOp(IREM, RDX_I, RAX_I, load(b), state())); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
483 return emitMove(RDX_I); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
484 case Long: |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
485 emitMove(a, RAX_L); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
486 append(new DivOp(LREM, RDX_L, RAX_L, load(b), state())); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
487 return emitMove(RDX_L); |
6521
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6496
diff
changeset
|
488 case Float: { |
7144
ae69cd8c08a9
rename: RuntimeCall -> RuntimeCallTarget
Doug Simon <doug.simon@oracle.com>
parents:
7143
diff
changeset
|
489 RuntimeCallTarget stub = runtime.lookupRuntimeCall(ARITHMETIC_FREM); |
6521
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6496
diff
changeset
|
490 return emitCall(stub, stub.getCallingConvention(), false, a, b); |
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6496
diff
changeset
|
491 } |
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6496
diff
changeset
|
492 case Double: { |
7144
ae69cd8c08a9
rename: RuntimeCall -> RuntimeCallTarget
Doug Simon <doug.simon@oracle.com>
parents:
7143
diff
changeset
|
493 RuntimeCallTarget stub = runtime.lookupRuntimeCall(ARITHMETIC_DREM); |
6521
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6496
diff
changeset
|
494 return emitCall(stub, stub.getCallingConvention(), false, a, b); |
2a0c9f20baa1
consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents:
6496
diff
changeset
|
495 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
496 default: |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
497 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
498 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
499 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
500 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
501 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
502 public Variable emitUDiv(Value a, Value b) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
503 switch (a.getKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
504 case Int: |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
505 emitMove(a, RAX_I); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
506 append(new DivOp(IUDIV, RAX_I, RAX_I, load(b), state())); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
507 return emitMove(RAX_I); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
508 case Long: |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
509 emitMove(a, RAX_L); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
510 append(new DivOp(LUDIV, RAX_L, RAX_L, load(b), state())); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
511 return emitMove(RAX_L); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
512 default: |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
513 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
514 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
515 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
516 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
517 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
518 public Variable emitURem(Value a, Value b) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
519 switch (a.getKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
520 case Int: |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
521 emitMove(a, RAX_I); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
522 append(new DivOp(IUREM, RDX_I, RAX_I, load(b), state())); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
523 return emitMove(RDX_I); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
524 case Long: |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
525 emitMove(a, RAX_L); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
526 append(new DivOp(LUREM, RDX_L, RAX_L, load(b), state())); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
527 return emitMove(RDX_L); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
528 default: |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
529 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
530 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
531 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
532 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
533 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
534 public Variable emitAnd(Value a, Value b) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
535 Variable result = newVariable(a.getKind()); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
536 switch (a.getKind()) { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
537 case Int: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
538 append(new Op2Stack(IAND, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
539 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
540 case Long: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
541 append(new Op2Stack(LAND, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
542 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
543 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
544 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
545 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
546 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
547 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
548 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
549 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
550 public Variable emitOr(Value a, Value b) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
551 Variable result = newVariable(a.getKind()); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
552 switch (a.getKind()) { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
553 case Int: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
554 append(new Op2Stack(IOR, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
555 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
556 case Long: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
557 append(new Op2Stack(LOR, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
558 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
559 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
560 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
561 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
562 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
563 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
564 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
565 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
566 public Variable emitXor(Value a, Value b) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
567 Variable result = newVariable(a.getKind()); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
568 switch (a.getKind()) { |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
569 case Int: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
570 append(new Op2Stack(IXOR, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
571 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
572 case Long: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
573 append(new Op2Stack(LXOR, result, a, loadNonConst(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
574 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
575 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
576 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
577 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
578 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
579 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
580 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
581 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
582 public Variable emitShl(Value a, Value b) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
583 Variable result = newVariable(a.getKind()); |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
584 switch (a.getKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
585 case Int: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
586 append(new ShiftOp(ISHL, result, a, loadShiftCount(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
587 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
588 case Long: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
589 append(new ShiftOp(LSHL, result, a, loadShiftCount(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
590 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
591 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
592 GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
593 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
594 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
595 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
596 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
597 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
598 public Variable emitShr(Value a, Value b) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
599 Variable result = newVariable(a.getKind()); |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
600 switch (a.getKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
601 case Int: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
602 append(new ShiftOp(ISHR, result, a, loadShiftCount(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
603 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
604 case Long: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
605 append(new ShiftOp(LSHR, result, a, loadShiftCount(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
606 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
607 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
608 GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
609 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
610 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
611 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
612 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
613 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
614 public Variable emitUShr(Value a, Value b) { |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
615 Variable result = newVariable(a.getKind()); |
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
616 switch (a.getKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
617 case Int: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
618 append(new ShiftOp(IUSHR, result, a, loadShiftCount(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
619 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
620 case Long: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
621 append(new ShiftOp(LUSHR, result, a, loadShiftCount(b))); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
622 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
623 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
624 GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
625 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
626 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
627 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
628 |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
629 private Value loadShiftCount(Value value) { |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
630 if (isConstant(value)) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
631 return value; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
632 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
633 // Non-constant shift count must be in RCX |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
634 emitMove(value, RCX_I); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
635 return RCX_I; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
636 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
637 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
638 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
639 public Variable emitConvert(ConvertNode.Op opcode, Value inputVal) { |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4199
diff
changeset
|
640 Variable input = load(inputVal); |
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4199
diff
changeset
|
641 Variable result = newVariable(opcode.to); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
642 switch (opcode) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
643 case I2L: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
644 append(new Op1Reg(I2L, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
645 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
646 case L2I: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
647 append(new Op1Stack(L2I, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
648 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
649 case I2B: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
650 append(new Op1Stack(I2B, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
651 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
652 case I2C: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
653 append(new Op1Stack(I2C, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
654 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
655 case I2S: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
656 append(new Op1Stack(I2S, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
657 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
658 case F2D: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
659 append(new Op1Reg(F2D, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
660 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
661 case D2F: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
662 append(new Op1Reg(D2F, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
663 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
664 case I2F: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
665 append(new Op1Reg(I2F, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
666 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
667 case I2D: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
668 append(new Op1Reg(I2D, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
669 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
670 case F2I: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
671 append(new Op1Reg(F2I, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
672 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
673 case D2I: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
674 append(new Op1Reg(D2I, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
675 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
676 case L2F: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
677 append(new Op1Reg(L2F, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
678 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
679 case L2D: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
680 append(new Op1Reg(L2D, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
681 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
682 case F2L: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
683 append(new Op1Reg(F2L, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
684 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
685 case D2L: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
686 append(new Op1Reg(D2L, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
687 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
688 case MOV_I2F: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
689 append(new Op1Reg(MOV_I2F, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
690 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
691 case MOV_L2D: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
692 append(new Op1Reg(MOV_L2D, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
693 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
694 case MOV_F2I: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
695 append(new Op1Reg(MOV_F2I, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
696 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
697 case MOV_D2L: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
698 append(new Op1Reg(MOV_D2L, result, input)); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
699 break; |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7280
diff
changeset
|
700 case UNSIGNED_I2L: |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
701 // Instructions that move or generate 32-bit register values also set the upper 32 |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
702 // bits of the register to zero. |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7280
diff
changeset
|
703 // Consequently, there is no need for a special zero-extension move. |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7280
diff
changeset
|
704 emitMove(input, result); |
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7280
diff
changeset
|
705 break; |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
706 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
707 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
708 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
709 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
710 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
711 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
712 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
713 public void emitDeoptimizeOnOverflow(DeoptimizationAction action, DeoptimizationReason reason, Object deoptInfo) { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5705
diff
changeset
|
714 LIRFrameState info = state(); |
5109
6766253384bf
more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5105
diff
changeset
|
715 LabelRef stubEntry = createDeoptStub(action, reason, info, deoptInfo); |
5402
80127e4a1742
remove Condition.OF and Condition.NOF
Lukas Stadler <lukas.stadler@jku.at>
parents:
5369
diff
changeset
|
716 append(new BranchOp(ConditionFlag.overflow, stubEntry, info)); |
5129
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
717 } |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
718 |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
719 @Override |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
720 public void emitDeoptimize(DeoptimizationAction action, DeoptimizationReason reason, Object deoptInfo, long leafGraphId) { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5705
diff
changeset
|
721 LIRFrameState info = state(leafGraphId); |
5130 | 722 LabelRef stubEntry = createDeoptStub(action, reason, info, deoptInfo); |
5129
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5061
diff
changeset
|
723 append(new JumpOp(stubEntry, info)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
724 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
725 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
726 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
727 public void emitMembar(int barriers) { |
4260
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
728 int necessaryBarriers = target.arch.requiredBarriers(barriers); |
78379b4203ec
remove a number of GraalCompilation usages in backend and CFGPrinter (breaks CFGPrinter lir output)
Lukas Stadler <lukas.stadler@jku.at>
parents:
4245
diff
changeset
|
729 if (target.isMP && necessaryBarriers != 0) { |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
730 append(new MembarOp(necessaryBarriers)); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
731 } |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
732 } |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
733 |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
734 @Override |
6478
62878ae057a5
added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents:
6476
diff
changeset
|
735 protected void emitDirectCall(DirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) { |
62878ae057a5
added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents:
6476
diff
changeset
|
736 append(new DirectCallOp(callTarget.target(), result, parameters, temps, callState)); |
6409
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
737 } |
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
738 |
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
739 @Override |
6478
62878ae057a5
added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents:
6476
diff
changeset
|
740 protected void emitIndirectCall(IndirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
741 // The current register allocator cannot handle variables at call sites, need a fixed |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
742 // register. |
6409
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
743 Value targetAddress = AMD64.rax.asValue(); |
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
744 emitMove(operand(callTarget.computedAddress()), targetAddress); |
6478
62878ae057a5
added support for temps in LIR call instructions
Doug Simon <doug.simon@oracle.com>
parents:
6476
diff
changeset
|
745 append(new IndirectCallOp(callTarget.target(), result, parameters, temps, targetAddress, callState)); |
6409
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
746 } |
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
747 |
823a2978e7ba
Lowering of call targets to direct / indirect call targets
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6329
diff
changeset
|
748 @Override |
7144
ae69cd8c08a9
rename: RuntimeCall -> RuntimeCallTarget
Doug Simon <doug.simon@oracle.com>
parents:
7143
diff
changeset
|
749 protected void emitCall(RuntimeCallTarget callTarget, Value result, Value[] arguments, Value[] temps, Value targetAddress, LIRFrameState info) { |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
750 if (isConstant(targetAddress)) { |
7143
445193cc2a7d
added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents:
7121
diff
changeset
|
751 append(new DirectCallOp(callTarget, result, arguments, temps, info)); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
752 } else { |
7143
445193cc2a7d
added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents:
7121
diff
changeset
|
753 append(new IndirectCallOp(callTarget, result, arguments, temps, targetAddress, info)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
754 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
755 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
756 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
757 @Override |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
758 public void emitBitCount(Variable result, Value value) { |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
759 if (value.getKind().getStackKind() == Kind.Int) { |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
760 append(new AMD64BitManipulationOp(IPOPCNT, result, value)); |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
761 } else { |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
762 append(new AMD64BitManipulationOp(LPOPCNT, result, value)); |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
763 } |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
764 } |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
765 |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
766 @Override |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
767 public void emitBitScanForward(Variable result, Value value) { |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
768 append(new AMD64BitManipulationOp(BSF, result, value)); |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
769 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
770 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
771 @Override |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
772 public void emitBitScanReverse(Variable result, Value value) { |
7098
e23980f4a890
Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7074
diff
changeset
|
773 if (value.getKind().getStackKind() == Kind.Int) { |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
774 append(new AMD64BitManipulationOp(IBSR, result, value)); |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
775 } else { |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
776 append(new AMD64BitManipulationOp(LBSR, result, value)); |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
777 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
778 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
779 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
780 @Override |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
781 public void emitMathAbs(Variable result, Variable input) { |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
782 append(new Op2Reg(DAND, result, input, Constant.forDouble(Double.longBitsToDouble(0x7FFFFFFFFFFFFFFFL)))); |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
783 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
784 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
785 @Override |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
786 public void emitMathSqrt(Variable result, Variable input) { |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
787 append(new AMD64MathIntrinsicOp(SQRT, result, input)); |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
788 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
789 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
790 @Override |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
791 public void emitMathLog(Variable result, Variable input, boolean base10) { |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
792 append(new AMD64MathIntrinsicOp(base10 ? LOG10 : LOG, result, input)); |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
793 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
794 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
795 @Override |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
796 public void emitMathCos(Variable result, Variable input) { |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
797 append(new AMD64MathIntrinsicOp(COS, result, input)); |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
798 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
799 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
800 @Override |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
801 public void emitMathSin(Variable result, Variable input) { |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
802 append(new AMD64MathIntrinsicOp(SIN, result, input)); |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
803 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
804 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
805 @Override |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
806 public void emitMathTan(Variable result, Variable input) { |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
807 append(new AMD64MathIntrinsicOp(TAN, result, input)); |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
808 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
809 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
810 @Override |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
811 public void emitByteSwap(Variable result, Value input) { |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
812 append(new AMD64ByteSwapOp(result, input)); |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
813 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
814 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
815 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
816 protected void emitReturn(Value input) { |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
817 append(new ReturnOp(input)); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
818 } |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
819 |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
820 @Override |
5698
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
821 protected void emitSequentialSwitch(Constant[] keyConstants, LabelRef[] keyTargets, LabelRef defaultTarget, Value key) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
822 // Making a copy of the switch value is necessary because jump table destroys the input |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
823 // value |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6675
diff
changeset
|
824 if (key.getKind() == Kind.Int || key.getKind() == Kind.Long) { |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6534
diff
changeset
|
825 append(new SequentialSwitchOp(keyConstants, keyTargets, defaultTarget, key, Value.ILLEGAL)); |
5698
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
826 } else { |
6950
41938af2b3d8
modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents:
6675
diff
changeset
|
827 assert key.getKind() == Kind.Object : key.getKind(); |
5698
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
828 append(new SequentialSwitchOp(keyConstants, keyTargets, defaultTarget, key, newVariable(Kind.Object))); |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
829 } |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
830 } |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
831 |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
832 @Override |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
833 protected void emitSwitchRanges(int[] lowKeys, int[] highKeys, LabelRef[] targets, LabelRef defaultTarget, Value key) { |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
834 append(new SwitchRangesOp(lowKeys, highKeys, targets, defaultTarget, key)); |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
835 } |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
836 |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
837 @Override |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
838 protected void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, Value key) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
839 // Making a copy of the switch value is necessary because jump table destroys the input |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
840 // value |
5698
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
841 Variable tmp = emitMove(key); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
842 append(new TableSwitchOp(lowKey, defaultTarget, targets, tmp, newVariable(target.wordKind))); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
843 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
844 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
845 @Override |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5705
diff
changeset
|
846 protected LabelRef createDeoptStub(DeoptimizationAction action, DeoptimizationReason reason, LIRFrameState info, Object deoptInfo) { |
5552
69a8969dbf40
Reduce public fields in api.code project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
847 assert info.topFrame.getBCI() >= 0 : "invalid bci for deopt framestate"; |
5109
6766253384bf
more preparations for disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5105
diff
changeset
|
848 AMD64DeoptimizationStub stub = new AMD64DeoptimizationStub(action, reason, info, deoptInfo); |
5273
7689999f0ea6
improved disassembly comments for out-of-line stubs
Doug Simon <doug.simon@oracle.com>
parents:
5247
diff
changeset
|
849 lir.stubs.add(stub); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
850 return LabelRef.forLabel(stub.label); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
851 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
852 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
853 @Override |
5425
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5406
diff
changeset
|
854 protected void emitNullCheckGuard(ValueNode object, long leafGraphId) { |
0364a2a874b8
changes towards a canonical representation of comparisons:
Lukas Stadler <lukas.stadler@jku.at>
parents:
5406
diff
changeset
|
855 Variable value = load(operand(object)); |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5705
diff
changeset
|
856 LIRFrameState info = state(leafGraphId); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
857 append(new NullCheckOp(value, info)); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
858 } |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
859 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
860 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
861 public void visitCompareAndSwap(CompareAndSwapNode node) { |
5540
a891c53a295b
Renaming RiKind => Kind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
862 Kind kind = node.newValue().kind(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
863 assert kind == node.expected().kind(); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
864 |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
865 Value expected = loadNonConst(operand(node.expected())); |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4199
diff
changeset
|
866 Variable newValue = load(operand(node.newValue())); |
4314
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
867 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
868 Address address; |
5187
9b8c0d1bc2dd
unsafe load/store snippets now require a displacement argument which allows x86 complex addressing modes to be used for tighter encoding of array store/load operations
Doug Simon <doug.simon@oracle.com>
parents:
5167
diff
changeset
|
869 int displacement = node.displacement(); |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
870 Value index = operand(node.offset()); |
5705
f96e7b39e9fe
Be more strict on isInt check in CAS lowering when index is constant
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5698
diff
changeset
|
871 if (isConstant(index) && NumUtil.isInt(asConstant(index).asLong() + displacement)) { |
7074
1361501d6bd5
added some more assertions to ensure that metadata constant are not emitted inline
Christian Haeubl <haeubl@ssw.jku.at>
parents:
7073
diff
changeset
|
872 assert !runtime.needsDataPatch(asConstant(index)); |
5187
9b8c0d1bc2dd
unsafe load/store snippets now require a displacement argument which allows x86 complex addressing modes to be used for tighter encoding of array store/load operations
Doug Simon <doug.simon@oracle.com>
parents:
5167
diff
changeset
|
873 displacement += (int) asConstant(index).asLong(); |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
874 address = new Address(kind, load(operand(node.object())), displacement); |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
875 } else { |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
876 address = new Address(kind, load(operand(node.object())), load(index), Address.Scale.Times1, displacement); |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4206
diff
changeset
|
877 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
878 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
879 RegisterValue rax = AMD64.rax.asValue(kind); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
880 emitMove(expected, rax); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
881 append(new CompareAndSwapOp(rax, address, rax, newValue)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
882 |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4199
diff
changeset
|
883 Variable result = newVariable(node.kind()); |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
884 append(new CondMoveOp(result, Condition.EQ, load(Constant.TRUE), Constant.FALSE)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
885 setResult(node, result); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
886 } |
7121
4aa99b5b158b
LIR generation for BreakpointNode is not HotSpot specific and generally useful, so it should not be in HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
887 |
4aa99b5b158b
LIR generation for BreakpointNode is not HotSpot specific and generally useful, so it should not be in HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
888 @Override |
4aa99b5b158b
LIR generation for BreakpointNode is not HotSpot specific and generally useful, so it should not be in HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
889 public void visitBreakpointNode(BreakpointNode node) { |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7280
diff
changeset
|
890 JavaType[] sig = new JavaType[node.arguments.size()]; |
7121
4aa99b5b158b
LIR generation for BreakpointNode is not HotSpot specific and generally useful, so it should not be in HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
891 for (int i = 0; i < sig.length; i++) { |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7280
diff
changeset
|
892 sig[i] = node.arguments.get(i).stamp().javaType(runtime); |
7121
4aa99b5b158b
LIR generation for BreakpointNode is not HotSpot specific and generally useful, so it should not be in HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
893 } |
4aa99b5b158b
LIR generation for BreakpointNode is not HotSpot specific and generally useful, so it should not be in HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
894 |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7280
diff
changeset
|
895 CallingConvention cc = frameMap.registerConfig.getCallingConvention(CallingConvention.Type.JavaCall, null, sig, target(), false); |
7121
4aa99b5b158b
LIR generation for BreakpointNode is not HotSpot specific and generally useful, so it should not be in HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
896 Value[] parameters = visitInvokeArguments(cc, node.arguments); |
4aa99b5b158b
LIR generation for BreakpointNode is not HotSpot specific and generally useful, so it should not be in HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
897 append(new AMD64BreakpointOp(parameters)); |
4aa99b5b158b
LIR generation for BreakpointNode is not HotSpot specific and generally useful, so it should not be in HotSpot project
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7098
diff
changeset
|
898 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
899 } |