|
|
@ -58,14 +58,15 @@ public class CreateAssignExpression { |
|
|
|
StoreInstruction store = (StoreInstruction) ic.getInstruction(); |
|
|
|
StoreInstruction store = (StoreInstruction) ic.getInstruction(); |
|
|
|
if (!store.isFreeOperator()) |
|
|
|
if (!store.isFreeOperator()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
int lvalueCount = store.getLValue().getFreeOperandCount(); |
|
|
|
Expression lvalue = store.getSubExpressions()[0]; |
|
|
|
|
|
|
|
int lvalueCount = lvalue.getFreeOperandCount(); |
|
|
|
|
|
|
|
|
|
|
|
boolean isAssignOp = false; |
|
|
|
boolean isAssignOp = false; |
|
|
|
if (opBlock.subBlocks[0] instanceof SpecialBlock) { |
|
|
|
if (opBlock.subBlocks[0] instanceof SpecialBlock) { |
|
|
|
SpecialBlock dup = (SpecialBlock) opBlock.subBlocks[0]; |
|
|
|
SpecialBlock dup = (SpecialBlock) opBlock.subBlocks[0]; |
|
|
|
if (dup.type != SpecialBlock.DUP |
|
|
|
if (dup.type != SpecialBlock.DUP |
|
|
|
|| dup.depth != lvalueCount |
|
|
|
|| dup.depth != lvalueCount |
|
|
|
|| dup.count != store.getLValue().getType().stackSize() |
|
|
|
|| dup.count != lvalue.getType().stackSize() |
|
|
|
|| !(opBlock.outer instanceof SequentialBlock)) |
|
|
|
|| !(opBlock.outer instanceof SequentialBlock)) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
opBlock = (SequentialBlock) opBlock.outer; |
|
|
|
opBlock = (SequentialBlock) opBlock.outer; |
|
|
@ -102,7 +103,7 @@ public class CreateAssignExpression { |
|
|
|
|
|
|
|
|
|
|
|
if (expr instanceof ConvertOperator |
|
|
|
if (expr instanceof ConvertOperator |
|
|
|
&& expr.getSubExpressions()[0] instanceof Operator |
|
|
|
&& expr.getSubExpressions()[0] instanceof Operator |
|
|
|
&& expr.getType().isOfType(store.getLValue().getType())) { |
|
|
|
&& expr.getType().isOfType(lvalue.getType())) { |
|
|
|
|
|
|
|
|
|
|
|
/* This gets tricky. We need to allow something like |
|
|
|
/* This gets tricky. We need to allow something like |
|
|
|
* s = (short) (int) ((double) s / 0.1); |
|
|
|
* s = (short) (int) ((double) s / 0.1); |
|
|
@ -129,9 +130,9 @@ public class CreateAssignExpression { |
|
|
|
|| !(loadExpr.isFreeOperator(lvalueCount))) |
|
|
|
|| !(loadExpr.isFreeOperator(lvalueCount))) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if (store.getLValue() instanceof LocalStoreOperator) |
|
|
|
if (lvalue instanceof LocalStoreOperator) |
|
|
|
((LocalLoadOperator)loadExpr).getLocalInfo().combineWith |
|
|
|
((LocalLoadOperator)loadExpr).getLocalInfo().combineWith |
|
|
|
(((LocalStoreOperator)store.getLValue()).getLocalInfo()); |
|
|
|
(((LocalStoreOperator)lvalue).getLocalInfo()); |
|
|
|
|
|
|
|
|
|
|
|
rightHandSide = expr.getSubExpressions()[1]; |
|
|
|
rightHandSide = expr.getSubExpressions()[1]; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -159,9 +160,9 @@ public class CreateAssignExpression { |
|
|
|
|| !(((Operator) simple).isFreeOperator(lvalueCount))) |
|
|
|
|| !(((Operator) simple).isFreeOperator(lvalueCount))) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
if (store.getLValue() instanceof LocalStoreOperator) |
|
|
|
if (lvalue instanceof LocalStoreOperator) |
|
|
|
((LocalLoadOperator)simple).getLocalInfo().combineWith |
|
|
|
((LocalLoadOperator)simple).getLocalInfo().combineWith |
|
|
|
(((LocalStoreOperator)store.getLValue()).getLocalInfo()); |
|
|
|
(((LocalStoreOperator)lvalue).getLocalInfo()); |
|
|
|
|
|
|
|
|
|
|
|
/* ... and remove it. */ |
|
|
|
/* ... and remove it. */ |
|
|
|
if (parent != null) { |
|
|
|
if (parent != null) { |
|
|
@ -177,7 +178,7 @@ public class CreateAssignExpression { |
|
|
|
dup.removeBlock(); |
|
|
|
dup.removeBlock(); |
|
|
|
ib.setInstruction(rightHandSide); |
|
|
|
ib.setInstruction(rightHandSide); |
|
|
|
|
|
|
|
|
|
|
|
store.getLValue().setType(rvalueType); |
|
|
|
lvalue.setType(rvalueType); |
|
|
|
store.makeOpAssign(store.OPASSIGN_OP + opIndex); |
|
|
|
store.makeOpAssign(store.OPASSIGN_OP + opIndex); |
|
|
|
|
|
|
|
|
|
|
|
if (isAssignOp) |
|
|
|
if (isAssignOp) |
|
|
@ -199,10 +200,11 @@ public class CreateAssignExpression { |
|
|
|
if (sequBlock.subBlocks[0] instanceof SpecialBlock |
|
|
|
if (sequBlock.subBlocks[0] instanceof SpecialBlock |
|
|
|
&& store.isFreeOperator()) { |
|
|
|
&& store.isFreeOperator()) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Expression lvalue = store.getSubExpressions()[0]; |
|
|
|
SpecialBlock dup = (SpecialBlock) sequBlock.subBlocks[0]; |
|
|
|
SpecialBlock dup = (SpecialBlock) sequBlock.subBlocks[0]; |
|
|
|
if (dup.type != SpecialBlock.DUP |
|
|
|
if (dup.type != SpecialBlock.DUP |
|
|
|
|| dup.depth != store.getLValue().getFreeOperandCount() |
|
|
|
|| dup.depth != lvalue.getFreeOperandCount() |
|
|
|
|| dup.count != store.getLValue().getType().stackSize()) |
|
|
|
|| dup.count != lvalue.getType().stackSize()) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
dup.removeBlock(); |
|
|
|
dup.removeBlock(); |
|
|
|