Commit 9c35f680f7
Changed files (4)
src/all_types.hpp
@@ -1750,8 +1750,6 @@ enum BuiltinFnId {
BuiltinFnIdIntCast,
BuiltinFnIdFloatCast,
BuiltinFnIdErrSetCast,
- BuiltinFnIdToBytes,
- BuiltinFnIdFromBytes,
BuiltinFnIdIntToFloat,
BuiltinFnIdFloatToInt,
BuiltinFnIdBoolToInt,
@@ -1821,7 +1819,6 @@ enum PanicMsgId {
PanicMsgIdDivisionByZero,
PanicMsgIdRemainderDivisionByZero,
PanicMsgIdExactDivisionRemainder,
- PanicMsgIdSliceWidenRemainder,
PanicMsgIdUnwrapOptionalFail,
PanicMsgIdInvalidErrorCode,
PanicMsgIdIncorrectAlignment,
@@ -2699,8 +2696,6 @@ enum IrInstSrcId {
IrInstSrcIdSaveErrRetAddr,
IrInstSrcIdAddImplicitReturnType,
IrInstSrcIdErrSetCast,
- IrInstSrcIdToBytes,
- IrInstSrcIdFromBytes,
IrInstSrcIdCheckRuntimeScope,
IrInstSrcIdHasDecl,
IrInstSrcIdUndeclaredIdent,
@@ -2739,7 +2734,6 @@ enum IrInstGenId {
IrInstGenIdCall,
IrInstGenIdReturn,
IrInstGenIdCast,
- IrInstGenIdResizeSlice,
IrInstGenIdUnreachable,
IrInstGenIdAsm,
IrInstGenIdTestNonNull,
@@ -3271,13 +3265,6 @@ struct IrInstGenCast {
CastOp cast_op;
};
-struct IrInstGenResizeSlice {
- IrInstGen base;
-
- IrInstGen *operand;
- IrInstGen *result_loc;
-};
-
struct IrInstSrcContainerInitList {
IrInstSrc base;
@@ -3629,21 +3616,6 @@ struct IrInstSrcErrSetCast {
IrInstSrc *target;
};
-struct IrInstSrcToBytes {
- IrInstSrc base;
-
- IrInstSrc *target;
- ResultLoc *result_loc;
-};
-
-struct IrInstSrcFromBytes {
- IrInstSrc base;
-
- IrInstSrc *dest_child_type;
- IrInstSrc *target;
- ResultLoc *result_loc;
-};
-
struct IrInstSrcIntToFloat {
IrInstSrc base;
src/codegen.cpp
@@ -972,8 +972,6 @@ static Buf *panic_msg_buf(PanicMsgId msg_id) {
return buf_create_from_str("remainder division by zero or negative value");
case PanicMsgIdExactDivisionRemainder:
return buf_create_from_str("exact division produced remainder");
- case PanicMsgIdSliceWidenRemainder:
- return buf_create_from_str("slice widening size mismatch");
case PanicMsgIdUnwrapOptionalFail:
return buf_create_from_str("attempt to unwrap null");
case PanicMsgIdUnreachable:
@@ -3085,74 +3083,6 @@ static void add_error_range_check(CodeGen *g, ZigType *err_set_type, ZigType *in
}
}
-static LLVMValueRef ir_render_resize_slice(CodeGen *g, IrExecutableGen *executable,
- IrInstGenResizeSlice *instruction)
-{
- ZigType *actual_type = instruction->operand->value->type;
- ZigType *wanted_type = instruction->base.value->type;
- LLVMValueRef expr_val = ir_llvm_value(g, instruction->operand);
- assert(expr_val);
-
- LLVMValueRef result_loc = ir_llvm_value(g, instruction->result_loc);
- assert(wanted_type->id == ZigTypeIdStruct);
- assert(wanted_type->data.structure.special == StructSpecialSlice);
- assert(actual_type->id == ZigTypeIdStruct);
- assert(actual_type->data.structure.special == StructSpecialSlice);
-
- ZigType *actual_pointer_type = actual_type->data.structure.fields[0]->type_entry;
- ZigType *actual_child_type = actual_pointer_type->data.pointer.child_type;
- ZigType *wanted_pointer_type = wanted_type->data.structure.fields[0]->type_entry;
- ZigType *wanted_child_type = wanted_pointer_type->data.pointer.child_type;
-
-
- size_t actual_ptr_index = actual_type->data.structure.fields[slice_ptr_index]->gen_index;
- size_t actual_len_index = actual_type->data.structure.fields[slice_len_index]->gen_index;
- size_t wanted_ptr_index = wanted_type->data.structure.fields[slice_ptr_index]->gen_index;
- size_t wanted_len_index = wanted_type->data.structure.fields[slice_len_index]->gen_index;
-
- LLVMValueRef src_ptr_ptr = LLVMBuildStructGEP(g->builder, expr_val, (unsigned)actual_ptr_index, "");
- LLVMValueRef src_ptr = gen_load_untyped(g, src_ptr_ptr, 0, false, "");
- LLVMValueRef src_ptr_casted = LLVMBuildBitCast(g->builder, src_ptr,
- get_llvm_type(g, wanted_type->data.structure.fields[0]->type_entry), "");
- LLVMValueRef dest_ptr_ptr = LLVMBuildStructGEP(g->builder, result_loc,
- (unsigned)wanted_ptr_index, "");
- gen_store_untyped(g, src_ptr_casted, dest_ptr_ptr, 0, false);
-
- LLVMValueRef src_len_ptr = LLVMBuildStructGEP(g->builder, expr_val, (unsigned)actual_len_index, "");
- LLVMValueRef src_len = gen_load_untyped(g, src_len_ptr, 0, false, "");
- uint64_t src_size = type_size(g, actual_child_type);
- uint64_t dest_size = type_size(g, wanted_child_type);
-
- LLVMValueRef new_len;
- if (dest_size == 1) {
- LLVMValueRef src_size_val = LLVMConstInt(g->builtin_types.entry_usize->llvm_type, src_size, false);
- new_len = LLVMBuildMul(g->builder, src_len, src_size_val, "");
- } else if (src_size == 1) {
- LLVMValueRef dest_size_val = LLVMConstInt(g->builtin_types.entry_usize->llvm_type, dest_size, false);
- if (ir_want_runtime_safety(g, &instruction->base)) {
- LLVMValueRef remainder_val = LLVMBuildURem(g->builder, src_len, dest_size_val, "");
- LLVMValueRef zero = LLVMConstNull(g->builtin_types.entry_usize->llvm_type);
- LLVMValueRef ok_bit = LLVMBuildICmp(g->builder, LLVMIntEQ, remainder_val, zero, "");
- LLVMBasicBlockRef ok_block = LLVMAppendBasicBlock(g->cur_fn_val, "SliceWidenOk");
- LLVMBasicBlockRef fail_block = LLVMAppendBasicBlock(g->cur_fn_val, "SliceWidenFail");
- LLVMBuildCondBr(g->builder, ok_bit, ok_block, fail_block);
-
- LLVMPositionBuilderAtEnd(g->builder, fail_block);
- gen_safety_crash(g, PanicMsgIdSliceWidenRemainder);
-
- LLVMPositionBuilderAtEnd(g->builder, ok_block);
- }
- new_len = LLVMBuildExactUDiv(g->builder, src_len, dest_size_val, "");
- } else {
- zig_unreachable();
- }
-
- LLVMValueRef dest_len_ptr = LLVMBuildStructGEP(g->builder, result_loc, (unsigned)wanted_len_index, "");
- gen_store_untyped(g, new_len, dest_len_ptr, 0, false);
-
- return result_loc;
-}
-
static LLVMValueRef ir_render_cast(CodeGen *g, IrExecutableGen *executable,
IrInstGenCast *cast_instruction)
{
@@ -6485,8 +6415,6 @@ static LLVMValueRef ir_render_instruction(CodeGen *g, IrExecutableGen *executabl
return ir_render_assert_zero(g, executable, (IrInstGenAssertZero *)instruction);
case IrInstGenIdAssertNonNull:
return ir_render_assert_non_null(g, executable, (IrInstGenAssertNonNull *)instruction);
- case IrInstGenIdResizeSlice:
- return ir_render_resize_slice(g, executable, (IrInstGenResizeSlice *)instruction);
case IrInstGenIdPtrOfArrayToSlice:
return ir_render_ptr_of_array_to_slice(g, executable, (IrInstGenPtrOfArrayToSlice *)instruction);
case IrInstGenIdSuspendBegin:
@@ -8317,8 +8245,6 @@ static void define_builtin_fns(CodeGen *g) {
create_builtin_fn(g, BuiltinFnIdAtomicLoad, "atomicLoad", 3);
create_builtin_fn(g, BuiltinFnIdAtomicStore, "atomicStore", 4);
create_builtin_fn(g, BuiltinFnIdErrSetCast, "errSetCast", 2);
- create_builtin_fn(g, BuiltinFnIdToBytes, "sliceToBytes", 1);
- create_builtin_fn(g, BuiltinFnIdFromBytes, "bytesToSlice", 2);
create_builtin_fn(g, BuiltinFnIdThis, "This", 0);
create_builtin_fn(g, BuiltinFnIdHasDecl, "hasDecl", 2);
create_builtin_fn(g, BuiltinFnIdUnionInit, "unionInit", 3);
src/ir.cpp
@@ -383,10 +383,6 @@ static void destroy_instruction_src(IrInstSrc *inst) {
return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFloatCast *>(inst));
case IrInstSrcIdErrSetCast:
return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcErrSetCast *>(inst));
- case IrInstSrcIdFromBytes:
- return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcFromBytes *>(inst));
- case IrInstSrcIdToBytes:
- return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcToBytes *>(inst));
case IrInstSrcIdIntToFloat:
return heap::c_allocator.destroy(reinterpret_cast<IrInstSrcIntToFloat *>(inst));
case IrInstSrcIdFloatToInt:
@@ -707,8 +703,6 @@ void destroy_instruction_gen(IrInstGen *inst) {
return heap::c_allocator.destroy(reinterpret_cast<IrInstGenAssertZero *>(inst));
case IrInstGenIdAssertNonNull:
return heap::c_allocator.destroy(reinterpret_cast<IrInstGenAssertNonNull *>(inst));
- case IrInstGenIdResizeSlice:
- return heap::c_allocator.destroy(reinterpret_cast<IrInstGenResizeSlice *>(inst));
case IrInstGenIdAlloca:
return heap::c_allocator.destroy(reinterpret_cast<IrInstGenAlloca *>(inst));
case IrInstGenIdSuspendBegin:
@@ -1563,14 +1557,6 @@ static constexpr IrInstSrcId ir_inst_id(IrInstSrcErrSetCast *) {
return IrInstSrcIdErrSetCast;
}
-static constexpr IrInstSrcId ir_inst_id(IrInstSrcToBytes *) {
- return IrInstSrcIdToBytes;
-}
-
-static constexpr IrInstSrcId ir_inst_id(IrInstSrcFromBytes *) {
- return IrInstSrcIdFromBytes;
-}
-
static constexpr IrInstSrcId ir_inst_id(IrInstSrcCheckRuntimeScope *) {
return IrInstSrcIdCheckRuntimeScope;
}
@@ -1700,10 +1686,6 @@ static constexpr IrInstGenId ir_inst_id(IrInstGenCast *) {
return IrInstGenIdCast;
}
-static constexpr IrInstGenId ir_inst_id(IrInstGenResizeSlice *) {
- return IrInstGenIdResizeSlice;
-}
-
static constexpr IrInstGenId ir_inst_id(IrInstGenUnreachable *) {
return IrInstGenIdUnreachable;
}
@@ -2759,21 +2741,6 @@ static IrInstGen *ir_build_var_decl_gen(IrAnalyze *ira, IrInst *source_instructi
return &inst->base;
}
-static IrInstGen *ir_build_resize_slice(IrAnalyze *ira, IrInst *source_instruction,
- IrInstGen *operand, ZigType *ty, IrInstGen *result_loc)
-{
- IrInstGenResizeSlice *instruction = ir_build_inst_gen<IrInstGenResizeSlice>(&ira->new_irb,
- source_instruction->scope, source_instruction->source_node);
- instruction->base.value->type = ty;
- instruction->operand = operand;
- instruction->result_loc = result_loc;
-
- ir_ref_inst_gen(operand, ira->new_irb.current_basic_block);
- if (result_loc != nullptr) ir_ref_inst_gen(result_loc, ira->new_irb.current_basic_block);
-
- return &instruction->base;
-}
-
static IrInstSrc *ir_build_export(IrBuilderSrc *irb, Scope *scope, AstNode *source_node,
IrInstSrc *target, IrInstSrc *options)
{
@@ -3540,32 +3507,6 @@ static IrInstSrc *ir_build_err_set_cast(IrBuilderSrc *irb, Scope *scope, AstNode
return &instruction->base;
}
-static IrInstSrc *ir_build_to_bytes(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, IrInstSrc *target,
- ResultLoc *result_loc)
-{
- IrInstSrcToBytes *instruction = ir_build_instruction<IrInstSrcToBytes>(irb, scope, source_node);
- instruction->target = target;
- instruction->result_loc = result_loc;
-
- ir_ref_instruction(target, irb->current_basic_block);
-
- return &instruction->base;
-}
-
-static IrInstSrc *ir_build_from_bytes(IrBuilderSrc *irb, Scope *scope, AstNode *source_node,
- IrInstSrc *dest_child_type, IrInstSrc *target, ResultLoc *result_loc)
-{
- IrInstSrcFromBytes *instruction = ir_build_instruction<IrInstSrcFromBytes>(irb, scope, source_node);
- instruction->dest_child_type = dest_child_type;
- instruction->target = target;
- instruction->result_loc = result_loc;
-
- ir_ref_instruction(dest_child_type, irb->current_basic_block);
- ir_ref_instruction(target, irb->current_basic_block);
-
- return &instruction->base;
-}
-
static IrInstSrc *ir_build_int_to_float(IrBuilderSrc *irb, Scope *scope, AstNode *source_node,
IrInstSrc *dest_type, IrInstSrc *target)
{
@@ -6597,31 +6538,6 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod
IrInstSrc *result = ir_build_err_set_cast(irb, scope, node, arg0_value, arg1_value);
return ir_lval_wrap(irb, scope, result, lval, result_loc);
}
- case BuiltinFnIdFromBytes:
- {
- AstNode *arg0_node = node->data.fn_call_expr.params.at(0);
- IrInstSrc *arg0_value = ir_gen_node(irb, arg0_node, scope);
- if (arg0_value == irb->codegen->invalid_inst_src)
- return arg0_value;
-
- AstNode *arg1_node = node->data.fn_call_expr.params.at(1);
- IrInstSrc *arg1_value = ir_gen_node(irb, arg1_node, scope);
- if (arg1_value == irb->codegen->invalid_inst_src)
- return arg1_value;
-
- IrInstSrc *result = ir_build_from_bytes(irb, scope, node, arg0_value, arg1_value, result_loc);
- return ir_lval_wrap(irb, scope, result, lval, result_loc);
- }
- case BuiltinFnIdToBytes:
- {
- AstNode *arg0_node = node->data.fn_call_expr.params.at(0);
- IrInstSrc *arg0_value = ir_gen_node(irb, arg0_node, scope);
- if (arg0_value == irb->codegen->invalid_inst_src)
- return arg0_value;
-
- IrInstSrc *result = ir_build_to_bytes(irb, scope, node, arg0_value, result_loc);
- return ir_lval_wrap(irb, scope, result, lval, result_loc);
- }
case BuiltinFnIdIntToFloat:
{
AstNode *arg0_node = node->data.fn_call_expr.params.at(0);
@@ -25489,171 +25405,6 @@ static IrInstGen *ir_analyze_instruction_err_set_cast(IrAnalyze *ira, IrInstSrcE
return ir_analyze_err_set_cast(ira, &instruction->base.base, target, dest_type);
}
-static IrInstGen *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstSrcFromBytes *instruction) {
- Error err;
-
- ZigType *dest_child_type = ir_resolve_type(ira, instruction->dest_child_type->child);
- if (type_is_invalid(dest_child_type))
- return ira->codegen->invalid_inst_gen;
-
- IrInstGen *target = instruction->target->child;
- if (type_is_invalid(target->value->type))
- return ira->codegen->invalid_inst_gen;
-
- bool src_ptr_const;
- bool src_ptr_volatile;
- uint32_t src_ptr_align;
- if (target->value->type->id == ZigTypeIdPointer) {
- src_ptr_const = target->value->type->data.pointer.is_const;
- src_ptr_volatile = target->value->type->data.pointer.is_volatile;
-
- if ((err = resolve_ptr_align(ira, target->value->type, &src_ptr_align)))
- return ira->codegen->invalid_inst_gen;
- } else if (is_slice(target->value->type)) {
- ZigType *src_ptr_type = target->value->type->data.structure.fields[slice_ptr_index]->type_entry;
- src_ptr_const = src_ptr_type->data.pointer.is_const;
- src_ptr_volatile = src_ptr_type->data.pointer.is_volatile;
-
- if ((err = resolve_ptr_align(ira, src_ptr_type, &src_ptr_align)))
- return ira->codegen->invalid_inst_gen;
- } else {
- src_ptr_const = true;
- src_ptr_volatile = false;
-
- if ((err = type_resolve(ira->codegen, target->value->type, ResolveStatusAlignmentKnown)))
- return ira->codegen->invalid_inst_gen;
-
- src_ptr_align = get_abi_alignment(ira->codegen, target->value->type);
- }
-
- if (src_ptr_align != 0) {
- if ((err = type_resolve(ira->codegen, dest_child_type, ResolveStatusAlignmentKnown)))
- return ira->codegen->invalid_inst_gen;
- }
-
- ZigType *dest_ptr_type = get_pointer_to_type_extra(ira->codegen, dest_child_type,
- src_ptr_const, src_ptr_volatile, PtrLenUnknown,
- src_ptr_align, 0, 0, false);
- ZigType *dest_slice_type = get_slice_type(ira->codegen, dest_ptr_type);
-
- ZigType *u8_ptr = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8,
- src_ptr_const, src_ptr_volatile, PtrLenUnknown,
- src_ptr_align, 0, 0, false);
- ZigType *u8_slice = get_slice_type(ira->codegen, u8_ptr);
-
- IrInstGen *casted_value = ir_implicit_cast2(ira, &instruction->target->base, target, u8_slice);
- if (type_is_invalid(casted_value->value->type))
- return ira->codegen->invalid_inst_gen;
-
- bool have_known_len = false;
- uint64_t known_len;
-
- if (instr_is_comptime(casted_value)) {
- ZigValue *val = ir_resolve_const(ira, casted_value, UndefBad);
- if (!val)
- return ira->codegen->invalid_inst_gen;
-
- ZigValue *len_val = val->data.x_struct.fields[slice_len_index];
- if (value_is_comptime(len_val)) {
- known_len = bigint_as_u64(&len_val->data.x_bigint);
- have_known_len = true;
- }
- }
-
- IrInstGen *result_loc = ir_resolve_result(ira, &instruction->base.base, instruction->result_loc,
- dest_slice_type, nullptr, true, true);
- if (result_loc != nullptr && (type_is_invalid(result_loc->value->type) || result_loc->value->type->id == ZigTypeIdUnreachable)) {
- return result_loc;
- }
-
- if (target->value->type->id == ZigTypeIdPointer &&
- target->value->type->data.pointer.ptr_len == PtrLenSingle &&
- target->value->type->data.pointer.child_type->id == ZigTypeIdArray)
- {
- known_len = target->value->type->data.pointer.child_type->data.array.len;
- have_known_len = true;
- } else if (casted_value->value->data.rh_slice.id == RuntimeHintSliceIdLen) {
- known_len = casted_value->value->data.rh_slice.len;
- have_known_len = true;
- }
-
- if (have_known_len) {
- if ((err = type_resolve(ira->codegen, dest_child_type, ResolveStatusSizeKnown)))
- return ira->codegen->invalid_inst_gen;
- uint64_t child_type_size = type_size(ira->codegen, dest_child_type);
- uint64_t remainder = known_len % child_type_size;
- if (remainder != 0) {
- ErrorMsg *msg = ir_add_error(ira, &instruction->base.base,
- buf_sprintf("unable to convert [%" ZIG_PRI_u64 "]u8 to %s: size mismatch",
- known_len, buf_ptr(&dest_slice_type->name)));
- add_error_note(ira->codegen, msg, instruction->dest_child_type->base.source_node,
- buf_sprintf("%s has size %" ZIG_PRI_u64 "; remaining bytes: %" ZIG_PRI_u64,
- buf_ptr(&dest_child_type->name), child_type_size, remainder));
- return ira->codegen->invalid_inst_gen;
- }
- }
-
- return ir_build_resize_slice(ira, &instruction->base.base, casted_value, dest_slice_type, result_loc);
-}
-
-static IrInstGen *ir_analyze_instruction_to_bytes(IrAnalyze *ira, IrInstSrcToBytes *instruction) {
- Error err;
-
- IrInstGen *target = instruction->target->child;
- if (type_is_invalid(target->value->type))
- return ira->codegen->invalid_inst_gen;
-
- if (!is_slice(target->value->type)) {
- ir_add_error(ira, &instruction->target->base,
- buf_sprintf("expected slice, found '%s'", buf_ptr(&target->value->type->name)));
- return ira->codegen->invalid_inst_gen;
- }
-
- ZigType *src_ptr_type = target->value->type->data.structure.fields[slice_ptr_index]->type_entry;
-
- uint32_t alignment;
- if ((err = resolve_ptr_align(ira, src_ptr_type, &alignment)))
- return ira->codegen->invalid_inst_gen;
-
- ZigType *dest_ptr_type = get_pointer_to_type_extra(ira->codegen, ira->codegen->builtin_types.entry_u8,
- src_ptr_type->data.pointer.is_const, src_ptr_type->data.pointer.is_volatile, PtrLenUnknown,
- alignment, 0, 0, false);
- ZigType *dest_slice_type = get_slice_type(ira->codegen, dest_ptr_type);
-
- if (instr_is_comptime(target)) {
- ZigValue *target_val = ir_resolve_const(ira, target, UndefBad);
- if (target_val == nullptr)
- return ira->codegen->invalid_inst_gen;
-
- IrInstGen *result = ir_const(ira, &instruction->base.base, dest_slice_type);
- result->value->data.x_struct.fields = alloc_const_vals_ptrs(ira->codegen, 2);
-
- ZigValue *ptr_val = result->value->data.x_struct.fields[slice_ptr_index];
- ZigValue *target_ptr_val = target_val->data.x_struct.fields[slice_ptr_index];
- copy_const_val(ira->codegen, ptr_val, target_ptr_val);
- ptr_val->type = dest_ptr_type;
-
- ZigValue *len_val = result->value->data.x_struct.fields[slice_len_index];
- len_val->special = ConstValSpecialStatic;
- len_val->type = ira->codegen->builtin_types.entry_usize;
- ZigValue *target_len_val = target_val->data.x_struct.fields[slice_len_index];
- ZigType *elem_type = src_ptr_type->data.pointer.child_type;
- BigInt elem_size_bigint;
- bigint_init_unsigned(&elem_size_bigint, type_size(ira->codegen, elem_type));
- bigint_mul(&len_val->data.x_bigint, &target_len_val->data.x_bigint, &elem_size_bigint);
-
- return result;
- }
-
- IrInstGen *result_loc = ir_resolve_result(ira, &instruction->base.base, instruction->result_loc,
- dest_slice_type, nullptr, true, true);
- if (type_is_invalid(result_loc->value->type) || result_loc->value->type->id == ZigTypeIdUnreachable) {
- return result_loc;
- }
-
- return ir_build_resize_slice(ira, &instruction->base.base, target, dest_slice_type, result_loc);
-}
-
static Error resolve_ptr_align(IrAnalyze *ira, ZigType *ty, uint32_t *result_align) {
Error err;
@@ -29783,10 +29534,6 @@ static IrInstGen *ir_analyze_instruction_base(IrAnalyze *ira, IrInstSrc *instruc
return ir_analyze_instruction_float_cast(ira, (IrInstSrcFloatCast *)instruction);
case IrInstSrcIdErrSetCast:
return ir_analyze_instruction_err_set_cast(ira, (IrInstSrcErrSetCast *)instruction);
- case IrInstSrcIdFromBytes:
- return ir_analyze_instruction_from_bytes(ira, (IrInstSrcFromBytes *)instruction);
- case IrInstSrcIdToBytes:
- return ir_analyze_instruction_to_bytes(ira, (IrInstSrcToBytes *)instruction);
case IrInstSrcIdIntToFloat:
return ir_analyze_instruction_int_to_float(ira, (IrInstSrcIntToFloat *)instruction);
case IrInstSrcIdFloatToInt:
@@ -30113,7 +29860,6 @@ bool ir_inst_gen_has_side_effects(IrInstGen *instruction) {
case IrInstGenIdCmpxchg:
case IrInstGenIdAssertZero:
case IrInstGenIdAssertNonNull:
- case IrInstGenIdResizeSlice:
case IrInstGenIdPtrOfArrayToSlice:
case IrInstGenIdSlice:
case IrInstGenIdOptionalWrap:
@@ -30339,8 +30085,6 @@ bool ir_inst_src_has_side_effects(IrInstSrc *instruction) {
case IrInstSrcIdIntToFloat:
case IrInstSrcIdFloatToInt:
case IrInstSrcIdBoolToInt:
- case IrInstSrcIdFromBytes:
- case IrInstSrcIdToBytes:
case IrInstSrcIdEnumToInt:
case IrInstSrcIdHasDecl:
case IrInstSrcIdAlloca:
src/ir_print.cpp
@@ -307,10 +307,6 @@ const char* ir_inst_src_type_str(IrInstSrcId id) {
return "SrcAddImplicitReturnType";
case IrInstSrcIdErrSetCast:
return "SrcErrSetCast";
- case IrInstSrcIdToBytes:
- return "SrcToBytes";
- case IrInstSrcIdFromBytes:
- return "SrcFromBytes";
case IrInstSrcIdCheckRuntimeScope:
return "SrcCheckRuntimeScope";
case IrInstSrcIdHasDecl:
@@ -383,8 +379,6 @@ const char* ir_inst_gen_type_str(IrInstGenId id) {
return "GenReturn";
case IrInstGenIdCast:
return "GenCast";
- case IrInstGenIdResizeSlice:
- return "GenResizeSlice";
case IrInstGenIdUnreachable:
return "GenUnreachable";
case IrInstGenIdAsm:
@@ -1644,20 +1638,6 @@ static void ir_print_err_set_cast(IrPrintSrc *irp, IrInstSrcErrSetCast *instruct
fprintf(irp->f, ")");
}
-static void ir_print_from_bytes(IrPrintSrc *irp, IrInstSrcFromBytes *instruction) {
- fprintf(irp->f, "@bytesToSlice(");
- ir_print_other_inst_src(irp, instruction->dest_child_type);
- fprintf(irp->f, ", ");
- ir_print_other_inst_src(irp, instruction->target);
- fprintf(irp->f, ")");
-}
-
-static void ir_print_to_bytes(IrPrintSrc *irp, IrInstSrcToBytes *instruction) {
- fprintf(irp->f, "@sliceToBytes(");
- ir_print_other_inst_src(irp, instruction->target);
- fprintf(irp->f, ")");
-}
-
static void ir_print_int_to_float(IrPrintSrc *irp, IrInstSrcIntToFloat *instruction) {
fprintf(irp->f, "@intToFloat(");
ir_print_other_inst_src(irp, instruction->dest_type);
@@ -2142,13 +2122,6 @@ static void ir_print_assert_non_null(IrPrintGen *irp, IrInstGenAssertNonNull *in
fprintf(irp->f, ")");
}
-static void ir_print_resize_slice(IrPrintGen *irp, IrInstGenResizeSlice *instruction) {
- fprintf(irp->f, "@resizeSlice(");
- ir_print_other_inst_gen(irp, instruction->operand);
- fprintf(irp->f, ")result=");
- ir_print_other_inst_gen(irp, instruction->result_loc);
-}
-
static void ir_print_alloca_src(IrPrintSrc *irp, IrInstSrcAlloca *instruction) {
fprintf(irp->f, "Alloca(align=");
ir_print_other_inst_src(irp, instruction->align);
@@ -2793,12 +2766,6 @@ static void ir_print_inst_src(IrPrintSrc *irp, IrInstSrc *instruction, bool trai
case IrInstSrcIdErrSetCast:
ir_print_err_set_cast(irp, (IrInstSrcErrSetCast *)instruction);
break;
- case IrInstSrcIdFromBytes:
- ir_print_from_bytes(irp, (IrInstSrcFromBytes *)instruction);
- break;
- case IrInstSrcIdToBytes:
- ir_print_to_bytes(irp, (IrInstSrcToBytes *)instruction);
- break;
case IrInstSrcIdIntToFloat:
ir_print_int_to_float(irp, (IrInstSrcIntToFloat *)instruction);
break;
@@ -3273,9 +3240,6 @@ static void ir_print_inst_gen(IrPrintGen *irp, IrInstGen *instruction, bool trai
case IrInstGenIdAssertNonNull:
ir_print_assert_non_null(irp, (IrInstGenAssertNonNull *)instruction);
break;
- case IrInstGenIdResizeSlice:
- ir_print_resize_slice(irp, (IrInstGenResizeSlice *)instruction);
- break;
case IrInstGenIdAlloca:
ir_print_alloca_gen(irp, (IrInstGenAlloca *)instruction);
break;