change name to LLVM

This commit is contained in:
Vu Tuan Minh
2025-04-28 06:43:58 +02:00
parent 3b36c75dae
commit 4a48ee286b
2 changed files with 11 additions and 11 deletions

View File

@@ -96,7 +96,7 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
Result r = h.addVar(instr.s().get(i));
String name = r.var;
h = r.symTable;
list.add(new AssignLVMImp(new VarLLVMImp(t2, name),new allocaLLVMImp(t2)));
list.add(new AssignLLVMImp(new VarLLVMImp(t2, name),new allocaLLVMImp(t2)));
}
prevSymTable.updateId(h);
return new InstrAndSymTable(list,h);
@@ -156,7 +156,7 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
ValLLVM var = res.val;
ArrayList<InstructionLLVM> result = new ArrayList<>();
result.addAll(res.instrs);
//InstructionLLVM r = new AssignLVMImp(new VarLLVMImpl(var.getType(),instr.t()),var);
//InstructionLLVM r = new AssignLLVMImp(new VarLLVMImpl(var.getType(),instr.t()),var);
InstructionLLVM r = new StoreLLVMImp(var.getType(),var,var.getType(),new VarLLVMImp(var.getType(),h.getVar(instr.t())));
result.add(r);
return result;
@@ -201,7 +201,7 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
Result r = h.addNewTempVar();
h = r.symTable;
VarLLVMImp varCond = new VarLLVMImp(exTemp.getType(), r.var);
l.add(new AssignLVMImp(varCond,exTemp));
l.add(new AssignLLVMImp(varCond,exTemp));
l.add(new BrCondLLVMImp(varCond,labelThen,labelFin));
l.add(new LabelLLVMImp(labelThen));
@@ -232,7 +232,7 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
Result r = h.addNewTempVar();
h = r.symTable;
VarLLVMImp varCond = new VarLLVMImp(exTemp.getType(), r.var);
l.add(new AssignLVMImp(varCond,exTemp));
l.add(new AssignLLVMImp(varCond,exTemp));
l.add(new BrCondLLVMImp(varCond,labelThen,labelElse));
l.add(new LabelLLVMImp(labelThen));
@@ -266,7 +266,7 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
Result r = h.addNewTempVar();
h = r.symTable;
VarLLVMImp varCond = new VarLLVMImp(exTemp.getType(), r.var);
l.add(new AssignLVMImp(varCond,exTemp));
l.add(new AssignLLVMImp(varCond,exTemp));
l.add(new BrCondLLVMImp(varCond,labelDo,labelDone));
l.add(new LabelLLVMImp(labelDo));
@@ -299,7 +299,7 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
Result r = h.addNewTempVar();
h = r.symTable;
VarLLVMImp varTemp = new VarLLVMImp(h.getvar_Type(e.name()).accept(this,h),r.var);
l.add(new AssignLVMImp(varTemp,((ExpressionLLVM)(new LoadLLVMImp(val)))));
l.add(new AssignLLVMImp(varTemp,((ExpressionLLVM)(new LoadLLVMImp(val)))));
prevSymTable.updateId(h);
return new InstrAndVal(l, varTemp);
}
@@ -326,7 +326,7 @@ public class toLLVM_Visitor implements ProgramVisitor<SymTable,ProgramLLVMImp>,
String temp = r.var;
h = r.symTable;
VarLLVMImp var = new VarLLVMImp(type,temp);
list.add(new AssignLVMImp(var, new BinOpLLVMImp(type,e.op(),val1,val2)));
list.add(new AssignLLVMImp(var, new BinOpLLVMImp(type,e.op(),val1,val2)));
prevSymTable.updateId(h);
return new InstrAndVal(list, var);
}