Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java @ 17197:ec35bb4eccb8
Add support for other data types to integer arithmetic nodes.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Wed, 24 Sep 2014 13:46:37 +0200 |
parents | cbd42807a31f |
children | 56458afc02a3 |
rev | line source |
---|---|
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
1 /* |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
4 * |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
8 * |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
13 * accompanied this code). |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
14 * |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
18 * |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
21 * questions. |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
22 */ |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.amd64; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
24 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
25 import static com.oracle.graal.amd64.AMD64.*; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
26 import static com.oracle.graal.api.code.ValueUtil.*; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
27 import static com.oracle.graal.hotspot.HotSpotBackend.*; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
28 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
29 import com.oracle.graal.amd64.*; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
30 import com.oracle.graal.api.code.*; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
31 import com.oracle.graal.api.meta.*; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
32 import com.oracle.graal.asm.*; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
33 import com.oracle.graal.compiler.amd64.*; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
34 import com.oracle.graal.compiler.common.calc.*; |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
35 import com.oracle.graal.compiler.common.type.*; |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
36 import com.oracle.graal.compiler.gen.*; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
37 import com.oracle.graal.compiler.match.*; |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
38 import com.oracle.graal.debug.*; |
14842
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
39 import com.oracle.graal.graph.*; |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
40 import com.oracle.graal.hotspot.*; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
41 import com.oracle.graal.hotspot.amd64.AMD64HotSpotLIRGenerator.SaveRbp; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
42 import com.oracle.graal.hotspot.meta.*; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
43 import com.oracle.graal.hotspot.nodes.*; |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
44 import com.oracle.graal.hotspot.nodes.type.*; |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
45 import com.oracle.graal.lir.*; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
46 import com.oracle.graal.lir.StandardOp.NoOp; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
47 import com.oracle.graal.lir.amd64.*; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
48 import com.oracle.graal.lir.amd64.AMD64Move.CompareAndSwapOp; |
15297
3a6151ed5a25
Move LIRGenerator to graal.lir (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15296
diff
changeset
|
49 import com.oracle.graal.lir.gen.*; |
16841
cbd42807a31f
moved NodeInfo and friends into separate com.oracle.graal.nodeinfo project so that annotation processor can be applied to the base Node class
Doug Simon <doug.simon@oracle.com>
parents:
16838
diff
changeset
|
50 import com.oracle.graal.nodes.CallTargetNode.InvokeKind; |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
51 import com.oracle.graal.nodes.*; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
52 import com.oracle.graal.nodes.calc.*; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
53 import com.oracle.graal.nodes.extended.*; |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
54 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
55 /** |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
56 * LIR generator specialized for AMD64 HotSpot. |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
57 */ |
14888
f6630873316b
Rename NodeLIRGenerator (and related classes and interfaces) to NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14854
diff
changeset
|
58 public class AMD64HotSpotNodeLIRBuilder extends AMD64NodeLIRBuilder implements HotSpotNodeLIRBuilder { |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
59 |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
60 private static ValueNode filterCompression(ValueNode node) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
61 ValueNode result = node; |
15849
e7277bf3b171
skip PiNode in AMD64HotSpotNodeLIRBuilder.filterCompression
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15838
diff
changeset
|
62 if (result instanceof PiNode) { |
e7277bf3b171
skip PiNode in AMD64HotSpotNodeLIRBuilder.filterCompression
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15838
diff
changeset
|
63 result = ((PiNode) result).getOriginalNode(); |
e7277bf3b171
skip PiNode in AMD64HotSpotNodeLIRBuilder.filterCompression
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15838
diff
changeset
|
64 } |
e7277bf3b171
skip PiNode in AMD64HotSpotNodeLIRBuilder.filterCompression
Lukas Stadler <lukas.stadler@oracle.com>
parents:
15838
diff
changeset
|
65 if (result instanceof CompressionNode) { |
16156
0993768dfc8e
new UnaryNode base class
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16094
diff
changeset
|
66 result = ((CompressionNode) result).getValue(); |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
67 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
68 return result; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
69 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
70 |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
71 private void emitCompareCompressedMemory(Kind kind, IfNode ifNode, ValueNode valueNode, CompressionNode compress, ConstantLocationNode location, Access access, CompareNode compare) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
72 Value value = gen.load(operand(valueNode)); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
73 AMD64AddressValue address = makeCompressedAddress(compress, location); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
74 Condition cond = compare.condition(); |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16156
diff
changeset
|
75 if (access == filterCompression(compare.getX())) { |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
76 cond = cond.mirror(); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
77 } else { |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16156
diff
changeset
|
78 assert access == filterCompression(compare.getY()); |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
79 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
80 |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
81 LabelRef trueLabel = getLIRBlock(ifNode.trueSuccessor()); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
82 LabelRef falseLabel = getLIRBlock(ifNode.falseSuccessor()); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
83 double trueLabelProbability = ifNode.probability(ifNode.trueSuccessor()); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
84 getGen().emitCompareBranchMemory(kind, value, address, getState(access), cond, compare.unorderedIsTrue(), trueLabel, falseLabel, trueLabelProbability); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
85 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
86 |
15333
06ecedffb109
Use LIRGeneratorTool in Backend.
Josef Eisl <josef.eisl@jku.at>
parents:
15311
diff
changeset
|
87 public AMD64HotSpotNodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool gen) { |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
88 super(graph, gen); |
15293
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15263
diff
changeset
|
89 assert gen instanceof AMD64HotSpotLIRGenerator; |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15263
diff
changeset
|
90 assert getDebugInfoBuilder() instanceof HotSpotDebugInfoBuilder; |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15263
diff
changeset
|
91 ((AMD64HotSpotLIRGenerator) gen).setLockStack(((HotSpotDebugInfoBuilder) getDebugInfoBuilder()).lockStack()); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
92 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
93 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
94 private AMD64HotSpotLIRGenerator getGen() { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
95 return (AMD64HotSpotLIRGenerator) gen; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
96 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
97 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
98 private SaveRbp getSaveRbp() { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
99 return getGen().saveRbp; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
100 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
101 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
102 private void setSaveRbp(SaveRbp saveRbp) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
103 getGen().saveRbp = saveRbp; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
104 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
105 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
106 @Override |
15838
15771ff797b4
Pass the compiled method to LIR factory
Christian Wimmer <christian.wimmer@oracle.com>
parents:
15547
diff
changeset
|
107 protected DebugInfoBuilder createDebugInfoBuilder(StructuredGraph graph, NodeMap<Value> nodeOperands) { |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
108 HotSpotLockStack lockStack = new HotSpotLockStack(gen.getResult().getFrameMap(), LIRKind.value(Kind.Long)); |
14842
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
109 return new HotSpotDebugInfoBuilder(nodeOperands, lockStack); |
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
110 } |
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
111 |
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
112 @Override |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
113 protected void emitPrologue(StructuredGraph graph) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
114 |
14843
dd75a505f1b6
Remove currentBlock from NodeLIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14842
diff
changeset
|
115 CallingConvention incomingArguments = gen.getCallingConvention(); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
116 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
117 Value[] params = new Value[incomingArguments.getArgumentCount() + 1]; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
118 for (int i = 0; i < params.length - 1; i++) { |
14923
bcef7320c707
Remove more duplicate methods from NodeLIRBuilder and LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14921
diff
changeset
|
119 params[i] = LIRGenerator.toStackKind(incomingArguments.getArgument(i)); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
120 if (isStackSlot(params[i])) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
121 StackSlot slot = ValueUtil.asStackSlot(params[i]); |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
122 if (slot.isInCallerFrame() && !gen.getResult().getLIR().hasArgInCallerFrame()) { |
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
123 gen.getResult().getLIR().setHasArgInCallerFrame(); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
124 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
125 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
126 } |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
127 params[params.length - 1] = rbp.asValue(LIRKind.value(Kind.Long)); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
128 |
14923
bcef7320c707
Remove more duplicate methods from NodeLIRBuilder and LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14921
diff
changeset
|
129 gen.emitIncomingValues(params); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
130 |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
131 setSaveRbp(((AMD64HotSpotLIRGenerator) gen).new SaveRbp(new NoOp(gen.getCurrentBlock(), gen.getResult().getLIR().getLIRforBlock(gen.getCurrentBlock()).size()))); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
132 append(getSaveRbp().placeholder); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
133 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
134 for (ParameterNode param : graph.getNodes(ParameterNode.class)) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
135 Value paramValue = params[param.index()]; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
136 assert paramValue.getKind() == param.getKind().getStackKind(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
137 setResult(param, gen.emitMove(paramValue)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
138 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
139 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
140 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
141 @Override |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
142 public void visitSafepointNode(SafepointNode i) { |
15296
c98708ec9663
Move state(DeoptimizingNode) from LIRGenerator to NodeLIRBuilder (errors).
Josef Eisl <josef.eisl@jku.at>
parents:
15293
diff
changeset
|
143 LIRFrameState info = state(i); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
144 append(new AMD64HotSpotSafepointOp(info, getGen().config, this)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
145 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
146 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
147 @Override |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
148 protected void emitDirectCall(DirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
149 InvokeKind invokeKind = ((HotSpotDirectCallTargetNode) callTarget).invokeKind(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
150 if (invokeKind == InvokeKind.Interface || invokeKind == InvokeKind.Virtual) { |
16564
688f84e397a3
Move the target method from MethodCallTargetNode and LoweredCallTargetNode to their superclass CallTargetNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
151 append(new AMD64HotspotDirectVirtualCallOp(callTarget.targetMethod(), result, parameters, temps, callState, invokeKind)); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
152 } else { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
153 assert invokeKind == InvokeKind.Static || invokeKind == InvokeKind.Special; |
16564
688f84e397a3
Move the target method from MethodCallTargetNode and LoweredCallTargetNode to their superclass CallTargetNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
154 HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) callTarget.targetMethod(); |
15311
820c6d353358
added ModifiersProvider as superinterface for ResolvedJava[Method|Field|Type] and implemented all checks against modifiers as default methods
Doug Simon <doug.simon@oracle.com>
parents:
15297
diff
changeset
|
155 assert !resolvedMethod.isAbstract() : "Cannot make direct call to abstract method."; |
16564
688f84e397a3
Move the target method from MethodCallTargetNode and LoweredCallTargetNode to their superclass CallTargetNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
156 append(new AMD64HotspotDirectStaticCallOp(callTarget.targetMethod(), result, parameters, temps, callState, invokeKind)); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
157 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
158 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
159 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
160 @Override |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
161 protected void emitIndirectCall(IndirectCallTargetNode callTarget, Value result, Value[] parameters, Value[] temps, LIRFrameState callState) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
162 if (callTarget instanceof HotSpotIndirectCallTargetNode) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
163 AllocatableValue metaspaceMethod = AMD64.rbx.asValue(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
164 gen.emitMove(metaspaceMethod, operand(((HotSpotIndirectCallTargetNode) callTarget).metaspaceMethod())); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
165 AllocatableValue targetAddress = AMD64.rax.asValue(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
166 gen.emitMove(targetAddress, operand(callTarget.computedAddress())); |
16564
688f84e397a3
Move the target method from MethodCallTargetNode and LoweredCallTargetNode to their superclass CallTargetNode
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16563
diff
changeset
|
167 append(new AMD64IndirectCallOp(callTarget.targetMethod(), result, parameters, temps, metaspaceMethod, targetAddress, callState)); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
168 } else { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
169 super.emitIndirectCall(callTarget, result, parameters, temps, callState); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
170 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
171 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
172 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
173 @Override |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
174 public void emitPatchReturnAddress(ValueNode address) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
175 append(new AMD64HotSpotPatchReturnAddressOp(gen.load(operand(address)))); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
176 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
177 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
178 @Override |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
179 public void emitJumpToExceptionHandlerInCaller(ValueNode handlerInCallerPc, ValueNode exception, ValueNode exceptionPc) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
180 Variable handler = gen.load(operand(handlerInCallerPc)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
181 ForeignCallLinkage linkage = gen.getForeignCalls().lookupForeignCall(EXCEPTION_HANDLER_IN_CALLER); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
182 CallingConvention outgoingCc = linkage.getOutgoingCallingConvention(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
183 assert outgoingCc.getArgumentCount() == 2; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
184 RegisterValue exceptionFixed = (RegisterValue) outgoingCc.getArgument(0); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
185 RegisterValue exceptionPcFixed = (RegisterValue) outgoingCc.getArgument(1); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
186 gen.emitMove(exceptionFixed, operand(exception)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
187 gen.emitMove(exceptionPcFixed, operand(exceptionPc)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
188 Register thread = getGen().getProviders().getRegisters().getThreadRegister(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
189 AMD64HotSpotJumpToExceptionHandlerInCallerOp op = new AMD64HotSpotJumpToExceptionHandlerInCallerOp(handler, exceptionFixed, exceptionPcFixed, getGen().config.threadIsMethodHandleReturnOffset, |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
190 thread); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
191 append(op); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
192 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
193 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
194 @Override |
16573
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16564
diff
changeset
|
195 public void visitFullInfopointNode(FullInfopointNode i) { |
15263
0b25b81414c9
Move various bci constants from FrameState (gral.nodes) to BytecodeFrame (graal.api.code)
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
15046
diff
changeset
|
196 if (i.getState() != null && i.getState().bci == BytecodeFrame.AFTER_BCI) { |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
197 Debug.log("Ignoring InfopointNode for AFTER_BCI"); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
198 } else { |
16573
a2ec1ac769e4
Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
16564
diff
changeset
|
199 super.visitFullInfopointNode(i); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
200 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
201 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
202 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
203 public void emitPrefetchAllocate(ValueNode address, ValueNode distance) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
204 AMD64AddressValue addr = getGen().emitAddress(operand(address), 0, gen.loadNonConst(operand(distance)), 1); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
205 append(new AMD64PrefetchOp(addr, getGen().config.allocatePrefetchInstr)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
206 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
207 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
208 @Override |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
209 public void visitDirectCompareAndSwap(DirectCompareAndSwapNode x) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
210 Value expected = gen.loadNonConst(operand(x.expectedValue())); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
211 Variable newVal = gen.load(operand(x.newValue())); |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
212 assert expected.getLIRKind().equals(newVal.getLIRKind()); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
213 |
16082
048943ad39bf
Reuse existing address simplification code in visitDirectCompareAndSwap.
Roland Schatz <roland.schatz@oracle.com>
parents:
15849
diff
changeset
|
214 AMD64AddressValue address = getGen().emitAddress(operand(x.object()), 0, operand(x.offset()), 1); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
215 |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
216 RegisterValue raxLocal = AMD64.rax.asValue(expected.getLIRKind()); |
14854 | 217 gen.emitMove(raxLocal, expected); |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
218 append(new CompareAndSwapOp(expected.getKind(), raxLocal, address, raxLocal, newVal)); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
219 |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
220 setResult(x, gen.emitMove(raxLocal)); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
221 } |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
222 |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
223 boolean canFormCompressedMemory(CompressionNode compress, ConstantLocationNode location) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
224 HotSpotVMConfig config = HotSpotGraalRuntime.runtime().getConfig(); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
225 if (config.useCompressedOops && compress.getEncoding().shift <= 3 && NumUtil.isInt(location.getDisplacement())) { |
16156
0993768dfc8e
new UnaryNode base class
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16094
diff
changeset
|
226 Stamp compressedStamp = compress.getValue().stamp(); |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
227 if (compressedStamp instanceof NarrowOopStamp) { |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
228 return true; |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
229 } else if (compressedStamp instanceof IntegerStamp) { |
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
230 IntegerStamp is = (IntegerStamp) compressedStamp; |
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
231 return is.getBits() == 32 && config.narrowKlassBase == config.narrowOopBase; |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
232 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
233 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
234 return false; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
235 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
236 |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
237 private AMD64AddressValue makeCompressedAddress(CompressionNode compress, ConstantLocationNode location) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
238 assert canFormCompressedMemory(compress, location); |
16156
0993768dfc8e
new UnaryNode base class
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16094
diff
changeset
|
239 AMD64AddressValue address = getGen().emitAddress(getGen().getProviders().getRegisters().getHeapBaseRegister().asValue(), location.getDisplacement(), operand(compress.getValue()), |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
240 1 << compress.getEncoding().shift); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
241 return address; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
242 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
243 |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
244 @MatchRule("(If (IntegerEquals=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
245 @MatchRule("(If (IntegerLessThan=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))") |
16601
cd25e42d9b22
rename IntegerBelowThanNode to IntegerBelowNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16573
diff
changeset
|
246 @MatchRule("(If (IntegerBelow=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))") |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
247 @MatchRule("(If (FloatEquals=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
248 @MatchRule("(If (FloatLessThan=compare value (FloatingRead=access (Compression=compress object) ConstantLocation=location)))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
249 @MatchRule("(If (IntegerEquals=compare value (Read=access (Compression=compress object) ConstantLocation=location)))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
250 @MatchRule("(If (IntegerLessThan=compare value (Read=access (Compression=compress object) ConstantLocation=location)))") |
16601
cd25e42d9b22
rename IntegerBelowThanNode to IntegerBelowNode
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16573
diff
changeset
|
251 @MatchRule("(If (IntegerBelow=compare value (Read=access (Compression=compress object) ConstantLocation=location)))") |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
252 @MatchRule("(If (FloatEquals=compare value (Read=access (Compression=compress object) ConstantLocation=location)))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
253 @MatchRule("(If (FloatLessThan=compare value (Read=access (Compression=compress object) ConstantLocation=location)))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
254 public ComplexMatchResult ifCompareCompressedMemory(IfNode root, CompareNode compare, CompressionNode compress, ValueNode value, ConstantLocationNode location, Access access) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
255 if (canFormCompressedMemory(compress, location)) { |
16207
df6f2365b153
rename of x() to getX(), y() to getY() and object() to getValue()
Lukas Stadler <lukas.stadler@oracle.com>
parents:
16156
diff
changeset
|
256 PlatformKind cmpKind = gen.getLIRKind(compare.getX().stamp()).getPlatformKind(); |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
257 if (cmpKind instanceof Kind) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
258 Kind kind = (Kind) cmpKind; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
259 return builder -> { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
260 emitCompareCompressedMemory(kind, root, value, compress, location, access, compare); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
261 return null; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
262 }; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
263 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
264 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
265 return null; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
266 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
267 |
17197
ec35bb4eccb8
Add support for other data types to integer arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
16841
diff
changeset
|
268 @MatchRule("(Add value (Read=access (Compression=compress object) ConstantLocation=location))") |
ec35bb4eccb8
Add support for other data types to integer arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
16841
diff
changeset
|
269 @MatchRule("(Sub value (Read=access (Compression=compress object) ConstantLocation=location))") |
ec35bb4eccb8
Add support for other data types to integer arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
16841
diff
changeset
|
270 @MatchRule("(Mul value (Read=access (Compression=compress object) ConstantLocation=location))") |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
271 @MatchRule("(FloatAdd value (Read=access (Compression=compress object) ConstantLocation=location))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
272 @MatchRule("(FloatSub value (Read=access (Compression=compress object) ConstantLocation=location))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
273 @MatchRule("(FloatMul value (Read=access (Compression=compress object) ConstantLocation=location))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
274 @MatchRule("(Or value (Read=access (Compression=compress object) ConstantLocation=location))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
275 @MatchRule("(Xor value (Read=access (Compression=compress object) ConstantLocation=location))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
276 @MatchRule("(And value (Read=access (Compression=compress object) ConstantLocation=location))") |
17197
ec35bb4eccb8
Add support for other data types to integer arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
16841
diff
changeset
|
277 @MatchRule("(Add value (FloatingRead=access (Compression=compress object) ConstantLocation=location))") |
ec35bb4eccb8
Add support for other data types to integer arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
16841
diff
changeset
|
278 @MatchRule("(Sub value (FloatingRead=access (Compression=compress object) ConstantLocation=location))") |
ec35bb4eccb8
Add support for other data types to integer arithmetic nodes.
Roland Schatz <roland.schatz@oracle.com>
parents:
16841
diff
changeset
|
279 @MatchRule("(Mul value (FloatingRead=access (Compression=compress object) ConstantLocation=location))") |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
280 @MatchRule("(FloatAdd value (FloatingRead=access (Compression=compress object) ConstantLocation=location))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
281 @MatchRule("(FloatSub value (FloatingRead=access (Compression=compress object) ConstantLocation=location))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
282 @MatchRule("(FloatMul value (FloatingRead=access (Compression=compress object) ConstantLocation=location))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
283 @MatchRule("(Or value (FloatingRead=access (Compression=compress object) ConstantLocation=location))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
284 @MatchRule("(Xor value (FloatingRead=access (Compression=compress object) ConstantLocation=location))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
285 @MatchRule("(And value (FloatingRead=access (Compression=compress object) ConstantLocation=location))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
286 public ComplexMatchResult binaryReadCompressed(BinaryNode root, ValueNode value, Access access, CompressionNode compress, ConstantLocationNode location) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
287 if (canFormCompressedMemory(compress, location)) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
288 AMD64Arithmetic op = getOp(root, access); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
289 if (op != null) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
290 return builder -> getLIRGeneratorTool().emitBinaryMemory(op, getMemoryKind(access), getLIRGeneratorTool().asAllocatable(operand(value)), makeCompressedAddress(compress, location), |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
291 getState(access)); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
292 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
293 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
294 return null; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
295 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
296 |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
297 @MatchRule("(Read (Compression=compress object) ConstantLocation=location)") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
298 @MatchRule("(Read (Pi (Compression=compress object)) ConstantLocation=location)") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
299 @MatchRule("(FloatingRead (Compression=compress object) ConstantLocation=location)") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
300 @MatchRule("(FloatingRead (Pi (Compression=compress object)) ConstantLocation=location)") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
301 public ComplexMatchResult readCompressed(Access root, CompressionNode compress, ConstantLocationNode location) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
302 if (canFormCompressedMemory(compress, location)) { |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
303 LIRKind readKind = getGen().getLIRKind(root.asNode().stamp()); |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
304 return builder -> { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
305 return getGen().emitLoad(readKind, makeCompressedAddress(compress, location), getState(root)); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
306 }; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
307 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
308 return null; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
309 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
310 |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
311 @MatchRule("(Write (Compression=compress object) ConstantLocation=location value)") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
312 @MatchRule("(Write (Pi (Compression=compress object)) ConstantLocation=location value)") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
313 public ComplexMatchResult writeCompressed(Access root, CompressionNode compress, ConstantLocationNode location, ValueNode value) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
314 if (canFormCompressedMemory(compress, location)) { |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16092
diff
changeset
|
315 LIRKind readKind = getGen().getLIRKind(value.asNode().stamp()); |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
316 return builder -> { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
317 getGen().emitStore(readKind, makeCompressedAddress(compress, location), operand(value), getState(root)); |
15453
100306ae985b
switch MatchRule from class to method annotation and fix review feedback
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15413
diff
changeset
|
318 return null; |
100306ae985b
switch MatchRule from class to method annotation and fix review feedback
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15413
diff
changeset
|
319 }; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
320 } |
15453
100306ae985b
switch MatchRule from class to method annotation and fix review feedback
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15413
diff
changeset
|
321 return null; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
322 } |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
323 } |