Mercurial > hg > truffle
annotate graal/com.oracle.graal.compiler.amd64/src/com/oracle/graal/compiler/amd64/AMD64LIRGenerator.java @ 14859:4f5c312d676e
Fix merge regressions.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Thu, 27 Mar 2014 18:35:55 +0100 |
parents | fbae9be45c95 |
children | d45e8c306349 |
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; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
38 import com.oracle.graal.compiler.gen.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
39 import com.oracle.graal.graph.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
40 import com.oracle.graal.lir.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
41 import com.oracle.graal.lir.StandardOp.JumpOp; |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
42 import com.oracle.graal.lir.amd64.*; |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
43 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
|
44 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
|
45 import com.oracle.graal.lir.amd64.AMD64Arithmetic.BinaryRegConst; |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
46 import com.oracle.graal.lir.amd64.AMD64Arithmetic.BinaryRegReg; |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
47 import com.oracle.graal.lir.amd64.AMD64Arithmetic.BinaryRegStack; |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
48 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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 import com.oracle.graal.lir.amd64.AMD64Arithmetic.Unary2Op; |
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.AMD64Compare.CompareMemoryOp; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
55 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 import com.oracle.graal.lir.amd64.AMD64ControlFlow.TableSwitchOp; |
14859 | 63 import com.oracle.graal.lir.amd64.AMD64Move.LeaDataOp; |
14121
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
64 import com.oracle.graal.lir.amd64.AMD64Move.LeaOp; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
65 import com.oracle.graal.lir.amd64.AMD64Move.MembarOp; |
14121
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
66 import com.oracle.graal.lir.amd64.AMD64Move.MoveFromRegOp; |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
67 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
|
68 import com.oracle.graal.lir.amd64.AMD64Move.StackLeaOp; |
14859 | 69 import com.oracle.graal.lir.amd64.AMD64Move.ZeroExtendLoadOp; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
70 import com.oracle.graal.nodes.*; |
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
71 import com.oracle.graal.nodes.calc.*; |
14061
a3cd3403a958
Remove unused imports.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
14057
diff
changeset
|
72 import com.oracle.graal.nodes.calc.FloatConvertNode.FloatConvert; |
13999
f2b300c6e621
Refactor Stamp hierarchy.
Roland Schatz <roland.schatz@oracle.com>
parents:
13973
diff
changeset
|
73 import com.oracle.graal.nodes.type.*; |
6525
2c913b643422
rename packages in graal.phases to match project name
Doug Simon <doug.simon@oracle.com>
parents:
6521
diff
changeset
|
74 import com.oracle.graal.phases.util.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
75 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
76 /** |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
77 * 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
|
78 */ |
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
|
79 public abstract class AMD64LIRGenerator extends LIRGenerator { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
80 |
5547
b6617d13ea44
Dropping Ci* prefixes. Some additional renamings in the api.code interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5546
diff
changeset
|
81 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
|
82 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
|
83 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
|
84 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
|
85 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
|
86 |
14121
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
87 private class AMD64SpillMoveFactory implements LIR.SpillMoveFactory { |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
88 |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
89 @Override |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
90 public LIRInstruction createMove(AllocatableValue result, Value input) { |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
91 return AMD64LIRGenerator.this.createMove(result, input); |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
92 } |
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 |
14842
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
95 public AMD64LIRGenerator(Providers providers, CallingConvention cc, LIRGenerationResult lirGenRes) { |
f2e61bf2a2d8
Removed nodeOperands from LIRGenerator.
Josef Eisl <josef.eisl@jku.at>
parents:
14841
diff
changeset
|
96 super(providers, cc, lirGenRes); |
14809
73774616a6b3
Decoupled LIRGenerator and LIRGenerationResult.
Josef Eisl <josef.eisl@jku.at>
parents:
14796
diff
changeset
|
97 lirGenRes.getLIR().setSpillMoveFactory(new AMD64SpillMoveFactory()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
98 } |
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 @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
|
101 public boolean canStoreConstant(Constant c, boolean isCompressed) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
102 // 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
|
103 switch (c.getKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
104 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
|
105 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
|
106 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
|
107 } |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
108 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
|
109 case Double: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
110 return false; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
111 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
|
112 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
|
113 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
|
114 } |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
115 return c.isNull(); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
116 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
117 return true; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
118 } |
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 @Override |
5538
e18ba36bfebc
Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5510
diff
changeset
|
122 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
|
123 switch (c.getKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
124 case Long: |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
125 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
|
126 case Object: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
127 return c.isNull(); |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
128 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
129 return true; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
130 } |
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 |
4314
9ce8594bedaf
Allow CiAddress as Input and Alive operands of LIR instructions.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4280
diff
changeset
|
133 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
134 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
|
135 PlatformKind kind; |
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14001
diff
changeset
|
136 if (input instanceof Constant) { |
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14001
diff
changeset
|
137 kind = input.getKind().getStackKind(); |
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14001
diff
changeset
|
138 } else { |
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14001
diff
changeset
|
139 kind = input.getPlatformKind(); |
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14001
diff
changeset
|
140 } |
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14001
diff
changeset
|
141 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
|
142 emitMove(result, input); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
143 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
144 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
145 |
14121
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
146 protected AMD64LIRInstruction createMove(AllocatableValue dst, Value src) { |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
147 if (src instanceof AMD64AddressValue) { |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
148 return new LeaOp(dst, (AMD64AddressValue) src); |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
149 } else if (isRegister(src) || isStackSlot(dst)) { |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
150 return new MoveFromRegOp(dst, src); |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
151 } else { |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
152 return new MoveToRegOp(dst, src); |
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
153 } |
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 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
156 @Override |
9296
1342574c4f7d
Move targets can only be AllocatableValues.
Roland Schatz <roland.schatz@oracle.com>
parents:
9294
diff
changeset
|
157 public void emitMove(AllocatableValue dst, Value src) { |
14121
0ddb3b3665bd
Backed out changeset: 38c881305352
Roland Schatz <roland.schatz@oracle.com>
parents:
14061
diff
changeset
|
158 append(createMove(dst, src)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
159 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
160 |
14859 | 161 public void emitData(AllocatableValue dst, byte[] data) { |
162 append(new LeaDataOp(dst, data)); | |
163 } | |
164 | |
9298
9ee5f3bfa755
Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
9297
diff
changeset
|
165 @Override |
9ee5f3bfa755
Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
9297
diff
changeset
|
166 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
|
167 AllocatableValue baseRegister; |
9204
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
168 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
|
169 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
|
170 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
|
171 baseRegister = Value.ILLEGAL; |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
172 } 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
|
173 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
|
174 baseRegister = Value.ILLEGAL; |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
175 } else { |
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
176 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
|
177 } |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
178 } else { |
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
179 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
|
180 } |
c6d003891de0
Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7839
diff
changeset
|
181 |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
182 AllocatableValue indexRegister; |
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
183 Scale scaleEnum; |
9638
c455c86138ba
Value: more occurrences of object equality replaced
Bernhard Urban <bernhard.urban@jku.at>
parents:
9613
diff
changeset
|
184 if (!index.equals(Value.ILLEGAL) && scale != 0) { |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
185 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
|
186 if (isConstant(index)) { |
9204
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
187 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
|
188 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
|
189 |
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 } 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
|
191 /* 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
|
192 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
|
193 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
|
194 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
|
195 } 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
|
196 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
|
197 } |
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 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
|
199 |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
200 } else { |
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
201 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
|
202 } |
c6d003891de0
Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7839
diff
changeset
|
203 } else { |
9294
899295127bc4
Get rid of the distinction between UNUSED and ILLEGAL value.
Roland Schatz <roland.schatz@oracle.com>
parents:
9293
diff
changeset
|
204 indexRegister = Value.ILLEGAL; |
8166
d2733c9b3d0e
Convert AMD64Address to CompositeValue.
Roland Schatz <roland.schatz@oracle.com>
parents:
8144
diff
changeset
|
205 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
|
206 } |
c6d003891de0
Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7839
diff
changeset
|
207 |
9204
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
208 int displacementInt; |
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
209 if (NumUtil.isInt(finalDisp)) { |
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
210 displacementInt = (int) finalDisp; |
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
211 } else { |
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
212 displacementInt = 0; |
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
213 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
|
214 if (baseRegister.equals(Value.ILLEGAL)) { |
9204
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
215 baseRegister = displacementRegister; |
10086 | 216 } else if (indexRegister.equals(Value.ILLEGAL)) { |
9204
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
217 indexRegister = displacementRegister; |
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
218 scaleEnum = Scale.Times1; |
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
219 } else { |
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
220 baseRegister = emitAdd(baseRegister, displacementRegister); |
589e140a7f1c
Allow locations to have long displacements.
Roland Schatz <roland.schatz@oracle.com>
parents:
9003
diff
changeset
|
221 } |
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 |
9293
d006c9920e94
Make kind of LIR memory access operations explicit.
Roland Schatz <roland.schatz@oracle.com>
parents:
9204
diff
changeset
|
224 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
|
225 } |
c6d003891de0
Get rid of all direct usages of Address outside of backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7839
diff
changeset
|
226 |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
227 public AMD64AddressValue asAddressValue(Value address) { |
9298
9ee5f3bfa755
Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
9297
diff
changeset
|
228 if (address instanceof AMD64AddressValue) { |
9ee5f3bfa755
Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
9297
diff
changeset
|
229 return (AMD64AddressValue) address; |
9ee5f3bfa755
Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
9297
diff
changeset
|
230 } else { |
9ee5f3bfa755
Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
9297
diff
changeset
|
231 return emitAddress(address, 0, Value.ILLEGAL, 0); |
9ee5f3bfa755
Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
9297
diff
changeset
|
232 } |
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 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
235 @Override |
9298
9ee5f3bfa755
Restructure load/store/lea LIR instructions.
Roland Schatz <roland.schatz@oracle.com>
parents:
9297
diff
changeset
|
236 public Variable emitAddress(StackSlot address) { |
4206
430b5db3e6f8
Remove CiVariable from the CRI
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4199
diff
changeset
|
237 Variable result = newVariable(target().wordKind); |
7882
124b28240347
Separate STACK and ADDR nodes in LIR.
Roland Schatz <roland.schatz@oracle.com>
parents:
7880
diff
changeset
|
238 append(new StackLeaOp(result, address)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
239 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
240 } |
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 @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
|
243 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
|
244 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
|
245 append(new JumpOp(label)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
246 } |
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 @Override |
13908
8f3cd93813f1
Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents:
13907
diff
changeset
|
249 public void emitCompareBranch(Value left, Value right, Condition cond, boolean unorderedIsTrue, LabelRef trueLabel, LabelRef falseLabel, double trueLabelProbability) { |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
250 boolean mirrored = emitCompare(left, right); |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
251 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
|
252 switch (left.getKind().getStackKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
253 case Int: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
254 case Long: |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
255 case Object: |
13908
8f3cd93813f1
Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents:
13907
diff
changeset
|
256 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
|
257 break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
258 case Float: |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
259 case Double: |
13908
8f3cd93813f1
Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents:
13907
diff
changeset
|
260 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
|
261 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
262 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
263 throw GraalInternalError.shouldNotReachHere("" + left.getKind()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
264 } |
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 @Override |
13908
8f3cd93813f1
Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents:
13907
diff
changeset
|
268 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
|
269 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
|
270 } |
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 @Override |
13908
8f3cd93813f1
Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents:
13907
diff
changeset
|
273 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
|
274 emitIntegerTest(left, right); |
13908
8f3cd93813f1
Use branch probability for emitting conditional jump.
Roland Schatz <roland.schatz@oracle.com>
parents:
13907
diff
changeset
|
275 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
|
276 } |
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 @Override |
301cff1a99d1
backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
279 public Variable emitConditionalMove(Value left, Value right, Condition cond, boolean unorderedIsTrue, Value trueValue, Value falseValue) { |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
280 boolean mirrored = emitCompare(left, right); |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
281 Condition finalCondition = mirrored ? cond.mirror() : cond; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
282 |
6329
92bc58dc5b5e
More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5798
diff
changeset
|
283 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
|
284 switch (left.getKind().getStackKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
285 case Int: |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
286 case Long: |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
287 case Object: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
288 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
|
289 break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
290 case Float: |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
291 case Double: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
292 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
|
293 break; |
7725
301cff1a99d1
backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
294 default: |
301cff1a99d1
backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
295 throw GraalInternalError.shouldNotReachHere("" + left.getKind()); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
296 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
297 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
298 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
299 |
7725
301cff1a99d1
backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
300 @Override |
301cff1a99d1
backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
301 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
|
302 emitIntegerTest(left, right); |
301cff1a99d1
backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
303 Variable result = newVariable(trueValue.getKind()); |
301cff1a99d1
backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
304 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
|
305 return result; |
301cff1a99d1
backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
306 } |
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 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
|
309 assert a.getKind().isNumericInteger(); |
7725
301cff1a99d1
backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
310 if (LIRValueUtil.isVariable(b)) { |
301cff1a99d1
backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
311 append(new AMD64TestOp(load(b), loadNonConst(a))); |
301cff1a99d1
backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
312 } else { |
301cff1a99d1
backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
313 append(new AMD64TestOp(load(a), loadNonConst(b))); |
301cff1a99d1
backend support for integer test operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
7660
diff
changeset
|
314 } |
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 |
13251
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
317 protected void emitCompareOp(Variable left, Value right) { |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
318 switch (left.getKind().getStackKind()) { |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
319 case Int: |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
320 append(new CompareOp(ICMP, left, right)); |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
321 break; |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
322 case Long: |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
323 append(new CompareOp(LCMP, left, right)); |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
324 break; |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
325 case Object: |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
326 append(new CompareOp(ACMP, left, right)); |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
327 break; |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
328 case Float: |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
329 append(new CompareOp(FCMP, 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 Double: |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
332 append(new CompareOp(DCMP, 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 default: |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
335 throw GraalInternalError.shouldNotReachHere(); |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
336 } |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
337 } |
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
338 |
14707
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
339 protected void emitCompareMemoryConOp(Kind kind, AMD64AddressValue left, Value right, LIRFrameState state) { |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
340 assert kind == right.getKind(); |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
341 switch (kind) { |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
342 case Int: |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
343 append(new CompareMemoryOp(ICMP, left, right, state)); |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
344 break; |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
345 case Long: |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
346 append(new CompareMemoryOp(LCMP, left, right, state)); |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
347 break; |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
348 default: |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
349 throw GraalInternalError.shouldNotReachHere(); |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
350 } |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
351 } |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
352 |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
353 protected void emitCompareRegMemoryOp(Kind kind, Value left, AMD64AddressValue right, LIRFrameState state) { |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
354 switch (kind) { |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
355 case Int: |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
356 append(new CompareMemoryOp(ICMP, left, right, state)); |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
357 break; |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
358 case Long: |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
359 append(new CompareMemoryOp(LCMP, left, right, state)); |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
360 break; |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
361 case Object: |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
362 append(new CompareMemoryOp(ACMP, left, right, state)); |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
363 break; |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
364 case Float: |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
365 append(new CompareMemoryOp(FCMP, left, right, state)); |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
366 break; |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
367 case Double: |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
368 append(new CompareMemoryOp(DCMP, left, right, state)); |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
369 break; |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
370 default: |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
371 throw GraalInternalError.shouldNotReachHere(); |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
372 } |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
373 } |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
374 |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
375 /** |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
376 * 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
|
377 * it did so. |
14850 | 378 * |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
379 * @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
|
380 * @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
|
381 * @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
|
382 */ |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
383 private boolean emitCompare(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
|
384 Variable left; |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
385 Value right; |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
386 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
|
387 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
|
388 left = load(b); |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
389 right = loadNonConst(a); |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
390 mirrored = true; |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
391 } else { |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
392 left = load(a); |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
393 right = loadNonConst(b); |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
394 mirrored = false; |
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
395 } |
13251
3a8a4042229f
Refactor emission of compare op.
Roland Schatz <roland.schatz@oracle.com>
parents:
13212
diff
changeset
|
396 emitCompareOp(left, right); |
5406
ae759e820ce7
AMD64LIRGenerator: reorder compare operands to prevent unnecessary loads of constants
Lukas Stadler <lukas.stadler@jku.at>
parents:
5402
diff
changeset
|
397 return mirrored; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
398 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
399 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
400 @Override |
7910
748cb57f53cb
Cleanup Op1 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7909
diff
changeset
|
401 public Variable emitNegate(Value inputVal) { |
748cb57f53cb
Cleanup Op1 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7909
diff
changeset
|
402 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
|
403 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
|
404 switch (input.getKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
405 case Int: |
7910
748cb57f53cb
Cleanup Op1 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7909
diff
changeset
|
406 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
|
407 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
408 case Long: |
7910
748cb57f53cb
Cleanup Op1 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7909
diff
changeset
|
409 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
|
410 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
411 case Float: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
412 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
|
413 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
414 case Double: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
415 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
|
416 break; |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
417 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
418 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
419 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
420 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
421 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
422 |
11355
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
423 @Override |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
424 public Variable emitNot(Value inputVal) { |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
425 AllocatableValue input = asAllocatable(inputVal); |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
426 Variable result = newVariable(input.getKind()); |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
427 switch (input.getKind()) { |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
428 case Int: |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
429 append(new Unary1Op(INOT, result, input)); |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
430 break; |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
431 case Long: |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
432 append(new Unary1Op(LNOT, result, input)); |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
433 break; |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
434 default: |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
435 throw GraalInternalError.shouldNotReachHere(); |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
436 } |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
437 return result; |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
438 } |
01269a181628
add bitwise "not" operation
Lukas Stadler <lukas.stadler@jku.at>
parents:
11290
diff
changeset
|
439 |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
440 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
|
441 if (isConstant(b)) { |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
442 return emitBinaryConst(op, commutative, asAllocatable(a), asConstant(b)); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
443 } else if (commutative && isConstant(a)) { |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
444 return emitBinaryConst(op, commutative, asAllocatable(b), asConstant(a)); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
445 } else { |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
446 return emitBinaryVar(op, commutative, asAllocatable(a), asAllocatable(b)); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
447 } |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
448 } |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
449 |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
450 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
|
451 switch (op) { |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
452 case IADD: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
453 case LADD: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
454 case ISUB: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
455 case LSUB: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
456 case IAND: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
457 case LAND: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
458 case IOR: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
459 case LOR: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
460 case IXOR: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
461 case LXOR: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
462 if (NumUtil.isInt(b.asLong())) { |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
463 Variable result = newVariable(a.getKind()); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
464 append(new BinaryRegConst(op, result, a, b)); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
465 return result; |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
466 } |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
467 break; |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
468 |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
469 case IMUL: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
470 case LMUL: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
471 if (NumUtil.isInt(b.asLong())) { |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
472 Variable result = newVariable(a.getKind()); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
473 append(new BinaryRegStackConst(op, result, a, b)); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
474 return result; |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
475 } |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
476 break; |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
477 } |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
478 |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
479 return emitBinaryVar(op, commutative, a, asAllocatable(b)); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
480 } |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
481 |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
482 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
|
483 Variable result = newVariable(a.getKind()); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
484 if (commutative) { |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
485 append(new BinaryCommutative(op, result, a, b)); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
486 } else { |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
487 append(new BinaryRegStack(op, result, a, b)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
488 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
489 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
490 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
491 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
492 @Override |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
493 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
|
494 switch (a.getKind().getStackKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
495 case Int: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
496 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
|
497 case Long: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
498 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
|
499 case Float: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
500 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
|
501 case Double: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
502 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
|
503 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
504 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
505 } |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
506 } |
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 @Override |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
509 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
|
510 switch (a.getKind().getStackKind()) { |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
511 case Int: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
512 return emitBinary(ISUB, false, a, b); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
513 case Long: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
514 return emitBinary(LSUB, false, a, b); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
515 case Float: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
516 return emitBinary(FSUB, false, a, b); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
517 case Double: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
518 return emitBinary(DSUB, false, a, b); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
519 default: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
520 throw GraalInternalError.shouldNotReachHere(); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
521 } |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
522 } |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
523 |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
524 @Override |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
525 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
|
526 switch (a.getKind().getStackKind()) { |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
527 case Int: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
528 return emitBinary(IMUL, true, a, b); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
529 case Long: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
530 return emitBinary(LMUL, true, a, b); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
531 case Float: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
532 return emitBinary(FMUL, true, a, b); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
533 case Double: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
534 return emitBinary(DMUL, true, a, b); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
535 default: |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
536 throw GraalInternalError.shouldNotReachHere(); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
537 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
538 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
539 |
14707
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
540 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
|
541 Variable result = newVariable(a.getKind()); |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
542 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
|
543 return result; |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
544 } |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
545 |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
546 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
|
547 Variable result = newVariable(kind); |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
548 append(new Unary2MemoryOp(op, result, address, state)); |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
549 return result; |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
550 } |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
551 |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
552 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
|
553 // 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
|
554 // the proper kind. |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
555 Variable result = newVariable(resultBits == 32 ? Kind.Int : Kind.Long); |
14859 | 556 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
|
557 return result; |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
558 } |
6ce6c4ccba8f
initial support for memory arithmetic on x86
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14633
diff
changeset
|
559 |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
560 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
|
561 AllocatableValue rax = AMD64.rax.asValue(a.getPlatformKind()); |
7920
2e3e4b691835
Remove duplicate code in DivOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
562 emitMove(rax, a); |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
563 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
|
564 } |
2e3e4b691835
Remove duplicate code in DivOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
7919
diff
changeset
|
565 |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
566 public Value[] emitIntegerDivRem(Value a, Value b, DeoptimizingNode deopting) { |
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
567 LIRFrameState state = state(deopting); |
10428
6188764e66af
Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
10086
diff
changeset
|
568 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
|
569 case Int: |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
570 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
|
571 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
|
572 case Long: |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
573 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
|
574 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
|
575 default: |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
576 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
|
577 } |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
578 } |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
579 |
3207ee96b659
Added possibility for platform-specific peephole optimizations. Added combining div/rem optimization.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
7328
diff
changeset
|
580 @Override |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
581 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
|
582 switch (a.getKind().getStackKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
583 case Int: |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
584 emitDivRem(IDIV, a, b, state(deopting)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
585 return emitMove(RAX_I); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
586 case Long: |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
587 emitDivRem(LDIV, a, b, state(deopting)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
588 return emitMove(RAX_L); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
589 case Float: { |
9422
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9298
diff
changeset
|
590 Variable result = newVariable(a.getPlatformKind()); |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
591 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
|
592 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
593 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
594 case Double: { |
9422
149fe42411df
Use platform specific kind in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
9298
diff
changeset
|
595 Variable result = newVariable(a.getPlatformKind()); |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
596 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
|
597 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
598 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
599 default: |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
600 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
601 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
602 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
603 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
604 @Override |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
605 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
|
606 switch (a.getKind().getStackKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
607 case Int: |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
608 emitDivRem(IREM, a, b, state(deopting)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
609 return emitMove(RDX_I); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
610 case Long: |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
611 emitDivRem(LREM, a, b, state(deopting)); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
612 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
|
613 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
|
614 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
|
615 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
|
616 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
|
617 } |
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
|
618 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
|
619 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
|
620 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
|
621 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
|
622 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
623 default: |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
624 throw GraalInternalError.shouldNotReachHere(); |
3733
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 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
627 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
628 @Override |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
629 public Variable emitUDiv(Value a, Value b, DeoptimizingNode deopting) { |
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
630 LIRFrameState state = state(deopting); |
10428
6188764e66af
Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
10086
diff
changeset
|
631 switch (a.getKind().getStackKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
632 case Int: |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
633 emitDivRem(IUDIV, a, b, state); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
634 return emitMove(RAX_I); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
635 case Long: |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
636 emitDivRem(LUDIV, a, b, state); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
637 return emitMove(RAX_L); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
638 default: |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
639 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
640 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
641 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
642 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
643 @Override |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
644 public Variable emitURem(Value a, Value b, DeoptimizingNode deopting) { |
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
645 LIRFrameState state = state(deopting); |
10428
6188764e66af
Use stack kind to determine instruction in AMD64LIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
10086
diff
changeset
|
646 switch (a.getKind().getStackKind()) { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
647 case Int: |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
648 emitDivRem(IUREM, a, b, state); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
649 return emitMove(RDX_I); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
650 case Long: |
8892
2c0c708a0ad6
Introduce DeoptimizingNode interface
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
8390
diff
changeset
|
651 emitDivRem(LUREM, a, b, state); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
652 return emitMove(RDX_L); |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
653 default: |
4524
dcc8f5c6f394
Refactorings to prepare for LIR project splitting
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4522
diff
changeset
|
654 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
655 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
656 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
657 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
658 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
659 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
|
660 switch (a.getKind().getStackKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
661 case Int: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
662 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
|
663 case Long: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
664 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
|
665 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
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 |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
671 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
|
672 switch (a.getKind().getStackKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
673 case Int: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
674 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
|
675 case Long: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
676 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
|
677 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
678 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
679 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
680 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
681 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
682 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
683 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
|
684 switch (a.getKind().getStackKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
685 case Int: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
686 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
|
687 case Long: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
688 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
|
689 default: |
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
690 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
691 } |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
692 } |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
693 |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
694 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
|
695 Variable result = newVariable(a.getPlatformKind()); |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
696 AllocatableValue input = asAllocatable(a); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
697 if (isConstant(b)) { |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
698 append(new BinaryRegConst(op, result, input, asConstant(b))); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
699 } else { |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
700 emitMove(RCX_I, b); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
701 append(new BinaryRegReg(op, result, input, RCX_I)); |
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
702 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
703 return result; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
704 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
705 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
706 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
707 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
|
708 switch (a.getKind().getStackKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
709 case Int: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
710 return emitShift(ISHL, a, b); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
711 case Long: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
712 return emitShift(LSHL, a, b); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
713 default: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
714 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
715 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
716 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
717 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
718 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
719 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
|
720 switch (a.getKind().getStackKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
721 case Int: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
722 return emitShift(ISHR, a, b); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
723 case Long: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
724 return emitShift(LSHR, a, b); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
725 default: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
726 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
727 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
728 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
729 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
730 @Override |
5539
bc647d8b0080
Renaming RiValue => Value.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5538
diff
changeset
|
731 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
|
732 switch (a.getKind().getStackKind()) { |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
733 case Int: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
734 return emitShift(IUSHR, a, b); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
735 case Long: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
736 return emitShift(LUSHR, a, b); |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
737 default: |
7919
0ae70d44ec9a
Restructure Op2 in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
7910
diff
changeset
|
738 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
739 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
740 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
741 |
14003
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14001
diff
changeset
|
742 private AllocatableValue emitConvert1Op(PlatformKind kind, AMD64Arithmetic op, AllocatableValue input) { |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
743 Variable result = newVariable(kind); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
744 append(new Unary1Op(op, result, input)); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
745 return result; |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
746 } |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
747 |
14003
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14001
diff
changeset
|
748 private AllocatableValue emitConvert2Op(PlatformKind kind, AMD64Arithmetic op, AllocatableValue input) { |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
749 Variable result = newVariable(kind); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
750 append(new Unary2Op(op, result, input)); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
751 return result; |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
752 } |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
753 |
14003
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14001
diff
changeset
|
754 @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
|
755 public Value emitReinterpret(PlatformKind to, Value inputVal) { |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
756 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
|
757 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
|
758 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
|
759 } |
384d7fc0e27b
Ignore reinterpret in backend if the new Stamp has the same PlatformKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
14003
diff
changeset
|
760 |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
761 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
|
762 /* |
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
|
763 * 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
|
764 * 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
|
765 */ |
14003
0c38906450a0
Make conversion from Stamp to PlatformKind extensible by backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14001
diff
changeset
|
766 switch ((Kind) to) { |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
767 case Int: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
768 switch (from) { |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
769 case Float: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
770 return emitConvert2Op(to, MOV_F2I, input); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
771 } |
7530
5e3d1a68664e
applied mx eclipseformat to all Java files
Doug Simon <doug.simon@oracle.com>
parents:
7380
diff
changeset
|
772 break; |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
773 case Long: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
774 switch (from) { |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
775 case Double: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
776 return emitConvert2Op(to, MOV_D2L, input); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
777 } |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
778 break; |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
779 case Float: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
780 switch (from) { |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
781 case Int: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
782 return emitConvert2Op(to, MOV_I2F, input); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
783 } |
7300
2912b72d840a
More complete and reusable Word type
Christian Wimmer <christian.wimmer@oracle.com>
parents:
7280
diff
changeset
|
784 break; |
12656
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
785 case Double: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
786 switch (from) { |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
787 case Long: |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
788 return emitConvert2Op(to, MOV_L2D, input); |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
789 } |
9334392ed279
Refactor ConvertNode.
Roland Schatz <roland.schatz@oracle.com>
parents:
12604
diff
changeset
|
790 break; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
791 } |
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
|
792 throw GraalInternalError.shouldNotReachHere(); |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
793 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
794 |
14000
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
795 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
|
796 AllocatableValue input = asAllocatable(inputVal); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
797 switch (op) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
798 case D2F: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
799 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
|
800 case D2I: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
801 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
|
802 case D2L: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
803 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
|
804 case F2D: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
805 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
|
806 case F2I: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
807 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
|
808 case F2L: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
809 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
|
810 case I2D: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
811 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
|
812 case I2F: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
813 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
|
814 case L2D: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
815 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
|
816 case L2F: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
817 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
|
818 default: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
819 throw GraalInternalError.shouldNotReachHere(); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
820 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
821 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
822 |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
823 @Override |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
824 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
|
825 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
|
826 // TODO make it possible to reinterpret Long as Int in LIR without move |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
827 return emitConvert1Op(Kind.Int, L2I, asAllocatable(inputVal)); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
828 } else { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
829 return inputVal; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
830 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
831 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
832 |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
833 @Override |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
834 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
|
835 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
|
836 if (fromBits == toBits) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
837 return inputVal; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
838 } else if (toBits > 32) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
839 // sign extend to 64 bits |
14001
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
840 switch (fromBits) { |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
841 case 8: |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
842 return emitConvert2Op(Kind.Long, B2L, asAllocatable(inputVal)); |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
843 case 16: |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
844 return emitConvert2Op(Kind.Long, S2L, asAllocatable(inputVal)); |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
845 case 32: |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
846 return emitConvert2Op(Kind.Long, I2L, asAllocatable(inputVal)); |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
847 default: |
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
848 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
|
849 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
850 } else { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
851 // 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
|
852 switch (fromBits) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
853 case 8: |
14001
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
854 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
|
855 case 16: |
14001
79114edb5130
Explicit x2L instructions in AMD64 backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
14000
diff
changeset
|
856 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
|
857 case 32: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
858 return inputVal; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
859 default: |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
860 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
|
861 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
862 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
863 } |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
864 |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
865 @Override |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
866 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
|
867 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
|
868 if (fromBits == toBits) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
869 return inputVal; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
870 } else if (fromBits > 32) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
871 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
|
872 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
|
873 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
|
874 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
|
875 return result; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
876 } else { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
877 assert inputVal.getKind() == Kind.Int; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
878 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
|
879 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
|
880 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
|
881 if (toBits > 32) { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
882 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
|
883 emitMove(longResult, result); |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
884 return longResult; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
885 } else { |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
886 return result; |
958c99d0790c
Split convert node into separate nodes for different conversions.
Roland Schatz <roland.schatz@oracle.com>
parents:
13999
diff
changeset
|
887 } |
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 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
891 @Override |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
892 public void emitMembar(int barriers) { |
12429
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
893 int necessaryBarriers = target().arch.requiredBarriers(barriers); |
5124eeec1a7b
split HotSpotRuntime into separate provider implementations
Doug Simon <doug.simon@oracle.com>
parents:
12363
diff
changeset
|
894 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
|
895 append(new MembarOp(necessaryBarriers)); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
896 } |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
897 } |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
898 |
13837
ed3a1471e133
Add the Graal Native Function Interface
Matthias Grimmer <grimmer@ssw.jku.at>
parents:
13559
diff
changeset
|
899 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
|
900 |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
901 @Override |
9742
cff1e11941c0
moved temporaries from CallingConvention to ForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents:
9739
diff
changeset
|
902 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
|
903 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
|
904 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
|
905 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
|
906 } else { |
9744
8342b10b9cc3
rename: *RuntimeCallOp -> *ForeignCallOp
Doug Simon <doug.simon@oracle.com>
parents:
9742
diff
changeset
|
907 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
|
908 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
909 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
910 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
911 @Override |
7280
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
912 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
|
913 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
|
914 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
|
915 } else { |
7909
afb56ecdb083
Fix usage and operand flags of AMD64BitManipulationOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
7884
diff
changeset
|
916 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
|
917 } |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
918 } |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
919 |
f368ec89e231
added intrinsifications for Integer.bitCount() and Long.bitCount()
Doug Simon <doug.simon@oracle.com>
parents:
7144
diff
changeset
|
920 @Override |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
921 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
|
922 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
|
923 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
924 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
925 @Override |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
926 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
|
927 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
|
928 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
|
929 } else { |
7909
afb56ecdb083
Fix usage and operand flags of AMD64BitManipulationOp.
Roland Schatz <roland.schatz@oracle.com>
parents:
7884
diff
changeset
|
930 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
|
931 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
932 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
933 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
934 @Override |
11290
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
935 public Value emitMathAbs(Value input) { |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
936 Variable result = newVariable(input.getPlatformKind()); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
937 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
|
938 return result; |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
939 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
940 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
941 @Override |
11290
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
942 public Value emitMathSqrt(Value input) { |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
943 Variable result = newVariable(input.getPlatformKind()); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
944 append(new Unary2Op(SQRT, result, asAllocatable(input))); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
945 return result; |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
946 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
947 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
948 @Override |
11290
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
949 public Value emitMathLog(Value input, boolean base10) { |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
950 Variable result = newVariable(input.getPlatformKind()); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
951 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
|
952 return result; |
6496
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
953 } |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
954 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
955 @Override |
11290
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
956 public Value emitMathCos(Value input) { |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
957 Variable result = newVariable(input.getPlatformKind()); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
958 append(new AMD64MathIntrinsicOp(COS, result, asAllocatable(input))); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
959 return result; |
6496
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 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
962 @Override |
11290
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
963 public Value emitMathSin(Value input) { |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
964 Variable result = newVariable(input.getPlatformKind()); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
965 append(new AMD64MathIntrinsicOp(SIN, result, asAllocatable(input))); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
966 return result; |
6496
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 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
969 @Override |
11290
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
970 public Value emitMathTan(Value input) { |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
971 Variable result = newVariable(input.getPlatformKind()); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
972 append(new AMD64MathIntrinsicOp(TAN, result, asAllocatable(input))); |
686d6d99352c
Move MathIntrinsic operations to ArithmeticLIRGenerator.
Roland Schatz <roland.schatz@oracle.com>
parents:
11289
diff
changeset
|
973 return result; |
6496
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 |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
976 @Override |
16d1411409b4
moved AMD64 specific code into com.oracle.graal.compiler.amd64
Doug Simon <doug.simon@oracle.com>
parents:
6493
diff
changeset
|
977 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
|
978 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
|
979 } |
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 @Override |
13973 | 982 public void emitArrayEquals(Kind kind, Variable result, Value array1, Value array2, Value length) { |
983 append(new AMD64ArrayEqualsOp(this, kind, result, array1, array2, asAllocatable(length))); | |
13541 | 984 } |
985 | |
986 @Override | |
14841
47e4d2e01c6e
Split LIRGenerator and fix AMD64 backend.
Josef Eisl <josef.eisl@jku.at>
parents:
14826
diff
changeset
|
987 public void emitReturn(Value input) { |
4323
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
988 append(new ReturnOp(input)); |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
989 } |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
990 |
df5547057954
Remove LIROpcode and use non-anonymous subclasses of LIRInstruction
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
4314
diff
changeset
|
991 @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
|
992 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
|
993 // 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
|
994 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
|
995 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
|
996 } |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
997 |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
998 @Override |
764db9ada24f
rework of switch operations: unify lookup- and tableswitch, introduce switch lir instructions
Lukas Stadler <lukas.stadler@jku.at>
parents:
5667
diff
changeset
|
999 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
|
1000 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
|
1001 } |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1002 |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1003 } |