call.carbon 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. // Exceptions. See /LICENSE for license information.
  3. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. //
  5. // AUTOUPDATE
  6. fn Add(a: i32, b: i32) -> i32 = "int.sadd";
  7. var arr: [i32; Add(1, 2)];
  8. // CHECK:STDOUT: --- call.carbon
  9. // CHECK:STDOUT:
  10. // CHECK:STDOUT: constants {
  11. // CHECK:STDOUT: %Add: type = fn_type @Add [template]
  12. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  13. // CHECK:STDOUT: %struct: Add = struct_value () [template]
  14. // CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
  15. // CHECK:STDOUT: %.3: i32 = int_literal 2 [template]
  16. // CHECK:STDOUT: %.4: i32 = int_literal 3 [template]
  17. // CHECK:STDOUT: %.5: type = array_type %.4, i32 [template]
  18. // CHECK:STDOUT: %.6: type = ptr_type [i32; 3] [template]
  19. // CHECK:STDOUT: }
  20. // CHECK:STDOUT:
  21. // CHECK:STDOUT: file {
  22. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  23. // CHECK:STDOUT: .Core = %Core
  24. // CHECK:STDOUT: .Add = %Add.decl
  25. // CHECK:STDOUT: .arr = %arr
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  28. // CHECK:STDOUT: %Add.decl: Add = fn_decl @Add [template = constants.%struct] {
  29. // CHECK:STDOUT: %a.loc7_8.1: i32 = param a
  30. // CHECK:STDOUT: @Add.%a: i32 = bind_name a, %a.loc7_8.1
  31. // CHECK:STDOUT: %b.loc7_16.1: i32 = param b
  32. // CHECK:STDOUT: @Add.%b: i32 = bind_name b, %b.loc7_16.1
  33. // CHECK:STDOUT: @Add.%return: ref i32 = var <return slot>
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT: %Add.ref: Add = name_ref Add, %Add.decl [template = constants.%struct]
  36. // CHECK:STDOUT: %.loc9_20: i32 = int_literal 1 [template = constants.%.2]
  37. // CHECK:STDOUT: %.loc9_23: i32 = int_literal 2 [template = constants.%.3]
  38. // CHECK:STDOUT: %int.sadd: init i32 = call %Add.ref(%.loc9_20, %.loc9_23) [template = constants.%.4]
  39. // CHECK:STDOUT: %.loc9_25: type = array_type %int.sadd, i32 [template = constants.%.5]
  40. // CHECK:STDOUT: %arr.var: ref [i32; 3] = var arr
  41. // CHECK:STDOUT: %arr: ref [i32; 3] = bind_name arr, %arr.var
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: fn @Add(%a: i32, %b: i32) -> i32 = "int.sadd";
  45. // CHECK:STDOUT: