Advertisement
Zelatrix

correct_ir

Jun 26th, 2021
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. ; ModuleID = "D:\early-deliverable\codegen.py"
  2. target triple = "x86_64-pc-windows-msvc"
  3. target datalayout = ""
  4.  
  5. define void @"main"()
  6. {
  7. entry:
  8. %".2" = bitcast [6 x i8]* @"fstr" to i64* ; Lines 2 and 3 allocate space for the variable in memory
  9. %".3" = alloca double
  10. store double 0x4000000000000000, double* %".3" ; Store the value 3 in a variable
  11. %".5" = load double, double* %".3" ; Load the variable's value
  12. %".6" = call i32 (i64*, ...) @"printf"(i64* %".2", double %".5") ; Print out the value of the variable
  13. %".7" = fadd double %".5", 0x4008000000000000 ; Add 3 to the value of the loaded variable
  14. %".8" = load double, double* %".3" ; Put the new value back into memory
  15. %".9" = call i32 (i64*, ...) @"printf"(i64* %".2", double %".7") ; Print out the new value
  16. ret void
  17. }
  18.  
  19. declare i32 @"printf"(i64* %".1", ...)
  20.  
  21. @"fstr" = internal constant [6 x i8] c"%lf \0a\00"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement