Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. define { i32, i32* }* @create_array() local_unnamed_addr gc "ocaml" {
  2. entry:
  3. %malloccall = tail call i8* @malloc(i32 32)
  4. %array_init = bitcast i8* %malloccall to i32*
  5. br label %test
  6.  
  7. test: ; preds = %loop, %entry
  8. %i.0 = phi i32 [ 0, %entry ], [ %add_tmp, %loop ]
  9. %lt_tmp = icmp slt i32 %i.0, 8
  10. %bool_tmp = zext i1 %lt_tmp to i32
  11. %cond = icmp eq i32 %bool_tmp, 1
  12. br i1 %cond, label %loop, label %end
  13.  
  14. loop: ; preds = %test
  15. %Element = getelementptr i32, i32* %array_init, i32 %i.0
  16. store i32 1, i32* %Element
  17. %add_tmp = add i32 %i.0, 1
  18. br label %test
  19.  
  20. end: ; preds = %test
  21. %malloccall4 = tail call i8* @malloc(i32 ptrtoint ({ i32, i32* }* getelementptr ({ i32, i32* }, { i32, i32* }* null, i32 1) to i32))
  22. %array_wrapper = bitcast i8* %malloccall4 to { i32, i32* }*
  23. %array_length = getelementptr { i32, i32* }, { i32, i32* }* %array_wrapper, i32 0, i32 0
  24. store i32 8, i32* %array_length
  25. %array_ptr = getelementptr { i32, i32* }, { i32, i32* }* %array_wrapper, i32 0, i32 1
  26. store i32* %array_init, i32** %array_ptr
  27. ret { i32, i32* }* %array_wrapper
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement