print et read fini !
This commit is contained in:
@@ -30,7 +30,7 @@ public interface Interface {
|
||||
public S visitAssignLLVM(AssignLLVMImp instr, H h);
|
||||
public S visitStoreLLVM(StoreLLVMImp instr, H h);
|
||||
public S visitPrintLLVM(PrintLLVMImp instr, H h);
|
||||
public S visitReadLLVM(ReadLLVMImp instr, H h);
|
||||
public S visitScanLLVM(ScanLLVMImp instr, H h);
|
||||
public S visitLabelLLVM(LabelLLVMImp instr, H h);
|
||||
public S visitBrLLVM(BrLLVMImp instr, H h);
|
||||
public S visitBrCondLLVM(BrCondLLVMImp instr, H h);
|
||||
|
||||
@@ -139,12 +139,12 @@ TypeLLVMVisitor<String,String>
|
||||
@Override
|
||||
public String visitPrintLLVM(PrintLLVMImp instr, String h) { //TODO
|
||||
DefineLLVMImp printLLVM = new DefineLLVMImp("printf", new IntLLVMImp(), new ArrayList<>(), new ArrayList<>());
|
||||
CallLLVMImp callPrint = new CallLLVMImp(printLLVM, new ArrayList<>(),"(i8*,...) ");
|
||||
CallLLVMImp callPrint = new CallLLVMImp(printLLVM, instr.l(),"(i8*,...) ");
|
||||
return callPrint.accept(this, h);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String visitReadLLVM(ReadLLVMImp instr, String h) { //TODO
|
||||
public String visitScanLLVM(ScanLLVMImp instr, String h) { //TODO
|
||||
DefineLLVMImp readLLVM = new DefineLLVMImp("scanf", new IntLLVMImp(), new ArrayList<>(), new ArrayList<>());
|
||||
CallLLVMImp callRead = new CallLLVMImp(readLLVM, instr.l(),"(i8*,...) ");
|
||||
return callRead.accept(this, h);
|
||||
@@ -153,8 +153,8 @@ TypeLLVMVisitor<String,String>
|
||||
@Override
|
||||
public String visitDeclarGlobalLLVM(DeclarGlobalLLVMImp instr, String h) {
|
||||
String str = "@."+instr.var().nom() + " = global";
|
||||
str += " [" + instr.type().accept(this, h)+ "x"+ instr.size()+ "] ";
|
||||
str+= "c\"\"\n";
|
||||
str += " [" + instr.size() + " x "+ instr.type().accept(this, h) + "] ";
|
||||
str+= "c\""+ instr.str()+"\"\n";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -88,15 +88,15 @@ public class ProgramLLVM {
|
||||
}
|
||||
}
|
||||
|
||||
public static record ReadLLVMImp(DeclarGlobalLLVMImp fmt,ArrayList<ValLLVM> l) implements InstructionLLVM{
|
||||
public static record ScanLLVMImp(DeclarGlobalLLVMImp fmt,ArrayList<ValLLVM> l) implements InstructionLLVM{
|
||||
|
||||
@Override
|
||||
public <H, S> S accept(InstructionLLVMVisitor<H, S> v, H h) {
|
||||
return v.visitReadLLVM(this, h);
|
||||
return v.visitScanLLVM(this, h);
|
||||
}
|
||||
}
|
||||
|
||||
public static record DeclarGlobalLLVMImp(VarLLVMImp var,TypeLLVM type, int size) implements InstructionLLVM{
|
||||
public static record DeclarGlobalLLVMImp(VarLLVMImp var,TypeLLVM type,String str, int size) implements InstructionLLVM{
|
||||
|
||||
@Override
|
||||
public <H, S> S accept(InstructionLLVMVisitor<H, S> v, H h) {
|
||||
|
||||
Reference in New Issue
Block a user