While toLLVM fait
This commit is contained in:
@@ -162,14 +162,21 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImpl>
|
||||
String labelDone = "done"+h.getNewIdLabel();
|
||||
|
||||
l.add(new LabelLLVMImp(labelWhile));
|
||||
InstrAndVal temp = instr.e().accept(this,h); //retourne les instruction pour optenir le résultat ainsi que la variable contenant le résultat final
|
||||
l.addAll(temp.instrs);
|
||||
InstrAndVal temp = instr.e().accept(this,h); //retourne les instructionz pour obtenir le résultat de l'expression ainsi que la variable contenant le résultat final
|
||||
l.addAll(temp.instrs); //instructions
|
||||
ValLLVM val = temp.val; //temp6
|
||||
//TODO : icmp et br
|
||||
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));
|
||||
|
||||
l.add(new LabelLLVMImp(labelDo));
|
||||
l.addAll(instr.i1().accept(this,h));
|
||||
//TODO br vers label while
|
||||
|
||||
l.add(new BrLLVMImp(labelWhile));
|
||||
|
||||
l.add(new LabelLLVMImp(labelDone));
|
||||
|
||||
return l;
|
||||
|
||||
Reference in New Issue
Block a user