1 19 20 25 26 27 28 29 30 package soot.baf.internal; 31 32 import soot.*; 33 import soot.baf.*; 34 import soot.util.*; 35 import java.util.*; 36 37 public class BIdentityInst extends AbstractInst 38 implements IdentityInst 39 { 40 ValueBox leftBox; 41 ValueBox rightBox; 42 43 List defBoxes; 44 45 46 47 48 public Value getLeftOp() 49 { 50 return leftBox.getValue(); 51 } 52 53 public int getInCount() 54 { 55 return 0; 56 } 57 58 public int getInMachineCount() 59 { 60 return 0; 61 } 62 63 public int getOutCount() 64 { 65 return 0; 66 } 67 68 public int getOutMachineCount() 69 { 70 return 0; 71 } 72 73 public Value getRightOp() 74 { 75 return rightBox.getValue(); 76 } 77 78 public ValueBox getLeftOpBox() 79 { 80 return leftBox; 81 } 82 83 public ValueBox getRightOpBox() 84 { 85 return rightBox; 86 } 87 88 public List getDefBoxes() 89 { 90 return defBoxes; 91 } 92 93 public List getUseBoxes() 94 { 95 List list = new ArrayList(); 96 97 list.addAll(rightBox.getValue().getUseBoxes()); 98 list.add(rightBox); 99 list.addAll(leftBox.getValue().getUseBoxes()); 100 101 return list; 102 } 103 104 public BIdentityInst(Value local, Value identityValue) 105 { 106 this(Baf.v().newLocalBox(local), 107 Baf.v().newIdentityRefBox(identityValue)); 108 } 109 110 protected BIdentityInst(ValueBox localBox, ValueBox identityValueBox) 111 { 112 this.leftBox = localBox; this.rightBox = identityValueBox; 113 114 defBoxes = new ArrayList(); 115 defBoxes.add(leftBox); 116 defBoxes = Collections.unmodifiableList(defBoxes); 117 } 118 119 120 public Object clone() 121 { 122 return new BIdentityInst(getLeftOp(), getRightOp()); 123 } 124 125 public String toString() 126 { 127 return leftBox.getValue().toString() + " := " + rightBox.getValue().toString(); 128 } 129 130 public void toString( UnitPrinter up ) { 131 leftBox.toString(up); 132 up.literal(" := "); 133 rightBox.toString(up); 134 } 135 136 final public String getName() { return ":="; } 137 138 public void setLeftOp(Value local) 139 { 140 leftBox.setValue(local); 141 } 142 143 public void setRightOp(Value identityRef) 144 { 145 rightBox.setValue(identityRef); 146 } 147 148 public void apply(Switch sw) 149 { 150 ((InstSwitch) sw).caseIdentityInst(this); 151 } 152 } 153 154 155 156 | Popular Tags |