Mercurial > hg > truffle
diff graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java @ 15002:06e50d290784
isAllowedUsageType on Nodes
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Mon, 07 Apr 2014 11:32:08 +0200 |
parents | 27c04ee36dcb |
children | 288c23143d47 |
line wrap: on
line diff
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Mon Apr 07 11:32:04 2014 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Mon Apr 07 11:32:08 2014 +0200 @@ -148,6 +148,7 @@ private final String shortName; private final String nameTemplate; private final int iterableId; + private final EnumSet<InputType> allowedUsageTypes; private int[] iterableIds; private static final DebugMetric ITERABLE_NODE_TYPES = Debug.metric("IterableNodeTypes"); @@ -220,7 +221,19 @@ newNameTemplate = info.nameTemplate(); } } + EnumSet<InputType> newAllowedUsageTypes = EnumSet.noneOf(InputType.class); + Class<?> current = clazz; + do { + NodeInfo currentInfo = current.getAnnotation(NodeInfo.class); + if (currentInfo != null) { + if (currentInfo.allowedUsageTypes().length > 0) { + newAllowedUsageTypes.addAll(Arrays.asList(currentInfo.allowedUsageTypes())); + } + } + current = current.getSuperclass(); + } while (current != Node.class); this.nameTemplate = newNameTemplate == null ? newShortName : newNameTemplate; + this.allowedUsageTypes = newAllowedUsageTypes; this.shortName = newShortName; if (presetIterableIds != null) { this.iterableIds = presetIterableIds; @@ -314,6 +327,10 @@ return nextIterableId; } + public EnumSet<InputType> getAllowedUsageTypes() { + return allowedUsageTypes; + } + protected static class FieldScanner extends BaseFieldScanner { public final ArrayList<Long> inputOffsets = new ArrayList<>();