1 /*
   2  * Copyright (c) 2015, 2016, 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 
  24 package jdk.test.lib.jittester;
  25 
  26 // all unary and binary operator kinds
  27 public enum OperatorKind {
  28     /** a += b */
  29     COMPOUND_ADD(1),
  30     /** a -= b */
  31     COMPOUND_SUB(1),
  32     /** a *= b */
  33     COMPOUND_MUL(1),
  34     /** a /= b */
  35     COMPOUND_DIV(1),
  36     /** a %= b */
  37     COMPOUND_MOD(1),
  38     /** a &= b */
  39     COMPOUND_AND(1),
  40     /** a |= b */
  41     COMPOUND_OR (1),
  42     /** a ^= b */
  43     COMPOUND_XOR(1),
  44     /** a >>= b */
  45     COMPOUND_SHR(1),
  46     /** a <<= b */
  47     COMPOUND_SHL(1),
  48     /** a >>>= b */
  49     COMPOUND_SAR(1),
  50     /** a = b */
  51     ASSIGN      (1),
  52     /**  a || b */
  53     OR          (3),
  54     /** a | b */
  55     BIT_OR      (5),
  56     /** a ^ b */
  57     BIT_XOR     (6),
  58     /** a && b */
  59     AND         (7),
  60     /** a & b */
  61     BIT_AND     (7),
  62     /** a == b */
  63     EQ          (8),
  64     /** a != b */
  65     NE          (8),
  66     /** a > b */
  67     GT          (9),
  68     /** a < b */
  69     LT          (9),
  70     /** a >= b */
  71     GE          (9),
  72     /** a <= b */
  73     LE          (9),
  74     /** a >> b */
  75     SHR         (10),
  76     /** a << b */
  77     SHL         (10),
  78     /** a >>> b */
  79     SAR         (10),
  80     /** a + b */
  81     ADD         (11),
  82     /** a.toString() + b */
  83     STRADD      (11),
  84     /** a - b */
  85     SUB         (11),
  86     /** a * b */
  87     MUL         (12),
  88     /** a / b */
  89     DIV         (12),
  90     /** a % b */
  91     MOD         (12),
  92     /** !a */
  93     NOT         (14),
  94     /** ~a */
  95     BIT_NOT     (14),
  96     /** +a */
  97     UNARY_PLUS  (14),
  98     /** -a */
  99     UNARY_MINUS (14),
 100     /** --a */
 101     PRE_DEC     (15, true),
 102     /** a-- */
 103     POST_DEC    (15, false),
 104     /** ++a */
 105     PRE_INC     (16, true),
 106     /** a++ */
 107     POST_INC    (16, false),
 108     ;
 109 
 110     public final int priority;
 111     public final boolean isPrefix; // used for unary operators
 112 
 113     private OperatorKind(int priority) {
 114         this(priority, true);
 115     }
 116 
 117     private OperatorKind(int priority, boolean isPrefix) {
 118         this.priority = priority;
 119         this.isPrefix = isPrefix;
 120     }
 121 }