params_two.carbon 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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_two.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_two.carbon
  10. fn Foo(a: i32, b: i32) {}
  11. fn Main() {
  12. Foo(1, 2);
  13. }
  14. // CHECK:STDOUT: --- params_two.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: %.3: i32 = int_literal 2 [template]
  26. // CHECK:STDOUT: }
  27. // CHECK:STDOUT:
  28. // CHECK:STDOUT: imports {
  29. // CHECK:STDOUT: %Core: <namespace> = namespace file.%Core.import, [template] {
  30. // CHECK:STDOUT: .Int32 = %import_ref
  31. // CHECK:STDOUT: import Core//prelude
  32. // CHECK:STDOUT: import Core//prelude/operators
  33. // CHECK:STDOUT: import Core//prelude/types
  34. // CHECK:STDOUT: import Core//prelude/operators/arithmetic
  35. // CHECK:STDOUT: import Core//prelude/operators/as
  36. // CHECK:STDOUT: import Core//prelude/operators/bitwise
  37. // CHECK:STDOUT: import Core//prelude/operators/comparison
  38. // CHECK:STDOUT: import Core//prelude/types/bool
  39. // CHECK:STDOUT: }
  40. // CHECK:STDOUT: %import_ref: %Int32.type = import_ref Core//prelude/types, inst+4, loaded [template = constants.%Int32]
  41. // CHECK:STDOUT: }
  42. // CHECK:STDOUT:
  43. // CHECK:STDOUT: file {
  44. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  45. // CHECK:STDOUT: .Core = imports.%Core
  46. // CHECK:STDOUT: .Foo = %Foo.decl
  47. // CHECK:STDOUT: .Main = %Main.decl
  48. // CHECK:STDOUT: }
  49. // CHECK:STDOUT: %Core.import = import Core
  50. // CHECK:STDOUT: %Foo.decl: %Foo.type = fn_decl @Foo [template = constants.%Foo] {
  51. // CHECK:STDOUT: %a.patt: i32 = binding_pattern a
  52. // CHECK:STDOUT: %b.patt: i32 = binding_pattern b
  53. // CHECK:STDOUT: } {
  54. // CHECK:STDOUT: %int.make_type_32.loc11_11: init type = call constants.%Int32() [template = i32]
  55. // CHECK:STDOUT: %.loc11_11.1: type = value_of_initializer %int.make_type_32.loc11_11 [template = i32]
  56. // CHECK:STDOUT: %.loc11_11.2: type = converted %int.make_type_32.loc11_11, %.loc11_11.1 [template = i32]
  57. // CHECK:STDOUT: %a.param: i32 = param a, runtime_param0
  58. // CHECK:STDOUT: %a: i32 = bind_name a, %a.param
  59. // CHECK:STDOUT: %int.make_type_32.loc11_19: init type = call constants.%Int32() [template = i32]
  60. // CHECK:STDOUT: %.loc11_19.1: type = value_of_initializer %int.make_type_32.loc11_19 [template = i32]
  61. // CHECK:STDOUT: %.loc11_19.2: type = converted %int.make_type_32.loc11_19, %.loc11_19.1 [template = i32]
  62. // CHECK:STDOUT: %b.param: i32 = param b, runtime_param1
  63. // CHECK:STDOUT: %b: i32 = bind_name b, %b.param
  64. // CHECK:STDOUT: }
  65. // CHECK:STDOUT: %Main.decl: %Main.type = fn_decl @Main [template = constants.%Main] {} {}
  66. // CHECK:STDOUT: }
  67. // CHECK:STDOUT:
  68. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  69. // CHECK:STDOUT:
  70. // CHECK:STDOUT: fn @Foo(%a: i32, %b: i32) {
  71. // CHECK:STDOUT: !entry:
  72. // CHECK:STDOUT: return
  73. // CHECK:STDOUT: }
  74. // CHECK:STDOUT:
  75. // CHECK:STDOUT: fn @Main() {
  76. // CHECK:STDOUT: !entry:
  77. // CHECK:STDOUT: %Foo.ref: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo]
  78. // CHECK:STDOUT: %.loc14_7: i32 = int_literal 1 [template = constants.%.2]
  79. // CHECK:STDOUT: %.loc14_10: i32 = int_literal 2 [template = constants.%.3]
  80. // CHECK:STDOUT: %Foo.call: init %.1 = call %Foo.ref(%.loc14_7, %.loc14_10)
  81. // CHECK:STDOUT: return
  82. // CHECK:STDOUT: }
  83. // CHECK:STDOUT: