mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Separate constant emission from function emission. (#3916)
Make constant emission non-recursive, and stop building a bogus FunctionContext to emit constants. To support this, move `InstConstantKind` from the typed instruction definition into the `.def` file, and add more macros to allow us to generate case labels based on whether an instruction is a constant. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com> Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
Carbon Infra Bot
parent
5627f88c22
commit
79c0b65288
+2
-2
@@ -15,7 +15,7 @@ fn G() -> i32 {
|
||||
// CHECK:STDOUT: ; ModuleID = 'function_param.carbon'
|
||||
// CHECK:STDOUT: source_filename = "function_param.carbon"
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: @tuple = internal constant [3 x i32] [i32 1, i32 2, i32 3]
|
||||
// CHECK:STDOUT: @const.loc12_11.1 = internal constant [3 x i32] [i32 1, i32 2, i32 3]
|
||||
// CHECK:STDOUT:
|
||||
// CHECK:STDOUT: define i32 @F(ptr %arr, i32 %i) {
|
||||
// CHECK:STDOUT: entry:
|
||||
@@ -30,7 +30,7 @@ fn G() -> i32 {
|
||||
// CHECK:STDOUT: %.loc12_20.4.array.index = getelementptr inbounds [3 x i32], ptr %.loc12_20.2.temp, i32 0, i32 0
|
||||
// CHECK:STDOUT: %.loc12_20.7.array.index = getelementptr inbounds [3 x i32], ptr %.loc12_20.2.temp, i32 0, i32 1
|
||||
// CHECK:STDOUT: %.loc12_20.10.array.index = getelementptr inbounds [3 x i32], ptr %.loc12_20.2.temp, i32 0, i32 2
|
||||
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %.loc12_20.2.temp, ptr align 4 @tuple, i64 12, i1 false)
|
||||
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %.loc12_20.2.temp, ptr align 4 @const.loc12_11.1, i64 12, i1 false)
|
||||
// CHECK:STDOUT: %F.call = call i32 @F(ptr %.loc12_20.2.temp, i32 1)
|
||||
// CHECK:STDOUT: ret i32 %F.call
|
||||
// CHECK:STDOUT: }
|
||||
|
||||
Reference in New Issue
Block a user