correction bug id des var temp dans le while

This commit is contained in:
Rochas
2025-04-13 12:36:39 +02:00
parent 99ca510bb1
commit 2f16120dae
5 changed files with 14 additions and 49 deletions

View File

@@ -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));