Rename the lowering dir to lower (#3172)

This is continuing with #3070, starting dir renaming with lowering
because it's at the tip. AFAICT git is catching all the file moves.
This commit is contained in:
Jon Ross-Perkins
2023-08-31 15:59:49 +00:00
committed by GitHub
parent 907be6465f
commit ec307b18d8
72 changed files with 34 additions and 34 deletions
@@ -0,0 +1,29 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Echo(a: {}) -> {} {
return {};
}
fn Main() {
var b: {} = Echo({});
}
// CHECK:STDOUT: ; ModuleID = 'empty_struct.carbon'
// CHECK:STDOUT: source_filename = "empty_struct.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Echo() {
// CHECK:STDOUT: %struct = alloca {}, align 8
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: %struct = alloca {}, align 8
// CHECK:STDOUT: %b = alloca {}, align 8
// CHECK:STDOUT: %struct1 = alloca {}, align 8
// CHECK:STDOUT: call void @Echo()
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,28 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Echo(a: ()) -> () {
return a;
}
fn Main() {
var b: () = Echo(());
}
// CHECK:STDOUT: ; ModuleID = 'empty_tuple.carbon'
// CHECK:STDOUT: source_filename = "empty_tuple.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Echo() {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: %tuple = alloca {}, align 8
// CHECK:STDOUT: %b = alloca {}, align 8
// CHECK:STDOUT: %tuple1 = alloca {}, align 8
// CHECK:STDOUT: call void @Echo()
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
+27
View File
@@ -0,0 +1,27 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Echo(a: i32) -> i32 {
return a;
}
fn Main() {
var b: i32 = Echo(1);
}
// CHECK:STDOUT: ; ModuleID = 'i32.carbon'
// CHECK:STDOUT: source_filename = "i32.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define i32 @Echo(i32 %a) {
// CHECK:STDOUT: ret i32 %a
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: %b = alloca i32, align 4
// CHECK:STDOUT: %Echo = call i32 @Echo(i32 1)
// CHECK:STDOUT: store i32 %Echo, ptr %b, align 4
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,34 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Foo() {}
fn Bar(a: ()) -> () { return a; }
fn Main() {
var x: () = Bar(Foo());
}
// CHECK:STDOUT: ; ModuleID = 'implicit_empty_tuple_as_arg.carbon'
// CHECK:STDOUT: source_filename = "implicit_empty_tuple_as_arg.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Foo() {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Bar() {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: %tuple = alloca {}, align 8
// CHECK:STDOUT: %x = alloca {}, align 8
// CHECK:STDOUT: call void @Foo()
// CHECK:STDOUT: %temp = alloca {}, align 8
// CHECK:STDOUT: call void @Bar()
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,23 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Foo(a: i32) {}
fn Main() {
Foo(1);
}
// CHECK:STDOUT: ; ModuleID = 'params_one.carbon'
// CHECK:STDOUT: source_filename = "params_one.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Foo(i32 %a) {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: call void @Foo(i32 1)
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,25 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Foo(a: i32,) {}
fn Main() {
Foo(1);
Foo(1,);
}
// CHECK:STDOUT: ; ModuleID = 'params_one_comma.carbon'
// CHECK:STDOUT: source_filename = "params_one_comma.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Foo(i32 %a) {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: call void @Foo(i32 1)
// CHECK:STDOUT: call void @Foo(i32 1)
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,23 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Foo(a: i32, b: i32) {}
fn Main() {
Foo(1, 2);
}
// CHECK:STDOUT: ; ModuleID = 'params_two.carbon'
// CHECK:STDOUT: source_filename = "params_two.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Foo(i32 %a, i32 %b) {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: call void @Foo(i32 1, i32 2)
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,25 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Foo(a: i32, b: i32,) {}
fn Main() {
Foo(1, 2);
Foo(1, 2,);
}
// CHECK:STDOUT: ; ModuleID = 'params_two_comma.carbon'
// CHECK:STDOUT: source_filename = "params_two_comma.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Foo(i32 %a, i32 %b) {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: call void @Foo(i32 1, i32 2)
// CHECK:STDOUT: call void @Foo(i32 1, i32 2)
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,23 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Foo() {}
fn Main() {
Foo();
}
// CHECK:STDOUT: ; ModuleID = 'params_zero.carbon'
// CHECK:STDOUT: source_filename = "params_zero.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Foo() {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: call void @Foo()
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,27 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn MakeImplicitEmptyTuple() {
}
fn Main() {
var b: () = MakeImplicitEmptyTuple();
}
// CHECK:STDOUT: ; ModuleID = 'return_implicit.carbon'
// CHECK:STDOUT: source_filename = "return_implicit.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @MakeImplicitEmptyTuple() {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: %tuple = alloca {}, align 8
// CHECK:STDOUT: %b = alloca {}, align 8
// CHECK:STDOUT: call void @MakeImplicitEmptyTuple()
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,33 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn F(a: {}, b: {.a: i32}, c: {.a: i32, .b: i32}) {}
fn Main() {
F({}, {.a = 1}, {.a = 2, .b = 3});
}
// CHECK:STDOUT: ; ModuleID = 'struct_param.carbon'
// CHECK:STDOUT: source_filename = "struct_param.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @F({ i32 } %b, ptr %c) {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: %struct = alloca {}, align 8
// CHECK:STDOUT: %struct1 = alloca { i32 }, align 8
// CHECK:STDOUT: %a = getelementptr inbounds { i32 }, ptr %struct1, i32 0, i32 0
// CHECK:STDOUT: store i32 1, ptr %a, align 4
// CHECK:STDOUT: %struct2 = alloca { i32, i32 }, align 8
// CHECK:STDOUT: %a3 = getelementptr inbounds { i32, i32 }, ptr %struct2, i32 0, i32 0
// CHECK:STDOUT: store i32 2, ptr %a3, align 4
// CHECK:STDOUT: %b = getelementptr inbounds { i32, i32 }, ptr %struct2, i32 0, i32 1
// CHECK:STDOUT: store i32 3, ptr %b, align 4
// CHECK:STDOUT: %1 = load { i32 }, ptr %struct1, align 4
// CHECK:STDOUT: call void @F({ i32 } %1, ptr %struct2)
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,33 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn F(a: (), b: (i32,), c: (i32, i32)) {}
fn Main() {
F((), (1,), (2, 3));
}
// CHECK:STDOUT: ; ModuleID = 'tuple_param.carbon'
// CHECK:STDOUT: source_filename = "tuple_param.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @F({ i32 } %b, ptr %c) {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: %tuple = alloca {}, align 8
// CHECK:STDOUT: %tuple1 = alloca { i32 }, align 8
// CHECK:STDOUT: %1 = getelementptr inbounds { i32 }, ptr %tuple1, i32 0, i32 0
// CHECK:STDOUT: store i32 1, ptr %1, align 4
// CHECK:STDOUT: %tuple2 = alloca { i32, i32 }, align 8
// CHECK:STDOUT: %2 = getelementptr inbounds { i32, i32 }, ptr %tuple2, i32 0, i32 0
// CHECK:STDOUT: store i32 2, ptr %2, align 4
// CHECK:STDOUT: %3 = getelementptr inbounds { i32, i32 }, ptr %tuple2, i32 0, i32 1
// CHECK:STDOUT: store i32 3, ptr %3, align 4
// CHECK:STDOUT: %4 = load { i32 }, ptr %tuple1, align 4
// CHECK:STDOUT: call void @F({ i32 } %4, ptr %tuple2)
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,46 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn F(a: (), b: (i32,), c: (i32, i32)) -> (i32, i32, i32) {
return (b[0], c[0], c[1]);
}
fn Main() {
F((), (1,), (2, 3));
}
// CHECK:STDOUT: ; ModuleID = 'tuple_param_with_return_slot.carbon'
// CHECK:STDOUT: source_filename = "tuple_param_with_return_slot.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @F(ptr sret({ i32, i32, i32 }) %return, { i32 } %b, ptr %c) {
// CHECK:STDOUT: %tuple.index = extractvalue { i32 } %b, 0
// CHECK:STDOUT: %tuple.index1 = getelementptr inbounds { i32, i32 }, ptr %c, i32 0, i32 0
// CHECK:STDOUT: %tuple.index2 = getelementptr inbounds { i32, i32 }, ptr %c, i32 0, i32 1
// CHECK:STDOUT: %tuple = alloca { i32, i32, i32 }, align 8
// CHECK:STDOUT: %1 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 0
// CHECK:STDOUT: store i32 %tuple.index, ptr %1, align 4
// CHECK:STDOUT: %2 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 1
// CHECK:STDOUT: store ptr %tuple.index1, ptr %2, align 8
// CHECK:STDOUT: %3 = getelementptr inbounds { i32, i32, i32 }, ptr %tuple, i32 0, i32 2
// CHECK:STDOUT: store ptr %tuple.index2, ptr %3, align 8
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: %tuple = alloca {}, align 8
// CHECK:STDOUT: %tuple1 = alloca { i32 }, align 8
// CHECK:STDOUT: %1 = getelementptr inbounds { i32 }, ptr %tuple1, i32 0, i32 0
// CHECK:STDOUT: store i32 1, ptr %1, align 4
// CHECK:STDOUT: %tuple2 = alloca { i32, i32 }, align 8
// CHECK:STDOUT: %2 = getelementptr inbounds { i32, i32 }, ptr %tuple2, i32 0, i32 0
// CHECK:STDOUT: store i32 2, ptr %2, align 4
// CHECK:STDOUT: %3 = getelementptr inbounds { i32, i32 }, ptr %tuple2, i32 0, i32 1
// CHECK:STDOUT: store i32 3, ptr %3, align 4
// CHECK:STDOUT: %temp = alloca { i32, i32, i32 }, align 8
// CHECK:STDOUT: %4 = load { i32 }, ptr %tuple1, align 4
// CHECK:STDOUT: call void @F(ptr %temp, { i32 } %4, ptr %tuple2)
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
+27
View File
@@ -0,0 +1,27 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn DoNothing(a: i32) {}
fn Main() {
var a: i32 = 0;
DoNothing(a);
}
// CHECK:STDOUT: ; ModuleID = 'var_param.carbon'
// CHECK:STDOUT: source_filename = "var_param.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @DoNothing(i32 %a) {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Main() {
// CHECK:STDOUT: %a = alloca i32, align 4
// CHECK:STDOUT: store i32 0, ptr %a, align 4
// CHECK:STDOUT: %1 = load i32, ptr %a, align 4
// CHECK:STDOUT: call void @DoNothing(i32 %1)
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,19 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn F(n: i32);
fn G(n: i32) { F(n); }
// CHECK:STDOUT: ; ModuleID = 'simple.carbon'
// CHECK:STDOUT: source_filename = "simple.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: declare void @F(i32)
// CHECK:STDOUT:
// CHECK:STDOUT: define void @G(i32 %n) {
// CHECK:STDOUT: call void @F(i32 %n)
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,15 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Echo(a: {}) {
}
// CHECK:STDOUT: ; ModuleID = 'empty_struct.carbon'
// CHECK:STDOUT: source_filename = "empty_struct.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Echo() {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,14 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Foo(a: i32) {}
// CHECK:STDOUT: ; ModuleID = 'params_one.carbon'
// CHECK:STDOUT: source_filename = "params_one.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Foo(i32 %a) {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,14 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Foo(a: i32, b: i32) {}
// CHECK:STDOUT: ; ModuleID = 'params_two.carbon'
// CHECK:STDOUT: source_filename = "params_two.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Foo(i32 %a, i32 %b) {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }
@@ -0,0 +1,14 @@
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
// AUTOUPDATE
fn Foo() {}
// CHECK:STDOUT: ; ModuleID = 'params_zero.carbon'
// CHECK:STDOUT: source_filename = "params_zero.carbon"
// CHECK:STDOUT:
// CHECK:STDOUT: define void @Foo() {
// CHECK:STDOUT: ret void
// CHECK:STDOUT: }