params_two.carbon 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. Foo(1, 2);
  9. }
  10. // CHECK:STDOUT: --- params_two.carbon
  11. // CHECK:STDOUT:
  12. // CHECK:STDOUT: constants {
  13. // CHECK:STDOUT: %Foo: type = fn_type @Foo [template]
  14. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  15. // CHECK:STDOUT: %struct.1: Foo = struct_value () [template]
  16. // CHECK:STDOUT: %Main: type = fn_type @Main [template]
  17. // CHECK:STDOUT: %struct.2: Main = struct_value () [template]
  18. // CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
  19. // CHECK:STDOUT: %.3: i32 = int_literal 2 [template]
  20. // CHECK:STDOUT: }
  21. // CHECK:STDOUT:
  22. // CHECK:STDOUT: file {
  23. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  24. // CHECK:STDOUT: .Core = %Core
  25. // CHECK:STDOUT: .Foo = %Foo.decl
  26. // CHECK:STDOUT: .Main = %Main.decl
  27. // CHECK:STDOUT: }
  28. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  29. // CHECK:STDOUT: %Foo.decl: Foo = fn_decl @Foo [template = constants.%struct.1] {
  30. // CHECK:STDOUT: %a.loc7_8.1: i32 = param a
  31. // CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc7_8.1
  32. // CHECK:STDOUT: %b.loc7_16.1: i32 = param b
  33. // CHECK:STDOUT: @Foo.%b: i32 = bind_name b, %b.loc7_16.1
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {}
  36. // CHECK:STDOUT: }
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) {
  39. // CHECK:STDOUT: !entry:
  40. // CHECK:STDOUT: return
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: fn @Main() {
  44. // CHECK:STDOUT: !entry:
  45. // CHECK:STDOUT: %Foo.ref: Foo = name_ref Foo, file.%Foo.decl [template = constants.%struct.1]
  46. // CHECK:STDOUT: %.loc10_7: i32 = int_literal 1 [template = constants.%.2]
  47. // CHECK:STDOUT: %.loc10_10: i32 = int_literal 2 [template = constants.%.3]
  48. // CHECK:STDOUT: %Foo.call: init () = call %Foo.ref(%.loc10_7, %.loc10_10)
  49. // CHECK:STDOUT: return
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT: