params_one.carbon 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. // TIP: To test this file alone, run:
  7. // TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/function/call/params_one.carbon
  8. // TIP: To dump output, run:
  9. // TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/function/call/params_one.carbon
  10. fn Foo(a: i32) {}
  11. fn Main() {
  12. Foo(1);
  13. }
  14. // CHECK:STDOUT: --- params_one.carbon
  15. // CHECK:STDOUT:
  16. // CHECK:STDOUT: constants {
  17. // CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
  18. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  19. // CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
  20. // CHECK:STDOUT: %Foo.type: type = fn_type @Foo [template]
  21. // CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
  22. // CHECK:STDOUT: %Main.type: type = fn_type @Main [template]
  23. // CHECK:STDOUT: %Main: %Main.type = struct_value () [template]
  24. // CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
  25. // CHECK:STDOUT: }
  26. // CHECK:STDOUT:
  27. // CHECK:STDOUT: file {
  28. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  29. // CHECK:STDOUT: .Core = %Core
  30. // CHECK:STDOUT: .Foo = %Foo.decl
  31. // CHECK:STDOUT: .Main = %Main.decl
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  34. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref ir3, inst+3, loaded [template = constants.%Int32]
  35. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  36. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%Int32() [template = i32]
  37. // CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32 [template = i32]
  38. // CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32, %.loc11_11.1 [template = i32]
  39. // CHECK:STDOUT: %a.loc11_8.1: i32 = param a
  40. // CHECK:STDOUT: @Foo.%a: i32 = bind_name a, %a.loc11_8.1
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {}
  43. // CHECK:STDOUT: }
  44. // CHECK:STDOUT:
  45. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  46. // CHECK:STDOUT:
  47. // CHECK:STDOUT: fn @Foo(%a: i32) {
  48. // CHECK:STDOUT: !entry:
  49. // CHECK:STDOUT: return
  50. // CHECK:STDOUT: }
  51. // CHECK:STDOUT:
  52. // CHECK:STDOUT: fn @Main() {
  53. // CHECK:STDOUT: !entry:
  54. // CHECK:STDOUT: %Foo.ref: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo]
  55. // CHECK:STDOUT: %.loc14: i32 = int_literal 1 [template = constants.%.2]
  56. // CHECK:STDOUT: %Foo.call: init %.1 = call %Foo.ref(%.loc14)
  57. // CHECK:STDOUT: return
  58. // CHECK:STDOUT: }
  59. // CHECK:STDOUT: