stage2: remove dead ZIR instructions

clearing up some enum tag space for future added instructions
This commit is contained in:
Andrew Kelley 2021-04-23 22:40:57 -07:00
parent fbfae832ea
commit 6b98384e20
3 changed files with 6 additions and 37 deletions

View File

@ -1825,7 +1825,6 @@ fn unusedResultExpr(gz: *GenZir, scope: *Scope, statement: ast.Node.Index) Inner
.int_big,
.float,
.float128,
.intcast,
.int_type,
.is_non_null,
.is_null,
@ -1837,7 +1836,6 @@ fn unusedResultExpr(gz: *GenZir, scope: *Scope, statement: ast.Node.Index) Inner
.mul,
.mulwrap,
.param_type,
.ptrtoint,
.ref,
.shl,
.shr,
@ -2004,7 +2002,6 @@ fn unusedResultExpr(gz: *GenZir, scope: *Scope, statement: ast.Node.Index) Inner
.condbr_inline,
.compile_error,
.ret_node,
.ret_tok,
.ret_coerce,
.@"unreachable",
.store,

View File

@ -206,7 +206,6 @@ pub fn analyzeBody(
.float => try sema.zirFloat(block, inst),
.float128 => try sema.zirFloat128(block, inst),
.int_type => try sema.zirIntType(block, inst),
.intcast => try sema.zirIntcast(block, inst),
.is_err => try sema.zirIsErr(block, inst),
.is_err_ptr => try sema.zirIsErrPtr(block, inst),
.is_non_null => try sema.zirIsNull(block, inst, true),
@ -225,7 +224,6 @@ pub fn analyzeBody(
.param_type => try sema.zirParamType(block, inst),
.ptr_type => try sema.zirPtrType(block, inst),
.ptr_type_simple => try sema.zirPtrTypeSimple(block, inst),
.ptrtoint => try sema.zirPtrtoint(block, inst),
.ref => try sema.zirRef(block, inst),
.shl => try sema.zirShl(block, inst),
.shr => try sema.zirShr(block, inst),
@ -369,7 +367,6 @@ pub fn analyzeBody(
.compile_error => return sema.zirCompileError(block, inst),
.ret_coerce => return sema.zirRetTok(block, inst, true),
.ret_node => return sema.zirRetNode(block, inst),
.ret_tok => return sema.zirRetTok(block, inst, false),
.@"unreachable" => return sema.zirUnreachable(block, inst),
.repeat => return sema.zirRepeat(block, inst),
.panic => return sema.zirPanic(block, inst),
@ -2860,7 +2857,7 @@ fn analyzeAs(
return sema.coerce(block, dest_type, operand, src);
}
fn zirPtrtoint(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
fn zirPtrToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
const tracy = trace(@src());
defer tracy.end();
@ -2936,7 +2933,7 @@ fn zirFieldPtrNamed(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Inne
return sema.namedFieldPtr(block, src, object_ptr, field_name, field_name_src);
}
fn zirIntcast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
fn zirIntCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
const tracy = trace(@src());
defer tracy.end();
@ -5161,12 +5158,6 @@ fn zirFrameAddress(
return sema.mod.fail(&block.base, src, "TODO: Sema.zirFrameAddress", .{});
}
fn zirPtrToInt(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
const inst_data = sema.code.instructions.items(.data)[inst].un_node;
const src = inst_data.src();
return sema.mod.fail(&block.base, src, "TODO: Sema.zirPtrToInt", .{});
}
fn zirAlignOf(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
const inst_data = sema.code.instructions.items(.data)[inst].un_node;
const src = inst_data.src();
@ -5245,12 +5236,6 @@ fn zirIntToPtr(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerErro
return sema.mod.fail(&block.base, src, "TODO: Sema.zirIntToPtr", .{});
}
fn zirIntCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
const src = inst_data.src();
return sema.mod.fail(&block.base, src, "TODO: Sema.zirIntCast", .{});
}
fn zirErrSetCast(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) InnerError!*Inst {
const inst_data = sema.code.instructions.items(.data)[inst].pl_node;
const src = inst_data.src();

View File

@ -384,11 +384,6 @@ pub const Inst = struct {
/// A float literal that fits in a f128. Uses the `pl_node` union value.
/// Payload is `Float128`.
float128,
/// Convert an integer value to another integer type, asserting that the destination type
/// can hold the same mathematical value.
/// Uses the `pl_node` field. AST is the `@intCast` syntax.
/// Payload is `Bin` with lhs as the dest type, rhs the operand.
intcast,
/// Make an integer type out of signedness and bit count.
/// Payload is `int_type`
int_type,
@ -445,9 +440,6 @@ pub const Inst = struct {
/// is not in a position where it must create an invalid type.
/// Uses the `param_type` union field.
param_type,
/// Convert a pointer to a `usize` integer.
/// Uses the `un_node` field. The AST node is the builtin fn call node.
ptrtoint,
/// Turns an R-Value into a const L-Value. In other words, it takes a value,
/// stores it in a memory location, and returns a const pointer to it. If the value
/// is `comptime`, the memory location is global static constant data. Otherwise,
@ -464,9 +456,7 @@ pub const Inst = struct {
/// Includes an operand as the return value.
/// Includes a token source location.
/// Uses the `un_tok` union field.
ret_tok,
/// Same as `ret_tok` except the operand needs to get coerced to the function's
/// return type.
/// The operand needs to get coerced to the function's return type.
ret_coerce,
/// Create a pointer type that does not have a sentinel, alignment, or bit range specified.
/// Uses the `ptr_type_simple` union field.
@ -712,6 +702,7 @@ pub const Inst = struct {
shl_with_overflow,
/// Implement builtin `@ptrToInt`. Uses `un_node`.
/// Convert a pointer to a `usize` integer.
ptr_to_int,
/// Implement builtin `@errToInt`. Uses `un_node`.
error_to_int,
@ -801,6 +792,8 @@ pub const Inst = struct {
float_cast,
/// Implements the `@intCast` builtin.
/// Uses `pl_node` with payload `Bin`. `lhs` is dest type, `rhs` is operand.
/// Convert an integer value to another integer type, asserting that the destination type
/// can hold the same mathematical value.
int_cast,
/// Implements the `@errSetCast` builtin.
/// Uses `pl_node` with payload `Bin`. `lhs` is dest type, `rhs` is operand.
@ -1030,7 +1023,6 @@ pub const Inst = struct {
.int_big,
.float,
.float128,
.intcast,
.int_type,
.is_non_null,
.is_null,
@ -1042,7 +1034,6 @@ pub const Inst = struct {
.mul,
.mulwrap,
.param_type,
.ptrtoint,
.ref,
.shl,
.shr,
@ -1202,7 +1193,6 @@ pub const Inst = struct {
.condbr_inline,
.compile_error,
.ret_node,
.ret_tok,
.ret_coerce,
.@"unreachable",
.repeat,
@ -2341,7 +2331,6 @@ const Writer = struct {
.coerce_result_ptr,
.elem_ptr,
.elem_val,
.intcast,
.store,
.store_to_block_ptr,
.store_to_inferred_ptr,
@ -2362,7 +2351,6 @@ const Writer = struct {
.load,
.ensure_result_used,
.ensure_result_non_error,
.ptrtoint,
.ret_node,
.resolve_inferred_alloc,
.optional_type,
@ -2432,7 +2420,6 @@ const Writer = struct {
=> try self.writeUnNode(stream, inst),
.ref,
.ret_tok,
.ret_coerce,
.ensure_err_payload_void,
=> try self.writeUnTok(stream, inst),