|
|
@ -25,13 +25,20 @@ public abstract class StoreInstruction extends Operator |
|
|
|
|
|
|
|
|
|
|
|
public String lvCasts; |
|
|
|
public String lvCasts; |
|
|
|
Type lvalueType; |
|
|
|
Type lvalueType; |
|
|
|
|
|
|
|
Type rvalueType; |
|
|
|
|
|
|
|
|
|
|
|
public StoreInstruction(Type type, int operator) { |
|
|
|
public StoreInstruction(Type type, int operator) { |
|
|
|
super(Type.tVoid, operator); |
|
|
|
super(Type.tVoid, operator); |
|
|
|
lvalueType = type; |
|
|
|
lvalueType = type; |
|
|
|
|
|
|
|
rvalueType = type; |
|
|
|
lvCasts = lvalueType.toString(); |
|
|
|
lvCasts = lvalueType.toString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void makeOpAssign(int operator) { |
|
|
|
|
|
|
|
setOperatorIndex(operator); |
|
|
|
|
|
|
|
rvalueType = Type.tUnknown; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Type getType() { |
|
|
|
public Type getType() { |
|
|
|
return type == Type.tVoid ? type : getLValueType(); |
|
|
|
return type == Type.tVoid ? type : getLValueType(); |
|
|
|
} |
|
|
|
} |
|
|
@ -89,7 +96,7 @@ public abstract class StoreInstruction extends Operator |
|
|
|
|
|
|
|
|
|
|
|
public Type getOperandType(int i) { |
|
|
|
public Type getOperandType(int i) { |
|
|
|
if (i == getLValueOperandCount()) |
|
|
|
if (i == getLValueOperandCount()) |
|
|
|
return getLValueType(); |
|
|
|
return rvalueType; |
|
|
|
else |
|
|
|
else |
|
|
|
return getLValueOperandType(i); |
|
|
|
return getLValueOperandType(i); |
|
|
|
} |
|
|
|
} |
|
|
@ -98,7 +105,10 @@ public abstract class StoreInstruction extends Operator |
|
|
|
int count = getLValueOperandCount(); |
|
|
|
int count = getLValueOperandCount(); |
|
|
|
if (count > 0) |
|
|
|
if (count > 0) |
|
|
|
setLValueOperandType(t); |
|
|
|
setLValueOperandType(t); |
|
|
|
setLValueType(t[count]); |
|
|
|
rvalueType = rvalueType.intersection(t[count]); |
|
|
|
|
|
|
|
if (getOperatorIndex() == ASSIGN_OP) |
|
|
|
|
|
|
|
/* In a direct assignment, lvalueType is rvalueType */ |
|
|
|
|
|
|
|
setLValueType(rvalueType); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public int getOperandCount() { |
|
|
|
public int getOperandCount() { |
|
|
|