Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Binary.java @ 21673:5024c80224c7
moved com.oracle.graal.[amd64|sparc] to com.oracle.jvmci.[amd64|sparc] (JBS:GRAAL-53)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 02 Jun 2015 22:11:52 +0200 |
parents | 48c1ebd24120 |
children | 6df25b1418be |
rev | line source |
---|---|
19971
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
1 /* |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
4 * |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
8 * |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
14 * |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
18 * |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
21 * questions. |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
22 */ |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.lir.amd64; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
24 |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19971
diff
changeset
|
25 import com.oracle.jvmci.meta.AllocatableValue; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19971
diff
changeset
|
26 import com.oracle.jvmci.meta.Value; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19971
diff
changeset
|
27 import com.oracle.jvmci.meta.JavaConstant; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19971
diff
changeset
|
28 import static com.oracle.jvmci.code.ValueUtil.*; |
19971
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
29 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
30 |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
19971
diff
changeset
|
31 import com.oracle.jvmci.code.CompilationResult.DataSectionReference; |
19971
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
32 import com.oracle.graal.asm.*; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
33 import com.oracle.graal.asm.amd64.*; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
34 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64BinaryArithmetic; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
35 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64MIOp; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
36 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64RMIOp; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
37 import com.oracle.graal.asm.amd64.AMD64Assembler.AMD64RMOp; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
38 import com.oracle.graal.asm.amd64.AMD64Assembler.OperandSize; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
39 import com.oracle.graal.lir.*; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
40 import com.oracle.graal.lir.StandardOp.ImplicitNullCheck; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
41 import com.oracle.graal.lir.asm.*; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
42 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
43 /** |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
44 * AMD64 LIR instructions that have two inputs and one output. |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
45 */ |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
46 public class AMD64Binary { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
47 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
48 /** |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
49 * Instruction that has two {@link AllocatableValue} operands. |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
50 */ |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
51 public static class Op extends AMD64LIRInstruction { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
52 public static final LIRInstructionClass<Op> TYPE = LIRInstructionClass.create(Op.class); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
53 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
54 @Opcode private final AMD64RMOp opcode; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
55 private final OperandSize size; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
56 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
57 @Def({REG, HINT}) protected AllocatableValue result; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
58 @Use({REG, STACK}) protected AllocatableValue x; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
59 @Alive({REG, STACK}) protected AllocatableValue y; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
60 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
61 public Op(AMD64RMOp opcode, OperandSize size, AllocatableValue result, AllocatableValue x, AllocatableValue y) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
62 super(TYPE); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
63 this.opcode = opcode; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
64 this.size = size; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
65 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
66 this.result = result; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
67 this.x = x; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
68 this.y = y; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
69 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
70 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
71 @Override |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
72 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
73 AMD64Move.move(crb, masm, result, x); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
74 if (isRegister(y)) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
75 opcode.emit(masm, size, asRegister(result), asRegister(y)); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
76 } else { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
77 assert isStackSlot(y); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
78 opcode.emit(masm, size, asRegister(result), (AMD64Address) crb.asAddress(y)); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
79 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
80 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
81 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
82 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
83 /** |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
84 * Commutative instruction that has two {@link AllocatableValue} operands. |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
85 */ |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
86 public static class CommutativeOp extends AMD64LIRInstruction { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
87 public static final LIRInstructionClass<CommutativeOp> TYPE = LIRInstructionClass.create(CommutativeOp.class); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
88 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
89 @Opcode private final AMD64RMOp opcode; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
90 private final OperandSize size; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
91 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
92 @Def({REG, HINT}) protected AllocatableValue result; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
93 @Use({REG, STACK}) protected AllocatableValue x; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
94 @Use({REG, STACK}) protected AllocatableValue y; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
95 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
96 public CommutativeOp(AMD64RMOp opcode, OperandSize size, AllocatableValue result, AllocatableValue x, AllocatableValue y) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
97 super(TYPE); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
98 this.opcode = opcode; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
99 this.size = size; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
100 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
101 this.result = result; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
102 this.x = x; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
103 this.y = y; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
104 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
105 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
106 @Override |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
107 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
108 AllocatableValue input; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
109 if (sameRegister(result, y)) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
110 input = x; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
111 } else { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
112 AMD64Move.move(crb, masm, result, x); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
113 input = y; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
114 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
115 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
116 if (isRegister(input)) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
117 opcode.emit(masm, size, asRegister(result), asRegister(input)); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
118 } else { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
119 assert isStackSlot(input); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
120 opcode.emit(masm, size, asRegister(result), (AMD64Address) crb.asAddress(input)); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
121 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
122 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
123 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
124 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
125 /** |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
126 * Instruction that has one {@link AllocatableValue} operand and one 32-bit immediate operand. |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
127 */ |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
128 public static class ConstOp extends AMD64LIRInstruction { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
129 public static final LIRInstructionClass<ConstOp> TYPE = LIRInstructionClass.create(ConstOp.class); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
130 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
131 @Opcode private final AMD64MIOp opcode; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
132 private final OperandSize size; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
133 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
134 @Def({REG, HINT}) protected AllocatableValue result; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
135 @Use({REG, STACK}) protected AllocatableValue x; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
136 private final int y; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
137 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
138 public ConstOp(AMD64BinaryArithmetic opcode, OperandSize size, AllocatableValue result, AllocatableValue x, int y) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
139 this(opcode.getMIOpcode(size, NumUtil.isByte(y)), size, result, x, y); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
140 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
141 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
142 public ConstOp(AMD64MIOp opcode, OperandSize size, AllocatableValue result, AllocatableValue x, int y) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
143 super(TYPE); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
144 this.opcode = opcode; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
145 this.size = size; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
146 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
147 this.result = result; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
148 this.x = x; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
149 this.y = y; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
150 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
151 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
152 @Override |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
153 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
154 AMD64Move.move(crb, masm, result, x); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
155 opcode.emit(masm, size, asRegister(result), y); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
156 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
157 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
158 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
159 /** |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
160 * Instruction that has one {@link AllocatableValue} operand and one |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
161 * {@link DataSectionReference} operand. |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
162 */ |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
163 public static class DataOp extends AMD64LIRInstruction { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
164 public static final LIRInstructionClass<DataOp> TYPE = LIRInstructionClass.create(DataOp.class); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
165 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
166 @Opcode private final AMD64RMOp opcode; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
167 private final OperandSize size; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
168 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
169 @Def({REG, HINT}) protected AllocatableValue result; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
170 @Use({REG, STACK}) protected AllocatableValue x; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
171 private final JavaConstant y; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
172 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
173 private final int alignment; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
174 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
175 public DataOp(AMD64RMOp opcode, OperandSize size, AllocatableValue result, AllocatableValue x, JavaConstant y) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
176 this(opcode, size, result, x, y, y.getKind().getByteCount()); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
177 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
178 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
179 public DataOp(AMD64RMOp opcode, OperandSize size, AllocatableValue result, AllocatableValue x, JavaConstant y, int alignment) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
180 super(TYPE); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
181 this.opcode = opcode; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
182 this.size = size; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
183 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
184 this.result = result; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
185 this.x = x; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
186 this.y = y; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
187 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
188 this.alignment = alignment; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
189 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
190 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
191 @Override |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
192 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
193 AMD64Move.move(crb, masm, result, x); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
194 opcode.emit(masm, size, asRegister(result), (AMD64Address) crb.recordDataReferenceInCode(y, alignment)); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
195 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
196 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
197 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
198 /** |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
199 * Instruction that has one {@link AllocatableValue} operand and one {@link AMD64AddressValue |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
200 * memory} operand. |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
201 */ |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
202 public static class MemoryOp extends AMD64LIRInstruction implements ImplicitNullCheck { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
203 public static final LIRInstructionClass<MemoryOp> TYPE = LIRInstructionClass.create(MemoryOp.class); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
204 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
205 @Opcode private final AMD64RMOp opcode; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
206 private final OperandSize size; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
207 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
208 @Def({REG, HINT}) protected AllocatableValue result; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
209 @Use({REG, STACK}) protected AllocatableValue x; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
210 @Alive({COMPOSITE}) protected AMD64AddressValue y; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
211 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
212 @State protected LIRFrameState state; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
213 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
214 public MemoryOp(AMD64RMOp opcode, OperandSize size, AllocatableValue result, AllocatableValue x, AMD64AddressValue y, LIRFrameState state) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
215 super(TYPE); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
216 this.opcode = opcode; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
217 this.size = size; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
218 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
219 this.result = result; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
220 this.x = x; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
221 this.y = y; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
222 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
223 this.state = state; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
224 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
225 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
226 @Override |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
227 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
228 AMD64Move.move(crb, masm, result, x); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
229 if (state != null) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
230 crb.recordImplicitException(masm.position(), state); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
231 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
232 opcode.emit(masm, size, asRegister(result), y.toAddress()); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
233 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
234 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
235 @Override |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
236 public void verify() { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
237 super.verify(); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
238 assert differentRegisters(result, y) || sameRegister(x, y); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
239 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
240 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
241 @Override |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
242 public boolean makeNullCheckFor(Value value, LIRFrameState nullCheckState, int implicitNullCheckLimit) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
243 if (state == null && y.isValidImplicitNullCheckFor(value, implicitNullCheckLimit)) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
244 state = nullCheckState; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
245 return true; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
246 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
247 return false; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
248 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
249 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
250 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
251 /** |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
252 * Instruction with a separate result operand, one {@link AllocatableValue} input and one 32-bit |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
253 * immediate input. |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
254 */ |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
255 public static class RMIOp extends AMD64LIRInstruction { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
256 public static final LIRInstructionClass<RMIOp> TYPE = LIRInstructionClass.create(RMIOp.class); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
257 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
258 @Opcode private final AMD64RMIOp opcode; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
259 private final OperandSize size; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
260 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
261 @Def({REG}) protected AllocatableValue result; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
262 @Use({REG, STACK}) protected AllocatableValue x; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
263 private final int y; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
264 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
265 public RMIOp(AMD64RMIOp opcode, OperandSize size, AllocatableValue result, AllocatableValue x, int y) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
266 super(TYPE); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
267 this.opcode = opcode; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
268 this.size = size; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
269 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
270 this.result = result; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
271 this.x = x; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
272 this.y = y; |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
273 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
274 |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
275 @Override |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
276 public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
277 if (isRegister(x)) { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
278 opcode.emit(masm, size, asRegister(result), asRegister(x), y); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
279 } else { |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
280 assert isStackSlot(x); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
281 opcode.emit(masm, size, asRegister(result), (AMD64Address) crb.asAddress(x), y); |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
282 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
283 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
284 } |
46dde3e92715
Restructure AMD64 LIR classes.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
285 } |