aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorJacob G-W <jacoblevgw@gmail.com>2021-06-19 21:10:22 -0400
committerAndrew Kelley <andrew@ziglang.org>2021-06-21 17:03:03 -0700
commit9fffffb07b081858db0c2102a0680aa166b48263 (patch)
tree36caed31c5b2aaa8e08bb8e6e90e9b2c30910ff3 /src/codegen
parentb83b3883ba0b5e965f8f7f1298c77c6d766741af (diff)
downloadzig-9fffffb07b081858db0c2102a0680aa166b48263.tar.gz
zig-9fffffb07b081858db0c2102a0680aa166b48263.zip
fix code broken from previous commit
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/arm.zig2
-rw-r--r--src/codegen/c.zig9
-rw-r--r--src/codegen/llvm.zig4
-rw-r--r--src/codegen/wasm.zig10
4 files changed, 21 insertions, 4 deletions
diff --git a/src/codegen/arm.zig b/src/codegen/arm.zig
index cc6abe2e52..891a9e100b 100644
--- a/src/codegen/arm.zig
+++ b/src/codegen/arm.zig
@@ -674,7 +674,7 @@ pub const Instruction = union(enum) {
};
const imm4h: u4 = switch (offset) {
.immediate => |imm| @truncate(u4, imm >> 4),
- .register => |reg| 0b0000,
+ .register => 0b0000,
};
return Instruction{
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 1100626553..ae439693b8 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -47,6 +47,8 @@ fn formatTypeAsCIdentifier(
options: std.fmt.FormatOptions,
writer: anytype,
) !void {
+ _ = fmt;
+ _ = options;
var buffer = [1]u8{0} ** 128;
// We don't care if it gets cut off, it's still more unique than a number
var buf = std.fmt.bufPrint(&buffer, "{}", .{data}) catch &buffer;
@@ -63,6 +65,8 @@ fn formatIdent(
options: std.fmt.FormatOptions,
writer: anytype,
) !void {
+ _ = fmt;
+ _ = options;
for (ident) |c, i| {
switch (c) {
'a'...'z', 'A'...'Z', '_' => try writer.writeByte(c),
@@ -747,6 +751,7 @@ pub fn genBody(o: *Object, body: ir.Body) error{ AnalysisFail, OutOfMemory }!voi
}
fn genVarPtr(o: *Object, inst: *Inst.VarPtr) !CValue {
+ _ = o;
return CValue{ .decl_ref = inst.variable.owner_decl };
}
@@ -937,6 +942,8 @@ fn genCall(o: *Object, inst: *Inst.Call) !CValue {
}
fn genDbgStmt(o: *Object, inst: *Inst.DbgStmt) !CValue {
+ _ = o;
+ _ = inst;
// TODO emit #line directive here with line number and filename
return CValue.none;
}
@@ -1016,11 +1023,13 @@ fn genBitcast(o: *Object, inst: *Inst.UnOp) !CValue {
}
fn genBreakpoint(o: *Object, inst: *Inst.NoOp) !CValue {
+ _ = inst;
try o.writer().writeAll("zig_breakpoint();\n");
return CValue.none;
}
fn genUnreach(o: *Object, inst: *Inst.NoOp) !CValue {
+ _ = inst;
try o.writer().writeAll("zig_unreachable();\n");
return CValue.none;
}
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 4e4621ca29..2baedf8c9d 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -154,6 +154,7 @@ pub const Object = struct {
object_pathZ: [:0]const u8,
pub fn create(allocator: *Allocator, sub_path: []const u8, options: link.Options) !*Object {
+ _ = sub_path;
const self = try allocator.create(Object);
errdefer allocator.destroy(self);
@@ -742,6 +743,7 @@ pub const FuncGen = struct {
}
fn genRetVoid(self: *FuncGen, inst: *Inst.NoOp) ?*const llvm.Value {
+ _ = inst;
_ = self.builder.buildRetVoid();
return null;
}
@@ -873,6 +875,7 @@ pub const FuncGen = struct {
}
fn genUnreach(self: *FuncGen, inst: *Inst.NoOp) ?*const llvm.Value {
+ _ = inst;
_ = self.builder.buildUnreachable();
return null;
}
@@ -1013,6 +1016,7 @@ pub const FuncGen = struct {
}
fn genBreakpoint(self: *FuncGen, inst: *Inst.NoOp) !?*const llvm.Value {
+ _ = inst;
const llvn_fn = self.getIntrinsic("llvm.debugtrap");
_ = self.builder.buildCall(llvn_fn, null, 0, "");
return null;
diff --git a/src/codegen/wasm.zig b/src/codegen/wasm.zig
index a830ca36e0..39930e22b4 100644
--- a/src/codegen/wasm.zig
+++ b/src/codegen/wasm.zig
@@ -702,7 +702,7 @@ pub const Context = struct {
try writer.writeByte(wasm.valtype(.i32)); // error code is always an i32 integer.
try writer.writeByte(val_type);
},
- else => |ret_type| {
+ else => {
try leb.writeULEB128(writer, @as(u32, 1));
// Can we maybe get the source index of the return type?
const val_type = try self.genValtype(.{ .node_offset = 0 }, return_type);
@@ -721,7 +721,7 @@ pub const Context = struct {
// TODO: check for and handle death of instructions
const mod_fn = blk: {
if (typed_value.val.castTag(.function)) |func| break :blk func.data;
- if (typed_value.val.castTag(.extern_fn)) |ext_fn| return Result.appended; // don't need code body for extern functions
+ if (typed_value.val.castTag(.extern_fn)) |_| return Result.appended; // don't need code body for extern functions
unreachable;
};
@@ -910,7 +910,7 @@ pub const Context = struct {
},
else => unreachable,
},
- .local => |local| {
+ .local => {
try self.emitWValue(rhs);
try writer.writeByte(wasm.opcode(.local_set));
try leb.writeULEB128(writer, lhs.local);
@@ -925,6 +925,7 @@ pub const Context = struct {
}
fn genArg(self: *Context, inst: *Inst.Arg) InnerError!WValue {
+ _ = inst;
// arguments share the index with locals
defer self.local_index += 1;
return WValue{ .local = self.local_index };
@@ -1213,12 +1214,15 @@ pub const Context = struct {
}
fn genBreakpoint(self: *Context, breakpoint: *Inst.NoOp) InnerError!WValue {
+ _ = self;
+ _ = breakpoint;
// unsupported by wasm itself. Can be implemented once we support DWARF
// for wasm
return .none;
}
fn genUnreachable(self: *Context, unreach: *Inst.NoOp) InnerError!WValue {
+ _ = unreach;
try self.code.append(wasm.opcode(.@"unreachable"));
return .none;
}