1 /* 2 * Copyright (c) 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 org.graalvm.compiler.nodeinfo; 24 25 import java.lang.annotation.ElementType; 26 import java.lang.annotation.Retention; 27 import java.lang.annotation.RetentionPolicy; 28 import java.lang.annotation.Target; 29 30 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_UNSET; 31 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_UNSET; 32 33 @Retention(RetentionPolicy.RUNTIME) 34 @Target(ElementType.TYPE) 35 public @interface NodeInfo { 36 37 String shortName() default ""; 38 39 /** 40 * The template used to build the {@link Verbosity#Name} version. Variable part are specified 41 * using {i#inputName} or {p#propertyName}. 42 */ 43 String nameTemplate() default ""; 44 45 InputType[] allowedUsageTypes() default {}; 46 47 /** 48 * An estimation of the number of CPU cycles needed to execute this node that can be used to 49 * compare its execution cost against other nodes. 50 * 51 * Implementations of graph cost models based on this value might throw an exception if a node's 52 * {@link NodeCycles} value is {@link NodeCycles#CYCLES_UNSET}. As such, it is recommended to 53 * specify a value for nodes likely to be inputs to a graph cost model. 54 */ 55 NodeCycles cycles() default CYCLES_UNSET; 56 57 /** 58 * A rationale for the chosen {@link NodeInfo#cycles()} value. 59 */ 60 String cyclesRationale() default ""; 61 62 /** 63 * An estimation of the code size needed to represent this node in machine code that can be used 64 * to compare its size cost against other nodes. 65 * 66 * Implementations of graph cost models based on this value might throw an exception if a node's 67 * {@link NodeSize} value is {@link NodeSize#SIZE_UNSET}. As such, it is recommended to specify 68 * a value for nodes likely to be inputs to a graph cost model. 69 */ 70 NodeSize size() default SIZE_UNSET; 71 72 /** 73 * A rationale for the chosen {@link NodeInfo#size()} value. 74 */ 75 String sizeRationale() default ""; 76 }