aboutsummaryrefslogtreecommitdiff
path: root/src/Air.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-09-24 17:33:06 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-09-24 17:33:06 -0700
commit42aa1ea115eca3dcc704eddf020ce87271a41174 (patch)
tree3242b53425c599af929446e6776a2f6b3a0c6966 /src/Air.zig
parent87fd502fb68f8f488e6eba6b1f7d70902d6bfe5a (diff)
downloadzig-42aa1ea115eca3dcc704eddf020ce87271a41174.tar.gz
zig-42aa1ea115eca3dcc704eddf020ce87271a41174.zip
stage2: implement `@memset` and `@memcpy` builtins
Diffstat (limited to 'src/Air.zig')
-rw-r--r--src/Air.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Air.zig b/src/Air.zig
index c3181fac60..4341271f3a 100644
--- a/src/Air.zig
+++ b/src/Air.zig
@@ -321,6 +321,19 @@ pub const Inst = struct {
/// Uses the `ty_op` field.
int_to_float,
+ /// Given dest ptr, value, and len, set all elements at dest to value.
+ /// Result type is always void.
+ /// Uses the `pl_op` field. Operand is the dest ptr. Payload is `Bin`. `lhs` is the
+ /// value, `rhs` is the length.
+ /// The element type may be any type, not just u8.
+ memset,
+ /// Given dest ptr, src ptr, and len, copy len elements from src to dest.
+ /// Result type is always void.
+ /// Uses the `pl_op` field. Operand is the dest ptr. Payload is `Bin`. `lhs` is the
+ /// src ptr, `rhs` is the length.
+ /// The element type may be any type, not just u8.
+ memcpy,
+
/// Uses the `ty_pl` field with payload `Cmpxchg`.
cmpxchg_weak,
/// Uses the `ty_pl` field with payload `Cmpxchg`.
@@ -628,6 +641,8 @@ pub fn typeOfIndex(air: Air, inst: Air.Inst.Index) Type {
.atomic_store_monotonic,
.atomic_store_release,
.atomic_store_seq_cst,
+ .memset,
+ .memcpy,
=> return Type.initTag(.void),
.ptrtoint,