diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-09-24 17:33:06 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2021-09-24 17:33:06 -0700 |
| commit | 42aa1ea115eca3dcc704eddf020ce87271a41174 (patch) | |
| tree | 3242b53425c599af929446e6776a2f6b3a0c6966 /src/AstGen.zig | |
| parent | 87fd502fb68f8f488e6eba6b1f7d70902d6bfe5a (diff) | |
| download | zig-42aa1ea115eca3dcc704eddf020ce87271a41174.tar.gz zig-42aa1ea115eca3dcc704eddf020ce87271a41174.zip | |
stage2: implement `@memset` and `@memcpy` builtins
Diffstat (limited to 'src/AstGen.zig')
| -rw-r--r-- | src/AstGen.zig | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig index 416584bee9..469e77037a 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -2149,8 +2149,6 @@ fn unusedResultExpr(gz: *GenZir, scope: *Scope, statement: Ast.Node.Index) Inner .field_ptr_type, .field_parent_ptr, .maximum, - .memcpy, - .memset, .minimum, .builtin_async_call, .c_import, @@ -2204,6 +2202,8 @@ fn unusedResultExpr(gz: *GenZir, scope: *Scope, statement: Ast.Node.Index) Inner .set_float_mode, .set_runtime_safety, .closure_capture, + .memcpy, + .memset, => break :b true, } } else switch (maybe_unused_result) { @@ -7576,17 +7576,17 @@ fn builtinCall( }, .memcpy => { const result = try gz.addPlNode(.memcpy, node, Zir.Inst.Memcpy{ - .dest = try expr(gz, scope, .{ .ty = .manyptr_u8_type }, params[0]), - .source = try expr(gz, scope, .{ .ty = .manyptr_const_u8_type }, params[1]), - .byte_count = try expr(gz, scope, .{ .ty = .usize_type }, params[2]), + .dest = try expr(gz, scope, .{ .coerced_ty = .manyptr_u8_type }, params[0]), + .source = try expr(gz, scope, .{ .coerced_ty = .manyptr_const_u8_type }, params[1]), + .byte_count = try expr(gz, scope, .{ .coerced_ty = .usize_type }, params[2]), }); return rvalue(gz, rl, result, node); }, .memset => { const result = try gz.addPlNode(.memset, node, Zir.Inst.Memset{ - .dest = try expr(gz, scope, .{ .ty = .manyptr_u8_type }, params[0]), - .byte = try expr(gz, scope, .{ .ty = .u8_type }, params[1]), - .byte_count = try expr(gz, scope, .{ .ty = .usize_type }, params[2]), + .dest = try expr(gz, scope, .{ .coerced_ty = .manyptr_u8_type }, params[0]), + .byte = try expr(gz, scope, .{ .coerced_ty = .u8_type }, params[1]), + .byte_count = try expr(gz, scope, .{ .coerced_ty = .usize_type }, params[2]), }); return rvalue(gz, rl, result, node); }, |
