hotspot/agent/src/share/classes/sun/jvm/hotspot/asm/sparc/V9CMoveDecoder.java
changeset 13905 12e9215f3daa
parent 13904 173d83d9c9d7
parent 13903 eebf638312d2
child 13907 52873e4bbeaa
equal deleted inserted replaced
13904:173d83d9c9d7 13905:12e9215f3daa
     1 /*
       
     2  * Copyright (c) 2002, 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 
       
    25 package sun.jvm.hotspot.asm.sparc;
       
    26 
       
    27 import sun.jvm.hotspot.asm.*;
       
    28 import sun.jvm.hotspot.utilities.Assert;
       
    29 
       
    30 abstract class V9CMoveDecoder extends InstructionDecoder
       
    31                    implements V9InstructionDecoder {
       
    32     static private final String iccConditionNames[] = {
       
    33         "n", "e", "le", "l", "leu", "cs", "neg", "vs",
       
    34         "a", "ne", "g", "ge", "gu", "cc", "pos", "vc"
       
    35     };
       
    36 
       
    37     static private final String fccConditionNames[] = {
       
    38         "fn", "fne", "flg", "ful", "fl", "fug", "fg", "fu",
       
    39         "fa", "fe",  "fue", "fge", "fuge", "fle", "fule", "fo"
       
    40     };
       
    41 
       
    42     static String getConditionName(int conditionCode, int conditionFlag) {
       
    43         return (conditionFlag == icc || conditionFlag == xcc) ?
       
    44                        iccConditionNames[conditionCode]
       
    45                      : fccConditionNames[conditionCode];
       
    46     }
       
    47 
       
    48     static int getMoveConditionCode(int instruction) {
       
    49         return (instruction & CMOVE_COND_MASK) >>> CMOVE_COND_START_BIT;
       
    50     }
       
    51 
       
    52     static int getRegisterConditionCode(int instruction) {
       
    53         return (instruction & CMOVE_RCOND_MASK) >>> CMOVE_RCOND_START_BIT;
       
    54     }
       
    55 
       
    56     static ImmediateOrRegister getCMoveSource(int instruction, int numBits) {
       
    57         ImmediateOrRegister source = null;
       
    58         if (isIBitSet(instruction)) {
       
    59             source = new Immediate(new Short((short) extractSignedIntFromNBits(instruction, numBits)));
       
    60         } else {
       
    61             source = SPARCRegisters.getRegister(getSourceRegister2(instruction));
       
    62         }
       
    63         return source;
       
    64     }
       
    65 
       
    66     static String getFloatTypeCode(int dataType) {
       
    67         String result = null;
       
    68         switch(dataType) {
       
    69             case RTLDT_FL_SINGLE:
       
    70                 result = "s";
       
    71                 break;
       
    72 
       
    73             case RTLDT_FL_DOUBLE:
       
    74                 result = "d";
       
    75                 break;
       
    76 
       
    77             case RTLDT_FL_QUAD:
       
    78                 result = "q";
       
    79                 break;
       
    80 
       
    81             default:
       
    82                 if (Assert.ASSERTS_ENABLED)
       
    83                     Assert.that(false, "should not reach here");
       
    84         }
       
    85         return result;
       
    86     }
       
    87 }