1 /*
   2  * Copyright 2002 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *
  23  */
  24 
  25 package sun.jvm.hotspot.asm.sparc;
  26 
  27 import sun.jvm.hotspot.asm.*;
  28 
  29 public class SPARCV9InstructionFactoryImpl extends SPARCInstructionFactoryImpl
  30                       implements SPARCV9InstructionFactory {
  31 
  32     public SPARCInstruction newUnimpInstruction(int const22) {
  33         return new SPARCV9IlltrapInstruction(const22);
  34     }
  35 
  36     public SPARCInstruction newRettInstruction(SPARCRegisterIndirectAddress addr) {
  37         return new SPARCV9ReturnInstruction(addr);
  38     }
  39 
  40     public SPARCInstruction newCoprocessorInstruction(int instruction, int cpopcode, int opc,
  41                                                      int rs1Num, int rs2Num, int rdNum) {
  42         return new SPARCV9ImpdepInstruction(cpopcode == SPARCOpcodes.CPop1? "impdep1" : "impdep2");
  43     }
  44 
  45     public SPARCInstruction newV9ReadInstruction(int specialRegNum, int asrRegNum, SPARCRegister rd) {
  46         return new SPARCV9ReadInstruction(specialRegNum, asrRegNum, rd);
  47     }
  48 
  49     public SPARCInstruction newV9WriteInstruction(int specialRegNum, int asrRegNum, SPARCRegister rs1,
  50                                                   ImmediateOrRegister operand2) {
  51         return new SPARCV9WriteInstruction(specialRegNum, asrRegNum, rs1, operand2);
  52     }
  53 
  54     public SPARCInstruction newV9BranchInstruction(String name, PCRelativeAddress addr,
  55               boolean isAnnuled, int conditionCode, boolean predictTaken, int conditionFlag) {
  56         return new SPARCV9BranchInstruction(name, addr, isAnnuled, conditionCode,
  57                        predictTaken, conditionFlag);
  58     }
  59 
  60     public SPARCInstruction newV9RegisterBranchInstruction(String name, PCRelativeAddress addr,
  61                                boolean isAnnuled, int regConditionCode, SPARCRegister conditionRegister,
  62                                boolean predictTaken) {
  63         return new SPARCV9RegisterBranchInstruction(name, addr, isAnnuled, regConditionCode,
  64                                conditionRegister, predictTaken);
  65     }
  66 
  67     public SPARCInstruction newV9CasInstruction(String name, SPARCRegisterIndirectAddress addr,
  68                                               SPARCRegister rs2, SPARCRegister rd, int dataType) {
  69         return new SPARCV9CasInstruction(name, addr, rs2, rd, dataType);
  70     }
  71 
  72     public SPARCInstruction newV9PrefetchInstruction(String name, SPARCRegisterIndirectAddress addr,
  73                                int prefetchFcn) {
  74         return new SPARCV9PrefetchInstruction(name, addr, prefetchFcn);
  75     }
  76 
  77     public SPARCInstruction newV9FlushwInstruction() {
  78         return new SPARCV9FlushwInstruction();
  79     }
  80 
  81     public SPARCInstruction newV9MOVccInstruction(String name, int conditionCode, int conditionFlag,
  82                                   ImmediateOrRegister source, SPARCRegister rd) {
  83         return new SPARCV9MOVccInstruction(name, conditionCode, conditionFlag, source, rd);
  84     }
  85 
  86     public SPARCInstruction newV9MOVrInstruction(String name, SPARCRegister rs1,
  87                                    ImmediateOrRegister operand2, SPARCRegister rd,
  88                                    int regConditionCode) {
  89         return new SPARCV9MOVrInstruction(name, rs1, operand2, rd, regConditionCode);
  90     }
  91 
  92     public SPARCInstruction newV9RdprInstruction(int regNum, SPARCRegister rd) {
  93         return new SPARCV9RdprInstruction(regNum, rd);
  94     }
  95 
  96     public SPARCInstruction newV9WrprInstruction(SPARCRegister rs1, ImmediateOrRegister operand2, int regNum) {
  97         return new SPARCV9WrprInstruction(rs1, operand2, regNum);
  98     }
  99 
 100     public SPARCInstruction newV9PopcInstruction(ImmediateOrRegister source, SPARCRegister rd) {
 101         return new SPARCV9PopcInstruction(source, rd);
 102     }
 103 
 104     public SPARCInstruction newV9DoneInstruction() {
 105         return new SPARCV9DoneInstruction();
 106     }
 107 
 108     public SPARCInstruction newV9RetryInstruction() {
 109         return new SPARCV9RetryInstruction();
 110     }
 111 
 112     public SPARCInstruction newV9SavedInstruction() {
 113         return new SPARCV9SavedInstruction();
 114     }
 115 
 116     public SPARCInstruction newV9RestoredInstruction() {
 117         return new SPARCV9RestoredInstruction();
 118     }
 119 
 120     public SPARCInstruction newV9MembarInstruction(int mmask, int cmask) {
 121         return new SPARCV9MembarInstruction(mmask, cmask);
 122     }
 123 
 124     public SPARCInstruction newV9SirInstruction() {
 125         return new SPARCV9SirInstruction();
 126     }
 127 
 128     public SPARCInstruction newV9FMOVccInstruction(String name, int opf,
 129                                            int conditionCode, int conditionFlag,
 130                                            SPARCFloatRegister rs, SPARCFloatRegister rd) {
 131         return new SPARCV9FMOVccInstruction(name, opf, conditionCode, conditionFlag, rs, rd);
 132     }
 133 
 134     public SPARCInstruction newV9FMOVrInstruction(String name, int opf,
 135                                    SPARCRegister rs1, SPARCFloatRegister rs2,
 136                                    SPARCFloatRegister rd, int regConditionCode) {
 137         return new SPARCV9FMOVrInstruction(name, opf, rs1, rs2, rd, regConditionCode);
 138     }
 139 }