diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-05-22 09:57:43 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-05-22 09:57:43 -0700 |
| commit | 9be8a9000faead40b1aec4877506ff10b066659c (patch) | |
| tree | 6dd2ebc0520ed61c8221e04a01b4b2f715f5520c /src/codegen | |
| parent | a7de02e05216db9a04e438703ddf1b6b12f3fbef (diff) | |
| download | zig-9be8a9000faead40b1aec4877506ff10b066659c.tar.gz zig-9be8a9000faead40b1aec4877506ff10b066659c.zip | |
Revert "implement `@expect` builtin (#19658)"
This reverts commit a7de02e05216db9a04e438703ddf1b6b12f3fbef.
This did not implement the accepted proposal, and I did not sign off
on the changes. I would like a chance to review this, please.
Diffstat (limited to 'src/codegen')
| -rw-r--r-- | src/codegen/c.zig | 23 | ||||
| -rw-r--r-- | src/codegen/llvm.zig | 22 |
2 files changed, 0 insertions, 45 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig index f3ff666802..9514b826ea 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -3343,8 +3343,6 @@ fn genBodyInner(f: *Function, body: []const Air.Inst.Index) error{ AnalysisFail, .@"try" => try airTry(f, inst), .try_ptr => try airTryPtr(f, inst), - - .expect => try airExpect(f, inst), .dbg_stmt => try airDbgStmt(f, inst), .dbg_inline_block => try airDbgInlineBlock(f, inst), @@ -4706,27 +4704,6 @@ fn airTryPtr(f: *Function, inst: Air.Inst.Index) !CValue { return lowerTry(f, inst, extra.data.ptr, body, err_union_ty, true); } -fn airExpect(f: *Function, inst: Air.Inst.Index) !CValue { - const bin_op = f.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; - const operand = try f.resolveInst(bin_op.lhs); - const expected = try f.resolveInst(bin_op.rhs); - - const writer = f.object.writer(); - const local = try f.allocLocal(inst, Type.bool); - const a = try Assignment.start(f, writer, CType.bool); - try f.writeCValue(writer, local, .Other); - try a.assign(f, writer); - - try writer.writeAll("zig_expect("); - try f.writeCValue(writer, operand, .FunctionArgument); - try writer.writeAll(", "); - try f.writeCValue(writer, expected, .FunctionArgument); - try writer.writeAll(")"); - - try a.end(f, writer); - return local; -} - fn lowerTry( f: *Function, inst: Air.Inst.Index, diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index c9f9384e91..9e51417ab6 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -5038,8 +5038,6 @@ pub const FuncGen = struct { .slice_ptr => try self.airSliceField(inst, 0), .slice_len => try self.airSliceField(inst, 1), - .expect => try self.airExpect(inst), - .call => try self.airCall(inst, .auto), .call_always_tail => try self.airCall(inst, .always_tail), .call_never_tail => try self.airCall(inst, .never_tail), @@ -6367,26 +6365,6 @@ pub const FuncGen = struct { return result; } - // Note that the LowerExpectPass only runs in Release modes - fn airExpect(self: *FuncGen, inst: Air.Inst.Index) !Builder.Value { - const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op; - - const operand = try self.resolveInst(bin_op.lhs); - const expected = try self.resolveInst(bin_op.rhs); - - return try self.wip.callIntrinsic( - .normal, - .none, - .expect, - &.{operand.typeOfWip(&self.wip)}, - &.{ - operand, - expected, - }, - "", - ); - } - fn sliceOrArrayPtr(fg: *FuncGen, ptr: Builder.Value, ty: Type) Allocator.Error!Builder.Value { const o = fg.dg.object; const mod = o.module; |
