Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotNodeLIRBuilder.java @ 15522:589c3627fab8
special cases for addresses involving compressed references
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Mon, 05 May 2014 20:33:00 -0700 |
parents | 100306ae985b |
children | cab432461b8b |
rev | line source |
---|---|
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
1 /* |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
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.asm.amd64.AMD64Address.Scale; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
34 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
|
35 import com.oracle.graal.compiler.common.calc.*; |
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.*; |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
50 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
|
51 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
|
52 import com.oracle.graal.nodes.extended.*; |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
53 import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; |
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 */ |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
58 @MatchableNodeImport({"com.oracle.graal.hotspot.nodes.HotSpotMatchableNodes"}) |
14888
f6630873316b
Rename NodeLIRGenerator (and related classes and interfaces) to NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14854
diff
changeset
|
59 public class AMD64HotSpotNodeLIRBuilder extends AMD64NodeLIRBuilder implements HotSpotNodeLIRBuilder { |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
60 |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
61 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
|
62 ValueNode result = node; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
63 while (result instanceof CompressionNode) { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
64 result = ((CompressionNode) result).getInput(); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
65 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
66 return result; |
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 |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
69 private void emitCompareMemoryObject(IfNode ifNode, ValueNode valueNode, Access access, CompareNode compare) { |
15412
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
70 Value value; |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
71 // This works by embedding the compressed form for constants, so force a constant instead of |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
72 // respecting what operand() would return. |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
73 if (valueNode.isConstant()) { |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
74 value = valueNode.asConstant(); |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
75 } else { |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
76 value = gen.load(operand(valueNode)); |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
77 } |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
78 AMD64AddressValue address = makeAddress(access); |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
79 |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
80 Condition cond = compare.condition(); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
81 Value left; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
82 Value right; |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
83 if (access == filterCompression(compare.x())) { |
15412
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
84 left = value; |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
85 right = address; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
86 } else { |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
87 assert access == filterCompression(compare.y()); |
15412
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
88 left = address; |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
89 right = value; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
90 cond = cond.mirror(); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
91 } |
15412
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
92 |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
93 LabelRef trueLabel = getLIRBlock(ifNode.trueSuccessor()); |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
94 LabelRef falseLabel = getLIRBlock(ifNode.falseSuccessor()); |
bd2d8a93cfbe
fix bug with compressed comparision using wrong version of constant
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15370
diff
changeset
|
95 double trueLabelProbability = ifNode.probability(ifNode.trueSuccessor()); |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
96 getGen().emitCompareBranchMemoryCompressed(left, right, cond, trueLabel, falseLabel, trueLabelProbability, getState(access)); |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
97 } |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
98 |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
99 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
|
100 Value value = gen.load(operand(valueNode)); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
101 AMD64AddressValue address = makeCompressedAddress(compress, location); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
102 Condition cond = compare.condition(); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
103 if (access == filterCompression(compare.x())) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
104 cond = cond.mirror(); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
105 } else { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
106 assert access == filterCompression(compare.y()); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
107 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
108 |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
109 LabelRef trueLabel = getLIRBlock(ifNode.trueSuccessor()); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
110 LabelRef falseLabel = getLIRBlock(ifNode.falseSuccessor()); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
111 double trueLabelProbability = ifNode.probability(ifNode.trueSuccessor()); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
112 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
|
113 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
114 |
15333
06ecedffb109
Use LIRGeneratorTool in Backend.
Josef Eisl <josef.eisl@jku.at>
parents:
15311
diff
changeset
|
115 public AMD64HotSpotNodeLIRBuilder(StructuredGraph graph, LIRGeneratorTool gen) { |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
116 super(graph, gen); |
15293
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15263
diff
changeset
|
117 assert gen instanceof AMD64HotSpotLIRGenerator; |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15263
diff
changeset
|
118 assert getDebugInfoBuilder() instanceof HotSpotDebugInfoBuilder; |
adc7d7aad51c
Deprecate LIRGenerator.getDebugInfoBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
15263
diff
changeset
|
119 ((AMD64HotSpotLIRGenerator) gen).setLockStack(((HotSpotDebugInfoBuilder) getDebugInfoBuilder()).lockStack()); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
120 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
121 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
122 private AMD64HotSpotLIRGenerator getGen() { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
123 return (AMD64HotSpotLIRGenerator) gen; |
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 private SaveRbp getSaveRbp() { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
127 return getGen().saveRbp; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
128 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
129 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
130 private void setSaveRbp(SaveRbp saveRbp) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
131 getGen().saveRbp = saveRbp; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
132 } |
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 @Override |
14842
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
135 protected DebugInfoBuilder createDebugInfoBuilder(NodeMap<Value> nodeOperands) { |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
136 HotSpotLockStack lockStack = new HotSpotLockStack(gen.getResult().getFrameMap(), Kind.Long); |
14842
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
137 return new HotSpotDebugInfoBuilder(nodeOperands, lockStack); |
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
138 } |
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
139 |
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
140 @Override |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
141 protected void emitPrologue(StructuredGraph graph) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
142 |
14843
dd75a505f1b6
Remove currentBlock from NodeLIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14842
diff
changeset
|
143 CallingConvention incomingArguments = gen.getCallingConvention(); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
144 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
145 Value[] params = new Value[incomingArguments.getArgumentCount() + 1]; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
146 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
|
147 params[i] = LIRGenerator.toStackKind(incomingArguments.getArgument(i)); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
148 if (isStackSlot(params[i])) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
149 StackSlot slot = ValueUtil.asStackSlot(params[i]); |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
150 if (slot.isInCallerFrame() && !gen.getResult().getLIR().hasArgInCallerFrame()) { |
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
151 gen.getResult().getLIR().setHasArgInCallerFrame(); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
152 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
153 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
154 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
155 params[params.length - 1] = rbp.asValue(Kind.Long); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
156 |
14923
bcef7320c707
Remove more duplicate methods from NodeLIRBuilder and LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14921
diff
changeset
|
157 gen.emitIncomingValues(params); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
158 |
14921
88dfaf6448e0
Remove LIRGenerationResult from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents:
14888
diff
changeset
|
159 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
|
160 append(getSaveRbp().placeholder); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
161 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
162 for (ParameterNode param : graph.getNodes(ParameterNode.class)) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
163 Value paramValue = params[param.index()]; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
164 assert paramValue.getKind() == param.getKind().getStackKind(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
165 setResult(param, gen.emitMove(paramValue)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
166 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
167 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
168 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
169 @Override |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
170 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
|
171 LIRFrameState info = state(i); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
172 append(new AMD64HotSpotSafepointOp(info, getGen().config, this)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
173 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
174 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
175 @Override |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
176 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
|
177 InvokeKind invokeKind = ((HotSpotDirectCallTargetNode) callTarget).invokeKind(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
178 if (invokeKind == InvokeKind.Interface || invokeKind == InvokeKind.Virtual) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
179 append(new AMD64HotspotDirectVirtualCallOp(callTarget.target(), result, parameters, temps, callState, invokeKind)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
180 } else { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
181 assert invokeKind == InvokeKind.Static || invokeKind == InvokeKind.Special; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
182 HotSpotResolvedJavaMethod resolvedMethod = (HotSpotResolvedJavaMethod) callTarget.target(); |
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
|
183 assert !resolvedMethod.isAbstract() : "Cannot make direct call to abstract method."; |
15046
5c71dcf0915d
use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15024
diff
changeset
|
184 append(new AMD64HotspotDirectStaticCallOp(callTarget.target(), result, parameters, temps, callState, invokeKind)); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
185 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
186 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
187 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
188 @Override |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
189 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
|
190 if (callTarget instanceof HotSpotIndirectCallTargetNode) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
191 AllocatableValue metaspaceMethod = AMD64.rbx.asValue(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
192 gen.emitMove(metaspaceMethod, operand(((HotSpotIndirectCallTargetNode) callTarget).metaspaceMethod())); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
193 AllocatableValue targetAddress = AMD64.rax.asValue(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
194 gen.emitMove(targetAddress, operand(callTarget.computedAddress())); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
195 append(new AMD64IndirectCallOp(callTarget.target(), result, parameters, temps, metaspaceMethod, targetAddress, callState)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
196 } else { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
197 super.emitIndirectCall(callTarget, result, parameters, temps, callState); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
198 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
199 } |
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 @Override |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
202 public void emitPatchReturnAddress(ValueNode address) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
203 append(new AMD64HotSpotPatchReturnAddressOp(gen.load(operand(address)))); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
204 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
205 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
206 @Override |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
207 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
|
208 Variable handler = gen.load(operand(handlerInCallerPc)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
209 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
|
210 CallingConvention outgoingCc = linkage.getOutgoingCallingConvention(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
211 assert outgoingCc.getArgumentCount() == 2; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
212 RegisterValue exceptionFixed = (RegisterValue) outgoingCc.getArgument(0); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
213 RegisterValue exceptionPcFixed = (RegisterValue) outgoingCc.getArgument(1); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
214 gen.emitMove(exceptionFixed, operand(exception)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
215 gen.emitMove(exceptionPcFixed, operand(exceptionPc)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
216 Register thread = getGen().getProviders().getRegisters().getThreadRegister(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
217 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
|
218 thread); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
219 append(op); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
220 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
221 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
222 @Override |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
223 public void visitInfopointNode(InfopointNode 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
|
224 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
|
225 Debug.log("Ignoring InfopointNode for AFTER_BCI"); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
226 } else { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
227 super.visitInfopointNode(i); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
228 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
229 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
230 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
231 public void emitPrefetchAllocate(ValueNode address, ValueNode distance) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
232 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
|
233 append(new AMD64PrefetchOp(addr, getGen().config.allocatePrefetchInstr)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
234 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
235 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
236 @Override |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
237 public void visitDirectCompareAndSwap(DirectCompareAndSwapNode x) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
238 Kind kind = x.newValue().getKind(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
239 assert kind == x.expectedValue().getKind(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
240 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
241 Value expected = gen.loadNonConst(operand(x.expectedValue())); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
242 Variable newVal = gen.load(operand(x.newValue())); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
243 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
244 int disp = 0; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
245 AMD64AddressValue address; |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
246 Value index = operand(x.offset()); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
247 if (ValueUtil.isConstant(index) && NumUtil.isInt(ValueUtil.asConstant(index).asLong() + disp)) { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
248 assert !gen.getCodeCache().needsDataPatch(asConstant(index)); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
249 disp += (int) ValueUtil.asConstant(index).asLong(); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
250 address = new AMD64AddressValue(kind, gen.load(operand(x.object())), disp); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
251 } else { |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
252 address = new AMD64AddressValue(kind, gen.load(operand(x.object())), gen.load(index), Scale.Times1, disp); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
253 } |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
254 |
14854 | 255 RegisterValue raxLocal = AMD64.rax.asValue(kind); |
256 gen.emitMove(raxLocal, expected); | |
15024
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14923
diff
changeset
|
257 append(new CompareAndSwapOp(kind, raxLocal, address, raxLocal, newVal)); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
258 |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
259 Variable result = newVariable(x.getKind()); |
14854 | 260 gen.emitMove(result, raxLocal); |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
261 setResult(x, result); |
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
262 } |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
263 |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
264 boolean canFormCompressedMemory(CompressionNode compress, ConstantLocationNode location) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
265 HotSpotVMConfig config = HotSpotGraalRuntime.runtime().getConfig(); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
266 if (config.useCompressedOops && compress.getEncoding().shift <= 3 && NumUtil.isInt(location.getDisplacement())) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
267 PlatformKind objectKind = compress.getInput().stamp().getPlatformKind(getGen()); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
268 if (objectKind == NarrowOopStamp.NarrowOop || objectKind == Kind.Int && config.narrowKlassBase == config.narrowOopBase) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
269 return true; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
270 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
271 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
272 return false; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
273 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
274 |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
275 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
|
276 assert canFormCompressedMemory(compress, location); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
277 AMD64AddressValue address = getGen().emitAddress(getGen().getProviders().getRegisters().getHeapBaseRegister().asValue(), location.getDisplacement(), operand(compress.getInput()), |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
278 1 << compress.getEncoding().shift); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
279 return address; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
280 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
281 |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
282 @MatchRule("(If (ObjectEquals=compare Constant=value (Pi (Compression Read=access))))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
283 @MatchRule("(If (ObjectEquals=compare Constant=value (Pi (Compression FloatingRead=access))))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
284 @MatchRule("(If (ObjectEquals=compare (Compression value) (Pi (Compression Read=access))))") |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
285 @MatchRule("(If (ObjectEquals=compare (Compression value) (Pi (Compression FloatingRead=access))))") |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
286 @MatchRule("(If (ObjectEquals=compare Constant=value (Compression Read=access)))") |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
287 @MatchRule("(If (ObjectEquals=compare Constant=value (Compression FloatingRead=access)))") |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
288 @MatchRule("(If (ObjectEquals=compare (Compression value) (Compression Read=access)))") |
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
289 @MatchRule("(If (ObjectEquals=compare (Compression value) (Compression FloatingRead=access)))") |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
290 public ComplexMatchResult ifCompareMemoryObject(IfNode root, CompareNode compare, ValueNode value, Access access) { |
15453
100306ae985b
switch MatchRule from class to method annotation and fix review feedback
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15413
diff
changeset
|
291 if (HotSpotGraalRuntime.runtime().getConfig().useCompressedOops) { |
100306ae985b
switch MatchRule from class to method annotation and fix review feedback
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15413
diff
changeset
|
292 return builder -> { |
15522
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
293 emitCompareMemoryObject(root, value, access, compare); |
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 return null; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
298 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
299 |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
300 @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
|
301 @MatchRule("(If (IntegerLessThan=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
|
302 @MatchRule("(If (IntegerBelowThan=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
|
303 @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
|
304 @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
|
305 @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
|
306 @MatchRule("(If (IntegerLessThan=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
|
307 @MatchRule("(If (IntegerBelowThan=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
|
308 @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
|
309 @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
|
310 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
|
311 if (canFormCompressedMemory(compress, location)) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
312 PlatformKind cmpKind = gen.getPlatformKind(compare.x().stamp()); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
313 if (cmpKind instanceof Kind) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
314 Kind kind = (Kind) cmpKind; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
315 return builder -> { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
316 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
|
317 return null; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
318 }; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
319 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
320 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
321 return null; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
322 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
323 |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
324 @MatchRule("(IntegerAdd 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
|
325 @MatchRule("(IntegerSub 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
|
326 @MatchRule("(IntegerMul 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
|
327 @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
|
328 @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
|
329 @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
|
330 @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
|
331 @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
|
332 @MatchRule("(And 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
|
333 @MatchRule("(IntegerAdd 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
|
334 @MatchRule("(IntegerSub 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
|
335 @MatchRule("(IntegerMul 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
|
336 @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
|
337 @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
|
338 @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
|
339 @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
|
340 @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
|
341 @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
|
342 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
|
343 if (canFormCompressedMemory(compress, location)) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
344 AMD64Arithmetic op = getOp(root, access); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
345 if (op != null) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
346 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
|
347 getState(access)); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
348 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
349 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
350 return null; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
351 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
352 |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
353 @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
|
354 @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
|
355 @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
|
356 @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
|
357 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
|
358 if (canFormCompressedMemory(compress, location)) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
359 PlatformKind readKind = getGen().getPlatformKind(root.asNode().stamp()); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
360 return builder -> { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
361 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
|
362 }; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
363 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
364 return null; |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
365 } |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
366 |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
367 @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
|
368 @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
|
369 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
|
370 if (canFormCompressedMemory(compress, location)) { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
371 PlatformKind readKind = getGen().getPlatformKind(value.asNode().stamp()); |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
372 return builder -> { |
589c3627fab8
special cases for addresses involving compressed references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15453
diff
changeset
|
373 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
|
374 return null; |
100306ae985b
switch MatchRule from class to method annotation and fix review feedback
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15413
diff
changeset
|
375 }; |
15370
319deee16746
add support for matching multiple HIR nodes when lowering to LIR
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15333
diff
changeset
|
376 } |
15453
100306ae985b
switch MatchRule from class to method annotation and fix review feedback
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
15413
diff
changeset
|
377 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
|
378 } |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
diff
changeset
|
379 } |