correction bug id des var temp dans le while
This commit is contained in:
@@ -137,7 +137,12 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImpl>
|
||||
@Override
|
||||
public ArrayList<InstructionLLVM> visitRead(ReadImp instr, SymTable h) {
|
||||
ArrayList<InstructionLLVM> l = new ArrayList<>();
|
||||
l.add(new ReadLLVMImpl(new ArrayList())); //TODO
|
||||
for(int i = 0; i<instr.t().size(); i++){
|
||||
String nomVar = h.getVar(instr.t().get(i).name());
|
||||
Type typeVar = h.getType(instr.t().get(i).name());
|
||||
VarLLVMImpl newVar = new VarLLVMImpl(typeVar.accept(this,h), nomVar);
|
||||
l.add(new ReadLLVMImpl(newVar));
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
@@ -213,7 +218,6 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImpl>
|
||||
ValLLVM val = temp.val; //temp6
|
||||
ExpressionLLVM exTemp = new IcmpLLVMImp(val,new ValLLVMImpl(new IntLLVMImpl(), 0));
|
||||
Result temp2 = h.addNewTempVar();
|
||||
h = temp2.symTable;
|
||||
VarLLVMImpl varCond = new VarLLVMImpl(exTemp.getType(), temp2.var);
|
||||
l.add(new AssignLVMImpl(varCond,exTemp));
|
||||
l.add(new BrCondLLVMImp(varCond,labelDo,labelDone));
|
||||
|
||||
Reference in New Issue
Block a user