i32.carbon 2.1 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 Echo(a: i32) -> i32 {
  7. return a;
  8. }
  9. fn Main() {
  10. var b: i32 = Echo(1);
  11. }
  12. // CHECK:STDOUT: --- i32.carbon
  13. // CHECK:STDOUT:
  14. // CHECK:STDOUT: constants {
  15. // CHECK:STDOUT: %Echo: type = fn_type @Echo [template]
  16. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  17. // CHECK:STDOUT: %struct.1: Echo = struct_value () [template]
  18. // CHECK:STDOUT: %Main: type = fn_type @Main [template]
  19. // CHECK:STDOUT: %struct.2: Main = struct_value () [template]
  20. // CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
  21. // CHECK:STDOUT: }
  22. // CHECK:STDOUT:
  23. // CHECK:STDOUT: file {
  24. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  25. // CHECK:STDOUT: .Core = %Core
  26. // CHECK:STDOUT: .Echo = %Echo.decl
  27. // CHECK:STDOUT: .Main = %Main.decl
  28. // CHECK:STDOUT: }
  29. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  30. // CHECK:STDOUT: %Echo.decl: Echo = fn_decl @Echo [template = constants.%struct.1] {
  31. // CHECK:STDOUT: %a.loc7_9.1: i32 = param a
  32. // CHECK:STDOUT: @Echo.%a: i32 = bind_name a, %a.loc7_9.1
  33. // CHECK:STDOUT: @Echo.%return: ref i32 = var <return slot>
  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 @Echo(%a: i32) -> i32 {
  39. // CHECK:STDOUT: !entry:
  40. // CHECK:STDOUT: %a.ref: i32 = name_ref a, %a
  41. // CHECK:STDOUT: return %a.ref
  42. // CHECK:STDOUT: }
  43. // CHECK:STDOUT:
  44. // CHECK:STDOUT: fn @Main() {
  45. // CHECK:STDOUT: !entry:
  46. // CHECK:STDOUT: %b.var: ref i32 = var b
  47. // CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
  48. // CHECK:STDOUT: %Echo.ref: Echo = name_ref Echo, file.%Echo.decl [template = constants.%struct.1]
  49. // CHECK:STDOUT: %.loc12: i32 = int_literal 1 [template = constants.%.2]
  50. // CHECK:STDOUT: %Echo.call: init i32 = call %Echo.ref(%.loc12)
  51. // CHECK:STDOUT: assign %b.var, %Echo.call
  52. // CHECK:STDOUT: return
  53. // CHECK:STDOUT: }
  54. // CHECK:STDOUT: