-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stage2: sparc64: Some more Air lowerings #11806
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I think we might want to slowly start working towards having sparc64-linux
with stage2_sparc64
enabled by default in our test-behavior
test suite. I tried it with this branch, but there are still some things missing:
thread 320770 panic: TODO try self.airBitAnd(inst)
/home/kubkon/dev/zig/src/Sema.zig:1350:5: 0x322fce9 in Sema.analyzeBodyInner (zig)
return result;
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:2482:5: 0x39b4c2f in arch.sparc64.CodeGen.fail (zig)
return error.CodegenFail;
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:2871:25: 0x39b3774 in arch.sparc64.CodeGen.genSetStack (zig)
else => return self.fail("TODO implement memset", .{}),
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:3530:13: 0x39c4283 in arch.sparc64.CodeGen.store (zig)
try self.genSetStack(value_ty, off, value);
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:1768:5: 0x3805c0f in arch.sparc64.CodeGen.airStore (zig)
try self.store(ptr, value, ptr_ty, value_ty);
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:593:33: 0x37fbece in arch.sparc64.CodeGen.genBody (zig)
.store => try self.airStore(inst),
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:389:9: 0x36234d2 in arch.sparc64.CodeGen.gen (zig)
try self.genBody(self.air.getMainBody());
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:2482:5: 0x3b48b8e in arch.sparc64.CodeGen.fail (zig)
return error.CodegenFail;
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:3065:17: 0x39afa58 in arch.sparc64.CodeGen.genTypedValue (zig)
else => return self.fail("TODO implement const of type '{}'", .{typed_value.ty.fmtDebug()}),
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:3399:35: 0x39ada0e in arch.sparc64.CodeGen.resolveInst (zig)
gop.value_ptr.* = try self.genTypedValue(.{
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:1764:19: 0x3805b4e in arch.sparc64.CodeGen.airStore (zig)
const value = try self.resolveInst(bin_op.rhs);
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:593:33: 0x37fbece in arch.sparc64.CodeGen.genBody (zig)
.store => try self.airStore(inst),
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:389:9: 0x36234d2 in arch.sparc64.CodeGen.gen (zig)
try self.genBody(self.air.getMainBody());
^
/home/kubkon/dev/zig/src/Sema.zig:1151:21: 0x322dd14 in Sema.analyzeBodyInner (zig)
return error.ComptimeBreak;
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:2482:5: 0x3b48b8e in arch.sparc64.CodeGen.fail (zig)
return error.CodegenFail;
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:3065:17: 0x39afa58 in arch.sparc64.CodeGen.genTypedValue (zig)
else => return self.fail("TODO implement const of type '{}'", .{typed_value.ty.fmtDebug()}),
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:3399:35: 0x39ada0e in arch.sparc64.CodeGen.resolveInst (zig)
gop.value_ptr.* = try self.genTypedValue(.{
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:1764:19: 0x3805b4e in arch.sparc64.CodeGen.airStore (zig)
const value = try self.resolveInst(bin_op.rhs);
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:593:33: 0x37fbece in arch.sparc64.CodeGen.genBody (zig)
.store => try self.airStore(inst),
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:389:9: 0x36234d2 in arch.sparc64.CodeGen.gen (zig)
try self.genBody(self.air.getMainBody());
^
/home/kubkon/dev/zig/src/Sema.zig:20663:49: 0x3659c07 in Sema.beginComptimePtrLoad (zig)
if (decl_tv.val.tag() == .variable) return error.RuntimeLoad;
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:2482:5: 0x3b48c7f in arch.sparc64.CodeGen.fail (zig)
return error.CodegenFail;
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:3032:17: 0x39afb9e in arch.sparc64.CodeGen.genTypedValue (zig)
return self.fail("TODO implement int genTypedValue of > 64 bits", .{});
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:3399:35: 0x39ada0e in arch.sparc64.CodeGen.resolveInst (zig)
gop.value_ptr.* = try self.genTypedValue(.{
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:1173:21: 0x37ff122 in arch.sparc64.CodeGen.airCmp (zig)
const lhs = try self.resolveInst(bin_op.lhs);
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:547:25: 0x37fb4c4 in arch.sparc64.CodeGen.genBody (zig)
.cmp_eq => try self.airCmp(inst, .eq),
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:1009:5: 0x3801dbd in arch.sparc64.CodeGen.airBlock (zig)
try self.genBody(body);
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:566:33: 0x37fb8f8 in arch.sparc64.CodeGen.genBody (zig)
.block => try self.airBlock(inst),
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:389:9: 0x36234d2 in arch.sparc64.CodeGen.gen (zig)
try self.genBody(self.air.getMainBody());
^
/home/kubkon/dev/zig/src/Sema.zig:1151:21: 0x322dd14 in Sema.analyzeBodyInner (zig)
return error.ComptimeBreak;
^
/home/kubkon/dev/zig/src/Sema.zig:1151:21: 0x322dd14 in Sema.analyzeBodyInner (zig)
return error.ComptimeBreak;
^
/home/kubkon/dev/zig/src/Sema.zig:12904:9: 0x340f0f2 in Sema.zirCondbr (zig)
return sema.analyzeBodyInner(parent_block, body);
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:556:33: 0x37fb687 in arch.sparc64.CodeGen.genBody (zig)
.bit_and => @panic("TODO try self.airBitAnd(inst)"),
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:1009:21: 0x3801d7e in arch.sparc64.CodeGen.airBlock (zig)
try self.genBody(body);
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:566:50: 0x37fb8cf in arch.sparc64.CodeGen.genBody (zig)
.block => try self.airBlock(inst),
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:389:25: 0x36234a4 in arch.sparc64.CodeGen.gen (zig)
try self.genBody(self.air.getMainBody());
^
/home/kubkon/dev/zig/src/arch/sparc64/CodeGen.zig:327:17: 0x342f64b in arch.sparc64.CodeGen.generate (zig)
function.gen() catch |err| switch (err) {
^
/home/kubkon/dev/zig/src/codegen.zig:106:72: 0x3424086 in codegen.generateFunction (zig)
.sparc64 => return @import("arch/sparc64/CodeGen.zig").generate(bin_file, src_loc, func, air, liveness, code, debug_output),
^
/home/kubkon/dev/zig/src/link/Elf.zig:2387:37: 0x3218bc1 in link.Elf.updateFunc (zig)
try codegen.generateFunction(&self.base, decl.srcLoc(), func, air, liveness, &code_buffer, .{
^
/home/kubkon/dev/zig/src/link.zig:469:77: 0x305ab1d in link.File.updateFunc (zig)
.elf => return @fieldParentPtr(Elf, "base", base).updateFunc(module, func, air, liveness),
^
/home/kubkon/dev/zig/src/Module.zig:3767:41: 0x303a4a2 in Module.ensureFuncBodyAnalyzed (zig)
mod.comp.bin_file.updateFunc(mod, func, air, liveness) catch |err| switch (err) {
^
/home/kubkon/dev/zig/src/Compilation.zig:2792:42: 0x2dee947 in Compilation.processOneJob (zig)
module.ensureFuncBodyAnalyzed(func) catch |err| switch (err) {
^
/home/kubkon/dev/zig/src/Compilation.zig:2734:30: 0x2ddb07d in Compilation.performAllTheWork (zig)
try processOneJob(comp, work_item);
^
/home/kubkon/dev/zig/src/Compilation.zig:2120:31: 0x2dd3db2 in Compilation.update (zig)
try comp.performAllTheWork(main_progress_node);
^
/home/kubkon/dev/zig/src/main.zig:3119:20: 0x2d4037f in updateModule (zig)
try comp.update();
^
/home/kubkon/dev/zig/src/main.zig:2808:17: 0x2d08ec9 in buildOutputType (zig)
updateModule(gpa, comp, hook) catch |err| switch (err) {
^
/home/kubkon/dev/zig/src/main.zig:225:31: 0x2ceed96 in mainArgs (zig)
return buildOutputType(gpa, arena, args, .zig_test);
^
/home/kubkon/dev/zig/src/main.zig:174:20: 0x2cedde4 in main (zig)
return mainArgs(gpa, arena, args);
^
/home/kubkon/opt/lib/zig/std/start.zig:581:37: 0x31cb5a7 in std.start.callMain (zig)
const result = root.main() catch |err| {
^
/home/kubkon/opt/lib/zig/std/start.zig:515:12: 0x2cf0837 in std.start.callMainWithArgs (zig)
return @call(.{ .modifier = .always_inline }, callMain, .{});
^
/home/kubkon/opt/lib/zig/std/start.zig:480:12: 0x2cf05e2 in std.start.main (zig)
return @call(.{ .modifier = .always_inline }, callMainWithArgs, .{ @intCast(usize, c_argc), c_argv, envp });
^
test...The following command terminated unexpectedly:
/home/kubkon/dev/zig/stage2/bin/zig test -fno-stage1 -fno-LLVM /home/kubkon/dev/zig/test/behavior.zig --test-name-prefix behavior-sparc64-linux-Debug-bare-multi-stage2_sparc64 --cache-dir /home/kubkon/dev/zig/zig-cache --global-cache-dir /home/kubkon/.cache/zig --name test -fno-single-threaded -target sparc64-linux -mcpu v9 --test-cmd qemu-sparc64 --test-cmd-bin -I /home/kubkon/dev/zig/test --zig-lib-dir /home/kubkon/dev/zig/lib --enable-cache
error: the following build command failed with exit code 6:
/home/kubkon/dev/zig/zig-cache/o/1ed4b1db22dbc3d83412561f2264c105/build /home/kubkon/dev/zig/stage2/bin/zig /home/kubkon/dev/zig /home/kubkon/dev/zig/zig-cache /home/kubkon/.cache/zig test-behavior -fqemu
And here's the diff we want to work towards:
diff --git a/test/tests.zig b/test/tests.zig
index 3666ef102..3e15d4684 100644
--- a/test/tests.zig
+++ b/test/tests.zig
@@ -107,6 +107,13 @@ const test_targets = blk: {
},
.backend = .stage2_x86_64,
},
+ .{
+ .target = .{
+ .cpu_arch = .sparc64,
+ .os_tag = .linux,
+ },
+ .backend = .stage2_sparc64,
+ },
.{
.target = .{
Okay, I'll focus on getting it enabled, thanks. |
Implement some more of the simpler Air instructions, also fix some of the comparison/branching related bookkeeping code.