annotate graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java @ 21200:9965d71c8971

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