tesst bugged
This commit is contained in:
@@ -49,7 +49,8 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
|
||||
for(int i = 0; i<prog.fonctions().size(); i++){
|
||||
DefineLLVMImp function = prog.fonctions().get(i).accept(this, h);
|
||||
Boolean isProto = (prog.fonctions().get(i) instanceof PrototypeImp);
|
||||
h = h.addFunction(function,isProto);
|
||||
TypeLLVM type = prog.fonctions().get(i); //TODO
|
||||
h = h.addFunction(function,isProto,type);
|
||||
if(!isProto){ //les prototypes n'existent pas dans LLVM
|
||||
fonctionLLVM.add(function);
|
||||
}
|
||||
@@ -250,9 +251,9 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
|
||||
@Override
|
||||
public ArrayList<InstructionLLVM> visitIfThen(IfThenImp instr, SymTable h) {
|
||||
ArrayList<InstructionLLVM> l = new ArrayList<>();
|
||||
String labelIf= "if"+h.getNewIdLabel()+":";
|
||||
String labelThen= "then"+h.getNewIdLabel()+":";
|
||||
String labelFin= "fin"+h.getNewIdLabel();
|
||||
String labelIf= "if"+h.getNewIdLabel();
|
||||
String labelThen= "then"+h.getNewIdLabel();
|
||||
String labelFin= "fi"+h.getNewIdLabel();
|
||||
|
||||
l.add(new LabelLLVMImp(labelIf));
|
||||
InstrAndVal temp = instr.e().accept(this,h);
|
||||
@@ -272,16 +273,19 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
|
||||
h=h.outBlock();
|
||||
|
||||
l.add(new LabelLLVMImp(labelFin));
|
||||
if (h.getFuncType() instanceof IntLLVMImp) {
|
||||
l.add(new ReturnLLVMImp(new IntLLVMImp(), new ValLLVMImp(new IntLLVMImp(), 0)));
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<InstructionLLVM> visitIfThenElse(IfThenElseImp instr, SymTable h) {
|
||||
ArrayList<InstructionLLVM> l = new ArrayList<>();
|
||||
String labelIf= "if"+h.getNewIdLabel()+":";
|
||||
String labelThen= "then"+h.getNewIdLabel()+":";
|
||||
String labelElse= "else"+h.getNewIdLabel()+":";
|
||||
String labelFin= "fin"+h.getNewIdLabel();
|
||||
String labelIf= "if"+h.getNewIdLabel();
|
||||
String labelThen= "then"+h.getNewIdLabel();
|
||||
String labelElse= "else"+h.getNewIdLabel();
|
||||
String labelFin= "fi"+h.getNewIdLabel();
|
||||
|
||||
l.add(new LabelLLVMImp(labelIf));
|
||||
InstrAndVal temp = instr.e().accept(this,h);
|
||||
|
||||
Reference in New Issue
Block a user