本文整理汇总了Java中com.ibm.wala.ssa.SSAInstruction.getNumberOfUses方法的典型用法代码示例。如果您正苦于以下问题:Java SSAInstruction.getNumberOfUses方法的具体用法?Java SSAInstruction.getNumberOfUses怎么用?Java SSAInstruction.getNumberOfUses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.ibm.wala.ssa.SSAInstruction
的用法示例。
在下文中一共展示了SSAInstruction.getNumberOfUses方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: analyzeConditional
import com.ibm.wala.ssa.SSAInstruction; //导入方法依赖的package包/类
/**
* This will search for a SSAConditionalBranchInstruction in the node and
* print information related to this conditional to the console
*
* @param node
*/
public static void analyzeConditional(CGNode node) {
// The symbol table maps a variable number in the ssa to the actual name and value
SymbolTable symtab = node.getIR().getSymbolTable();
SSACFG cfg = node.getIR().getControlFlowGraph();
// Iterate over all basic blocks
for (int i = 0; i < cfg.getNumberOfNodes(); i++) {
BasicBlock bb = cfg.getBasicBlock(i);
// Iterate over all instructions in the basic block
List<SSAInstruction> instructions = bb.getAllInstructions();
if (containsConditional(instructions)) {
for (SSAInstruction ins : instructions) {
if (ins.toString().contains("binaryop")) {
System.out.print(ins);
for (int u = 0; u < ins.getNumberOfUses(); u++) {
System.out.print(" && ");
// In case of null we have a phi instruction. JavaScript apparently does not handle this very well.
if (symtab.getValue(ins.getUse(u)) == null)
System.out.print(ins.getUse(u) + " depends on previous if ");
else
System.out.print(ins.getUse(u) + " = " + symtab.getValue(ins.getUse(u)));
}
System.out.println("");
}
if (ins instanceof SSAConditionalBranchInstruction) {
System.out.println(ins.toString(symtab));
System.out.println("----------");
}
}
}
}
}
示例2: getNumberOfUses
import com.ibm.wala.ssa.SSAInstruction; //导入方法依赖的package包/类
protected int getNumberOfUses(SSAInstruction inst) {
if (fieldPhiSet.contains(inst)) {
return inst.getNumberOfUses();
} else {
return ((int[])valueNumbers.get(Pair.make(inst, USES))).length;
}
}
示例3: getUsesList
import com.ibm.wala.ssa.SSAInstruction; //导入方法依赖的package包/类
/**
* creates a {@link List} out of all uses found in the given {@link SSAInstruction} starting with the use of index
* {@code startsWith}.
*
* @param ins the {@code SSAInstruction} to look for uses
* @param startWith the index of the use to start with adding to the list
* @return a list containing the found uses
*/
public static List<Integer> getUsesList(SSAInstruction ins, int startWith) {
int size = ins.getNumberOfUses();
List<Integer> list = Lists.newArrayListWithExpectedSize(size);
for (int i = startWith; i < size; i++) {
list.add(ins.getUse(i));
}
return list;
}
示例4: searchReturn
import com.ibm.wala.ssa.SSAInstruction; //导入方法依赖的package包/类
/**
* Searches for ReturnStatement but mainly it replaces evaluated variable .
* Also adds a new line in codes list. with evaluated value . Called by
* ReplaceEvaluated button in mainPanel.
*
* @throws FileNotFoundException
* @throws ScriptException
*/
public void searchReturn(final JTextPane textSliceEdt)
throws FileNotFoundException, ScriptException {
String out = "";
Statement statm = (Statement) sdg.getNode(Integer.parseInt(hallo));
CGNode node = statm.getNode();
SSACFG cfg = node.getIR().getControlFlowGraph();
String names = "";
for (int i = 0; i < cfg.getNumberOfNodes(); i++) {
BasicBlock bb = cfg.getBasicBlock(i);
// Iterate over all instructions in the basic block
List<SSAInstruction> instructions = bb.getAllInstructions();
for (SSAInstruction ins : instructions) {
if (ins.toString().contains("return")) {
System.out.print(ins);
for (int u = 0; u < ins.getNumberOfUses(); u++) {
System.out.println(ins.getUse(u));
names = getLocalNames(node, names, ins, u);
System.out.println(names);
}
}
}
if (codes.get(codes.size() - 3).contains("return")) {
System.out.println("Retrun in letzter reihe");
int temp = codes.get(codes.size() - 1).indexOf("return");
codes.get(codes.size() - 1).substring(temp + 1);
if (codes.get(codes.size() - 1).substring(temp + 1)
.contains(names)) {
System.out
.println("symbol found in return statement in codeliste");
}
}
}
String command = "";
System.out.println("Codes " + codes);
System.out.println("command " + command);
for (int j = 0; j < codes.size(); j++) {
command += codes.get(j);
}
System.out.println("command" + command);
String rudi = Main.evalState(command);
if (names == "") {
codes.add(codes.size() - 4, "var " + "foo" + "=" + "\"" + rudi
+ "\";");
} else {
codes.add(codes.size() - 4, "var " + names + "=" + "\"" + rudi
+ "\";");
}
codes.remove(codes.size() - 4);
System.out.println(codes);
for (int i = 0; i < codes.size(); i++) {
if (codes.get(i).toString().contains("return foo")) {
codes.remove(i);
System.out
.println("removedb return Statement cos it is evaluated");
}
out += codes.get(i) + "\n";
}
textSliceEdt.setText(out);
}