Correction SymTable, param, et Type en TypeLLVM
This commit is contained in:
@@ -97,8 +97,7 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
|
||||
ArrayList<InstructionLLVM> list = new ArrayList<>();
|
||||
for(int i = 0; i<instr.s().size();i++){
|
||||
TypeLLVM t2 = instr.t().accept(this,h);
|
||||
//String name = instr.s().get(i);//h.addVarLLVM(instr.s().get(i));
|
||||
Result r = h.addVar(instr.s().get(i));
|
||||
Result r = h.addVar(instr.s().get(i),t2);
|
||||
String name = r.var;
|
||||
h = r.symTable;
|
||||
list.add(new AssignLLVMImp(new VarLLVMImp(t2, name,false),new allocaLLVMImp(t2)));
|
||||
@@ -229,11 +228,10 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
|
||||
int size = 1; //le \00 est focément à la fin et compte comme un seul char
|
||||
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());
|
||||
TypeLLVM typeVar = h.getType(instr.t().get(i).name());
|
||||
|
||||
//Ajout * par passant PointerType
|
||||
TypeLLVM baseType = typeVar.accept(this, h);
|
||||
TypeLLVM ptrType = new PointerLLVMImp(baseType);
|
||||
TypeLLVM ptrType = new PointerLLVMImp(typeVar);
|
||||
|
||||
VarLLVMImp newVar = new VarLLVMImp(ptrType, nomVar,false);
|
||||
strGlobal+="%d"; //2 char de long
|
||||
@@ -378,10 +376,10 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
|
||||
@Override
|
||||
public InstrAndVal visitVar(VarImp e, SymTable h) {
|
||||
ArrayList<InstructionLLVM> l =new ArrayList<>();
|
||||
ValLLVM val = new VarLLVMImp(h.getvar_Type(e.name()).accept(this,h),h.getVar(e.name()),false);
|
||||
ValLLVM val = new VarLLVMImp(h.getvar_Type(e.name()),h.getVar(e.name()),false);
|
||||
Result r = h.addNewTempVar();
|
||||
h = r.symTable;
|
||||
VarLLVMImp varTemp = new VarLLVMImp(h.getvar_Type(e.name()).accept(this,h),r.var,false);
|
||||
VarLLVMImp varTemp = new VarLLVMImp(h.getvar_Type(e.name()),r.var,false);
|
||||
l.add(new AssignLLVMImp(varTemp,((ExpressionLLVM)(new LoadLLVMImp(val)))));
|
||||
return new InstrAndVal(l, varTemp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user