cleanup ssa instructions in wala.core

This commit is contained in:
Juergen Graf 2014-07-29 19:43:58 +02:00
parent 21b5b417b4
commit 60228a8c0d
28 changed files with 66 additions and 70 deletions

View File

@ -210,11 +210,9 @@ public class JavaLanguage extends LanguageImpl implements BytecodeLanguage, Cons
}
@Override
/** BEGIN Custom change: Add GoTo Instruction */
public SSAGotoInstruction GotoInstruction(int iindex, int target) {
return new SSAGotoInstruction(iindex, target);
}
/** END Custom change: Add GoTo Instruction */
@Override
public SSAInstanceofInstruction InstanceofInstruction(int iindex, int result, int ref, TypeReference checkedType) {

View File

@ -19,8 +19,8 @@ public abstract class ReflectiveMemberAccess extends SSAInstruction {
protected final int memberRef;
protected ReflectiveMemberAccess(int index, int objectRef, int memberRef) {
super(index);
protected ReflectiveMemberAccess(int iindex, int objectRef, int memberRef) {
super(iindex);
this.objectRef = objectRef;
this.memberRef = memberRef;
}

View File

@ -37,8 +37,8 @@ public abstract class SSAAbstractInvokeInstruction extends SSAInstruction {
* @param exception The value number which represents the exception object which the call may throw.
* @param site The call site, containing the program counter location and the method being called.
*/
protected SSAAbstractInvokeInstruction(int index, int exception, CallSiteReference site) {
super(index);
protected SSAAbstractInvokeInstruction(int iindex, int exception, CallSiteReference site) {
super(iindex);
this.exception = exception;
this.site = site;
}

View File

@ -17,8 +17,8 @@ package com.ibm.wala.ssa;
public abstract class SSAAbstractThrowInstruction extends SSAInstruction {
private final int exception;
public SSAAbstractThrowInstruction(int index, int exception) {
super(index);
public SSAAbstractThrowInstruction(int iindex, int exception) {
super(iindex);
//assert exception > 0;
this.exception = exception;
}

View File

@ -19,8 +19,8 @@ public abstract class SSAAbstractUnaryInstruction extends SSAInstruction {
protected final int val;
protected SSAAbstractUnaryInstruction(int index, int result, int val) {
super(index);
protected SSAAbstractUnaryInstruction(int iindex, int result, int val) {
super(iindex);
this.result = result;
this.val = val;
}

View File

@ -51,8 +51,8 @@ public class SSAAddressOfInstruction extends SSAInstruction {
/**
* Use this constructor when taking the address of a local variable.
*/
public SSAAddressOfInstruction(int index, int lval, int local, TypeReference pointeeType) {
super(index);
public SSAAddressOfInstruction(int iindex, int lval, int local, TypeReference pointeeType) {
super(iindex);
if (local <= 0) {
throw new IllegalArgumentException("Invalid local address load of " + local);
}
@ -66,8 +66,8 @@ public class SSAAddressOfInstruction extends SSAInstruction {
/**
* Use this constructor when taking the address of an array element.
*/
public SSAAddressOfInstruction(int index, int lval, int basePointer, int indexVal, TypeReference pointeeType) {
super(index);
public SSAAddressOfInstruction(int iindex, int lval, int basePointer, int indexVal, TypeReference pointeeType) {
super(iindex);
this.lval = lval;
this.addressVal = basePointer;
this.indexVal = indexVal;
@ -78,8 +78,8 @@ public class SSAAddressOfInstruction extends SSAInstruction {
/**
* Use this constructor when taking the address of a field in an object.
*/
public SSAAddressOfInstruction(int index, int lval, int basePointer, FieldReference field, TypeReference pointeeType) {
super(index);
public SSAAddressOfInstruction(int iindex, int lval, int basePointer, FieldReference field, TypeReference pointeeType) {
super(iindex);
this.lval = lval;
this.addressVal = basePointer;
this.indexVal = -1;

View File

@ -19,8 +19,8 @@ public abstract class SSAArrayLengthInstruction extends SSAInstruction {
private final int arrayref;
protected SSAArrayLengthInstruction(int index, int result, int arrayref) {
super(index);
protected SSAArrayLengthInstruction(int iindex, int result, int arrayref) {
super(iindex);
this.result = result;
this.arrayref = arrayref;
}

View File

@ -28,8 +28,8 @@ public abstract class SSABinaryOpInstruction extends SSAInstruction {
*/
private final boolean mayBeInteger;
protected SSABinaryOpInstruction(int index, IBinaryOpInstruction.IOperator operator, int result, int val1, int val2, boolean mayBeInteger) {
super(index);
protected SSABinaryOpInstruction(int iindex, IBinaryOpInstruction.IOperator operator, int result, int val1, int val2, boolean mayBeInteger) {
super(iindex);
this.result = result;
this.val1 = val1;
this.val2 = val2;

View File

@ -26,8 +26,8 @@ public class SSAComparisonInstruction extends SSAInstruction {
/**
*/
public SSAComparisonInstruction(int index, IComparisonInstruction.Operator operator, int result, int val1, int val2) {
super(index);
public SSAComparisonInstruction(int iindex, IComparisonInstruction.Operator operator, int result, int val1, int val2) {
super(iindex);
this.operator = operator;
this.result = result;
this.val1 = val1;

View File

@ -24,8 +24,8 @@ public abstract class SSAConversionInstruction extends SSAInstruction {
private final TypeReference toType;
protected SSAConversionInstruction(int index, int result, int val, TypeReference fromType, TypeReference toType) {
super(index);
protected SSAConversionInstruction(int iindex, int result, int val, TypeReference fromType, TypeReference toType) {
super(iindex);
this.result = result;
this.val = val;
this.fromType = fromType;

View File

@ -23,8 +23,8 @@ public abstract class SSAFieldAccessInstruction extends SSAInstruction {
private final int ref;
protected SSAFieldAccessInstruction(int index, FieldReference field, int ref) throws IllegalArgumentException {
super(index);
protected SSAFieldAccessInstruction(int iindex, FieldReference field, int ref) throws IllegalArgumentException {
super(iindex);
this.field = field;
this.ref = ref;
if (field == null) {

View File

@ -22,8 +22,8 @@ public class SSAGetCaughtExceptionInstruction extends SSAInstruction {
private final int bbNumber;
public SSAGetCaughtExceptionInstruction(int index, int bbNumber, int exceptionValueNumber) {
super(index);
public SSAGetCaughtExceptionInstruction(int iindex, int bbNumber, int exceptionValueNumber) {
super(iindex);
this.exceptionValueNumber = exceptionValueNumber;
this.bbNumber = bbNumber;
}

View File

@ -19,13 +19,13 @@ import com.ibm.wala.types.FieldReference;
public abstract class SSAGetInstruction extends SSAFieldAccessInstruction {
private final int result;
protected SSAGetInstruction(int index, int result, int ref, FieldReference field) {
super(index, field, ref);
protected SSAGetInstruction(int iindex, int result, int ref, FieldReference field) {
super(iindex, field, ref);
this.result = result;
}
protected SSAGetInstruction(int index, int result, FieldReference field) {
super(index, field, -1);
protected SSAGetInstruction(int iindex, int result, FieldReference field) {
super(iindex, field, -1);
this.result = result;
}

View File

@ -16,7 +16,6 @@ package com.ibm.wala.ssa;
public class SSAGotoInstruction extends SSAInstruction {
private final int target;
/** BEGIN Custom change: Add GoTo Instruction */
public SSAGotoInstruction(int iindex, int target) {
super(iindex);
this.target = target;
@ -29,7 +28,6 @@ public class SSAGotoInstruction extends SSAInstruction {
public int getTarget() {
return this.target;
}
/** END Custom change: Add GoTo Instruction */
@Override
public SSAInstruction copyForSSA(SSAInstructionFactory insts, int[] defs, int[] uses) {

View File

@ -22,8 +22,8 @@ public class SSAInstanceofInstruction extends SSAInstruction {
private final TypeReference checkedType;
public SSAInstanceofInstruction(int index, int result, int ref, TypeReference checkedType) {
super(index);
public SSAInstanceofInstruction(int iindex, int result, int ref, TypeReference checkedType) {
super(iindex);
this.result = result;
this.ref = ref;
this.checkedType = checkedType;

View File

@ -26,8 +26,8 @@ public abstract class SSAInvokeInstruction extends SSAAbstractInvokeInstruction
*/
private final int[] params;
protected SSAInvokeInstruction(int index, int result, int[] params, int exception, CallSiteReference site) {
super(index, exception, site);
protected SSAInvokeInstruction(int iindex, int result, int[] params, int exception, CallSiteReference site) {
super(iindex, exception, site);
this.result = result;
this.params = params;
assertParamsKosher(result, params, site);
@ -36,8 +36,8 @@ public abstract class SSAInvokeInstruction extends SSAAbstractInvokeInstruction
/**
* Constructor InvokeInstruction. This case for void return values
*/
protected SSAInvokeInstruction(int index, int[] params, int exception, CallSiteReference site) {
this(index, -1, params, exception, site);
protected SSAInvokeInstruction(int iindex, int[] params, int exception, CallSiteReference site) {
this(iindex, -1, params, exception, site);
}
@Override

View File

@ -26,8 +26,8 @@ public class SSALoadIndirectInstruction extends SSAAbstractUnaryInstruction {
* @param lval the value number which is def'fed by this instruction.
* @param addressVal the value number holding the pointer p deferenced (*p)
*/
public SSALoadIndirectInstruction(int index, int lval, TypeReference t, int addressVal) {
super(index, lval, addressVal);
public SSALoadIndirectInstruction(int iindex, int lval, TypeReference t, int addressVal) {
super(iindex, lval, addressVal);
this.loadedType = t;
}

View File

@ -30,8 +30,8 @@ public abstract class SSALoadMetadataInstruction extends SSAInstruction {
*/
private final TypeReference entityType;
protected SSALoadMetadataInstruction(int index, int lval, TypeReference entityType, Object token) {
super(index);
protected SSALoadMetadataInstruction(int iindex, int lval, TypeReference entityType, Object token) {
super(iindex);
this.lval = lval;
this.token = token;
this.entityType = entityType;

View File

@ -29,8 +29,8 @@ public abstract class SSAMonitorInstruction extends SSAInstruction {
* @param ref The value number of the object being locked or unlocked
* @param isEnter Does this instruction represent a monitorenter?
*/
protected SSAMonitorInstruction(int index, int ref, boolean isEnter) {
super(index);
protected SSAMonitorInstruction(int iindex, int ref, boolean isEnter) {
super(iindex);
this.ref = ref;
this.isEnter = isEnter;
}

View File

@ -33,8 +33,8 @@ public abstract class SSANewInstruction extends SSAInstruction {
/**
* Create a new instruction to allocate a scalar.
*/
protected SSANewInstruction(int index, int result, NewSiteReference site) throws IllegalArgumentException {
super(index);
protected SSANewInstruction(int iindex, int result, NewSiteReference site) throws IllegalArgumentException {
super(iindex);
if (site == null) {
throw new IllegalArgumentException("site cannot be null");
}
@ -49,8 +49,8 @@ public abstract class SSANewInstruction extends SSAInstruction {
* @throws IllegalArgumentException if site is null
* @throws IllegalArgumentException if params is null
*/
protected SSANewInstruction(int index, int result, NewSiteReference site, int[] params) {
super(index);
protected SSANewInstruction(int iindex, int result, NewSiteReference site, int[] params) {
super(iindex);
if (params == null) {
throw new IllegalArgumentException("params is null");
}

View File

@ -40,8 +40,8 @@ public class SSAPhiInstruction extends SSAInstruction {
private int[] params;
public SSAPhiInstruction(int index, int result, int[] params) throws IllegalArgumentException {
super(index);
public SSAPhiInstruction(int iindex, int result, int[] params) throws IllegalArgumentException {
super(iindex);
if (params == null) {
throw new IllegalArgumentException("params is null");
}

View File

@ -53,8 +53,8 @@ public class SSAPiInstruction extends SSAUnaryOpInstruction {
* @param successorBlock the successor block; this PI assignment happens on the transition between this basic block and
* the successor block.
*/
public SSAPiInstruction(int index, int result, int val, int piBlock, int successorBlock, SSAInstruction cause) {
super(index, null, result, val);
public SSAPiInstruction(int iindex, int result, int val, int piBlock, int successorBlock, SSAInstruction cause) {
super(iindex, null, result, val);
this.cause = cause;
this.successorBlock = successorBlock;
this.piBlock = piBlock;

View File

@ -19,13 +19,13 @@ public abstract class SSAPutInstruction extends SSAFieldAccessInstruction {
private final int val;
protected SSAPutInstruction(int index, int ref, int val, FieldReference field) {
super(index, field, ref);
protected SSAPutInstruction(int iindex, int ref, int val, FieldReference field) {
super(iindex, field, ref);
this.val = val;
}
protected SSAPutInstruction(int index, int val, FieldReference field) {
super(index, field, -1);
protected SSAPutInstruction(int iindex, int val, FieldReference field) {
super(iindex, field, -1);
this.val = val;
}

View File

@ -23,14 +23,14 @@ public class SSAReturnInstruction extends SSAInstruction {
private final boolean isPrimitive;
public SSAReturnInstruction(int index, int result, boolean isPrimitive) {
super(index);
public SSAReturnInstruction(int iindex, int result, boolean isPrimitive) {
super(iindex);
this.result = result;
this.isPrimitive = isPrimitive;
}
public SSAReturnInstruction(int index) {
super(index);
public SSAReturnInstruction(int iindex) {
super(iindex);
this.result = -1;
this.isPrimitive = false;
}

View File

@ -30,8 +30,8 @@ public class SSAStoreIndirectInstruction extends SSAInstruction {
* @param addressVal the value number holding the pointer p deferenced (*p)
* @param rval the value number which is stored into the pointer location
*/
public SSAStoreIndirectInstruction(int index, int addressVal, int rval, TypeReference pointeeType) {
super(index);
public SSAStoreIndirectInstruction(int iindex, int addressVal, int rval, TypeReference pointeeType) {
super(iindex);
this.addressVal = addressVal;
this.rval = rval;
this.pointeeType = pointeeType;

View File

@ -26,8 +26,8 @@ public class SSASwitchInstruction extends SSAInstruction {
/**
* The labels in casesAndLabels represent <em>instruction indices</em> in the IR that each switch case branches to.
*/
public SSASwitchInstruction(int index, int val, int defaultLabel, int[] casesAndLabels) {
super(index);
public SSASwitchInstruction(int iindex, int val, int defaultLabel, int[] casesAndLabels) {
super(iindex);
this.val = val;
this.defaultLabel = defaultLabel;
this.casesAndLabels = casesAndLabels;

View File

@ -15,8 +15,8 @@ package com.ibm.wala.ssa;
*/
public abstract class SSAThrowInstruction extends SSAAbstractThrowInstruction {
protected SSAThrowInstruction(int index, int exception) {
super(index, exception);
protected SSAThrowInstruction(int iindex, int exception) {
super(iindex, exception);
}
/*

View File

@ -21,8 +21,8 @@ public class SSAUnaryOpInstruction extends SSAAbstractUnaryInstruction {
private final IUnaryOpInstruction.IOperator operator;
public SSAUnaryOpInstruction(int index, IUnaryOpInstruction.IOperator operator, int result, int val) {
super(index, result, val);
public SSAUnaryOpInstruction(int iindex, IUnaryOpInstruction.IOperator operator, int result, int val) {
super(iindex, result, val);
this.operator = operator;
}