Mercurial > hg > truffle
annotate graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java @ 21080:3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Wed, 22 Apr 2015 16:46:57 +0200 |
parents | f259c81821ef |
children | 9965d71c8971 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
23 package com.oracle.graal.lir.amd64; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5539
diff
changeset
|
25 import static com.oracle.graal.api.code.ValueUtil.*; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
26 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 import static java.lang.Double.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 import static java.lang.Float.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 |
6580
d56d600819fe
moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
30 import com.oracle.graal.amd64.*; |
7882
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
31 import com.oracle.graal.api.code.*; |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5506
diff
changeset
|
32 import com.oracle.graal.api.meta.*; |
6531
4afe23aa0a00
renamed packages: com.oracle.max.asm... -> com.oracle.graal.asm...
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
33 import com.oracle.graal.asm.amd64.*; |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
15024
diff
changeset
|
34 import com.oracle.graal.compiler.common.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
35 import com.oracle.graal.lir.*; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
36 import com.oracle.graal.lir.StandardOp.MoveOp; |
12785
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
37 import com.oracle.graal.lir.StandardOp.NullCheck; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
38 import com.oracle.graal.lir.asm.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
40 public class AMD64Move { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
42 private abstract static class AbstractMoveOp extends AMD64LIRInstruction implements MoveOp { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
43 public static final LIRInstructionClass<AbstractMoveOp> TYPE = LIRInstructionClass.create(AbstractMoveOp.class); |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
44 |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
45 private Kind moveKind; |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
46 |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
47 protected AbstractMoveOp(LIRInstructionClass<? extends AbstractMoveOp> c, Kind moveKind) { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
48 super(c); |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
49 if (moveKind == Kind.Illegal) { |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
50 // unknown operand size, conservatively move the whole register |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
51 this.moveKind = Kind.Long; |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
52 } else { |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
53 this.moveKind = moveKind; |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
54 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
55 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
56 |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
57 @Override |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
58 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
59 move(moveKind, crb, masm, getResult(), getInput()); |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
60 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
61 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
62 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
63 @Opcode("MOVE") |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
64 public static final class MoveToRegOp extends AbstractMoveOp { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
65 public static final LIRInstructionClass<MoveToRegOp> TYPE = LIRInstructionClass.create(MoveToRegOp.class); |
7881 | 66 |
9297
a5f2b9012865
Interval locations can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
9293
diff
changeset
|
67 @Def({REG, HINT}) protected AllocatableValue result; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
68 @Use({REG, STACK, CONST}) protected Value input; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
69 |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
70 public MoveToRegOp(Kind moveKind, AllocatableValue result, Value input) { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
71 super(TYPE, moveKind); |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
72 this.result = result; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
73 this.input = input; |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
74 } |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
75 |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
76 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
77 public Value getInput() { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
78 return input; |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
79 } |
7881 | 80 |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
81 @Override |
9297
a5f2b9012865
Interval locations can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
9293
diff
changeset
|
82 public AllocatableValue getResult() { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
83 return result; |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
84 } |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
85 } |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
86 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
87 @Opcode("MOVE") |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
88 public static final class MoveFromRegOp extends AbstractMoveOp { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
89 public static final LIRInstructionClass<MoveFromRegOp> TYPE = LIRInstructionClass.create(MoveFromRegOp.class); |
7881 | 90 |
9297
a5f2b9012865
Interval locations can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
9293
diff
changeset
|
91 @Def({REG, STACK}) protected AllocatableValue result; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
92 @Use({REG, CONST, HINT}) protected Value input; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
93 |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
94 public MoveFromRegOp(Kind moveKind, AllocatableValue result, Value input) { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
95 super(TYPE, moveKind); |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
96 this.result = result; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
97 this.input = input; |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
98 } |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
99 |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
100 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
101 public Value getInput() { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
102 return input; |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
103 } |
7881 | 104 |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
105 @Override |
9297
a5f2b9012865
Interval locations can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
9293
diff
changeset
|
106 public AllocatableValue getResult() { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
107 return result; |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
108 } |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
109 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
110 |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
111 public static final class LeaOp extends AMD64LIRInstruction { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
112 public static final LIRInstructionClass<LeaOp> TYPE = LIRInstructionClass.create(LeaOp.class); |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
113 |
7908
775745294caa
Change Value to AllocatableValue in move operations.
Roland Schatz <roland.schatz@oracle.com>
parents:
7905
diff
changeset
|
114 @Def({REG}) protected AllocatableValue result; |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
115 @Use({COMPOSITE, UNINITIALIZED}) protected AMD64AddressValue address; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
116 |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
117 public LeaOp(AllocatableValue result, AMD64AddressValue address) { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
118 super(TYPE); |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
119 this.result = result; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
120 this.address = address; |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
121 } |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
122 |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
123 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
124 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
125 masm.leaq(asLongReg(result), address.toAddress()); |
7882
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
126 } |
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
127 } |
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
128 |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
129 public static final class LeaDataOp extends AMD64LIRInstruction { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
130 public static final LIRInstructionClass<LeaDataOp> TYPE = LIRInstructionClass.create(LeaDataOp.class); |
14735
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
131 |
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
132 @Def({REG}) protected AllocatableValue result; |
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
133 private final byte[] data; |
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
134 |
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
135 public LeaDataOp(AllocatableValue result, byte[] data) { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
136 super(TYPE); |
14735
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
137 this.result = result; |
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
138 this.data = data; |
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
139 } |
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
140 |
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
141 @Override |
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
142 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
18176
c2270ad35f57
Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents:
15251
diff
changeset
|
143 masm.leaq(asRegister(result), (AMD64Address) crb.recordDataReferenceInCode(data, 16)); |
14735
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
144 } |
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
145 } |
c5ee41cf9823
replaced RawDataValue with LIRGeneratorTool.emitData(); accept only ASCII strings in log and VM error messages
Doug Simon <doug.simon@oracle.com>
parents:
14730
diff
changeset
|
146 |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
147 public static final class StackLeaOp extends AMD64LIRInstruction { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
148 public static final LIRInstructionClass<StackLeaOp> TYPE = LIRInstructionClass.create(StackLeaOp.class); |
7882
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
149 |
7908
775745294caa
Change Value to AllocatableValue in move operations.
Roland Schatz <roland.schatz@oracle.com>
parents:
7905
diff
changeset
|
150 @Def({REG}) protected AllocatableValue result; |
18425
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18187
diff
changeset
|
151 @Use({STACK, UNINITIALIZED}) protected StackSlotValue slot; |
7882
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
152 |
18425
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18187
diff
changeset
|
153 public StackLeaOp(AllocatableValue result, StackSlotValue slot) { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
154 super(TYPE); |
18436
59e65d3aa2fc
Use StackSlotValue where appropriate.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
155 assert isStackSlotValue(slot) : "Not a stack slot: " + slot; |
7882
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
156 this.result = result; |
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
157 this.slot = slot; |
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
158 } |
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
159 |
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
160 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
161 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
162 masm.leaq(asLongReg(result), (AMD64Address) crb.asAddress(slot)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
163 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
164 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
165 |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
166 public static final class MembarOp extends AMD64LIRInstruction { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
167 public static final LIRInstructionClass<MembarOp> TYPE = LIRInstructionClass.create(MembarOp.class); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
168 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
169 private final int barriers; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
170 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
171 public MembarOp(final int barriers) { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
172 super(TYPE); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
173 this.barriers = barriers; |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
174 } |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
175 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
176 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
177 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
178 masm.membar(barriers); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
179 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
180 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
181 |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
182 public static final class NullCheckOp extends AMD64LIRInstruction implements NullCheck { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
183 public static final LIRInstructionClass<NullCheckOp> TYPE = LIRInstructionClass.create(NullCheckOp.class); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
184 |
21080
3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
19972
diff
changeset
|
185 @Use({COMPOSITE}) protected AMD64AddressValue address; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
186 @State protected LIRFrameState state; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
187 |
21080
3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
19972
diff
changeset
|
188 public NullCheckOp(AMD64AddressValue address, LIRFrameState state) { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
189 super(TYPE); |
21080
3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
19972
diff
changeset
|
190 this.address = address; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
191 this.state = state; |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
192 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
193 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
194 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
195 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
14031
390c4b742890
made com.oracle.graal.asm.Buffer non-public and a private field in AbstractAssembler
twisti
parents:
13931
diff
changeset
|
196 crb.recordImplicitException(masm.position(), state); |
21080
3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
19972
diff
changeset
|
197 masm.nullCheck(address.toAddress()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
198 } |
12785
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
199 |
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
200 public Value getCheckedValue() { |
21080
3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
19972
diff
changeset
|
201 return address.base; |
12785
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
202 } |
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
203 |
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
204 public LIRFrameState getState() { |
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
205 return state; |
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
206 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
207 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
208 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
209 @Opcode("CAS") |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
210 public static final class CompareAndSwapOp extends AMD64LIRInstruction { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
211 public static final LIRInstructionClass<CompareAndSwapOp> TYPE = LIRInstructionClass.create(CompareAndSwapOp.class); |
7881 | 212 |
15024
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
213 private final Kind accessKind; |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
214 |
7908
775745294caa
Change Value to AllocatableValue in move operations.
Roland Schatz <roland.schatz@oracle.com>
parents:
7905
diff
changeset
|
215 @Def protected AllocatableValue result; |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
216 @Use({COMPOSITE}) protected AMD64AddressValue address; |
7908
775745294caa
Change Value to AllocatableValue in move operations.
Roland Schatz <roland.schatz@oracle.com>
parents:
7905
diff
changeset
|
217 @Use protected AllocatableValue cmpValue; |
775745294caa
Change Value to AllocatableValue in move operations.
Roland Schatz <roland.schatz@oracle.com>
parents:
7905
diff
changeset
|
218 @Use protected AllocatableValue newValue; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
219 |
15024
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
220 public CompareAndSwapOp(Kind accessKind, AllocatableValue result, AMD64AddressValue address, AllocatableValue cmpValue, AllocatableValue newValue) { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
221 super(TYPE); |
15024
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
222 this.accessKind = accessKind; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
223 this.result = result; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
224 this.address = address; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
225 this.cmpValue = cmpValue; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
226 this.newValue = newValue; |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
227 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
228 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
229 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
230 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
15024
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
231 assert asRegister(cmpValue).equals(AMD64.rax) && asRegister(result).equals(AMD64.rax); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
232 |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
233 if (crb.target.isMP) { |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
234 masm.lock(); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
235 } |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
236 switch (accessKind) { |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
237 case Int: |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
238 masm.cmpxchgl(asRegister(newValue), address.toAddress()); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
239 break; |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
240 case Long: |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
241 case Object: |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
242 masm.cmpxchgq(asRegister(newValue), address.toAddress()); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
243 break; |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
244 default: |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
245 throw GraalInternalError.shouldNotReachHere(); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
246 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
247 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
248 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
249 |
15251 | 250 @Opcode("ATOMIC_READ_AND_ADD") |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
251 public static final class AtomicReadAndAddOp extends AMD64LIRInstruction { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
252 public static final LIRInstructionClass<AtomicReadAndAddOp> TYPE = LIRInstructionClass.create(AtomicReadAndAddOp.class); |
15251 | 253 |
254 private final Kind accessKind; | |
255 | |
256 @Def protected AllocatableValue result; | |
257 @Alive({COMPOSITE}) protected AMD64AddressValue address; | |
258 @Use protected AllocatableValue delta; | |
259 | |
260 public AtomicReadAndAddOp(Kind accessKind, AllocatableValue result, AMD64AddressValue address, AllocatableValue delta) { | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
261 super(TYPE); |
15251 | 262 this.accessKind = accessKind; |
263 this.result = result; | |
264 this.address = address; | |
265 this.delta = delta; | |
266 } | |
267 | |
268 @Override | |
269 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { | |
270 move(accessKind, crb, masm, result, delta); | |
271 if (crb.target.isMP) { | |
272 masm.lock(); | |
273 } | |
274 switch (accessKind) { | |
275 case Int: | |
276 masm.xaddl(address.toAddress(), asRegister(result)); | |
277 break; | |
278 case Long: | |
279 masm.xaddq(address.toAddress(), asRegister(result)); | |
280 break; | |
281 default: | |
282 throw GraalInternalError.shouldNotReachHere(); | |
283 } | |
284 } | |
285 } | |
286 | |
287 @Opcode("ATOMIC_READ_AND_WRITE") | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
288 public static final class AtomicReadAndWriteOp extends AMD64LIRInstruction { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
289 public static final LIRInstructionClass<AtomicReadAndWriteOp> TYPE = LIRInstructionClass.create(AtomicReadAndWriteOp.class); |
15251 | 290 |
291 private final Kind accessKind; | |
292 | |
293 @Def protected AllocatableValue result; | |
294 @Alive({COMPOSITE}) protected AMD64AddressValue address; | |
295 @Use protected AllocatableValue newValue; | |
296 | |
297 public AtomicReadAndWriteOp(Kind accessKind, AllocatableValue result, AMD64AddressValue address, AllocatableValue newValue) { | |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
298 super(TYPE); |
15251 | 299 this.accessKind = accessKind; |
300 this.result = result; | |
301 this.address = address; | |
302 this.newValue = newValue; | |
303 } | |
304 | |
305 @Override | |
306 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { | |
307 move(accessKind, crb, masm, result, newValue); | |
308 switch (accessKind) { | |
309 case Int: | |
310 masm.xchgl(asRegister(result), address.toAddress()); | |
311 break; | |
312 case Long: | |
313 case Object: | |
314 masm.xchgq(asRegister(result), address.toAddress()); | |
315 break; | |
316 default: | |
317 throw GraalInternalError.shouldNotReachHere(); | |
318 } | |
319 } | |
320 } | |
321 | |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
322 public static void move(CompilationResultBuilder crb, AMD64MacroAssembler masm, Value result, Value input) { |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
323 move(result.getKind(), crb, masm, result, input); |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
324 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
325 |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
326 public static void move(Kind moveKind, CompilationResultBuilder crb, AMD64MacroAssembler masm, Value result, Value input) { |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
327 if (isRegister(input)) { |
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
328 if (isRegister(result)) { |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
329 reg2reg(moveKind, masm, result, input); |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
330 } else if (isStackSlot(result)) { |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
331 reg2stack(moveKind, crb, masm, result, input); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
332 } else { |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
333 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
334 } |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
335 } else if (isStackSlot(input)) { |
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
336 if (isRegister(result)) { |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
337 stack2reg(moveKind, crb, masm, result, input); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
338 } else { |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
339 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
340 } |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
341 } else if (isConstant(input)) { |
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
342 if (isRegister(result)) { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
343 const2reg(crb, masm, result, (JavaConstant) input); |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
344 } else if (isStackSlot(result)) { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
345 const2stack(crb, masm, result, (JavaConstant) input); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
346 } else { |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
347 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
348 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
349 } else { |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
350 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
351 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
352 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
353 |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
354 private static void reg2reg(Kind kind, AMD64MacroAssembler masm, Value result, Value input) { |
6474
f2624e472426
ignore kinds when checking for redundant register to register move
Doug Simon <doug.simon@oracle.com>
parents:
6329
diff
changeset
|
355 if (asRegister(input).equals(asRegister(result))) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
356 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
357 } |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
358 switch (kind.getStackKind()) { |
7881 | 359 case Int: |
360 masm.movl(asRegister(result), asRegister(input)); | |
361 break; | |
362 case Long: | |
363 masm.movq(asRegister(result), asRegister(input)); | |
364 break; | |
365 case Float: | |
366 masm.movflt(asFloatReg(result), asFloatReg(input)); | |
367 break; | |
368 case Double: | |
369 masm.movdbl(asDoubleReg(result), asDoubleReg(input)); | |
370 break; | |
371 case Object: | |
372 masm.movq(asRegister(result), asRegister(input)); | |
373 break; | |
374 default: | |
375 throw GraalInternalError.shouldNotReachHere("kind=" + result.getKind()); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
376 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
377 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
378 |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
379 private static void reg2stack(Kind kind, CompilationResultBuilder crb, AMD64MacroAssembler masm, Value result, Value input) { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
380 AMD64Address dest = (AMD64Address) crb.asAddress(result); |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
381 switch (kind) { |
14944
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
382 case Boolean: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
383 case Byte: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
384 masm.movb(dest, asRegister(input)); |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
385 break; |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
386 case Short: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
387 case Char: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
388 masm.movw(dest, asRegister(input)); |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
389 break; |
7881 | 390 case Int: |
391 masm.movl(dest, asRegister(input)); | |
392 break; | |
393 case Long: | |
394 masm.movq(dest, asRegister(input)); | |
395 break; | |
396 case Float: | |
397 masm.movflt(dest, asFloatReg(input)); | |
398 break; | |
399 case Double: | |
400 masm.movsd(dest, asDoubleReg(input)); | |
401 break; | |
402 case Object: | |
403 masm.movq(dest, asRegister(input)); | |
404 break; | |
405 default: | |
406 throw GraalInternalError.shouldNotReachHere(); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
407 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
408 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
409 |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
410 private static void stack2reg(Kind kind, CompilationResultBuilder crb, AMD64MacroAssembler masm, Value result, Value input) { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
411 AMD64Address src = (AMD64Address) crb.asAddress(input); |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
412 switch (kind) { |
14944
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
413 case Boolean: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
414 masm.movzbl(asRegister(result), src); |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
415 break; |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
416 case Byte: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
417 masm.movsbl(asRegister(result), src); |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
418 break; |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
419 case Short: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
420 masm.movswl(asRegister(result), src); |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
421 break; |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
422 case Char: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
423 masm.movzwl(asRegister(result), src); |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
424 break; |
7881 | 425 case Int: |
426 masm.movl(asRegister(result), src); | |
427 break; | |
428 case Long: | |
429 masm.movq(asRegister(result), src); | |
430 break; | |
431 case Float: | |
432 masm.movflt(asFloatReg(result), src); | |
433 break; | |
434 case Double: | |
435 masm.movdbl(asDoubleReg(result), src); | |
436 break; | |
437 case Object: | |
438 masm.movq(asRegister(result), src); | |
439 break; | |
440 default: | |
441 throw GraalInternalError.shouldNotReachHere(); | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
442 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
443 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
444 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
445 private static void const2reg(CompilationResultBuilder crb, AMD64MacroAssembler masm, Value result, JavaConstant input) { |
7881 | 446 /* |
447 * Note: we use the kind of the input operand (and not the kind of the result operand) | |
448 * because they don't match in all cases. For example, an object constant can be loaded to a | |
449 * long register when unsafe casts occurred (e.g., for a write barrier where arithmetic | |
450 * operations are then performed on the pointer). | |
451 */ | |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6531
diff
changeset
|
452 switch (input.getKind().getStackKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
453 case Int: |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
454 if (crb.codeCache.needsDataPatch(input)) { |
13576
4e679d50ba9a
Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents:
13520
diff
changeset
|
455 crb.recordInlineDataInCode(input); |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6580
diff
changeset
|
456 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
457 // Do not optimize with an XOR as this instruction may be between |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
458 // a CMP and a Jcc in which case the XOR will modify the condition |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
459 // flags and interfere with the Jcc. |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6580
diff
changeset
|
460 masm.movl(asRegister(result), input.asInt()); |
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6580
diff
changeset
|
461 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
462 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
463 case Long: |
13520
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
464 boolean patch = false; |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
465 if (crb.codeCache.needsDataPatch(input)) { |
13520
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
466 patch = true; |
13576
4e679d50ba9a
Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents:
13520
diff
changeset
|
467 crb.recordInlineDataInCode(input); |
6996
eec373d34caf
added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents:
6580
diff
changeset
|
468 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
469 // Do not optimize with an XOR as this instruction may be between |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
470 // a CMP and a Jcc in which case the XOR will modify the condition |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
471 // flags and interfere with the Jcc. |
13520
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
472 if (patch) { |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
473 masm.movq(asRegister(result), input.asLong()); |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
474 } else { |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
475 if (input.asLong() == (int) input.asLong()) { |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
476 // Sign extended to long |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
477 masm.movslq(asRegister(result), (int) input.asLong()); |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
478 } else if ((input.asLong() & 0xFFFFFFFFL) == input.asLong()) { |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
479 // Zero extended to long |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
480 masm.movl(asRegister(result), (int) input.asLong()); |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
481 } else { |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
482 masm.movq(asRegister(result), input.asLong()); |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
483 } |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
484 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
485 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
486 case Float: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
487 // This is *not* the same as 'constant == 0.0f' in the case where constant is -0.0f |
4581
8f985001dc27
Use kind of input operand (instead of result operand) to determine the type of moves, because an Object constant can be loaded to a Long register for unsafe operation.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4525
diff
changeset
|
488 if (Float.floatToRawIntBits(input.asFloat()) == Float.floatToRawIntBits(0.0f)) { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
489 assert !crb.codeCache.needsDataPatch(input); |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
490 masm.xorps(asFloatReg(result), asFloatReg(result)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
491 } else { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
492 masm.movflt(asFloatReg(result), (AMD64Address) crb.asFloatConstRef(input)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
493 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
494 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
495 case Double: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
496 // This is *not* the same as 'constant == 0.0d' in the case where constant is -0.0d |
4581
8f985001dc27
Use kind of input operand (instead of result operand) to determine the type of moves, because an Object constant can be loaded to a Long register for unsafe operation.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4525
diff
changeset
|
497 if (Double.doubleToRawLongBits(input.asDouble()) == Double.doubleToRawLongBits(0.0d)) { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
498 assert !crb.codeCache.needsDataPatch(input); |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
499 masm.xorpd(asDoubleReg(result), asDoubleReg(result)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
500 } else { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
501 masm.movdbl(asDoubleReg(result), (AMD64Address) crb.asDoubleConstRef(input)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
502 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
503 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
504 case Object: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
505 // Do not optimize with an XOR as this instruction may be between |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
506 // a CMP and a Jcc in which case the XOR will modify the condition |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
507 // flags and interfere with the Jcc. |
4581
8f985001dc27
Use kind of input operand (instead of result operand) to determine the type of moves, because an Object constant can be loaded to a Long register for unsafe operation.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4525
diff
changeset
|
508 if (input.isNull()) { |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
509 masm.movq(asRegister(result), 0x0L); |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
510 } else if (crb.target.inlineObjects) { |
13576
4e679d50ba9a
Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents:
13520
diff
changeset
|
511 crb.recordInlineDataInCode(input); |
4183
9e0c1b4cfef5
Move all isXxx and asXxx out of CiValue and into their own util class.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4181
diff
changeset
|
512 masm.movq(asRegister(result), 0xDEADDEADDEADDEADL); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
513 } else { |
13576
4e679d50ba9a
Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents:
13520
diff
changeset
|
514 masm.movq(asRegister(result), (AMD64Address) crb.recordDataReferenceInCode(input, 0)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
515 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
516 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
517 default: |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
518 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
519 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
520 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
521 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
522 private static void const2stack(CompilationResultBuilder crb, AMD64MacroAssembler masm, Value result, JavaConstant input) { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
523 assert !crb.codeCache.needsDataPatch(input); |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13111
diff
changeset
|
524 AMD64Address dest = (AMD64Address) crb.asAddress(result); |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
6531
diff
changeset
|
525 switch (input.getKind().getStackKind()) { |
7881 | 526 case Int: |
527 masm.movl(dest, input.asInt()); | |
528 break; | |
529 case Long: | |
530 masm.movlong(dest, input.asLong()); | |
531 break; | |
532 case Float: | |
533 masm.movl(dest, floatToRawIntBits(input.asFloat())); | |
534 break; | |
535 case Double: | |
536 masm.movlong(dest, doubleToRawLongBits(input.asDouble())); | |
537 break; | |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
538 case Object: |
4581
8f985001dc27
Use kind of input operand (instead of result operand) to determine the type of moves, because an Object constant can be loaded to a Long register for unsafe operation.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4525
diff
changeset
|
539 if (input.isNull()) { |
7839
838293a77af7
Make Address class platform specific.
Roland Schatz <roland.schatz@oracle.com>
parents:
7827
diff
changeset
|
540 masm.movlong(dest, 0L); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
541 } else { |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
542 throw GraalInternalError.shouldNotReachHere("Non-null object constants must be in register"); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
543 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
544 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
545 default: |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4323
diff
changeset
|
546 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
547 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
548 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
549 } |