Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stringify ast #3

Draft
wants to merge 112 commits into
base: main
Choose a base branch
from
Draft

stringify ast #3

wants to merge 112 commits into from

Conversation

probably-neb
Copy link
Owner

  • create stringify ast
  • add notes for future ast stringify fixes

probably-neb and others added 29 commits May 21, 2024 22:49
define i64 @main() {entry:  %a3 = alloca i64  %a4 = load i64, i64* %a3  %c8 = alloca i64  %c9 = load i64, i64* %c8  %b14 = alloca i64  %b15 = load i64, i64* %b14  br label %body0body0:  br label %if.cond1if.cond1:  %imm_store5 = add i64 1, 0  %_6 = icmp eq i64 %a4, %imm_store5  br i1 %_6, label %then.body2, label %if.exit4then.body2:  br label %then.exit3then.exit3:  br label %if.exit4if.exit4:  %b0 = phi i64 [ %b15, %if.cond1 ], [ %c9, %then.exit3 ]  br label %exitexit:  %return_reg12 = phi i64 [ %a4, %if.exit4 ]  ret i64 %return_reg12}
declare i8* @malloc(i32)declare void @free(i8*)declare i32 @printf(i8*, ...)declare i32 @scanf(i8*, ...)@.println = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align [email protected] = private unnamed_addr constant [5 x i8] c"%ld \00", align [email protected] = private unnamed_addr constant [4 x i8] c"%ld\00", align [email protected]_scratch = common global i32 0, align 4define void @main() {entry:  br label %body0body0:  %imm_store2 = add i64 10, 0  br label %while.cond11while.cond11:  %imm_store4 = add i64 0, 0  %_5 = icmp sge i64 %imm_store2, %imm_store4  br i1 %_5, label %while.body2, label %while.exit5while.body2:  %a1 = phi i64 [ %imm_store2, %while.cond11 ], [ %_10, %while.fillback4 ]  %_7 = getelementptr [ 5 x i8 ], [ 5 x i8 ]* @.println, i1 0, i32 0  %_8 = call i32 (i8*, ...) @printf(i8* %_7, i64 %a1)  %imm_store9 = add i64 1, 0  %_10 = sub i64 %a1, %imm_store9  br label %while.cond23while.cond23:  %imm_store12 = add i64 0, 0  %imm_store13 = icmp sge i64 %_10, %imm_store12  br i1 %imm_store13, label %while.fillback4, label %while.exit5while.fillback4:  br label %while.body2while.exit5:  %a0 = phi i64 [ %imm_store2, %while.cond11 ], [ %_10, %while.cond23 ]  br label %exitexit:  ret void}
…er scale fill back, I think maybe just a phi for every node? This is thinking for a later time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants