aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-07-14 19:04:02 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-07-20 12:19:16 -0700
commit27be4f31402557972ae28d552f4ec4617357d454 (patch)
treee8c88a0307752dcc00946e261e4e18b4f25a0f89 /src/Module.zig
parent7bb2d13a090f700b3806127a639e164726af8e03 (diff)
downloadzig-27be4f31402557972ae28d552f4ec4617357d454.tar.gz
zig-27be4f31402557972ae28d552f4ec4617357d454.zip
Sema: more AIR memory layout reworking progress
Additionally: ZIR encoding for floats now supports float literals up to f64, not only f32. This is because we no longer need a source location for this instruction.
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 0a082313b3..4bd48dad05 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -1226,6 +1226,17 @@ pub const Scope = struct {
return block.src_decl.namespace.file_scope;
}
+ pub fn addTy(
+ block: *Block,
+ tag: Air.Inst.Tag,
+ ty: Type,
+ ) error{OutOfMemory}!Air.Inst.Ref {
+ return block.addInst(.{
+ .tag = tag,
+ .data = .{ .ty = ty },
+ });
+ }
+
pub fn addTyOp(
block: *Block,
tag: Air.Inst.Tag,
@@ -1241,6 +1252,13 @@ pub const Scope = struct {
});
}
+ pub fn addNoOp(block: *Block, tag: Air.Inst.Tag) error{OutOfMemory}!Air.Inst.Ref {
+ return block.addInst(.{
+ .tag = tag,
+ .data = .no_op,
+ });
+ }
+
pub fn addUnOp(
block: *Block,
tag: Air.Inst.Tag,
@@ -1252,6 +1270,20 @@ pub const Scope = struct {
});
}
+ pub fn addBr(
+ block: *Block,
+ target_block: Air.Inst.Index,
+ operand: Air.Inst.Ref,
+ ) error{OutOfMemory}!Air.Inst.Ref {
+ return block.addInst(.{
+ .tag = .br,
+ .data = .{ .br = .{
+ .block_inst = target_block,
+ .operand = operand,
+ } },
+ });
+ }
+
pub fn addBinOp(
block: *Block,
tag: Air.Inst.Tag,