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 SPARCV9RegisterBranchInstruction extends SPARCInstruction 30 implements SPARCV9Instruction, BranchInstruction { 31 final protected PCRelativeAddress addr; 32 final protected boolean isAnnuled; 33 final protected int regConditionCode; 34 final protected SPARCRegister conditionRegister; 35 final protected boolean predictTaken; 36 37 public SPARCV9RegisterBranchInstruction(String name, PCRelativeAddress addr, 38 boolean isAnnuled, int regConditionCode, 39 SPARCRegister conditionRegister, boolean predictTaken) { 40 super(name); 41 this.addr = addr; 42 this.isAnnuled = isAnnuled; 43 this.regConditionCode = regConditionCode; 44 this.conditionRegister = conditionRegister; 45 this.predictTaken = predictTaken; 46 } 47 48 public String asString(long currentPc, SymbolFinder symFinder) { 49 long address = addr.getDisplacement() + currentPc; 50 StringBuffer buf = new StringBuffer(); 51 buf.append(getName()); 52 buf.append(spaces); 53 buf.append(symFinder.getSymbolFor(address)); 54 return buf.toString(); 55 } 56 57 public boolean isBranch() { 58 return true; 59 } 60 61 public Address getBranchDestination() { 62 return addr; 63 } 64 65 public boolean isAnnuledBranch() { 66 return isAnnuled; 67 } 68 69 public boolean isConditional() { 70 return true; 71 } 72 73 public int getRegisterConditionCode() { 74 return regConditionCode; 75 } 76 77 public SPARCRegister getConditionRegister() { 78 return conditionRegister; 79 } 80 81 public boolean getPredictTaken() { 82 return predictTaken; 83 } 84 }