You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
package jode;
|
|
|
|
public class CreateExpression implements Transformation {
|
|
|
|
public InstructionHeader transform(InstructionHeader ih) {
|
|
Operator op;
|
|
Expression exprs[];
|
|
int params;
|
|
try {
|
|
op = (Operator) ih.getInstruction();
|
|
params = op.getOperandCount();
|
|
exprs = new Expression[params];
|
|
for (int i = params-1; i>=0; i--) {
|
|
ih = ih.getSimpleUniquePredecessor();
|
|
exprs[i] = (Expression) ih.getInstruction();
|
|
if (exprs[i].isVoid()) {
|
|
if (i == params-1)
|
|
return null;
|
|
Expression e = exprs[i+1].tryToCombine(exprs[i]);
|
|
if (e == null)
|
|
return null;
|
|
i++;
|
|
exprs[i] = e;
|
|
ih = ih.combine(2, e);
|
|
}
|
|
}
|
|
} catch (NullPointerException ex) {
|
|
return null;
|
|
} catch (ClassCastException ex) {
|
|
return null;
|
|
}
|
|
if(Decompiler.isVerbose && params > 0)
|
|
System.err.print("x");
|
|
return ih.combine(params+1, new Expression(op, exprs));
|
|
}
|
|
}
|
|
|