more_param_ir.carbon 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 Foo(a: i32, b: i32) {}
  7. fn Main() {
  8. var x: (i32,) = (1,);
  9. // Generates multiple IR instructions for the first parameter.
  10. Foo(x[0], 6);
  11. }
  12. // CHECK:STDOUT: --- more_param_ir.carbon
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: constants {
  15. // CHECK:STDOUT: %.loc10_15.1: type = tuple_type (type), const
  16. // CHECK:STDOUT: %.loc10_15.2: type = tuple_type (i32), const
  17. // CHECK:STDOUT: %.loc10_20: i32 = int_literal 1, const
  18. // CHECK:STDOUT: %.loc12_9: i32 = int_literal 0, const
  19. // CHECK:STDOUT: %.loc12_13: i32 = int_literal 6, const
  20. // CHECK:STDOUT: %.loc12_6: type = tuple_type (), const
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: file {
  24. // CHECK:STDOUT: package: <namespace> = namespace package, {.Foo = %Foo, .Main = %Main}
  25. // CHECK:STDOUT: %Foo: <function> = fn_decl @Foo, const
  26. // CHECK:STDOUT: %Main: <function> = fn_decl @Main, const
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT:
  29. // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) {
  30. // CHECK:STDOUT: !entry:
  31. // CHECK:STDOUT: return
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT:
  34. // CHECK:STDOUT: fn @Main() {
  35. // CHECK:STDOUT: !entry:
  36. // CHECK:STDOUT: %.loc10_15.1: (type,) = tuple_literal (i32)
  37. // CHECK:STDOUT: %.loc10_15.2: type = converted %.loc10_15.1, constants.%.loc10_15.2, const = constants.%.loc10_15.2
  38. // CHECK:STDOUT: %x.var: ref (i32,) = var x
  39. // CHECK:STDOUT: %x: ref (i32,) = bind_name x, %x.var
  40. // CHECK:STDOUT: %.loc10_20: i32 = int_literal 1, const = constants.%.loc10_20
  41. // CHECK:STDOUT: %.loc10_22.1: (i32,) = tuple_literal (%.loc10_20)
  42. // CHECK:STDOUT: %.loc10_22.2: init (i32,) = tuple_init (%.loc10_20) to %x.var
  43. // CHECK:STDOUT: %.loc10_22.3: init (i32,) = converted %.loc10_22.1, %.loc10_22.2
  44. // CHECK:STDOUT: assign %x.var, %.loc10_22.3
  45. // CHECK:STDOUT: %Foo.ref: <function> = name_ref Foo, file.%Foo, const = file.%Foo
  46. // CHECK:STDOUT: %x.ref: ref (i32,) = name_ref x, %x
  47. // CHECK:STDOUT: %.loc12_9: i32 = int_literal 0, const = constants.%.loc12_9
  48. // CHECK:STDOUT: %.loc12_10.1: ref i32 = tuple_index %x.ref, %.loc12_9
  49. // CHECK:STDOUT: %.loc12_13: i32 = int_literal 6, const = constants.%.loc12_13
  50. // CHECK:STDOUT: %.loc12_10.2: i32 = bind_value %.loc12_10.1
  51. // CHECK:STDOUT: %.loc12_6: init () = call %Foo.ref(%.loc12_10.2, %.loc12_13)
  52. // CHECK:STDOUT: return
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT: