basic.carbon 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 Main() -> i32 {
  7. return 1 as i32;
  8. }
  9. // CHECK:STDOUT: --- basic.carbon
  10. // CHECK:STDOUT:
  11. // CHECK:STDOUT: constants {
  12. // CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
  13. // CHECK:STDOUT: %.1: type = tuple_type () [template]
  14. // CHECK:STDOUT: %struct.1: Int32 = struct_value () [template]
  15. // CHECK:STDOUT: %Main: type = fn_type @Main [template]
  16. // CHECK:STDOUT: %struct.2: Main = struct_value () [template]
  17. // CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
  18. // CHECK:STDOUT: }
  19. // CHECK:STDOUT:
  20. // CHECK:STDOUT: file {
  21. // CHECK:STDOUT: package: <namespace> = namespace [template] {
  22. // CHECK:STDOUT: .Core = %Core
  23. // CHECK:STDOUT: .Main = %Main.decl
  24. // CHECK:STDOUT: }
  25. // CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
  26. // CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
  27. // CHECK:STDOUT: %Main.decl: Main = fn_decl @Main [template = constants.%struct.2] {
  28. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32]
  29. // CHECK:STDOUT: %.loc7_14.1: type = value_of_initializer %int.make_type_32 [template = i32]
  30. // CHECK:STDOUT: %.loc7_14.2: type = converted %int.make_type_32, %.loc7_14.1 [template = i32]
  31. // CHECK:STDOUT: @Main.%return: ref i32 = var <return slot>
  32. // CHECK:STDOUT: }
  33. // CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct.1]
  34. // CHECK:STDOUT: }
  35. // CHECK:STDOUT:
  36. // CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
  37. // CHECK:STDOUT:
  38. // CHECK:STDOUT: fn @Main() -> i32 {
  39. // CHECK:STDOUT: !entry:
  40. // CHECK:STDOUT: %.loc8_10: i32 = int_literal 1 [template = constants.%.2]
  41. // CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct.1() [template = i32]
  42. // CHECK:STDOUT: %.loc8_15.1: type = value_of_initializer %int.make_type_32 [template = i32]
  43. // CHECK:STDOUT: %.loc8_15.2: type = converted %int.make_type_32, %.loc8_15.1 [template = i32]
  44. // CHECK:STDOUT: return %.loc8_10
  45. // CHECK:STDOUT: }
  46. // CHECK:STDOUT: