comparison graal/Compiler/src/com/sun/c1x/ir/UnsafeGetRaw.java @ 2507:9ec15d6914ca

Pull over of compiler from maxine repository.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 27 Apr 2011 11:43:22 +0200
parents
children
comparison
equal deleted inserted replaced
2506:4a3bf8a5bf41 2507:9ec15d6914ca
1 /*
2 * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
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 */
23 package com.sun.c1x.ir;
24
25 import com.sun.c1x.debug.*;
26 import com.sun.cri.ci.*;
27
28 /**
29 * The {@code UnsafeGetRaw} instruction represents an unsafe access of raw memory where
30 * the type is not an object reference.
31 *
32 * @author Ben L. Titzer
33 */
34 public final class UnsafeGetRaw extends UnsafeRawOp {
35
36 final boolean mayBeUnaligned;
37
38 /**
39 * Constructs a new UnsafeGetRaw instruction.
40 * @param opKind the kind of the operation
41 * @param addr the instruction generating the base address
42 * @param mayBeUnaligned {@code true} if this operation may be unaligned
43 */
44 public UnsafeGetRaw(CiKind opKind, Value addr, boolean mayBeUnaligned) {
45 super(opKind, addr, false);
46 this.mayBeUnaligned = mayBeUnaligned;
47 }
48
49 /**
50 * Constructs a new UnsafeGetRaw instruction.
51 * @param opKind the kind of the operation
52 * @param addr the instruction generating the base address
53 * @param index the instruction generating the index
54 * @param log2scale the log base 2 of the scaling factor
55 * @param mayBeUnaligned {@code true} if this operation may be unaligned
56 */
57 public UnsafeGetRaw(CiKind opKind, Value addr, Value index, int log2scale, boolean mayBeUnaligned) {
58 super(opKind, addr, index, log2scale, false);
59 this.mayBeUnaligned = mayBeUnaligned;
60 }
61
62 /**
63 * Checks whether this operation may be unaligned.
64 * @return {@code true} if this operation may be unaligned
65 */
66 public boolean mayBeUnaligned() {
67 return mayBeUnaligned;
68 }
69
70 @Override
71 public void accept(ValueVisitor v) {
72 v.visitUnsafeGetRaw(this);
73 }
74
75 @Override
76 public void print(LogStream out) {
77 out.print("UnsafeGetRaw.(base ").print(base());
78 if (hasIndex()) {
79 out.print(", index ").print(index()).print(", log2_scale ").print(log2Scale());
80 }
81 out.print(')');
82 }
83 }