Mercurial > hg > truffle
annotate graal/com.oracle.graal.lir/src/com/oracle/graal/lir/constopt/DefUseTree.java @ 18163:c88ab4f1f04a
re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 24 Oct 2014 16:18:10 +0200 |
parents | 2451521ed26f |
children | 9619ba4daf4c |
rev | line source |
---|---|
16952 | 1 /* |
2 * Copyright (c) 2014, 2014, 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.lir.constopt; | |
24 | |
25 import java.util.*; | |
26 import java.util.function.*; | |
27 | |
28 import com.oracle.graal.api.meta.*; | |
29 import com.oracle.graal.compiler.common.cfg.*; | |
30 import com.oracle.graal.lir.*; | |
31 import com.oracle.graal.lir.StandardOp.MoveOp; | |
32 | |
33 /** | |
34 * Represents def-use tree of a constant. | |
35 */ | |
36 class DefUseTree { | |
37 private final LIRInstruction instruction; | |
38 private final AbstractBlock<?> block; | |
39 private final List<UseEntry> uses; | |
40 | |
41 public DefUseTree(LIRInstruction instruction, AbstractBlock<?> block) { | |
42 assert instruction instanceof MoveOp : "Not a MoveOp: " + instruction; | |
43 this.instruction = instruction; | |
44 this.block = block; | |
45 this.uses = new ArrayList<>(); | |
46 } | |
47 | |
48 public Variable getVariable() { | |
49 return (Variable) ((MoveOp) instruction).getResult(); | |
50 } | |
51 | |
52 public Constant getConstant() { | |
53 return (Constant) ((MoveOp) instruction).getInput(); | |
54 } | |
55 | |
56 public LIRInstruction getInstruction() { | |
57 return instruction; | |
58 } | |
59 | |
60 public AbstractBlock<?> getBlock() { | |
61 return block; | |
62 } | |
63 | |
64 @Override | |
65 public String toString() { | |
66 return "DefUseTree [" + instruction + "|" + block + "," + uses + "]"; | |
67 } | |
68 | |
69 public void addUsage(AbstractBlock<?> b, LIRInstruction inst, ValuePosition position) { | |
70 uses.add(new UseEntry(b, inst, position)); | |
71 } | |
72 | |
73 public int usageCount() { | |
74 return uses.size(); | |
75 } | |
76 | |
77 public void forEach(Consumer<? super UseEntry> action) { | |
78 uses.forEach(action); | |
79 } | |
80 | |
18163
c88ab4f1f04a
re-enabled Checkstyle with the release of 6.0 that supports Java 8; fixed existing Checkstyle warnings
Doug Simon <doug.simon@oracle.com>
parents:
16952
diff
changeset
|
81 } |