Rename IntLiteral to IntValue. (#4475)

This instruction represents integer values, whether they come from
literals or calculations, so it the old name is inaccurate. I also plan
to rename `BigInt` to `IntLiteral` based on recent discussion and this
change aims to avoid confusion stemming from the same name being used
for two different things.

I'm not renaming `FloatLiteral` because recent discussion suggests we
may want distinct `FloatLiteral` versus `FloatValue` representations in
SemIR.
This commit is contained in:
Richard Smith
2024-11-02 01:19:39 +00:00
committed by GitHub
parent 261fe38508
commit db76e81630
250 changed files with 1933 additions and 1935 deletions
+2 -2
View File
@@ -21,7 +21,7 @@ fn F() -> i32 {
// CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
// CHECK:STDOUT: %F.type: type = fn_type @F [template]
// CHECK:STDOUT: %F: %F.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
// CHECK:STDOUT: %.2: i32 = int_value 0 [template]
// CHECK:STDOUT: %.3: type = ptr_type i32 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -61,7 +61,7 @@ fn F() -> i32 {
// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32]
// CHECK:STDOUT: %n.var: ref i32 = var n
// CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var
// CHECK:STDOUT: %.loc12_16: i32 = int_literal 0 [template = constants.%.2]
// CHECK:STDOUT: %.loc12_16: i32 = int_value 0 [template = constants.%.2]
// CHECK:STDOUT: assign %n.var, %.loc12_16
// CHECK:STDOUT: %n.ref: ref i32 = name_ref n, %n
// CHECK:STDOUT: %.loc13_13: %.3 = addr_of %n.ref
+9 -9
View File
@@ -30,15 +30,15 @@ fn F() {
// CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
// CHECK:STDOUT: %.2: type = struct_type {.a: i32, .b: i32} [template]
// CHECK:STDOUT: %.3: type = ptr_type %.2 [template]
// CHECK:STDOUT: %.4: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.5: i32 = int_literal 2 [template]
// CHECK:STDOUT: %.4: i32 = int_value 1 [template]
// CHECK:STDOUT: %.5: i32 = int_value 2 [template]
// CHECK:STDOUT: %struct: %.2 = struct_value (%.4, %.5) [template]
// CHECK:STDOUT: %.6: type = ptr_type i32 [template]
// CHECK:STDOUT: %.7: type = tuple_type (type, type) [template]
// CHECK:STDOUT: %.8: type = tuple_type (i32, i32) [template]
// CHECK:STDOUT: %.9: type = ptr_type %.8 [template]
// CHECK:STDOUT: %tuple: %.8 = tuple_value (%.4, %.5) [template]
// CHECK:STDOUT: %.10: i32 = int_literal 0 [template]
// CHECK:STDOUT: %.10: i32 = int_value 0 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -70,8 +70,8 @@ fn F() {
// CHECK:STDOUT: %.loc12_27: type = struct_type {.a: i32, .b: i32} [template = constants.%.2]
// CHECK:STDOUT: %s.var: ref %.2 = var s
// CHECK:STDOUT: %s: ref %.2 = bind_name s, %s.var
// CHECK:STDOUT: %.loc12_37: i32 = int_literal 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc12_45: i32 = int_literal 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc12_37: i32 = int_value 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc12_45: i32 = int_value 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc12_46.1: %.2 = struct_literal (%.loc12_37, %.loc12_45)
// CHECK:STDOUT: %.loc12_46.2: ref i32 = struct_access %s.var, element0
// CHECK:STDOUT: %.loc12_46.3: init i32 = initialize_from %.loc12_37 to %.loc12_46.2 [template = constants.%.4]
@@ -123,8 +123,8 @@ fn F() {
// CHECK:STDOUT: %.loc18_19.6: type = converted %.loc18_19.1, constants.%.8 [template = constants.%.8]
// CHECK:STDOUT: %t.var: ref %.8 = var t
// CHECK:STDOUT: %t: ref %.8 = bind_name t, %t.var
// CHECK:STDOUT: %.loc18_24: i32 = int_literal 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc18_27: i32 = int_literal 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc18_24: i32 = int_value 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc18_27: i32 = int_value 2 [template = constants.%.5]
// CHECK:STDOUT: %.loc18_28.1: %.8 = tuple_literal (%.loc18_24, %.loc18_27)
// CHECK:STDOUT: %.loc18_28.2: ref i32 = tuple_access %t.var, element0
// CHECK:STDOUT: %.loc18_28.3: init i32 = initialize_from %.loc18_24 to %.loc18_28.2 [template = constants.%.4]
@@ -140,7 +140,7 @@ fn F() {
// CHECK:STDOUT: %t0.var: ref %.6 = var t0
// CHECK:STDOUT: %t0: ref %.6 = bind_name t0, %t0.var
// CHECK:STDOUT: %t.ref.loc19: ref %.8 = name_ref t, %t
// CHECK:STDOUT: %.loc19_21: i32 = int_literal 0 [template = constants.%.10]
// CHECK:STDOUT: %.loc19_21: i32 = int_value 0 [template = constants.%.10]
// CHECK:STDOUT: %.loc19_20: ref i32 = tuple_access %t.ref.loc19, element0
// CHECK:STDOUT: %.loc19_18: %.6 = addr_of %.loc19_20
// CHECK:STDOUT: assign %t0.var, %.loc19_18
@@ -151,7 +151,7 @@ fn F() {
// CHECK:STDOUT: %t1.var: ref %.6 = var t1
// CHECK:STDOUT: %t1: ref %.6 = bind_name t1, %t1.var
// CHECK:STDOUT: %t.ref.loc20: ref %.8 = name_ref t, %t
// CHECK:STDOUT: %.loc20_21: i32 = int_literal 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc20_21: i32 = int_value 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc20_20: ref i32 = tuple_access %t.ref.loc20, element1
// CHECK:STDOUT: %.loc20_18: %.6 = addr_of %.loc20_20
// CHECK:STDOUT: assign %t1.var, %.loc20_18
+2 -2
View File
@@ -23,7 +23,7 @@ fn F() -> i32 {
// CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
// CHECK:STDOUT: %F.type: type = fn_type @F [template]
// CHECK:STDOUT: %F: %F.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
// CHECK:STDOUT: %.2: i32 = int_value 0 [template]
// CHECK:STDOUT: %.3: type = ptr_type i32 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -63,7 +63,7 @@ fn F() -> i32 {
// CHECK:STDOUT: %.loc12_10.2: type = converted %int.make_type_32.loc12, %.loc12_10.1 [template = i32]
// CHECK:STDOUT: %n.var: ref i32 = var n
// CHECK:STDOUT: %n: ref i32 = bind_name n, %n.var
// CHECK:STDOUT: %.loc12_16: i32 = int_literal 0 [template = constants.%.2]
// CHECK:STDOUT: %.loc12_16: i32 = int_value 0 [template = constants.%.2]
// CHECK:STDOUT: assign %n.var, %.loc12_16
// CHECK:STDOUT: %int.make_type_32.loc13: init type = call constants.%Int32() [template = i32]
// CHECK:STDOUT: %.loc13_13.1: type = value_of_initializer %int.make_type_32.loc13 [template = i32]
+11 -11
View File
@@ -112,7 +112,7 @@ fn AddressOfParam(param: i32) {
// CHECK:STDOUT: %H: %H.type = struct_value () [template]
// CHECK:STDOUT: %AddressOfLiteral.type: type = fn_type @AddressOfLiteral [template]
// CHECK:STDOUT: %AddressOfLiteral: %AddressOfLiteral.type = struct_value () [template]
// CHECK:STDOUT: %.3: i32 = int_literal 0 [template]
// CHECK:STDOUT: %.3: i32 = int_value 0 [template]
// CHECK:STDOUT: %.4: type = ptr_type i32 [template]
// CHECK:STDOUT: %.5: bool = bool_literal true [template]
// CHECK:STDOUT: %.6: type = ptr_type bool [template]
@@ -120,11 +120,11 @@ fn AddressOfParam(param: i32) {
// CHECK:STDOUT: %.8: type = ptr_type f64 [template]
// CHECK:STDOUT: %.9: type = ptr_type String [template]
// CHECK:STDOUT: %.10: String = string_literal "Hello" [template]
// CHECK:STDOUT: %.11: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.12: i32 = int_literal 2 [template]
// CHECK:STDOUT: %.11: i32 = int_value 1 [template]
// CHECK:STDOUT: %.12: i32 = int_value 2 [template]
// CHECK:STDOUT: %.13: type = tuple_type (i32, i32) [template]
// CHECK:STDOUT: %.14: type = ptr_type %.13 [template]
// CHECK:STDOUT: %.15: i32 = int_literal 5 [template]
// CHECK:STDOUT: %.15: i32 = int_value 5 [template]
// CHECK:STDOUT: %.16: type = ptr_type %.2 [template]
// CHECK:STDOUT: %AddressOfOperator.type: type = fn_type @AddressOfOperator [template]
// CHECK:STDOUT: %AddressOfOperator: %AddressOfOperator.type = struct_value () [template]
@@ -211,7 +211,7 @@ fn AddressOfParam(param: i32) {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @AddressOfLiteral() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc20_4: i32 = int_literal 0 [template = constants.%.3]
// CHECK:STDOUT: %.loc20_4: i32 = int_value 0 [template = constants.%.3]
// CHECK:STDOUT: %.loc20_3: %.4 = addr_of <error> [template = <error>]
// CHECK:STDOUT: %.loc25_4: bool = bool_literal true [template = constants.%.5]
// CHECK:STDOUT: %.loc25_3: %.6 = addr_of <error> [template = <error>]
@@ -219,11 +219,11 @@ fn AddressOfParam(param: i32) {
// CHECK:STDOUT: %.loc30_3: %.8 = addr_of <error> [template = <error>]
// CHECK:STDOUT: %.loc35_4: String = string_literal "Hello" [template = constants.%.10]
// CHECK:STDOUT: %.loc35_3: %.9 = addr_of <error> [template = <error>]
// CHECK:STDOUT: %.loc40_5: i32 = int_literal 1 [template = constants.%.11]
// CHECK:STDOUT: %.loc40_8: i32 = int_literal 2 [template = constants.%.12]
// CHECK:STDOUT: %.loc40_5: i32 = int_value 1 [template = constants.%.11]
// CHECK:STDOUT: %.loc40_8: i32 = int_value 2 [template = constants.%.12]
// CHECK:STDOUT: %.loc40_9: %.13 = tuple_literal (%.loc40_5, %.loc40_8)
// CHECK:STDOUT: %.loc40_3: %.14 = addr_of <error> [template = <error>]
// CHECK:STDOUT: %.loc45_10: i32 = int_literal 5 [template = constants.%.15]
// CHECK:STDOUT: %.loc45_10: i32 = int_value 5 [template = constants.%.15]
// CHECK:STDOUT: %.loc45_11: %.2 = struct_literal (%.loc45_10)
// CHECK:STDOUT: %.loc45_3: %.16 = addr_of <error> [template = <error>]
// CHECK:STDOUT: return
@@ -277,10 +277,10 @@ fn AddressOfParam(param: i32) {
// CHECK:STDOUT:
// CHECK:STDOUT: fn @AddressOfTupleElementValue() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc92_6: i32 = int_literal 1 [template = constants.%.11]
// CHECK:STDOUT: %.loc92_9: i32 = int_literal 2 [template = constants.%.12]
// CHECK:STDOUT: %.loc92_6: i32 = int_value 1 [template = constants.%.11]
// CHECK:STDOUT: %.loc92_9: i32 = int_value 2 [template = constants.%.12]
// CHECK:STDOUT: %.loc92_10.1: %.13 = tuple_literal (%.loc92_6, %.loc92_9)
// CHECK:STDOUT: %.loc92_12: i32 = int_literal 0 [template = constants.%.3]
// CHECK:STDOUT: %.loc92_12: i32 = int_value 0 [template = constants.%.3]
// CHECK:STDOUT: %tuple: %.13 = tuple_value (%.loc92_6, %.loc92_9) [template = constants.%tuple]
// CHECK:STDOUT: %.loc92_10.2: %.13 = converted %.loc92_10.1, %tuple [template = constants.%tuple]
// CHECK:STDOUT: %.loc92_11: i32 = tuple_access %.loc92_10.2, element0 [template = constants.%.11]
+2 -2
View File
@@ -27,7 +27,7 @@ var a: i32* = a_ref;
// CHECK:STDOUT: %Int32.type: type = fn_type @Int32 [template]
// CHECK:STDOUT: %.1: type = tuple_type () [template]
// CHECK:STDOUT: %Int32: %Int32.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 0 [template]
// CHECK:STDOUT: %.2: i32 = int_value 0 [template]
// CHECK:STDOUT: %.3: type = ptr_type i32 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -64,7 +64,7 @@ var a: i32* = a_ref;
// CHECK:STDOUT:
// CHECK:STDOUT: fn @__global_init() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %.loc4: i32 = int_literal 0 [template = constants.%.2]
// CHECK:STDOUT: %.loc4: i32 = int_value 0 [template = constants.%.2]
// CHECK:STDOUT: assign file.%a_orig.var, %.loc4
// CHECK:STDOUT: %a_orig.ref: ref i32 = name_ref a_orig, file.%a_orig
// CHECK:STDOUT: %.loc5: %.3 = addr_of %a_orig.ref