mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
x86_64: add .dead pseudo-instruction to mark an unused MIR instruction
This commit is contained in:
parent
621fc36b55
commit
c9a153c797
@ -630,8 +630,8 @@ fn gen(self: *Self) InnerError!void {
|
||||
// TODO During semantic analysis, check if there are no function calls. If there
|
||||
// are none, here we can omit the part where we subtract and then add rsp.
|
||||
const backpatch_stack_sub = try self.addInst(.{
|
||||
.tag = .nop,
|
||||
.ops = .none,
|
||||
.tag = .dead,
|
||||
.ops = undefined,
|
||||
.data = undefined,
|
||||
});
|
||||
|
||||
@ -657,8 +657,8 @@ fn gen(self: *Self) InnerError!void {
|
||||
|
||||
// Push callee-preserved regs that were used actually in use.
|
||||
const backpatch_push_callee_preserved_regs = try self.addInst(.{
|
||||
.tag = .nop,
|
||||
.ops = .none,
|
||||
.tag = .dead,
|
||||
.ops = undefined,
|
||||
.data = undefined,
|
||||
});
|
||||
|
||||
@ -688,8 +688,8 @@ fn gen(self: *Self) InnerError!void {
|
||||
|
||||
// Pop saved callee-preserved regs.
|
||||
const backpatch_pop_callee_preserved_regs = try self.addInst(.{
|
||||
.tag = .nop,
|
||||
.ops = .none,
|
||||
.tag = .dead,
|
||||
.ops = undefined,
|
||||
.data = undefined,
|
||||
});
|
||||
|
||||
@ -701,8 +701,8 @@ fn gen(self: *Self) InnerError!void {
|
||||
|
||||
// Maybe add rsp, x if required. This is backpatched later.
|
||||
const backpatch_stack_add = try self.addInst(.{
|
||||
.tag = .nop,
|
||||
.ops = .none,
|
||||
.tag = .dead,
|
||||
.ops = undefined,
|
||||
.data = undefined,
|
||||
});
|
||||
|
||||
|
||||
@ -137,6 +137,8 @@ pub fn lowerMir(emit: *Emit) InnerError!void {
|
||||
|
||||
.push_regs => try emit.mirPushPopRegisterList(.push, inst),
|
||||
.pop_regs => try emit.mirPushPopRegisterList(.pop, inst),
|
||||
|
||||
.dead => {},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -163,6 +163,10 @@ pub const Inst = struct {
|
||||
/// Pop registers
|
||||
/// Uses `payload` payload with data of type `SaveRegisterList`.
|
||||
pop_regs,
|
||||
|
||||
/// Tombstone
|
||||
/// Emitter should skip this instruction.
|
||||
dead,
|
||||
};
|
||||
|
||||
pub const Ops = enum(u8) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user