annotate graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java @ 15278:3ef4196cf8e5

use movl instead of andl for L2I
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Tue, 22 Apr 2014 17:25:31 -0700
parents 882f4cb7cfcf
children a38d791982e1
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 /*
4181
319860ae697a Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4142
diff changeset
2 * Copyright (c) 2009, 2012, 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 */
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
23
6532
0c6030872cd0 renamed package: com.oracle.graal.compiler.target.amd64 -> com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6531
diff changeset
24 package com.oracle.graal.compiler.amd64;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
25
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
26 import static com.oracle.graal.api.code.ValueUtil.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
27 import static com.oracle.graal.lir.amd64.AMD64Arithmetic.*;
7861
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
28 import static com.oracle.graal.lir.amd64.AMD64BitManipulationOp.IntrinsicOpcode.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
29 import static com.oracle.graal.lir.amd64.AMD64Compare.*;
7280
f368ec89e231 added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents: 7144
diff changeset
30 import static com.oracle.graal.lir.amd64.AMD64MathIntrinsicOp.IntrinsicOpcode.*;
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4314
diff changeset
31
6580
d56d600819fe moved AMD64 into its own (new) project: com.oracle.graal.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6539
diff changeset
32 import com.oracle.graal.amd64.*;
5510
426c605c9d3c Move cri.ci to api.code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5507
diff changeset
33 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
34 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: 6525
diff changeset
35 import com.oracle.graal.asm.*;
8167
7f57c30575c8 Make AMD64Address a low-level representation for use by the assembler only.
Roland Schatz <roland.schatz@oracle.com>
parents: 8166
diff changeset
36 import com.oracle.graal.asm.amd64.AMD64Address.Scale;
6675
6eb83c6eb177 change LIRGenerator to take StructuredGraph instead of Graph
Lukas Stadler <lukas.stadler@jku.at>
parents: 6580
diff changeset
37 import com.oracle.graal.asm.amd64.AMD64Assembler.ConditionFlag;
15193
96bb07a5d667 Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents: 14998
diff changeset
38 import com.oracle.graal.compiler.common.*;
15200
97eed257999b Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
39 import com.oracle.graal.compiler.common.calc.*;
15261
882f4cb7cfcf Move Stamps to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15200
diff changeset
40 import com.oracle.graal.compiler.common.type.*;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
41 import com.oracle.graal.compiler.gen.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
42 import com.oracle.graal.lir.*;
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
43 import com.oracle.graal.lir.StandardOp.JumpOp;
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
44 import com.oracle.graal.lir.amd64.*;
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
45 import com.oracle.graal.lir.amd64.AMD64Arithmetic.BinaryCommutative;
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
46 import com.oracle.graal.lir.amd64.AMD64Arithmetic.BinaryMemory;
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
47 import com.oracle.graal.lir.amd64.AMD64Arithmetic.BinaryRegConst;
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
48 import com.oracle.graal.lir.amd64.AMD64Arithmetic.BinaryRegReg;
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
49 import com.oracle.graal.lir.amd64.AMD64Arithmetic.BinaryRegStack;
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
50 import com.oracle.graal.lir.amd64.AMD64Arithmetic.BinaryRegStackConst;
7861
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
51 import com.oracle.graal.lir.amd64.AMD64Arithmetic.DivRemOp;
9581
d84ea522800e replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9431
diff changeset
52 import com.oracle.graal.lir.amd64.AMD64Arithmetic.FPDivRemOp;
7910
748cb57f53cb Cleanup Op1 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7909
diff changeset
53 import com.oracle.graal.lir.amd64.AMD64Arithmetic.Unary1Op;
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
54 import com.oracle.graal.lir.amd64.AMD64Arithmetic.Unary2MemoryOp;
7910
748cb57f53cb Cleanup Op1 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7909
diff changeset
55 import com.oracle.graal.lir.amd64.AMD64Arithmetic.Unary2Op;
15278
3ef4196cf8e5 use movl instead of andl for L2I
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15261
diff changeset
56 import com.oracle.graal.lir.amd64.AMD64Arithmetic.Unary2RegOp;
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
57 import com.oracle.graal.lir.amd64.AMD64Compare.CompareMemoryOp;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
58 import com.oracle.graal.lir.amd64.AMD64Compare.CompareOp;
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
59 import com.oracle.graal.lir.amd64.AMD64ControlFlow.BranchOp;
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
60 import com.oracle.graal.lir.amd64.AMD64ControlFlow.CondMoveOp;
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
61 import com.oracle.graal.lir.amd64.AMD64ControlFlow.FloatBranchOp;
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
62 import com.oracle.graal.lir.amd64.AMD64ControlFlow.FloatCondMoveOp;
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
63 import com.oracle.graal.lir.amd64.AMD64ControlFlow.ReturnOp;
13294
29907e69ae8d rework of switch generation: move code into platform independent SwitchStrategy, add boolean switch strategy
Lukas Stadler <lukas.stadler@jku.at>
parents: 13268
diff changeset
64 import com.oracle.graal.lir.amd64.AMD64ControlFlow.StrategySwitchOp;
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5775
diff changeset
65 import com.oracle.graal.lir.amd64.AMD64ControlFlow.TableSwitchOp;
14859
4f5c312d676e Fix merge regressions.
Josef Eisl <josef.eisl@jku.at>
parents: 14850
diff changeset
66 import com.oracle.graal.lir.amd64.AMD64Move.LeaDataOp;
14121
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
67 import com.oracle.graal.lir.amd64.AMD64Move.LeaOp;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
68 import com.oracle.graal.lir.amd64.AMD64Move.MembarOp;
14121
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
69 import com.oracle.graal.lir.amd64.AMD64Move.MoveFromRegOp;
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
70 import com.oracle.graal.lir.amd64.AMD64Move.MoveToRegOp;
7882
124b28240347 Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents: 7880
diff changeset
71 import com.oracle.graal.lir.amd64.AMD64Move.StackLeaOp;
14859
4f5c312d676e Fix merge regressions.
Josef Eisl <josef.eisl@jku.at>
parents: 14850
diff changeset
72 import com.oracle.graal.lir.amd64.AMD64Move.ZeroExtendLoadOp;
5060
4ed4295ce15f Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5059
diff changeset
73 import com.oracle.graal.nodes.*;
14061
a3cd3403a958 Remove unused imports.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 14057
diff changeset
74 import com.oracle.graal.nodes.calc.FloatConvertNode.FloatConvert;
6525
2c913b643422 rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents: 6521
diff changeset
75 import com.oracle.graal.phases.util.*;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
76
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
77 /**
6496
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
78 * This class implements the AMD64 specific portion of the LIR generator.
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
79 */
5247
62bbfd78c703 removed mechanism for lowering ExceptionObjectNode via substitution; only LIR lowering by the runtime is now supported
Doug Simon <doug.simon@oracle.com>
parents: 5233
diff changeset
80 public abstract class AMD64LIRGenerator extends LIRGenerator {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
82 private static final RegisterValue RAX_I = AMD64.rax.asValue(Kind.Int);
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
83 private static final RegisterValue RAX_L = AMD64.rax.asValue(Kind.Long);
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
84 private static final RegisterValue RDX_I = AMD64.rdx.asValue(Kind.Int);
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
85 private static final RegisterValue RDX_L = AMD64.rdx.asValue(Kind.Long);
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
86 private static final RegisterValue RCX_I = AMD64.rcx.asValue(Kind.Int);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87
14121
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
88 private class AMD64SpillMoveFactory implements LIR.SpillMoveFactory {
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
89
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
90 @Override
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
91 public LIRInstruction createMove(AllocatableValue result, Value input) {
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
92 return AMD64LIRGenerator.this.createMove(result, input);
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
93 }
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
94 }
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
95
14842
f2e61bf2a2d8 Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents: 14841
diff changeset
96 public AMD64LIRGenerator(Providers providers, CallingConvention cc, LIRGenerationResult lirGenRes) {
f2e61bf2a2d8 Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents: 14841
diff changeset
97 super(providers, cc, lirGenRes);
14809
73774616a6b3 Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents: 14796
diff changeset
98 lirGenRes.getLIR().setSpillMoveFactory(new AMD64SpillMoveFactory());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
99 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
100
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
101 @Override
13520
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13466
diff changeset
102 public boolean canStoreConstant(Constant c, boolean isCompressed) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
103 // there is no immediate move of 64-bit constants on Intel
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
104 switch (c.getKind()) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
105 case Long:
13520
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13466
diff changeset
106 if (isCompressed) {
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13466
diff changeset
107 return true;
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13466
diff changeset
108 }
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
109 return Util.isInt(c.asLong()) && !getCodeCache().needsDataPatch(c);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
110 case Double:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
111 return false;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
112 case Object:
13520
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13466
diff changeset
113 if (isCompressed) {
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13466
diff changeset
114 return true;
fb7b39f07232 Embed compressed constants when possible and use more efficient patterns for encoding
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13466
diff changeset
115 }
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
116 return c.isNull();
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
117 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
118 return true;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
119 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
120 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
122 @Override
5538
e18ba36bfebc Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5510
diff changeset
123 public boolean canInlineConstant(Constant c) {
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
124 switch (c.getKind()) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
125 case Long:
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
126 return NumUtil.isInt(c.asLong()) && !getCodeCache().needsDataPatch(c);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
127 case Object:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
128 return c.isNull();
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
129 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
130 return true;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
131 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
132 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
133
4314
9ce8594bedaf Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4280
diff changeset
134 @Override
5539
bc647d8b0080 Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
135 public Variable emitMove(Value input) {
14003
0c38906450a0 Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14001
diff changeset
136 PlatformKind kind;
0c38906450a0 Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14001
diff changeset
137 if (input instanceof Constant) {
0c38906450a0 Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14001
diff changeset
138 kind = input.getKind().getStackKind();
0c38906450a0 Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14001
diff changeset
139 } else {
0c38906450a0 Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14001
diff changeset
140 kind = input.getPlatformKind();
0c38906450a0 Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14001
diff changeset
141 }
0c38906450a0 Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14001
diff changeset
142 Variable result = newVariable(kind);
7883
cc9b45598a4f Change argument order to be consistent with the rest of the backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7882
diff changeset
143 emitMove(result, input);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
144 return result;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
145 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
146
14121
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
147 protected AMD64LIRInstruction createMove(AllocatableValue dst, Value src) {
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
148 if (src instanceof AMD64AddressValue) {
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
149 return new LeaOp(dst, (AMD64AddressValue) src);
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
150 } else if (isRegister(src) || isStackSlot(dst)) {
14945
b14cb2d9253d Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 14931
diff changeset
151 return new MoveFromRegOp(dst.getKind(), dst, src);
14121
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
152 } else {
14945
b14cb2d9253d Make compression and uncompression explicit in the high level graph.
Roland Schatz <roland.schatz@oracle.com>
parents: 14931
diff changeset
153 return new MoveToRegOp(dst.getKind(), dst, src);
14121
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
154 }
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
155 }
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
156
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
157 @Override
9296
1342574c4f7d Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents: 9294
diff changeset
158 public void emitMove(AllocatableValue dst, Value src) {
14121
0ddb3b3665bd Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents: 14061
diff changeset
159 append(createMove(dst, src));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
160 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
161
14859
4f5c312d676e Fix merge regressions.
Josef Eisl <josef.eisl@jku.at>
parents: 14850
diff changeset
162 public void emitData(AllocatableValue dst, byte[] data) {
4f5c312d676e Fix merge regressions.
Josef Eisl <josef.eisl@jku.at>
parents: 14850
diff changeset
163 append(new LeaDataOp(dst, data));
4f5c312d676e Fix merge regressions.
Josef Eisl <josef.eisl@jku.at>
parents: 14850
diff changeset
164 }
4f5c312d676e Fix merge regressions.
Josef Eisl <josef.eisl@jku.at>
parents: 14850
diff changeset
165
9298
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9297
diff changeset
166 @Override
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9297
diff changeset
167 public AMD64AddressValue emitAddress(Value base, long displacement, Value index, int scale) {
8166
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8144
diff changeset
168 AllocatableValue baseRegister;
9204
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
169 long finalDisp = displacement;
7861
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
170 if (isConstant(base)) {
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
171 if (asConstant(base).isNull()) {
9294
899295127bc4 Get rid of the distinction between UNUSED and ILLEGAL value.
Roland Schatz <roland.schatz@oracle.com>
parents: 9293
diff changeset
172 baseRegister = Value.ILLEGAL;
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
173 } else if (asConstant(base).getKind() != Kind.Object && !getCodeCache().needsDataPatch(asConstant(base))) {
9204
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
174 finalDisp += asConstant(base).asLong();
9294
899295127bc4 Get rid of the distinction between UNUSED and ILLEGAL value.
Roland Schatz <roland.schatz@oracle.com>
parents: 9293
diff changeset
175 baseRegister = Value.ILLEGAL;
8166
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8144
diff changeset
176 } else {
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8144
diff changeset
177 baseRegister = load(base);
7861
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
178 }
8166
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8144
diff changeset
179 } else {
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8144
diff changeset
180 baseRegister = asAllocatable(base);
7861
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
181 }
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
182
8166
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8144
diff changeset
183 AllocatableValue indexRegister;
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8144
diff changeset
184 Scale scaleEnum;
9638
c455c86138ba Value: more occurrences of object equality replaced
Bernhard Urban <bernhard.urban@jku.at>
parents: 9613
diff changeset
185 if (!index.equals(Value.ILLEGAL) && scale != 0) {
8166
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8144
diff changeset
186 scaleEnum = Scale.fromInt(scale);
7861
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
187 if (isConstant(index)) {
9204
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
188 finalDisp += asConstant(index).asLong() * scale;
9294
899295127bc4 Get rid of the distinction between UNUSED and ILLEGAL value.
Roland Schatz <roland.schatz@oracle.com>
parents: 9293
diff changeset
189 indexRegister = Value.ILLEGAL;
13134
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
190
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
191 } else if (scaleEnum == null) {
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
192 /* Scale value that architecture cannot handle, so scale manually. */
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
193 Value longIndex = index.getKind() == Kind.Long ? index : emitSignExtend(index, 32, 64);
13134
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
194 if (CodeUtil.isPowerOf2(scale)) {
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
195 indexRegister = emitShl(longIndex, Constant.forLong(CodeUtil.log2(scale)));
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
196 } else {
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
197 indexRegister = emitMul(longIndex, Constant.forLong(scale));
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
198 }
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
199 scaleEnum = Scale.Times1;
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
200
8166
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8144
diff changeset
201 } else {
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8144
diff changeset
202 indexRegister = asAllocatable(index);
7861
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
203 }
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
204 } else {
9294
899295127bc4 Get rid of the distinction between UNUSED and ILLEGAL value.
Roland Schatz <roland.schatz@oracle.com>
parents: 9293
diff changeset
205 indexRegister = Value.ILLEGAL;
8166
d2733c9b3d0e Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents: 8144
diff changeset
206 scaleEnum = Scale.Times1;
7861
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
207 }
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
208
9204
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
209 int displacementInt;
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
210 if (NumUtil.isInt(finalDisp)) {
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
211 displacementInt = (int) finalDisp;
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
212 } else {
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
213 displacementInt = 0;
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
214 AllocatableValue displacementRegister = load(Constant.forLong(finalDisp));
9638
c455c86138ba Value: more occurrences of object equality replaced
Bernhard Urban <bernhard.urban@jku.at>
parents: 9613
diff changeset
215 if (baseRegister.equals(Value.ILLEGAL)) {
9204
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
216 baseRegister = displacementRegister;
10086
e0fb8a213650 fix == on Value
Mick Jordan <mick.jordan@oracle.com>
parents: 9896
diff changeset
217 } else if (indexRegister.equals(Value.ILLEGAL)) {
9204
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
218 indexRegister = displacementRegister;
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
219 scaleEnum = Scale.Times1;
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
220 } else {
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
221 baseRegister = emitAdd(baseRegister, displacementRegister);
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
222 }
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
223 }
589e140a7f1c Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents: 9003
diff changeset
224
9293
d006c9920e94 Make kind of LIR memory access operations explicit.
Roland Schatz <roland.schatz@oracle.com>
parents: 9204
diff changeset
225 return new AMD64AddressValue(target().wordKind, baseRegister, indexRegister, scaleEnum, displacementInt);
7861
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
226 }
c6d003891de0 Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7839
diff changeset
227
14841
47e4d2e01c6e Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents: 14826
diff changeset
228 public AMD64AddressValue asAddressValue(Value address) {
9298
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9297
diff changeset
229 if (address instanceof AMD64AddressValue) {
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9297
diff changeset
230 return (AMD64AddressValue) address;
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9297
diff changeset
231 } else {
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9297
diff changeset
232 return emitAddress(address, 0, Value.ILLEGAL, 0);
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9297
diff changeset
233 }
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9297
diff changeset
234 }
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9297
diff changeset
235
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
236 @Override
9298
9ee5f3bfa755 Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents: 9297
diff changeset
237 public Variable emitAddress(StackSlot address) {
4206
430b5db3e6f8 Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4199
diff changeset
238 Variable result = newVariable(target().wordKind);
7882
124b28240347 Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents: 7880
diff changeset
239 append(new StackLeaOp(result, address));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
240 return result;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
241 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
242
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
243 @Override
8293
ae7e78091f03 Cleanup branching and jumps in LIRGenerator: JumpOp/BranchOp do not need a state. In emitBranch, emitNullCheckBranch, emitCompareBranch, emitOverflowCheckBranch and emitIntegerTestBranch both targets are always provided.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8292
diff changeset
244 public void emitJump(LabelRef label) {
13294
29907e69ae8d rework of switch generation: move code into platform independent SwitchStrategy, add boolean switch strategy
Lukas Stadler <lukas.stadler@jku.at>
parents: 13268
diff changeset
245 assert label != null;
8293
ae7e78091f03 Cleanup branching and jumps in LIRGenerator: JumpOp/BranchOp do not need a state. In emitBranch, emitNullCheckBranch, emitCompareBranch, emitOverflowCheckBranch and emitIntegerTestBranch both targets are always provided.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8292
diff changeset
246 append(new JumpOp(label));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
247 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
248
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
249 @Override
14962
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
250 public void emitCompareBranch(PlatformKind cmpKind, Value left, Value right, Condition cond, boolean unorderedIsTrue, LabelRef trueLabel, LabelRef falseLabel, double trueLabelProbability) {
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
251 boolean mirrored = emitCompare(cmpKind, left, right);
5406
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
252 Condition finalCondition = mirrored ? cond.mirror() : cond;
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: 6534
diff changeset
253 switch (left.getKind().getStackKind()) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
254 case Int:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
255 case Long:
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
256 case Object:
13908
8f3cd93813f1 Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents: 13907
diff changeset
257 append(new BranchOp(finalCondition, trueLabel, falseLabel, trueLabelProbability));
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
258 break;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
259 case Float:
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
260 case Double:
13908
8f3cd93813f1 Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents: 13907
diff changeset
261 append(new FloatBranchOp(finalCondition, unorderedIsTrue, trueLabel, falseLabel, trueLabelProbability));
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
262 break;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
263 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
264 throw GraalInternalError.shouldNotReachHere("" + left.getKind());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
265 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
266 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
267
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
268 @Override
13908
8f3cd93813f1 Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents: 13907
diff changeset
269 public void emitOverflowCheckBranch(LabelRef overflow, LabelRef noOverflow, double overflowProbability) {
8f3cd93813f1 Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents: 13907
diff changeset
270 append(new BranchOp(ConditionFlag.Overflow, overflow, noOverflow, overflowProbability));
8210
c64ecb1ef1a9 Create LIRGenerator.emitOverflowCheckBranch in preparation for emitDeoptimizeOnOverflow removal
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8209
diff changeset
271 }
c64ecb1ef1a9 Create LIRGenerator.emitOverflowCheckBranch in preparation for emitDeoptimizeOnOverflow removal
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8209
diff changeset
272
c64ecb1ef1a9 Create LIRGenerator.emitOverflowCheckBranch in preparation for emitDeoptimizeOnOverflow removal
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8209
diff changeset
273 @Override
13908
8f3cd93813f1 Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents: 13907
diff changeset
274 public void emitIntegerTestBranch(Value left, Value right, LabelRef trueDestination, LabelRef falseDestination, double trueDestinationProbability) {
7725
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
275 emitIntegerTest(left, right);
13908
8f3cd93813f1 Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents: 13907
diff changeset
276 append(new BranchOp(Condition.EQ, trueDestination, falseDestination, trueDestinationProbability));
7725
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
277 }
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
278
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
279 @Override
14962
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
280 public Variable emitConditionalMove(PlatformKind cmpKind, Value left, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue) {
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
281 boolean mirrored = emitCompare(cmpKind, left, right);
5406
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
282 Condition finalCondition = mirrored ? cond.mirror() : cond;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
283
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
284 Variable result = newVariable(trueValue.getKind());
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: 6534
diff changeset
285 switch (left.getKind().getStackKind()) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
286 case Int:
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
287 case Long:
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
288 case Object:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
289 append(new CondMoveOp(result, finalCondition, load(trueValue), loadNonConst(falseValue)));
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
290 break;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
291 case Float:
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
292 case Double:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
293 append(new FloatCondMoveOp(result, finalCondition, unorderedIsTrue, load(trueValue), load(falseValue)));
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
294 break;
7725
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
295 default:
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
296 throw GraalInternalError.shouldNotReachHere("" + left.getKind());
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
297 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
298 return result;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
299 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
300
7725
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
301 @Override
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
302 public Variable emitIntegerTestMove(Value left, Value right, Value trueValue, Value falseValue) {
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
303 emitIntegerTest(left, right);
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
304 Variable result = newVariable(trueValue.getKind());
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
305 append(new CondMoveOp(result, Condition.EQ, load(trueValue), loadNonConst(falseValue)));
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
306 return result;
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
307 }
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
308
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
309 private void emitIntegerTest(Value a, Value b) {
12695
4aec62c32a82 Helper functions for identifying numeric kinds.
Roland Schatz <roland.schatz@oracle.com>
parents: 12656
diff changeset
310 assert a.getKind().isNumericInteger();
7725
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
311 if (LIRValueUtil.isVariable(b)) {
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
312 append(new AMD64TestOp(load(b), loadNonConst(a)));
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
313 } else {
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
314 append(new AMD64TestOp(load(a), loadNonConst(b)));
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
315 }
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
316 }
301cff1a99d1 backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 7660
diff changeset
317
14962
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
318 protected void emitCompareOp(PlatformKind cmpKind, Variable left, Value right) {
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
319 switch ((Kind) cmpKind) {
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
320 case Byte:
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
321 case Boolean:
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
322 append(new CompareOp(BCMP, left, right));
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
323 break;
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
324 case Short:
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
325 case Char:
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
326 append(new CompareOp(SCMP, left, right));
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
327 break;
13251
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
328 case Int:
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
329 append(new CompareOp(ICMP, left, right));
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
330 break;
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
331 case Long:
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
332 append(new CompareOp(LCMP, left, right));
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
333 break;
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
334 case Object:
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
335 append(new CompareOp(ACMP, left, right));
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
336 break;
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
337 case Float:
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
338 append(new CompareOp(FCMP, left, right));
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
339 break;
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
340 case Double:
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
341 append(new CompareOp(DCMP, left, right));
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
342 break;
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
343 default:
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
344 throw GraalInternalError.shouldNotReachHere();
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
345 }
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
346 }
3a8a4042229f Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents: 13212
diff changeset
347
14931
d45e8c306349 use MemOp as base class for new memory ops
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14859
diff changeset
348 protected void emitCompareMemoryConOp(Kind kind, AMD64AddressValue address, Value value, LIRFrameState state) {
14962
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
349 assert kind.getStackKind() == value.getKind().getStackKind();
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
350 switch (kind) {
14962
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
351 case Byte:
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
352 case Boolean:
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
353 append(new CompareMemoryOp(BCMP, kind, address, value, state));
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
354 break;
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
355 case Short:
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
356 case Char:
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
357 append(new CompareMemoryOp(SCMP, kind, address, value, state));
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
358 break;
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
359 case Int:
14931
d45e8c306349 use MemOp as base class for new memory ops
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14859
diff changeset
360 append(new CompareMemoryOp(ICMP, kind, address, value, state));
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
361 break;
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
362 case Long:
14931
d45e8c306349 use MemOp as base class for new memory ops
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14859
diff changeset
363 append(new CompareMemoryOp(LCMP, kind, address, value, state));
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
364 break;
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
365 default:
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
366 throw GraalInternalError.shouldNotReachHere();
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
367 }
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
368 }
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
369
14931
d45e8c306349 use MemOp as base class for new memory ops
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14859
diff changeset
370 protected void emitCompareRegMemoryOp(Kind kind, Value value, AMD64AddressValue address, LIRFrameState state) {
d45e8c306349 use MemOp as base class for new memory ops
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14859
diff changeset
371 AMD64Compare opcode = null;
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
372 switch (kind) {
14962
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
373 case Byte:
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
374 case Boolean:
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
375 opcode = BCMP;
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
376 break;
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
377 case Short:
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
378 case Char:
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
379 opcode = SCMP;
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
380 break;
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
381 case Int:
14931
d45e8c306349 use MemOp as base class for new memory ops
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14859
diff changeset
382 opcode = ICMP;
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
383 break;
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
384 case Long:
14931
d45e8c306349 use MemOp as base class for new memory ops
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14859
diff changeset
385 opcode = LCMP;
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
386 break;
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
387 case Object:
14931
d45e8c306349 use MemOp as base class for new memory ops
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14859
diff changeset
388 opcode = ACMP;
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
389 break;
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
390 case Float:
14931
d45e8c306349 use MemOp as base class for new memory ops
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14859
diff changeset
391 opcode = FCMP;
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
392 break;
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
393 case Double:
14931
d45e8c306349 use MemOp as base class for new memory ops
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14859
diff changeset
394 opcode = DCMP;
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
395 break;
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
396 default:
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
397 throw GraalInternalError.shouldNotReachHere();
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
398 }
14931
d45e8c306349 use MemOp as base class for new memory ops
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14859
diff changeset
399 append(new CompareMemoryOp(opcode, kind, address, value, state));
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
400 }
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
401
5406
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
402 /**
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
403 * This method emits the compare instruction, and may reorder the operands. It returns true if
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
404 * it did so.
14850
Josef Eisl <josef.eisl@jku.at>
parents: 14842 14747
diff changeset
405 *
5406
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
406 * @param a the left operand of the comparison
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
407 * @param b the right operand of the comparison
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
408 * @return true if the left and right operands were switched, false otherwise
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
409 */
14962
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
410 private boolean emitCompare(PlatformKind cmpKind, Value a, Value b) {
5406
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
411 Variable left;
5539
bc647d8b0080 Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
412 Value right;
5406
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
413 boolean mirrored;
5547
b6617d13ea44 Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5546
diff changeset
414 if (LIRValueUtil.isVariable(b)) {
5406
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
415 left = load(b);
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
416 right = loadNonConst(a);
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
417 mirrored = true;
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
418 } else {
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
419 left = load(a);
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
420 right = loadNonConst(b);
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
421 mirrored = false;
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
422 }
14962
e4a5b8904695 Support for short and byte compare in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14949
diff changeset
423 emitCompareOp(cmpKind, left, right);
5406
ae759e820ce7 AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents: 5402
diff changeset
424 return mirrored;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
425 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
426
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
427 @Override
7910
748cb57f53cb Cleanup Op1 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7909
diff changeset
428 public Variable emitNegate(Value inputVal) {
748cb57f53cb Cleanup Op1 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7909
diff changeset
429 AllocatableValue input = asAllocatable(inputVal);
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
430 Variable result = newVariable(input.getKind());
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5798
diff changeset
431 switch (input.getKind()) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
432 case Int:
7910
748cb57f53cb Cleanup Op1 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7909
diff changeset
433 append(new Unary1Op(INEG, result, input));
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
434 break;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
435 case Long:
7910
748cb57f53cb Cleanup Op1 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7909
diff changeset
436 append(new Unary1Op(LNEG, result, input));
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
437 break;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
438 case Float:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
439 append(new BinaryRegConst(FXOR, result, input, Constant.forFloat(Float.intBitsToFloat(0x80000000))));
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
440 break;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
441 case Double:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
442 append(new BinaryRegConst(DXOR, result, input, Constant.forDouble(Double.longBitsToDouble(0x8000000000000000L))));
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
443 break;
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
444 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
445 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
446 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
447 return result;
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
11355
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
450 @Override
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
451 public Variable emitNot(Value inputVal) {
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
452 AllocatableValue input = asAllocatable(inputVal);
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
453 Variable result = newVariable(input.getKind());
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
454 switch (input.getKind()) {
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
455 case Int:
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
456 append(new Unary1Op(INOT, result, input));
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
457 break;
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
458 case Long:
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
459 append(new Unary1Op(LNOT, result, input));
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
460 break;
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
461 default:
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
462 throw GraalInternalError.shouldNotReachHere();
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
463 }
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
464 return result;
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
465 }
01269a181628 add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents: 11290
diff changeset
466
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
467 private Variable emitBinary(AMD64Arithmetic op, boolean commutative, Value a, Value b) {
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
468 if (isConstant(b)) {
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
469 return emitBinaryConst(op, commutative, asAllocatable(a), asConstant(b));
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
470 } else if (commutative && isConstant(a)) {
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
471 return emitBinaryConst(op, commutative, asAllocatable(b), asConstant(a));
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
472 } else {
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
473 return emitBinaryVar(op, commutative, asAllocatable(a), asAllocatable(b));
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
474 }
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
475 }
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
476
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
477 private Variable emitBinaryConst(AMD64Arithmetic op, boolean commutative, AllocatableValue a, Constant b) {
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
478 switch (op) {
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
479 case IADD:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
480 case LADD:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
481 case ISUB:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
482 case LSUB:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
483 case IAND:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
484 case LAND:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
485 case IOR:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
486 case LOR:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
487 case IXOR:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
488 case LXOR:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
489 if (NumUtil.isInt(b.asLong())) {
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
490 Variable result = newVariable(a.getKind());
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
491 append(new BinaryRegConst(op, result, a, b));
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
492 return result;
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
493 }
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
494 break;
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
495
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
496 case IMUL:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
497 case LMUL:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
498 if (NumUtil.isInt(b.asLong())) {
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
499 Variable result = newVariable(a.getKind());
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
500 append(new BinaryRegStackConst(op, result, a, b));
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
501 return result;
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
502 }
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
503 break;
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
504 }
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
505
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
506 return emitBinaryVar(op, commutative, a, asAllocatable(b));
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
507 }
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
508
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
509 private Variable emitBinaryVar(AMD64Arithmetic op, boolean commutative, AllocatableValue a, AllocatableValue b) {
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
510 Variable result = newVariable(a.getKind());
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
511 if (commutative) {
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
512 append(new BinaryCommutative(op, result, a, b));
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
513 } else {
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
514 append(new BinaryRegStack(op, result, a, b));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
515 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
516 return result;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
517 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
518
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
519 @Override
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
520 public Variable emitAdd(Value a, Value b) {
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
521 switch (a.getKind().getStackKind()) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
522 case Int:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
523 return emitBinary(IADD, true, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
524 case Long:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
525 return emitBinary(LADD, true, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
526 case Float:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
527 return emitBinary(FADD, true, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
528 case Double:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
529 return emitBinary(DADD, true, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
530 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
531 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
532 }
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
533 }
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
534
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
535 @Override
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
536 public Variable emitSub(Value a, Value b) {
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
537 switch (a.getKind().getStackKind()) {
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
538 case Int:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
539 return emitBinary(ISUB, false, a, b);
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
540 case Long:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
541 return emitBinary(LSUB, false, a, b);
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
542 case Float:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
543 return emitBinary(FSUB, false, a, b);
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
544 case Double:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
545 return emitBinary(DSUB, false, a, b);
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
546 default:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
547 throw GraalInternalError.shouldNotReachHere();
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
548 }
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
549 }
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
550
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
551 @Override
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
552 public Variable emitMul(Value a, Value b) {
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
553 switch (a.getKind().getStackKind()) {
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
554 case Int:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
555 return emitBinary(IMUL, true, a, b);
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
556 case Long:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
557 return emitBinary(LMUL, true, a, b);
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
558 case Float:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
559 return emitBinary(FMUL, true, a, b);
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
560 case Double:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
561 return emitBinary(DMUL, true, a, b);
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
562 default:
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
563 throw GraalInternalError.shouldNotReachHere();
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
564 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
565 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
566
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
567 protected Value emitBinaryMemory(AMD64Arithmetic op, Kind kind, AllocatableValue a, AMD64AddressValue location, LIRFrameState state) {
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
568 Variable result = newVariable(a.getKind());
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
569 append(new BinaryMemory(op, kind, result, a, location, state));
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
570 return result;
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
571 }
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
572
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
573 protected Value emitConvert2MemoryOp(PlatformKind kind, AMD64Arithmetic op, AMD64AddressValue address, LIRFrameState state) {
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
574 Variable result = newVariable(kind);
14931
d45e8c306349 use MemOp as base class for new memory ops
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14859
diff changeset
575 append(new Unary2MemoryOp(op, result, (Kind) null, address, state));
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
576 return result;
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
577 }
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
578
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
579 protected Value emitZeroExtendMemory(Kind memoryKind, int resultBits, AMD64AddressValue address, LIRFrameState state) {
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
580 // Issue a zero extending load of the proper bit size and set the result to
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
581 // the proper kind.
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
582 Variable result = newVariable(resultBits == 32 ? Kind.Int : Kind.Long);
14859
4f5c312d676e Fix merge regressions.
Josef Eisl <josef.eisl@jku.at>
parents: 14850
diff changeset
583 append(new ZeroExtendLoadOp(memoryKind, result, address, state));
14707
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
584 return result;
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
585 }
6ce6c4ccba8f initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14633
diff changeset
586
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
587 private void emitDivRem(AMD64Arithmetic op, Value a, Value b, LIRFrameState state) {
9422
149fe42411df Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 9298
diff changeset
588 AllocatableValue rax = AMD64.rax.asValue(a.getPlatformKind());
7920
2e3e4b691835 Remove duplicate code in DivOp.
Roland Schatz <roland.schatz@oracle.com>
parents: 7919
diff changeset
589 emitMove(rax, a);
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
590 append(new DivRemOp(op, rax, asAllocatable(b), state));
7920
2e3e4b691835 Remove duplicate code in DivOp.
Roland Schatz <roland.schatz@oracle.com>
parents: 7919
diff changeset
591 }
2e3e4b691835 Remove duplicate code in DivOp.
Roland Schatz <roland.schatz@oracle.com>
parents: 7919
diff changeset
592
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
593 public Value[] emitIntegerDivRem(Value a, Value b, DeoptimizingNode deopting) {
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
594 LIRFrameState state = state(deopting);
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
595 switch (a.getKind().getStackKind()) {
7380
3207ee96b659 Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7328
diff changeset
596 case Int:
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
597 emitDivRem(IDIVREM, a, b, state);
7380
3207ee96b659 Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7328
diff changeset
598 return new Value[]{emitMove(RAX_I), emitMove(RDX_I)};
3207ee96b659 Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7328
diff changeset
599 case Long:
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
600 emitDivRem(LDIVREM, a, b, state);
7380
3207ee96b659 Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7328
diff changeset
601 return new Value[]{emitMove(RAX_L), emitMove(RDX_L)};
3207ee96b659 Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7328
diff changeset
602 default:
3207ee96b659 Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7328
diff changeset
603 throw GraalInternalError.shouldNotReachHere();
3207ee96b659 Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7328
diff changeset
604 }
3207ee96b659 Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7328
diff changeset
605 }
3207ee96b659 Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7328
diff changeset
606
3207ee96b659 Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7328
diff changeset
607 @Override
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
608 public Value emitDiv(Value a, Value b, DeoptimizingNode deopting) {
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
609 switch (a.getKind().getStackKind()) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
610 case Int:
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
611 emitDivRem(IDIV, a, b, state(deopting));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
612 return emitMove(RAX_I);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
613 case Long:
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
614 emitDivRem(LDIV, a, b, state(deopting));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
615 return emitMove(RAX_L);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
616 case Float: {
9422
149fe42411df Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 9298
diff changeset
617 Variable result = newVariable(a.getPlatformKind());
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
618 append(new BinaryRegStack(FDIV, result, asAllocatable(a), asAllocatable(b)));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
619 return result;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
620 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
621 case Double: {
9422
149fe42411df Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 9298
diff changeset
622 Variable result = newVariable(a.getPlatformKind());
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
623 append(new BinaryRegStack(DDIV, result, asAllocatable(a), asAllocatable(b)));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
624 return result;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
625 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
626 default:
4524
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4522
diff changeset
627 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
628 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
629 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
630
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
631 @Override
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
632 public Value emitRem(Value a, Value b, DeoptimizingNode deopting) {
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
633 switch (a.getKind().getStackKind()) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
634 case Int:
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
635 emitDivRem(IREM, a, b, state(deopting));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
636 return emitMove(RDX_I);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
637 case Long:
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
638 emitDivRem(LREM, a, b, state(deopting));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
639 return emitMove(RDX_L);
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6496
diff changeset
640 case Float: {
9581
d84ea522800e replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9431
diff changeset
641 Variable result = newVariable(a.getPlatformKind());
d84ea522800e replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9431
diff changeset
642 append(new FPDivRemOp(FREM, result, load(a), load(b)));
d84ea522800e replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9431
diff changeset
643 return result;
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6496
diff changeset
644 }
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6496
diff changeset
645 case Double: {
9581
d84ea522800e replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9431
diff changeset
646 Variable result = newVariable(a.getPlatformKind());
d84ea522800e replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9431
diff changeset
647 append(new FPDivRemOp(DREM, result, load(a), load(b)));
d84ea522800e replaced arithmetic_[fd]rem stubs with inline compiled code (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9431
diff changeset
648 return result;
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6496
diff changeset
649 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
650 default:
4524
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4522
diff changeset
651 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
652 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
653 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
654
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
655 @Override
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
656 public Variable emitUDiv(Value a, Value b, DeoptimizingNode deopting) {
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
657 LIRFrameState state = state(deopting);
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
658 switch (a.getKind().getStackKind()) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
659 case Int:
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
660 emitDivRem(IUDIV, a, b, state);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
661 return emitMove(RAX_I);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
662 case Long:
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
663 emitDivRem(LUDIV, a, b, state);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
664 return emitMove(RAX_L);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
665 default:
4524
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4522
diff changeset
666 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
667 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
668 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
669
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
670 @Override
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
671 public Variable emitURem(Value a, Value b, DeoptimizingNode deopting) {
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
672 LIRFrameState state = state(deopting);
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
673 switch (a.getKind().getStackKind()) {
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
674 case Int:
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
675 emitDivRem(IUREM, a, b, state);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
676 return emitMove(RDX_I);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
677 case Long:
8892
2c0c708a0ad6 Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8390
diff changeset
678 emitDivRem(LUREM, a, b, state);
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
679 return emitMove(RDX_L);
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
680 default:
4524
dcc8f5c6f394 Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4522
diff changeset
681 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
682 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
683 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
684
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
685 @Override
5539
bc647d8b0080 Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
686 public Variable emitAnd(Value a, Value b) {
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
687 switch (a.getKind().getStackKind()) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
688 case Int:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
689 return emitBinary(IAND, true, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
690 case Long:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
691 return emitBinary(LAND, true, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
692 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
693 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
694 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
695 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
696
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
697 @Override
5539
bc647d8b0080 Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
698 public Variable emitOr(Value a, Value b) {
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
699 switch (a.getKind().getStackKind()) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
700 case Int:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
701 return emitBinary(IOR, true, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
702 case Long:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
703 return emitBinary(LOR, true, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
704 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
705 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
706 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
707 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
708
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
709 @Override
5539
bc647d8b0080 Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
710 public Variable emitXor(Value a, Value b) {
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
711 switch (a.getKind().getStackKind()) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
712 case Int:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
713 return emitBinary(IXOR, true, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
714 case Long:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
715 return emitBinary(LXOR, true, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
716 default:
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
717 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
718 }
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
719 }
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
720
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
721 private Variable emitShift(AMD64Arithmetic op, Value a, Value b) {
9422
149fe42411df Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 9298
diff changeset
722 Variable result = newVariable(a.getPlatformKind());
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
723 AllocatableValue input = asAllocatable(a);
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
724 if (isConstant(b)) {
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
725 append(new BinaryRegConst(op, result, input, asConstant(b)));
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
726 } else {
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
727 emitMove(RCX_I, b);
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
728 append(new BinaryRegReg(op, result, input, RCX_I));
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
729 }
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
730 return result;
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
731 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
732
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
733 @Override
5539
bc647d8b0080 Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
734 public Variable emitShl(Value a, Value b) {
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
735 switch (a.getKind().getStackKind()) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
736 case Int:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
737 return emitShift(ISHL, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
738 case Long:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
739 return emitShift(LSHL, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
740 default:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
741 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
742 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
743 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
744
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
745 @Override
5539
bc647d8b0080 Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
746 public Variable emitShr(Value a, Value b) {
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
747 switch (a.getKind().getStackKind()) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
748 case Int:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
749 return emitShift(ISHR, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
750 case Long:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
751 return emitShift(LSHR, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
752 default:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
753 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
754 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
755 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
756
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
757 @Override
5539
bc647d8b0080 Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5538
diff changeset
758 public Variable emitUShr(Value a, Value b) {
10428
6188764e66af Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 10086
diff changeset
759 switch (a.getKind().getStackKind()) {
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
760 case Int:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
761 return emitShift(IUSHR, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
762 case Long:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
763 return emitShift(LUSHR, a, b);
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
764 default:
7919
0ae70d44ec9a Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 7910
diff changeset
765 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
766 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
767 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
768
15278
3ef4196cf8e5 use movl instead of andl for L2I
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15261
diff changeset
769 private AllocatableValue emitConvert2RegOp(PlatformKind kind, AMD64Arithmetic op, AllocatableValue input) {
12656
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
770 Variable result = newVariable(kind);
15278
3ef4196cf8e5 use movl instead of andl for L2I
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15261
diff changeset
771 append(new Unary2RegOp(op, result, input));
12656
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
772 return result;
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
773 }
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
774
14003
0c38906450a0 Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14001
diff changeset
775 private AllocatableValue emitConvert2Op(PlatformKind kind, AMD64Arithmetic op, AllocatableValue input) {
12656
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
776 Variable result = newVariable(kind);
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
777 append(new Unary2Op(op, result, input));
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
778 return result;
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
779 }
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
780
14003
0c38906450a0 Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14001
diff changeset
781 @Override
14009
384d7fc0e27b Ignore reinterpret in backend if the new Stamp has the same PlatformKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14003
diff changeset
782 public Value emitReinterpret(PlatformKind to, Value inputVal) {
12656
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
783 Kind from = inputVal.getKind();
14009
384d7fc0e27b Ignore reinterpret in backend if the new Stamp has the same PlatformKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14003
diff changeset
784 if (to == from) {
384d7fc0e27b Ignore reinterpret in backend if the new Stamp has the same PlatformKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14003
diff changeset
785 return inputVal;
384d7fc0e27b Ignore reinterpret in backend if the new Stamp has the same PlatformKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14003
diff changeset
786 }
384d7fc0e27b Ignore reinterpret in backend if the new Stamp has the same PlatformKind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14003
diff changeset
787
12656
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
788 AllocatableValue input = asAllocatable(inputVal);
13134
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
789 /*
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
790 * Conversions between integer to floating point types require moves between CPU and FPU
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
791 * registers.
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
792 */
14003
0c38906450a0 Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14001
diff changeset
793 switch ((Kind) to) {
12656
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
794 case Int:
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
795 switch (from) {
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
796 case Float:
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
797 return emitConvert2Op(to, MOV_F2I, input);
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
798 }
7530
5e3d1a68664e applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents: 7380
diff changeset
799 break;
12656
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
800 case Long:
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
801 switch (from) {
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
802 case Double:
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
803 return emitConvert2Op(to, MOV_D2L, input);
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
804 }
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
805 break;
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
806 case Float:
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
807 switch (from) {
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
808 case Int:
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
809 return emitConvert2Op(to, MOV_I2F, input);
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
810 }
7300
2912b72d840a More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7280
diff changeset
811 break;
12656
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
812 case Double:
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
813 switch (from) {
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
814 case Long:
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
815 return emitConvert2Op(to, MOV_L2D, input);
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
816 }
9334392ed279 Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents: 12604
diff changeset
817 break;
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
818 }
13134
6217f601e65d Allow addresses with an arbitrary scale value; fix handling of unsigned int-to-long conversion
Christian Wimmer <christian.wimmer@oracle.com>
parents: 12695
diff changeset
819 throw GraalInternalError.shouldNotReachHere();
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
820 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
821
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
822 public Value emitFloatConvert(FloatConvert op, Value inputVal) {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
823 AllocatableValue input = asAllocatable(inputVal);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
824 switch (op) {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
825 case D2F:
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
826 return emitConvert2Op(Kind.Float, D2F, input);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
827 case D2I:
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
828 return emitConvert2Op(Kind.Int, D2I, input);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
829 case D2L:
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
830 return emitConvert2Op(Kind.Long, D2L, input);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
831 case F2D:
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
832 return emitConvert2Op(Kind.Double, F2D, input);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
833 case F2I:
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
834 return emitConvert2Op(Kind.Int, F2I, input);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
835 case F2L:
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
836 return emitConvert2Op(Kind.Long, F2L, input);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
837 case I2D:
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
838 return emitConvert2Op(Kind.Double, I2D, input);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
839 case I2F:
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
840 return emitConvert2Op(Kind.Float, I2F, input);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
841 case L2D:
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
842 return emitConvert2Op(Kind.Double, L2D, input);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
843 case L2F:
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
844 return emitConvert2Op(Kind.Float, L2F, input);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
845 default:
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
846 throw GraalInternalError.shouldNotReachHere();
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
847 }
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
848 }
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
849
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
850 @Override
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
851 public Value emitNarrow(Value inputVal, int bits) {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
852 if (inputVal.getKind() == Kind.Long && bits <= 32) {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
853 // TODO make it possible to reinterpret Long as Int in LIR without move
15278
3ef4196cf8e5 use movl instead of andl for L2I
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15261
diff changeset
854 return emitConvert2RegOp(Kind.Int, L2I, asAllocatable(inputVal));
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
855 } else {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
856 return inputVal;
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
857 }
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
858 }
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
859
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
860 @Override
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
861 public Value emitSignExtend(Value inputVal, int fromBits, int toBits) {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
862 assert fromBits <= toBits && toBits <= 64;
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
863 if (fromBits == toBits) {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
864 return inputVal;
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
865 } else if (toBits > 32) {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
866 // sign extend to 64 bits
14001
79114edb5130 Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
867 switch (fromBits) {
79114edb5130 Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
868 case 8:
79114edb5130 Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
869 return emitConvert2Op(Kind.Long, B2L, asAllocatable(inputVal));
79114edb5130 Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
870 case 16:
79114edb5130 Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
871 return emitConvert2Op(Kind.Long, S2L, asAllocatable(inputVal));
79114edb5130 Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
872 case 32:
79114edb5130 Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
873 return emitConvert2Op(Kind.Long, I2L, asAllocatable(inputVal));
79114edb5130 Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
874 default:
79114edb5130 Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
875 throw GraalInternalError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
876 }
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
877 } else {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
878 // sign extend to 32 bits (smaller values are internally represented as 32 bit values)
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
879 switch (fromBits) {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
880 case 8:
14001
79114edb5130 Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
881 return emitConvert2Op(Kind.Int, B2I, asAllocatable(inputVal));
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
882 case 16:
14001
79114edb5130 Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 14000
diff changeset
883 return emitConvert2Op(Kind.Int, S2I, asAllocatable(inputVal));
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
884 case 32:
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
885 return inputVal;
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
886 default:
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
887 throw GraalInternalError.unimplemented("unsupported sign extension (" + fromBits + " bit -> " + toBits + " bit)");
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
888 }
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
889 }
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
890 }
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
891
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
892 @Override
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
893 public Value emitZeroExtend(Value inputVal, int fromBits, int toBits) {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
894 assert fromBits <= toBits && toBits <= 64;
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
895 if (fromBits == toBits) {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
896 return inputVal;
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
897 } else if (fromBits > 32) {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
898 assert inputVal.getKind() == Kind.Long;
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
899 Variable result = newVariable(Kind.Long);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
900 long mask = IntegerStamp.defaultMask(fromBits);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
901 append(new BinaryRegConst(AMD64Arithmetic.LAND, result, asAllocatable(inputVal), Constant.forLong(mask)));
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
902 return result;
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
903 } else {
14998
1c1818fb5ad1 Fix wrong assertion.
Roland Schatz <roland.schatz@oracle.com>
parents: 14962
diff changeset
904 assert inputVal.getKind().getStackKind() == Kind.Int;
14000
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
905 Variable result = newVariable(Kind.Int);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
906 int mask = (int) IntegerStamp.defaultMask(fromBits);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
907 append(new BinaryRegConst(AMD64Arithmetic.IAND, result, asAllocatable(inputVal), Constant.forInt(mask)));
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
908 if (toBits > 32) {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
909 Variable longResult = newVariable(Kind.Long);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
910 emitMove(longResult, result);
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
911 return longResult;
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
912 } else {
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
913 return result;
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
914 }
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
915 }
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
916 }
958c99d0790c Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents: 13999
diff changeset
917
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
918 @Override
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
919 public void emitMembar(int barriers) {
12429
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
920 int necessaryBarriers = target().arch.requiredBarriers(barriers);
5124eeec1a7b split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents: 12363
diff changeset
921 if (target().isMP && necessaryBarriers != 0) {
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4314
diff changeset
922 append(new MembarOp(necessaryBarriers));
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4314
diff changeset
923 }
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4314
diff changeset
924 }
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4314
diff changeset
925
13837
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13559
diff changeset
926 public abstract void emitCCall(long address, CallingConvention nativeCallingConvention, Value[] args, int numberOfFloatingPointArguments);
ed3a1471e133 Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 13559
diff changeset
927
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4314
diff changeset
928 @Override
9742
cff1e11941c0 moved temporaries from CallingConvention to ForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9739
diff changeset
929 protected void emitForeignCall(ForeignCallLinkage linkage, Value result, Value[] arguments, Value[] temps, LIRFrameState info) {
cff1e11941c0 moved temporaries from CallingConvention to ForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9739
diff changeset
930 long maxOffset = linkage.getMaxCallTargetOffset();
8333
e9c6fc513719 Remove last usages of scratch register. Separate runtime calls from normal method calls in LIR.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8293
diff changeset
931 if (maxOffset != (int) maxOffset) {
13212
eb03a7335eb0 Use fixed instead of virtual register for target in far foreign call, since the register allocator does not support virtual registers to be used at call sites.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 13134
diff changeset
932 append(new AMD64Call.DirectFarForeignCallOp(linkage, result, arguments, temps, info));
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4314
diff changeset
933 } else {
9744
8342b10b9cc3 rename: *RuntimeCallOp -> *ForeignCallOp
Doug Simon <doug.simon@oracle.com>
parents: 9742
diff changeset
934 append(new AMD64Call.DirectNearForeignCallOp(linkage, result, arguments, temps, info));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
935 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
936 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
937
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
938 @Override
7280
f368ec89e231 added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents: 7144
diff changeset
939 public void emitBitCount(Variable result, Value value) {
f368ec89e231 added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents: 7144
diff changeset
940 if (value.getKind().getStackKind() == Kind.Int) {
7909
afb56ecdb083 Fix usage and operand flags of AMD64BitManipulationOp.
Roland Schatz <roland.schatz@oracle.com>
parents: 7884
diff changeset
941 append(new AMD64BitManipulationOp(IPOPCNT, result, asAllocatable(value)));
7280
f368ec89e231 added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents: 7144
diff changeset
942 } else {
7909
afb56ecdb083 Fix usage and operand flags of AMD64BitManipulationOp.
Roland Schatz <roland.schatz@oracle.com>
parents: 7884
diff changeset
943 append(new AMD64BitManipulationOp(LPOPCNT, result, asAllocatable(value)));
7280
f368ec89e231 added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents: 7144
diff changeset
944 }
f368ec89e231 added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents: 7144
diff changeset
945 }
f368ec89e231 added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents: 7144
diff changeset
946
f368ec89e231 added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents: 7144
diff changeset
947 @Override
6496
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
948 public void emitBitScanForward(Variable result, Value value) {
7909
afb56ecdb083 Fix usage and operand flags of AMD64BitManipulationOp.
Roland Schatz <roland.schatz@oracle.com>
parents: 7884
diff changeset
949 append(new AMD64BitManipulationOp(BSF, result, asAllocatable(value)));
6496
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
950 }
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
951
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
952 @Override
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
953 public void emitBitScanReverse(Variable result, Value value) {
7098
e23980f4a890 Cleanup of Kind class: remove isXxx methods
Christian Wimmer <christian.wimmer@oracle.com>
parents: 7074
diff changeset
954 if (value.getKind().getStackKind() == Kind.Int) {
7909
afb56ecdb083 Fix usage and operand flags of AMD64BitManipulationOp.
Roland Schatz <roland.schatz@oracle.com>
parents: 7884
diff changeset
955 append(new AMD64BitManipulationOp(IBSR, result, asAllocatable(value)));
6496
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
956 } else {
7909
afb56ecdb083 Fix usage and operand flags of AMD64BitManipulationOp.
Roland Schatz <roland.schatz@oracle.com>
parents: 7884
diff changeset
957 append(new AMD64BitManipulationOp(LBSR, result, asAllocatable(value)));
6496
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
958 }
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
959 }
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
960
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
961 @Override
11290
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
962 public Value emitMathAbs(Value input) {
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
963 Variable result = newVariable(input.getPlatformKind());
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
964 append(new BinaryRegConst(DAND, result, asAllocatable(input), Constant.forDouble(Double.longBitsToDouble(0x7FFFFFFFFFFFFFFFL))));
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
965 return result;
6496
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
966 }
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
967
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
968 @Override
11290
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
969 public Value emitMathSqrt(Value input) {
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
970 Variable result = newVariable(input.getPlatformKind());
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
971 append(new Unary2Op(SQRT, result, asAllocatable(input)));
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
972 return result;
6496
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
973 }
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
974
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
975 @Override
11290
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
976 public Value emitMathLog(Value input, boolean base10) {
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
977 Variable result = newVariable(input.getPlatformKind());
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
978 append(new AMD64MathIntrinsicOp(base10 ? LOG10 : LOG, result, asAllocatable(input)));
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
979 return result;
6496
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
980 }
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
981
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
982 @Override
11290
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
983 public Value emitMathCos(Value input) {
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
984 Variable result = newVariable(input.getPlatformKind());
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
985 append(new AMD64MathIntrinsicOp(COS, result, asAllocatable(input)));
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
986 return result;
6496
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
987 }
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
988
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
989 @Override
11290
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
990 public Value emitMathSin(Value input) {
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
991 Variable result = newVariable(input.getPlatformKind());
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
992 append(new AMD64MathIntrinsicOp(SIN, result, asAllocatable(input)));
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
993 return result;
6496
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
994 }
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
995
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
996 @Override
11290
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
997 public Value emitMathTan(Value input) {
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
998 Variable result = newVariable(input.getPlatformKind());
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
999 append(new AMD64MathIntrinsicOp(TAN, result, asAllocatable(input)));
686d6d99352c Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents: 11289
diff changeset
1000 return result;
6496
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
1001 }
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
1002
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
1003 @Override
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
1004 public void emitByteSwap(Variable result, Value input) {
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
1005 append(new AMD64ByteSwapOp(result, input));
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
1006 }
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
1007
16d1411409b4 moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents: 6493
diff changeset
1008 @Override
13973
faa6fda7ee36 added Arrays.equals substitutions
twisti
parents: 13908
diff changeset
1009 public void emitArrayEquals(Kind kind, Variable result, Value array1, Value array2, Value length) {
faa6fda7ee36 added Arrays.equals substitutions
twisti
parents: 13908
diff changeset
1010 append(new AMD64ArrayEqualsOp(this, kind, result, array1, array2, asAllocatable(length)));
13541
63bb635911ab String.equals method substitution
twisti
parents: 13520
diff changeset
1011 }
63bb635911ab String.equals method substitution
twisti
parents: 13520
diff changeset
1012
63bb635911ab String.equals method substitution
twisti
parents: 13520
diff changeset
1013 @Override
14841
47e4d2e01c6e Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents: 14826
diff changeset
1014 public void emitReturn(Value input) {
14949
b65036798097 Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14945
diff changeset
1015 AllocatableValue operand = Value.ILLEGAL;
b65036798097 Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14945
diff changeset
1016 if (input != null) {
b65036798097 Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14945
diff changeset
1017 operand = resultOperandFor(input.getKind());
b65036798097 Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14945
diff changeset
1018 emitMove(operand, input);
b65036798097 Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14945
diff changeset
1019 }
b65036798097 Remove visitReturn from NodeLIRBuilder.
Josef Eisl <josef.eisl@jku.at>
parents: 14945
diff changeset
1020 append(new ReturnOp(operand));
4323
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4314
diff changeset
1021 }
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4314
diff changeset
1022
df5547057954 Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4314
diff changeset
1023 @Override
13294
29907e69ae8d rework of switch generation: move code into platform independent SwitchStrategy, add boolean switch strategy
Lukas Stadler <lukas.stadler@jku.at>
parents: 13268
diff changeset
1024 protected void emitStrategySwitch(SwitchStrategy strategy, Variable key, LabelRef[] keyTargets, LabelRef defaultTarget) {
13302
094f4ee93977 some javadoc for switch strategies
Lukas Stadler <lukas.stadler@jku.at>
parents: 13294
diff changeset
1025 // a temp is needed for loading object constants
13294
29907e69ae8d rework of switch generation: move code into platform independent SwitchStrategy, add boolean switch strategy
Lukas Stadler <lukas.stadler@jku.at>
parents: 13268
diff changeset
1026 boolean needsTemp = key.getKind() == Kind.Object;
29907e69ae8d rework of switch generation: move code into platform independent SwitchStrategy, add boolean switch strategy
Lukas Stadler <lukas.stadler@jku.at>
parents: 13268
diff changeset
1027 append(new StrategySwitchOp(strategy, keyTargets, defaultTarget, key, needsTemp ? newVariable(key.getKind()) : Value.ILLEGAL));
5698
764db9ada24f rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 5667
diff changeset
1028 }
764db9ada24f rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 5667
diff changeset
1029
764db9ada24f rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 5667
diff changeset
1030 @Override
764db9ada24f rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents: 5667
diff changeset
1031 protected void emitTableSwitch(int lowKey, LabelRef defaultTarget, LabelRef[] targets, Value key) {
13466
51d31106cd5e fix wrong register definition in AMD64 TableSwitchOp
Erik Eckstein <erik.eckstein@oracle.com>
parents: 13302
diff changeset
1032 append(new TableSwitchOp(lowKey, defaultTarget, targets, key, newVariable(target().wordKind), newVariable(key.getPlatformKind())));
3733
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1033 }
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1034
e233f5660da4 Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1035 }