aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/c.zig
diff options
context:
space:
mode:
authorJacob G-W <jacoblevgw@gmail.com>2021-06-17 11:57:27 -0400
committerVeikka Tuominen <git@vexu.eu>2021-06-21 18:45:28 +0300
commita95fdb06352a6a1e60d0167bad62f5a46345177a (patch)
treedb2347ab29797d19c899bf2f6a043a984eb173c2 /src/codegen/c.zig
parentfc1feebdc0ffd4730c724780265d4ef6a9515dc8 (diff)
downloadzig-a95fdb06352a6a1e60d0167bad62f5a46345177a.tar.gz
zig-a95fdb06352a6a1e60d0167bad62f5a46345177a.zip
stage2: simplify codegen for errorToInt and intToError
We can just use bitcast instead of error_to_int, int_to_error since errorToInt and intToError do not actually do anything, just change types. This allows us to remove 2 air ops that were the exact same as bitcast
Diffstat (limited to 'src/codegen/c.zig')
-rw-r--r--src/codegen/c.zig10
1 files changed, 0 insertions, 10 deletions
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 68b74d7659..7ebecb45c9 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -724,8 +724,6 @@ pub fn genBody(o: *Object, body: ir.Body) error{ AnalysisFail, OutOfMemory }!voi
.is_err => try genIsErr(o, inst.castTag(.is_err).?),
.is_err_ptr => try genIsErr(o, inst.castTag(.is_err_ptr).?),
- .error_to_int => try genErrorToInt(o, inst.castTag(.error_to_int).?),
- .int_to_error => try genIntToError(o, inst.castTag(.int_to_error).?),
.unwrap_errunion_payload => try genUnwrapErrUnionPay(o, inst.castTag(.unwrap_errunion_payload).?),
.unwrap_errunion_err => try genUnwrapErrUnionErr(o, inst.castTag(.unwrap_errunion_err).?),
@@ -1283,14 +1281,6 @@ fn genIsErr(o: *Object, inst: *Inst.UnOp) !CValue {
return local;
}
-fn genIntToError(o: *Object, inst: *Inst.UnOp) !CValue {
- return o.resolveInst(inst.operand);
-}
-
-fn genErrorToInt(o: *Object, inst: *Inst.UnOp) !CValue {
- return o.resolveInst(inst.operand);
-}
-
fn IndentWriter(comptime UnderlyingWriter: type) type {
return struct {
const Self = @This();