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.
This commit is contained in:
Andrew Kelley
2021-07-14 19:04:02 -07:00
parent 7bb2d13a09
commit 27be4f3140
5 changed files with 486 additions and 517 deletions

View File

@@ -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,