while imp en cours, todo : if else then
This commit is contained in:
@@ -156,6 +156,22 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImpl>
|
||||
@Override
|
||||
public ArrayList<InstructionLLVM> visitWhile(WhileImp instr, SymTable h) {
|
||||
ArrayList<InstructionLLVM> l = new ArrayList<>();
|
||||
|
||||
String labelWhile = "while"+h.getNewIdLabel();
|
||||
String labelDo = "do"+h.getNewIdLabel();
|
||||
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);
|
||||
ValLLVM val = temp.val; //temp6
|
||||
//TODO : icmp et br
|
||||
|
||||
l.add(new LabelLLVMImp(labelDo));
|
||||
l.addAll(instr.i1().accept(this,h));
|
||||
//TODO br vers label while
|
||||
l.add(new LabelLLVMImp(labelDone));
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user