Mercurial > hg > graal-compiler
comparison graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/nodes/WriteRegisterNode.java @ 8354:55ef03d64f03
Generalize read and write of fixed register for snippets. Move to HotSpot-independent project.
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Mon, 18 Mar 2013 19:28:44 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
8353:98b90a7bb764 | 8354:55ef03d64f03 |
---|---|
1 /* | |
2 * Copyright (c) 2013, 2013, 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.oracle.graal.snippets.nodes; | |
24 | |
25 import com.oracle.graal.api.code.*; | |
26 import com.oracle.graal.api.meta.*; | |
27 import com.oracle.graal.graph.*; | |
28 import com.oracle.graal.nodes.*; | |
29 import com.oracle.graal.nodes.spi.*; | |
30 import com.oracle.graal.nodes.type.*; | |
31 | |
32 /** | |
33 * Changes the value of a specific register. | |
34 */ | |
35 @NodeInfo(nameTemplate = "WriteRegister %{p#register}") | |
36 public final class WriteRegisterNode extends FixedWithNextNode implements LIRLowerable { | |
37 | |
38 /** | |
39 * The fixed register to access. | |
40 */ | |
41 private final Register register; | |
42 | |
43 /** | |
44 * The new value assigned to the register. | |
45 */ | |
46 @Input private ValueNode value; | |
47 | |
48 public WriteRegisterNode(Register register, ValueNode value) { | |
49 super(StampFactory.forVoid()); | |
50 this.register = register; | |
51 this.value = value; | |
52 } | |
53 | |
54 @Override | |
55 public void generate(LIRGeneratorTool generator) { | |
56 Value val = generator.operand(value); | |
57 generator.emitMove(val, register.asValue(val.getKind())); | |
58 } | |
59 | |
60 @Override | |
61 public String toString(Verbosity verbosity) { | |
62 if (verbosity == Verbosity.Name) { | |
63 return super.toString(Verbosity.Name) + "%" + register; | |
64 } else { | |
65 return super.toString(verbosity); | |
66 } | |
67 } | |
68 } |