43972
|
1 |
/*
|
52910
|
2 |
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
43972
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
* or visit www.oracle.com if you need additional information or have any
|
|
21 |
* questions.
|
|
22 |
*/
|
50858
|
23 |
|
|
24 |
|
43972
|
25 |
package org.graalvm.compiler.hotspot.amd64;
|
|
26 |
|
|
27 |
import static jdk.vm.ci.code.ValueUtil.asRegister;
|
|
28 |
import jdk.vm.ci.amd64.AMD64Kind;
|
|
29 |
import jdk.vm.ci.meta.AllocatableValue;
|
|
30 |
import jdk.vm.ci.meta.Constant;
|
|
31 |
|
|
32 |
import org.graalvm.compiler.asm.amd64.AMD64MacroAssembler;
|
|
33 |
import org.graalvm.compiler.debug.GraalError;
|
|
34 |
import org.graalvm.compiler.lir.LIRInstructionClass;
|
|
35 |
import org.graalvm.compiler.lir.amd64.AMD64LIRInstruction;
|
|
36 |
import org.graalvm.compiler.lir.asm.CompilationResultBuilder;
|
|
37 |
|
|
38 |
public final class AMD64HotSpotLoadAddressOp extends AMD64LIRInstruction {
|
|
39 |
|
|
40 |
public static final LIRInstructionClass<AMD64HotSpotLoadAddressOp> TYPE = LIRInstructionClass.create(AMD64HotSpotLoadAddressOp.class);
|
|
41 |
|
|
42 |
@Def({OperandFlag.REG}) protected AllocatableValue result;
|
|
43 |
private final Constant constant;
|
|
44 |
private final Object note;
|
|
45 |
|
|
46 |
public AMD64HotSpotLoadAddressOp(AllocatableValue result, Constant constant, Object note) {
|
|
47 |
super(TYPE);
|
|
48 |
this.result = result;
|
|
49 |
this.constant = constant;
|
|
50 |
this.note = note;
|
|
51 |
}
|
|
52 |
|
|
53 |
@Override
|
|
54 |
public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) {
|
|
55 |
crb.recordInlineDataInCodeWithNote(constant, note);
|
|
56 |
AMD64Kind kind = (AMD64Kind) result.getPlatformKind();
|
|
57 |
switch (kind) {
|
|
58 |
case DWORD:
|
|
59 |
masm.movl(asRegister(result), masm.getPlaceholder(-1));
|
|
60 |
break;
|
|
61 |
case QWORD:
|
|
62 |
masm.movq(asRegister(result), masm.getPlaceholder(-1));
|
|
63 |
break;
|
|
64 |
default:
|
|
65 |
throw GraalError.shouldNotReachHere("unexpected kind: " + kind);
|
|
66 |
}
|
|
67 |
}
|
|
68 |
|
|
69 |
}
|