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
@@ -78,8 +78,8 @@ fn Main() {
// CHECK:STDOUT: %Run2: %Run2.type = struct_value () [template]
// CHECK:STDOUT: %Main.type: type = fn_type @Main [template]
// CHECK:STDOUT: %Main: %Main.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.3: i32 = int_literal 0 [template]
// CHECK:STDOUT: %.2: i32 = int_value 1 [template]
// CHECK:STDOUT: %.3: i32 = int_value 0 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -151,17 +151,17 @@ fn Main() {
// CHECK:STDOUT: fn @Main() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Run0.ref.loc23: %Run0.type = name_ref Run0, file.%Run0.decl [template = constants.%Run0]
// CHECK:STDOUT: %.loc23: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc23: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %Run0.ref.loc31: %Run0.type = name_ref Run0, file.%Run0.decl [template = constants.%Run0]
// CHECK:STDOUT: %.loc31_8: i32 = int_literal 0 [template = constants.%.3]
// CHECK:STDOUT: %.loc31_11: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc31_8: i32 = int_value 0 [template = constants.%.3]
// CHECK:STDOUT: %.loc31_11: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %Run1.ref.loc40: %Run1.type = name_ref Run1, file.%Run1.decl [template = constants.%Run1]
// CHECK:STDOUT: %Run1.ref.loc48: %Run1.type = name_ref Run1, file.%Run1.decl [template = constants.%Run1]
// CHECK:STDOUT: %.loc48_8: i32 = int_literal 0 [template = constants.%.3]
// CHECK:STDOUT: %.loc48_11: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc48_8: i32 = int_value 0 [template = constants.%.3]
// CHECK:STDOUT: %.loc48_11: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %Run2.ref.loc57: %Run2.type = name_ref Run2, file.%Run2.decl [template = constants.%Run2]
// CHECK:STDOUT: %Run2.ref.loc64: %Run2.type = name_ref Run2, file.%Run2.decl [template = constants.%Run2]
// CHECK:STDOUT: %.loc64: i32 = int_literal 0 [template = constants.%.3]
// CHECK:STDOUT: %.loc64: i32 = int_value 0 [template = constants.%.3]
// CHECK:STDOUT: return
// CHECK:STDOUT: }
// CHECK:STDOUT:
@@ -23,7 +23,7 @@ fn Run() {
// CHECK:STDOUT: --- fail_return_type_mismatch.carbon
// CHECK:STDOUT:
// CHECK:STDOUT: constants {
// CHECK:STDOUT: %.1: Core.BigInt = int_literal 64 [template]
// CHECK:STDOUT: %.1: Core.BigInt = int_value 64 [template]
// CHECK:STDOUT: %Float.type: type = fn_type @Float [template]
// CHECK:STDOUT: %.2: type = tuple_type () [template]
// CHECK:STDOUT: %Float: %Float.type = struct_value () [template]
@@ -82,7 +82,7 @@ fn Run() {
// CHECK:STDOUT: %return.patt: f64 = return_slot_pattern
// CHECK:STDOUT: %return.param_patt: f64 = out_param_pattern %return.patt, runtime_param0
// CHECK:STDOUT: } {
// CHECK:STDOUT: %.loc11_13.1: Core.BigInt = int_literal 64 [template = constants.%.1]
// CHECK:STDOUT: %.loc11_13.1: Core.BigInt = int_value 64 [template = constants.%.1]
// CHECK:STDOUT: %float.make_type: init type = call constants.%Float(%.loc11_13.1) [template = f64]
// CHECK:STDOUT: %.loc11_13.2: type = value_of_initializer %float.make_type [template = f64]
// CHECK:STDOUT: %.loc11_13.3: type = converted %float.make_type, %.loc11_13.2 [template = f64]
+2 -2
View File
@@ -26,7 +26,7 @@ fn Main() {
// CHECK:STDOUT: %Echo: %Echo.type = struct_value () [template]
// CHECK:STDOUT: %Main.type: type = fn_type @Main [template]
// CHECK:STDOUT: %Main: %Main.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.2: i32 = int_value 1 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -81,7 +81,7 @@ fn Main() {
// CHECK:STDOUT: %b.var: ref i32 = var b
// CHECK:STDOUT: %b: ref i32 = bind_name b, %b.var
// CHECK:STDOUT: %Echo.ref: %Echo.type = name_ref Echo, file.%Echo.decl [template = constants.%Echo]
// CHECK:STDOUT: %.loc16_21: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc16_21: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %Echo.call: init i32 = call %Echo.ref(%.loc16_21)
// CHECK:STDOUT: assign %b.var, %Echo.call
// CHECK:STDOUT: return
@@ -28,10 +28,10 @@ fn Main() {
// CHECK:STDOUT: %Main: %Main.type = struct_value () [template]
// CHECK:STDOUT: %.2: type = tuple_type (type) [template]
// CHECK:STDOUT: %.3: type = tuple_type (i32) [template]
// CHECK:STDOUT: %.4: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.4: i32 = int_value 1 [template]
// CHECK:STDOUT: %tuple: %.3 = tuple_value (%.4) [template]
// CHECK:STDOUT: %.5: i32 = int_literal 0 [template]
// CHECK:STDOUT: %.6: i32 = int_literal 6 [template]
// CHECK:STDOUT: %.5: i32 = int_value 0 [template]
// CHECK:STDOUT: %.6: i32 = int_value 6 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -86,16 +86,16 @@ fn Main() {
// CHECK:STDOUT: %.loc14_15.4: type = converted %.loc14_15.1, constants.%.3 [template = constants.%.3]
// CHECK:STDOUT: %x.var: ref %.3 = var x
// CHECK:STDOUT: %x: ref %.3 = bind_name x, %x.var
// CHECK:STDOUT: %.loc14_20: i32 = int_literal 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc14_20: i32 = int_value 1 [template = constants.%.4]
// CHECK:STDOUT: %.loc14_22.1: %.3 = tuple_literal (%.loc14_20)
// CHECK:STDOUT: %.loc14_22.2: init %.3 = tuple_init (%.loc14_20) to %x.var [template = constants.%tuple]
// CHECK:STDOUT: %.loc14_23: init %.3 = converted %.loc14_22.1, %.loc14_22.2 [template = constants.%tuple]
// CHECK:STDOUT: assign %x.var, %.loc14_23
// CHECK:STDOUT: %Foo.ref: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo]
// CHECK:STDOUT: %x.ref: ref %.3 = name_ref x, %x
// CHECK:STDOUT: %.loc16_9: i32 = int_literal 0 [template = constants.%.5]
// CHECK:STDOUT: %.loc16_9: i32 = int_value 0 [template = constants.%.5]
// CHECK:STDOUT: %.loc16_8.1: ref i32 = tuple_access %x.ref, element0
// CHECK:STDOUT: %.loc16_12: i32 = int_literal 6 [template = constants.%.6]
// CHECK:STDOUT: %.loc16_12: i32 = int_value 6 [template = constants.%.6]
// CHECK:STDOUT: %.loc16_8.2: i32 = bind_value %.loc16_8.1
// CHECK:STDOUT: %Foo.call: init %.1 = call %Foo.ref(%.loc16_8.2, %.loc16_12)
// CHECK:STDOUT: return
+2 -2
View File
@@ -24,7 +24,7 @@ fn Main() {
// CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
// CHECK:STDOUT: %Main.type: type = fn_type @Main [template]
// CHECK:STDOUT: %Main: %Main.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.2: i32 = int_value 1 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -66,7 +66,7 @@ fn Main() {
// CHECK:STDOUT: fn @Main() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Foo.ref: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo]
// CHECK:STDOUT: %.loc14: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc14: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %Foo.call: init %.1 = call %Foo.ref(%.loc14)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
@@ -25,7 +25,7 @@ fn Main() {
// CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
// CHECK:STDOUT: %Main.type: type = fn_type @Main [template]
// CHECK:STDOUT: %Main: %Main.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.2: i32 = int_value 1 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -67,10 +67,10 @@ fn Main() {
// CHECK:STDOUT: fn @Main() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Foo.ref.loc14: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo]
// CHECK:STDOUT: %.loc14: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc14: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %Foo.call.loc14: init %.1 = call %Foo.ref.loc14(%.loc14)
// CHECK:STDOUT: %Foo.ref.loc15: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo]
// CHECK:STDOUT: %.loc15: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc15: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %Foo.call.loc15: init %.1 = call %Foo.ref.loc15(%.loc15)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
+4 -4
View File
@@ -24,8 +24,8 @@ fn Main() {
// CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
// CHECK:STDOUT: %Main.type: type = fn_type @Main [template]
// CHECK:STDOUT: %Main: %Main.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.3: i32 = int_literal 2 [template]
// CHECK:STDOUT: %.2: i32 = int_value 1 [template]
// CHECK:STDOUT: %.3: i32 = int_value 2 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -74,8 +74,8 @@ fn Main() {
// CHECK:STDOUT: fn @Main() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Foo.ref: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo]
// CHECK:STDOUT: %.loc14_7: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc14_10: i32 = int_literal 2 [template = constants.%.3]
// CHECK:STDOUT: %.loc14_7: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc14_10: i32 = int_value 2 [template = constants.%.3]
// CHECK:STDOUT: %Foo.call: init %.1 = call %Foo.ref(%.loc14_7, %.loc14_10)
// CHECK:STDOUT: return
// CHECK:STDOUT: }
@@ -25,8 +25,8 @@ fn Main() {
// CHECK:STDOUT: %Foo: %Foo.type = struct_value () [template]
// CHECK:STDOUT: %Main.type: type = fn_type @Main [template]
// CHECK:STDOUT: %Main: %Main.type = struct_value () [template]
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
// CHECK:STDOUT: %.3: i32 = int_literal 2 [template]
// CHECK:STDOUT: %.2: i32 = int_value 1 [template]
// CHECK:STDOUT: %.3: i32 = int_value 2 [template]
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: imports {
@@ -75,12 +75,12 @@ fn Main() {
// CHECK:STDOUT: fn @Main() {
// CHECK:STDOUT: !entry:
// CHECK:STDOUT: %Foo.ref.loc14: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo]
// CHECK:STDOUT: %.loc14_7: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc14_10: i32 = int_literal 2 [template = constants.%.3]
// CHECK:STDOUT: %.loc14_7: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc14_10: i32 = int_value 2 [template = constants.%.3]
// CHECK:STDOUT: %Foo.call.loc14: init %.1 = call %Foo.ref.loc14(%.loc14_7, %.loc14_10)
// CHECK:STDOUT: %Foo.ref.loc15: %Foo.type = name_ref Foo, file.%Foo.decl [template = constants.%Foo]
// CHECK:STDOUT: %.loc15_7: i32 = int_literal 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc15_10: i32 = int_literal 2 [template = constants.%.3]
// CHECK:STDOUT: %.loc15_7: i32 = int_value 1 [template = constants.%.2]
// CHECK:STDOUT: %.loc15_10: i32 = int_value 2 [template = constants.%.3]
// CHECK:STDOUT: %Foo.call.loc15: init %.1 = call %Foo.ref.loc15(%.loc15_7, %.loc15_10)
// CHECK:STDOUT: return
// CHECK:STDOUT: }