call réparé
This commit is contained in:
@@ -34,7 +34,7 @@ public interface Interface {
|
||||
public S visitLabelLLVM(LabelLLVMImp instr, H h);
|
||||
public S visitBrLLVM(BrLLVMImp instr, H h);
|
||||
public S visitBrCondLLVM(BrCondLLVMImp instr, H h);
|
||||
public S visitCallLLVM(CallLLVMImp instr, H h);
|
||||
public S visitCallVoidLLVM(CallVoidLLVMImp instr, H h);
|
||||
}
|
||||
|
||||
//////////ExpressionLLVM (expression)
|
||||
@@ -53,6 +53,7 @@ public interface Interface {
|
||||
public S visitValLLVM(ValLLVMImp e,H h);
|
||||
public S visitVarLLVM(VarLLVMImp e,H h);
|
||||
public S visitIcmpLLVM(IcmpLLVMImp e, H h);
|
||||
public S visitCallLLVM(CallLLVMImp e, H h);
|
||||
}
|
||||
|
||||
/*public interface IdentifierLLVM{ //globaux @ et local %
|
||||
|
||||
@@ -69,6 +69,16 @@ TypeLLVMVisitor<String,String>
|
||||
return INDENT+instr.var().accept(this, h) + " = " + instr.e().accept(this, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visitCallVoidLLVM(CallVoidLLVMImp instr, String h) {
|
||||
String str = INDENT+ "call " + instr.str() + instr.f().type().accept(this, h) + " @"+instr.f().name() + "(";
|
||||
for(int i = 0; i<instr.params().size(); i++){
|
||||
str += instr.params().get(i).getType().accept(this, h) + " " + instr.params().get(i).accept(this,h);
|
||||
if(i<instr.params().size()-1) str += ", ";
|
||||
}
|
||||
return str + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visitBinOpLLVM(BinOpLLVMImp e, String h) {
|
||||
String str = "";
|
||||
@@ -187,4 +197,5 @@ TypeLLVMVisitor<String,String>
|
||||
return "i8*";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -74,10 +74,10 @@ public class ProgramLLVM {
|
||||
}
|
||||
}
|
||||
|
||||
public static record CallLLVMImp(DefineLLVMImp f, ArrayList<ValLLVM> params, String str) implements InstructionLLVM{ //une expression ?
|
||||
public static record CallVoidLLVMImp(DefineLLVMImp f, ArrayList<ValLLVM> params, String str) implements InstructionLLVM{
|
||||
@Override
|
||||
public <H, S> S accept(InstructionLLVMVisitor<H, S> v, H h) {
|
||||
return v.visitCallLLVM(this, h);
|
||||
return v.visitCallVoidLLVM(this, h);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,6 +148,18 @@ public class ProgramLLVM {
|
||||
|
||||
}
|
||||
|
||||
public static record CallLLVMImp(DefineLLVMImp f, ArrayList<ValLLVM> params, String str) implements ExpressionLLVM{
|
||||
@Override
|
||||
public <H, S> S accept(ExpressionLLVMVisitor<H, S> v, H h) {
|
||||
return v.visitCallLLVM(this, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeLLVM getType() {
|
||||
return f.type();
|
||||
}
|
||||
}
|
||||
|
||||
//Val
|
||||
|
||||
public static record ValLLVMImp(TypeLLVM type, int val) implements ValLLVM{
|
||||
|
||||
Reference in New Issue
Block a user