llvmir some opt

This commit is contained in:
邓智航
2025-12-10 17:58:17 +08:00
commit 84827838e2
103 changed files with 5838 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package midend.llvm.instr;
import midend.llvm.type.IrInterType;
import midend.llvm.type.IrPointerType;
import midend.llvm.constant.IrConstantStr;
public class PutStrInstr extends IrInstr {
private IrConstantStr strVal;
public PutStrInstr(String name, IrConstantStr putValue) {
super(IrInterType.VOID, name, IrInstrType.IO);
addUse(putValue);
strVal = putValue;
}
public static String putStrDecl() {
return "declare void @putstr(i8*)";
}
public String toString() {
IrPointerType ptrType = (IrPointerType) strVal.getType();
return "call void @putstr(i8* getelementptr inbounds ("
+ ptrType.getPointeeType() + ", " + ptrType +
" " + strVal.getName() + ", i32 0, i32 0))";
}
}