Mercurial > hg > truffle
annotate graal/com.oracle.graal.lir.sparc/src/com/oracle/graal/lir/sparc/SPARCByteSwapOp.java @ 19526:8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 20 Feb 2015 22:22:55 +0100 |
parents | b856446ff7e0 |
children | 96ab2078eeaf |
rev | line source |
---|---|
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
1 /* |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18425
diff
changeset
|
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
4 * |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
8 * |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
14 * |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
18 * |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
21 * questions. |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
22 */ |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.lir.sparc; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
24 |
16518
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15193
diff
changeset
|
25 import static com.oracle.graal.api.code.ValueUtil.*; |
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15193
diff
changeset
|
26 import static com.oracle.graal.lir.LIRInstruction.OperandFlag.*; |
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15193
diff
changeset
|
27 |
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15193
diff
changeset
|
28 import com.oracle.graal.api.code.*; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
29 import com.oracle.graal.api.meta.*; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
30 import com.oracle.graal.asm.sparc.*; |
16519
2b91702c4e69
[SPARC] Fixing IntegerBits
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16518
diff
changeset
|
31 import com.oracle.graal.asm.sparc.SPARCAssembler.*; |
15193
96bb07a5d667
Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents:
13227
diff
changeset
|
32 import com.oracle.graal.compiler.common.*; |
9856
fbeda9df497d
implemented workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=409824
Doug Simon <doug.simon@oracle.com>
parents:
9846
diff
changeset
|
33 import com.oracle.graal.lir.*; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
34 import com.oracle.graal.lir.asm.*; |
16518
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15193
diff
changeset
|
35 import com.oracle.graal.lir.gen.*; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
36 |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
37 @Opcode("BSWAP") |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18425
diff
changeset
|
38 public final class SPARCByteSwapOp extends SPARCLIRInstruction implements SPARCTailDelayedLIRInstruction { |
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18425
diff
changeset
|
39 public static final LIRInstructionClass<SPARCByteSwapOp> TYPE = LIRInstructionClass.create(SPARCByteSwapOp.class); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
40 |
16518
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15193
diff
changeset
|
41 @Def({REG, HINT}) protected Value result; |
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15193
diff
changeset
|
42 @Use({REG}) protected Value input; |
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15193
diff
changeset
|
43 @Temp({REG}) protected Value tempIndex; |
18425
b856446ff7e0
Introduce StackSlotValue and VirtualStackSlot.
Josef Eisl <josef.eisl@jku.at>
parents:
18149
diff
changeset
|
44 @Use({STACK}) protected StackSlotValue tmpSlot; |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
45 |
16518
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15193
diff
changeset
|
46 public SPARCByteSwapOp(LIRGeneratorTool tool, Value result, Value input) { |
19526
8fc336a04d77
Create TYPE fields for LIRInstruction and CompositeValue. Renaming NodeClass#get to NodeClass#create.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18425
diff
changeset
|
47 super(TYPE); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
48 this.result = result; |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
49 this.input = input; |
18149
c6086a18c9ce
Rename LIRGenerationResult.getFrameMap() to getFrameMapBuilder().
Josef Eisl <josef.eisl@jku.at>
parents:
17206
diff
changeset
|
50 this.tmpSlot = tool.getResult().getFrameMapBuilder().allocateSpillSlot(LIRKind.value(Kind.Long)); |
16518
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15193
diff
changeset
|
51 this.tempIndex = tool.newVariable(LIRKind.value(Kind.Long)); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
52 } |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
53 |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
54 @Override |
13227
1a66453f73db
renamed TargetMethodAssembler to CompilationResultBuilder
Doug Simon <doug.simon@oracle.com>
parents:
11233
diff
changeset
|
55 public void emitCode(CompilationResultBuilder crb, SPARCMacroAssembler masm) { |
17206
2d401b9ca70d
[SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17177
diff
changeset
|
56 SPARCMove.move(crb, masm, tmpSlot, input, SPARCDelayedControlTransfer.DUMMY); |
16519
2b91702c4e69
[SPARC] Fixing IntegerBits
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16518
diff
changeset
|
57 SPARCAddress addr = (SPARCAddress) crb.asAddress(tmpSlot); |
2b91702c4e69
[SPARC] Fixing IntegerBits
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16518
diff
changeset
|
58 if (addr.getIndex().equals(Register.None)) { |
2b91702c4e69
[SPARC] Fixing IntegerBits
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16518
diff
changeset
|
59 Register tempReg = ValueUtil.asLongReg(tempIndex); |
2b91702c4e69
[SPARC] Fixing IntegerBits
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16518
diff
changeset
|
60 new SPARCMacroAssembler.Setx(addr.getDisplacement(), tempReg, false).emit(masm); |
2b91702c4e69
[SPARC] Fixing IntegerBits
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16518
diff
changeset
|
61 addr = new SPARCAddress(addr.getBase(), tempReg); |
2b91702c4e69
[SPARC] Fixing IntegerBits
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16518
diff
changeset
|
62 } |
17206
2d401b9ca70d
[SPARC] Improve the lookup for delayable candidates, renaming interfaces/methods
Stefan Anzinger <stefan.anzinger@oracle.com>
parents:
17177
diff
changeset
|
63 delayedControlTransfer.emitControlTransfer(crb, masm); |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
64 switch (input.getKind()) { |
11233 | 65 case Int: |
16519
2b91702c4e69
[SPARC] Fixing IntegerBits
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16518
diff
changeset
|
66 new SPARCAssembler.Lduwa(addr.getBase(), addr.getIndex(), asIntReg(result), Asi.ASI_PRIMARY_LITTLE).emit(masm); |
2b91702c4e69
[SPARC] Fixing IntegerBits
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
16518
diff
changeset
|
67 break; |
11233 | 68 case Long: |
16518
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15193
diff
changeset
|
69 new SPARCAssembler.Ldxa(addr.getBase(), addr.getIndex(), asLongReg(result), Asi.ASI_PRIMARY_LITTLE).emit(masm); |
3eb13b910134
[SPARC] Fixing LongBits tests and some implicit exceptions
Stefan Anzinger <stefan.anzinger@gmail.com>
parents:
15193
diff
changeset
|
70 break; |
11233 | 71 default: |
72 throw GraalInternalError.shouldNotReachHere(); | |
9846
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
73 } |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
74 } |
91a1041ec905
SPARCLIRGenerator, sqrt, condition move, breakpoint op, partial bit ops
Morris Meyer <morris.meyer@oracle.com>
parents:
diff
changeset
|
75 } |