Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java @ 22510:d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Wed, 26 Aug 2015 13:27:03 +0200 |
parents | aff4dce0b9f6 |
children | 3285aa5a60f8 |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
19529
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 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
25 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
|
26 import static java.lang.Double.*; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 import static java.lang.Float.*; |
22054 | 28 import static jdk.internal.jvmci.code.ValueUtil.*; |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
29 import jdk.internal.jvmci.amd64.*; |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
30 import jdk.internal.jvmci.code.*; |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
31 import jdk.internal.jvmci.common.*; |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
32 import jdk.internal.jvmci.meta.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 |
21720
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21708
diff
changeset
|
34 import com.oracle.graal.asm.*; |
d915361cc3a1
moved asm, bytecode and asm.test code back to com.oracle.graal name space (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21708
diff
changeset
|
35 import com.oracle.graal.asm.amd64.*; |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
36 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MIOp; |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
37 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MOp; |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
38 import com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
39 import com.oracle.graal.lir.*; |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
40 import com.oracle.graal.lir.StandardOp.LoadConstantOp; |
12785
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
41 import com.oracle.graal.lir.StandardOp.NullCheck; |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
42 import com.oracle.graal.lir.StandardOp.ValueMoveOp; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
43 import com.oracle.graal.lir.asm.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
45 public class AMD64Move { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
47 private abstract static class AbstractMoveOp extends AMD64LIRInstruction implements ValueMoveOp { |
19529
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 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
|
49 |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
50 private Kind moveKind; |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
51 |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
52 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
|
53 super(c); |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
54 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
|
55 // 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
|
56 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
|
57 } else { |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
58 this.moveKind = moveKind; |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
59 } |
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 @Override |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
63 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
|
64 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
|
65 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
66 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
67 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
68 @Opcode("MOVE") |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
69 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
|
70 public static final LIRInstructionClass<MoveToRegOp> TYPE = LIRInstructionClass.create(MoveToRegOp.class); |
7881 | 71 |
9297
a5f2b9012865
Interval locations can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
9293
diff
changeset
|
72 @Def({REG, HINT}) protected AllocatableValue result; |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
73 @Use({REG, STACK}) protected AllocatableValue input; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
74 |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
75 public MoveToRegOp(Kind moveKind, AllocatableValue result, AllocatableValue input) { |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
76 super(TYPE, moveKind); |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
77 this.result = result; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
78 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
|
79 } |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
80 |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
81 @Override |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
82 public AllocatableValue getInput() { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
83 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
|
84 } |
7881 | 85 |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
86 @Override |
9297
a5f2b9012865
Interval locations can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
9293
diff
changeset
|
87 public AllocatableValue getResult() { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
88 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
|
89 } |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
90 } |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
91 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
92 @Opcode("MOVE") |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
93 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
|
94 public static final LIRInstructionClass<MoveFromRegOp> TYPE = LIRInstructionClass.create(MoveFromRegOp.class); |
7881 | 95 |
9297
a5f2b9012865
Interval locations can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
9293
diff
changeset
|
96 @Def({REG, STACK}) protected AllocatableValue result; |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
97 @Use({REG, HINT}) protected AllocatableValue input; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
98 |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
99 public MoveFromRegOp(Kind moveKind, AllocatableValue result, AllocatableValue input) { |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
100 super(TYPE, moveKind); |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
101 this.result = result; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
102 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
|
103 } |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
104 |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
105 @Override |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
106 public AllocatableValue getInput() { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
107 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
|
108 } |
7881 | 109 |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
110 @Override |
9297
a5f2b9012865
Interval locations can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
9293
diff
changeset
|
111 public AllocatableValue getResult() { |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
112 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
|
113 } |
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
114 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
115 |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
116 @Opcode("MOVE") |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
117 public static class MoveFromConstOp extends AMD64LIRInstruction implements LoadConstantOp { |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
118 public static final LIRInstructionClass<MoveFromConstOp> TYPE = LIRInstructionClass.create(MoveFromConstOp.class); |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
119 |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
120 @Def({REG, STACK}) protected AllocatableValue result; |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
121 private final JavaConstant input; |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
122 |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
123 public MoveFromConstOp(AllocatableValue result, JavaConstant input) { |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
124 super(TYPE); |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
125 this.result = result; |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
126 this.input = input; |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
127 } |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
128 |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
129 @Override |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
130 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
131 if (isRegister(result)) { |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
132 const2reg(crb, masm, result, input); |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
133 } else { |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
134 assert isStackSlot(result); |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
135 const2stack(crb, masm, result, input); |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
136 } |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
137 } |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
138 |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
139 public Constant getConstant() { |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
140 return input; |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
141 } |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
142 |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
143 public AllocatableValue getResult() { |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
144 return result; |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
145 } |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
146 } |
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
147 |
21200 | 148 @Opcode("STACKMOVE") |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
149 public static final class AMD64StackMove extends AMD64LIRInstruction implements ValueMoveOp { |
21200 | 150 public static final LIRInstructionClass<AMD64StackMove> TYPE = LIRInstructionClass.create(AMD64StackMove.class); |
151 | |
152 @Def({STACK}) protected AllocatableValue result; | |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
153 @Use({STACK, HINT}) protected AllocatableValue input; |
21200 | 154 @Alive({OperandFlag.STACK, OperandFlag.UNINITIALIZED}) private StackSlotValue backupSlot; |
155 | |
156 private Register scratch; | |
157 | |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
158 public AMD64StackMove(AllocatableValue result, AllocatableValue input, Register scratch, StackSlotValue backupSlot) { |
21200 | 159 super(TYPE); |
160 this.result = result; | |
161 this.input = input; | |
162 this.backupSlot = backupSlot; | |
163 this.scratch = scratch; | |
164 } | |
165 | |
166 @Override | |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
167 public AllocatableValue getInput() { |
21200 | 168 return input; |
169 } | |
170 | |
171 @Override | |
172 public AllocatableValue getResult() { | |
173 return result; | |
174 } | |
175 | |
22045
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
176 public Register getScratchRegister() { |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
177 return scratch; |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
178 } |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
179 |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
180 public StackSlotValue getBackupSlot() { |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
181 return backupSlot; |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
182 } |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
183 |
21200 | 184 @Override |
185 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { | |
186 // backup scratch register | |
187 move(backupSlot.getKind(), crb, masm, backupSlot, scratch.asValue(backupSlot.getLIRKind())); | |
188 // move stack slot | |
189 move(getInput().getKind(), crb, masm, scratch.asValue(getInput().getLIRKind()), getInput()); | |
190 move(getResult().getKind(), crb, masm, getResult(), scratch.asValue(getResult().getLIRKind())); | |
191 // restore scratch register | |
192 move(backupSlot.getKind(), crb, masm, scratch.asValue(backupSlot.getLIRKind()), backupSlot); | |
193 | |
194 } | |
195 } | |
196 | |
22045
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
197 @Opcode("MULTISTACKMOVE") |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
198 public static final class AMD64MultiStackMove extends AMD64LIRInstruction { |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
199 public static final LIRInstructionClass<AMD64MultiStackMove> TYPE = LIRInstructionClass.create(AMD64MultiStackMove.class); |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
200 |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
201 @Def({STACK}) protected AllocatableValue[] results; |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
202 @Use({STACK}) protected Value[] inputs; |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
203 @Alive({OperandFlag.STACK, OperandFlag.UNINITIALIZED}) private StackSlotValue backupSlot; |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
204 |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
205 private Register scratch; |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
206 |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
207 public AMD64MultiStackMove(AllocatableValue[] results, Value[] inputs, Register scratch, StackSlotValue backupSlot) { |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
208 super(TYPE); |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
209 this.results = results; |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
210 this.inputs = inputs; |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
211 this.backupSlot = backupSlot; |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
212 this.scratch = scratch; |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
213 } |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
214 |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
215 @Override |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
216 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
217 // backup scratch register |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
218 move(backupSlot.getKind(), crb, masm, backupSlot, scratch.asValue(backupSlot.getLIRKind())); |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
219 for (int i = 0; i < results.length; i++) { |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
220 Value input = inputs[i]; |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
221 AllocatableValue result = results[i]; |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
222 // move stack slot |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
223 move(input.getKind(), crb, masm, scratch.asValue(input.getLIRKind()), input); |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
224 move(result.getKind(), crb, masm, result, scratch.asValue(result.getLIRKind())); |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
225 } |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
226 // restore scratch register |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
227 move(backupSlot.getKind(), crb, masm, scratch.asValue(backupSlot.getLIRKind()), backupSlot); |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
228 |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
229 } |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
230 } |
e38161633db6
AMD64Move: add AMD64MultiStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
22006
diff
changeset
|
231 |
22006
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
232 @Opcode("STACKMOVE") |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
233 public static final class AMD64PushPopStackMove extends AMD64LIRInstruction implements ValueMoveOp { |
22006
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
234 public static final LIRInstructionClass<AMD64PushPopStackMove> TYPE = LIRInstructionClass.create(AMD64PushPopStackMove.class); |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
235 |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
236 @Def({STACK}) protected AllocatableValue result; |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
237 @Use({STACK, HINT}) protected AllocatableValue input; |
22006
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
238 private final OperandSize size; |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
239 |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
240 public AMD64PushPopStackMove(OperandSize size, AllocatableValue result, AllocatableValue input) { |
22006
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
241 super(TYPE); |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
242 this.result = result; |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
243 this.input = input; |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
244 this.size = size; |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
245 } |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
246 |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
247 @Override |
22510
d3d19b31e9a4
Split MoveOp into ValueMoveOp and LoadConstantOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
22207
diff
changeset
|
248 public AllocatableValue getInput() { |
22006
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
249 return input; |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
250 } |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
251 |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
252 @Override |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
253 public AllocatableValue getResult() { |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
254 return result; |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
255 } |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
256 |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
257 @Override |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
258 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
259 AMD64MOp.PUSH.emit(masm, size, (AMD64Address) crb.asAddress(input)); |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
260 AMD64MOp.POP.emit(masm, size, (AMD64Address) crb.asAddress(result)); |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
261 } |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
262 } |
985f49785f06
AMD64Move: add AMD64PushPopStackMove.
Josef Eisl <josef.eisl@jku.at>
parents:
21720
diff
changeset
|
263 |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
264 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
|
265 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
|
266 |
7908
775745294caa
Change Value to AllocatableValue in move operations.
Roland Schatz <roland.schatz@oracle.com>
parents:
7905
diff
changeset
|
267 @Def({REG}) protected AllocatableValue result; |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
268 @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
|
269 |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
270 public LeaOp(AllocatableValue result, AMD64AddressValue address) { |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
271 super(TYPE); |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
272 this.result = result; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
273 this.address = address; |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
274 } |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
275 |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
276 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
277 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
278 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
|
279 } |
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
280 } |
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
281 |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
282 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
|
283 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
|
284 |
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
|
285 @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
|
286 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
|
287 |
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
|
288 public LeaDataOp(AllocatableValue result, byte[] data) { |
19529
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 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
|
290 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
|
291 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
|
292 } |
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
|
293 |
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
|
294 @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
|
295 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
|
296 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
|
297 } |
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
|
298 } |
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
|
299 |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
300 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
|
301 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
|
302 |
7908
775745294caa
Change Value to AllocatableValue in move operations.
Roland Schatz <roland.schatz@oracle.com>
parents:
7905
diff
changeset
|
303 @Def({REG}) protected AllocatableValue result; |
18425
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18187
diff
changeset
|
304 @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
|
305 |
18425
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18187
diff
changeset
|
306 public StackLeaOp(AllocatableValue result, StackSlotValue slot) { |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
307 super(TYPE); |
18436
59e65d3aa2fc
Use StackSlotValue where appropriate.
Josef Eisl <josef.eisl@jku.at>
parents:
18425
diff
changeset
|
308 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
|
309 this.result = result; |
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
310 this.slot = slot; |
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
311 } |
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
312 |
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7881
diff
changeset
|
313 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
314 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
315 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
|
316 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
317 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
318 |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
319 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
|
320 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
|
321 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
322 private final int barriers; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
323 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
324 public MembarOp(final int barriers) { |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
325 super(TYPE); |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
326 this.barriers = barriers; |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
327 } |
4245
75c620f90ab9
Support stack-operands and register hints in new register allocator API
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4231
diff
changeset
|
328 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
329 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
330 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
|
331 masm.membar(barriers); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
332 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
333 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
334 |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
335 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
|
336 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
|
337 |
21080
3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
19972
diff
changeset
|
338 @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
|
339 @State protected LIRFrameState state; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
340 |
21080
3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
19972
diff
changeset
|
341 public NullCheckOp(AMD64AddressValue address, LIRFrameState state) { |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
342 super(TYPE); |
21080
3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
19972
diff
changeset
|
343 this.address = address; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
344 this.state = state; |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
345 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
346 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
347 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
348 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
|
349 crb.recordImplicitException(masm.position(), state); |
21080
3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
19972
diff
changeset
|
350 masm.nullCheck(address.toAddress()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
351 } |
12785
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
352 |
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
353 public Value getCheckedValue() { |
21080
3253fe1bed41
Remove CompressedNullCheckOp, merge functionality into regular NullCheckOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
19972
diff
changeset
|
354 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
|
355 } |
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
356 |
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
357 public LIRFrameState getState() { |
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
358 return state; |
c13633a4d472
peephole optimization to remove null checks at the LIR level
Lukas Stadler <lukas.stadler@jku.at>
parents:
12766
diff
changeset
|
359 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
360 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
361 |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
362 @Opcode("CAS") |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
363 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
|
364 public static final LIRInstructionClass<CompareAndSwapOp> TYPE = LIRInstructionClass.create(CompareAndSwapOp.class); |
7881 | 365 |
15024
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
366 private final Kind accessKind; |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
367 |
7908
775745294caa
Change Value to AllocatableValue in move operations.
Roland Schatz <roland.schatz@oracle.com>
parents:
7905
diff
changeset
|
368 @Def protected AllocatableValue result; |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
369 @Use({COMPOSITE}) protected AMD64AddressValue address; |
7908
775745294caa
Change Value to AllocatableValue in move operations.
Roland Schatz <roland.schatz@oracle.com>
parents:
7905
diff
changeset
|
370 @Use protected AllocatableValue cmpValue; |
775745294caa
Change Value to AllocatableValue in move operations.
Roland Schatz <roland.schatz@oracle.com>
parents:
7905
diff
changeset
|
371 @Use protected AllocatableValue newValue; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
372 |
15024
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
373 public CompareAndSwapOp(Kind accessKind, AllocatableValue result, AMD64AddressValue address, AllocatableValue cmpValue, AllocatableValue newValue) { |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
374 super(TYPE); |
15024
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
375 this.accessKind = accessKind; |
5733
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
376 this.result = result; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
377 this.address = address; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
378 this.cmpValue = cmpValue; |
141b15521a39
use annotated fields for operands of LIR instructions
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5547
diff
changeset
|
379 this.newValue = newValue; |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
380 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
381 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
382 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
383 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
|
384 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
|
385 |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
386 if (crb.target.isMP) { |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
387 masm.lock(); |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
388 } |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
389 switch (accessKind) { |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
390 case Int: |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
391 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
|
392 break; |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
393 case Long: |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
394 case Object: |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
395 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
|
396 break; |
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
397 default: |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
398 throw JVMCIError.shouldNotReachHere(); |
15024
2ee777221036
Use high level CompressionNode in lowering of CompareAndSwapNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
14991
diff
changeset
|
399 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
400 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
401 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
402 |
15251 | 403 @Opcode("ATOMIC_READ_AND_ADD") |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
404 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
|
405 public static final LIRInstructionClass<AtomicReadAndAddOp> TYPE = LIRInstructionClass.create(AtomicReadAndAddOp.class); |
15251 | 406 |
407 private final Kind accessKind; | |
408 | |
409 @Def protected AllocatableValue result; | |
410 @Alive({COMPOSITE}) protected AMD64AddressValue address; | |
411 @Use protected AllocatableValue delta; | |
412 | |
413 public AtomicReadAndAddOp(Kind accessKind, AllocatableValue result, AMD64AddressValue address, AllocatableValue delta) { | |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
414 super(TYPE); |
15251 | 415 this.accessKind = accessKind; |
416 this.result = result; | |
417 this.address = address; | |
418 this.delta = delta; | |
419 } | |
420 | |
421 @Override | |
422 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { | |
423 move(accessKind, crb, masm, result, delta); | |
424 if (crb.target.isMP) { | |
425 masm.lock(); | |
426 } | |
427 switch (accessKind) { | |
428 case Int: | |
429 masm.xaddl(address.toAddress(), asRegister(result)); | |
430 break; | |
431 case Long: | |
432 masm.xaddq(address.toAddress(), asRegister(result)); | |
433 break; | |
434 default: | |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
435 throw JVMCIError.shouldNotReachHere(); |
15251 | 436 } |
437 } | |
438 } | |
439 | |
440 @Opcode("ATOMIC_READ_AND_WRITE") | |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
441 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
|
442 public static final LIRInstructionClass<AtomicReadAndWriteOp> TYPE = LIRInstructionClass.create(AtomicReadAndWriteOp.class); |
15251 | 443 |
444 private final Kind accessKind; | |
445 | |
446 @Def protected AllocatableValue result; | |
447 @Alive({COMPOSITE}) protected AMD64AddressValue address; | |
448 @Use protected AllocatableValue newValue; | |
449 | |
450 public AtomicReadAndWriteOp(Kind accessKind, AllocatableValue result, AMD64AddressValue address, AllocatableValue newValue) { | |
19529
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18436
diff
changeset
|
451 super(TYPE); |
15251 | 452 this.accessKind = accessKind; |
453 this.result = result; | |
454 this.address = address; | |
455 this.newValue = newValue; | |
456 } | |
457 | |
458 @Override | |
459 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { | |
460 move(accessKind, crb, masm, result, newValue); | |
461 switch (accessKind) { | |
462 case Int: | |
463 masm.xchgl(asRegister(result), address.toAddress()); | |
464 break; | |
465 case Long: | |
466 case Object: | |
467 masm.xchgq(asRegister(result), address.toAddress()); | |
468 break; | |
469 default: | |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
470 throw JVMCIError.shouldNotReachHere(); |
15251 | 471 } |
472 } | |
473 } | |
474 | |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
475 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
|
476 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
|
477 } |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
478 |
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
479 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
|
480 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
|
481 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
|
482 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
|
483 } 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
|
484 reg2stack(moveKind, crb, masm, result, input); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
485 } else { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
486 throw JVMCIError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
487 } |
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
|
488 } 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
|
489 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
|
490 stack2reg(moveKind, crb, masm, result, input); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
491 } else { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
492 throw JVMCIError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
493 } |
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
|
494 } 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
|
495 if (isRegister(result)) { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
496 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
|
497 } else if (isStackSlot(result)) { |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
498 const2stack(crb, masm, result, (JavaConstant) input); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
499 } else { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
500 throw JVMCIError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
501 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
502 } else { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
503 throw JVMCIError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
504 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
505 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
506 |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
507 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
|
508 if (asRegister(input).equals(asRegister(result))) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
509 return; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
510 } |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
511 switch (kind.getStackKind()) { |
7881 | 512 case Int: |
513 masm.movl(asRegister(result), asRegister(input)); | |
514 break; | |
515 case Long: | |
516 masm.movq(asRegister(result), asRegister(input)); | |
517 break; | |
518 case Float: | |
519 masm.movflt(asFloatReg(result), asFloatReg(input)); | |
520 break; | |
521 case Double: | |
522 masm.movdbl(asDoubleReg(result), asDoubleReg(input)); | |
523 break; | |
524 case Object: | |
525 masm.movq(asRegister(result), asRegister(input)); | |
526 break; | |
527 default: | |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
528 throw JVMCIError.shouldNotReachHere("kind=" + result.getKind()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
529 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
530 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
531 |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
532 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:
13113
diff
changeset
|
533 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
|
534 switch (kind) { |
14944
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
535 case Boolean: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
536 case Byte: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
537 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
|
538 break; |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
539 case Short: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
540 case Char: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
541 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
|
542 break; |
7881 | 543 case Int: |
544 masm.movl(dest, asRegister(input)); | |
545 break; | |
546 case Long: | |
547 masm.movq(dest, asRegister(input)); | |
548 break; | |
549 case Float: | |
550 masm.movflt(dest, asFloatReg(input)); | |
551 break; | |
552 case Double: | |
553 masm.movsd(dest, asDoubleReg(input)); | |
554 break; | |
555 case Object: | |
556 masm.movq(dest, asRegister(input)); | |
557 break; | |
558 default: | |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
559 throw JVMCIError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
560 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
561 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
562 |
14945
b14cb2d9253d
Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents:
14944
diff
changeset
|
563 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:
13113
diff
changeset
|
564 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
|
565 switch (kind) { |
14944
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
566 case Boolean: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
567 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
|
568 break; |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
569 case Byte: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
570 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
|
571 break; |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
572 case Short: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
573 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
|
574 break; |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
575 case Char: |
96f8e6b6a81a
Support for spill moves of values smaller than int.
Roland Schatz <roland.schatz@oracle.com>
parents:
14747
diff
changeset
|
576 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
|
577 break; |
7881 | 578 case Int: |
579 masm.movl(asRegister(result), src); | |
580 break; | |
581 case Long: | |
582 masm.movq(asRegister(result), src); | |
583 break; | |
584 case Float: | |
585 masm.movflt(asFloatReg(result), src); | |
586 break; | |
587 case Double: | |
588 masm.movdbl(asDoubleReg(result), src); | |
589 break; | |
590 case Object: | |
591 masm.movq(asRegister(result), src); | |
592 break; | |
593 default: | |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
594 throw JVMCIError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
595 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
596 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
597 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
598 private static void const2reg(CompilationResultBuilder crb, AMD64MacroAssembler masm, Value result, JavaConstant input) { |
7881 | 599 /* |
600 * Note: we use the kind of the input operand (and not the kind of the result operand) | |
601 * because they don't match in all cases. For example, an object constant can be loaded to a | |
602 * long register when unsafe casts occurred (e.g., for a write barrier where arithmetic | |
603 * operations are then performed on the pointer). | |
604 */ | |
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
|
605 switch (input.getKind().getStackKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
606 case Int: |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
607 if (crb.codeCache.needsDataPatch(input)) { |
13576
4e679d50ba9a
Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents:
13520
diff
changeset
|
608 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
|
609 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
610 // 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
|
611 // 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
|
612 // 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
|
613 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
|
614 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
615 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
616 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
|
617 boolean patch = false; |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
618 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
|
619 patch = true; |
13576
4e679d50ba9a
Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents:
13520
diff
changeset
|
620 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
|
621 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
622 // 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
|
623 // 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
|
624 // 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
|
625 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
|
626 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
|
627 } else { |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
628 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
|
629 // 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
|
630 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
|
631 } 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
|
632 // 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
|
633 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
|
634 } else { |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
635 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
|
636 } |
fb7b39f07232
Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
13240
diff
changeset
|
637 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
638 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
639 case Float: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
640 // 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
|
641 if (Float.floatToRawIntBits(input.asFloat()) == Float.floatToRawIntBits(0.0f)) { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
642 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
|
643 masm.xorps(asFloatReg(result), asFloatReg(result)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
644 } else { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
645 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
|
646 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
647 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
648 case Double: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
649 // 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
|
650 if (Double.doubleToRawLongBits(input.asDouble()) == Double.doubleToRawLongBits(0.0d)) { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
651 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
|
652 masm.xorpd(asDoubleReg(result), asDoubleReg(result)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
653 } else { |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
654 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
|
655 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
656 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
657 case Object: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
658 // 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
|
659 // 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
|
660 // 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
|
661 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
|
662 masm.movq(asRegister(result), 0x0L); |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
663 } else if (crb.target.inlineObjects) { |
13576
4e679d50ba9a
Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents:
13520
diff
changeset
|
664 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
|
665 masm.movq(asRegister(result), 0xDEADDEADDEADDEADL); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
666 } else { |
13576
4e679d50ba9a
Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents:
13520
diff
changeset
|
667 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
|
668 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
669 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
670 default: |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
671 throw JVMCIError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
672 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
673 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
674 |
18187
9619ba4daf4c
Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents:
18176
diff
changeset
|
675 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:
13113
diff
changeset
|
676 assert !crb.codeCache.needsDataPatch(input); |
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
13113
diff
changeset
|
677 AMD64Address dest = (AMD64Address) crb.asAddress(result); |
21438
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
678 final long imm; |
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
|
679 switch (input.getKind().getStackKind()) { |
7881 | 680 case Int: |
21438
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
681 imm = input.asInt(); |
7881 | 682 break; |
683 case Long: | |
21438
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
684 imm = input.asLong(); |
7881 | 685 break; |
686 case Float: | |
21438
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
687 imm = floatToRawIntBits(input.asFloat()); |
7881 | 688 break; |
689 case Double: | |
21438
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
690 imm = doubleToRawLongBits(input.asDouble()); |
7881 | 691 break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
692 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
|
693 if (input.isNull()) { |
21438
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
694 imm = 0; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
695 } else { |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
696 throw JVMCIError.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
|
697 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
698 break; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
699 default: |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
700 throw JVMCIError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
701 } |
21438
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
702 switch (result.getKind()) { |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
703 case Byte: |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
704 assert NumUtil.isByte(imm) : "Is not in byte range: " + imm; |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
705 AMD64MIOp.MOVB.emit(masm, OperandSize.BYTE, dest, (int) imm); |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
706 break; |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
707 case Short: |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
708 assert NumUtil.isShort(imm) : "Is not in short range: " + imm; |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
709 AMD64MIOp.MOV.emit(masm, OperandSize.WORD, dest, (int) imm); |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
710 break; |
22207
aff4dce0b9f6
AMD64Move#const2stack: add support for Char.
Josef Eisl <josef.eisl@jku.at>
parents:
22054
diff
changeset
|
711 case Char: |
aff4dce0b9f6
AMD64Move#const2stack: add support for Char.
Josef Eisl <josef.eisl@jku.at>
parents:
22054
diff
changeset
|
712 assert NumUtil.isUShort(imm) : "Is not in char range: " + imm; |
aff4dce0b9f6
AMD64Move#const2stack: add support for Char.
Josef Eisl <josef.eisl@jku.at>
parents:
22054
diff
changeset
|
713 AMD64MIOp.MOV.emit(masm, OperandSize.WORD, dest, (int) imm); |
aff4dce0b9f6
AMD64Move#const2stack: add support for Char.
Josef Eisl <josef.eisl@jku.at>
parents:
22054
diff
changeset
|
714 break; |
21438
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
715 case Int: |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
716 case Float: |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
717 assert NumUtil.isInt(imm) : "Is not in int range: " + imm; |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
718 masm.movl(dest, (int) imm); |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
719 break; |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
720 case Long: |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
721 case Double: |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
722 case Object: |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
723 masm.movlong(dest, imm); |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
724 break; |
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
725 default: |
21543
93c50cefb9e8
moved GraalInternalError to com.oracle.jvmci.common and renamed it to JVMCIError (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21438
diff
changeset
|
726 throw JVMCIError.shouldNotReachHere("Unknown result Kind: " + result.getKind()); |
21438
a4f376f516dc
AMD64Move: refactor #const2stack and add support for short and byte.
Josef Eisl <josef.eisl@jku.at>
parents:
21200
diff
changeset
|
727 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
728 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
729 } |