Skip to content

Commit

Permalink
update type of lval after ramget using declared Type.
Browse files Browse the repository at this point in the history
Throw error (with a meaningful description) if lval is not an instance of VarLvalue.
  • Loading branch information
Daniel Pujiula authored and maxhowald committed Apr 28, 2019
1 parent 26f30ed commit f638ab2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions compiler/frontend/src/SFE/Compiler/RamGetEnhancedStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ public Statement toSLPTCircuit(Object obj) {
if (value.size() > 1) {
for (int i = 0; i < value.size(); i++) {
LvalExpression lval = value.fieldEltAt(i);
if (lval.getLvalue() instanceof VarLvalue) {
Type declaredType = ((VarLvalue) lval.getLvalue()).getDeclaredType();
lval.getLvalue().setType(declaredType);
} else {
throw new RuntimeException("Failed to reset the type of the lvalue " +
lval.getLvalue().toString() + " to its declared type after " +
"ramget: I don't know how to determine the declared type " +
"of a " + lval.getClass() + "."
);
}
Expression fieldAddr = new BinaryOpExpression(new PlusOperator(),
address, IntConstant.valueOf(i));
Statement ramget = new RamGetEnhancedStatement(lval, fieldAddr);
Expand Down

0 comments on commit f638ab2

Please sign in to comment.