authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-09 10:46:13-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-09 10:46:13-04:00
log3ec766abe38a892346e56a47ec0fa4c27eda2995
treed907c38df837a1e21a73939f890b832b102545e9
parent771e88951a9af48335abe14e4c44b5c4f5b252de
signature Commit is signed but in an unrecognized format.

remove ResultLocField dead code


3 files changed, 0 insertions(+), 59 deletions(-)

src/all_types.hpp-9
......@@ -3588,7 +3588,6 @@ enum ResultLocId {
35883588 ResultLocIdInvalid,
35893589 ResultLocIdNone,
35903590 ResultLocIdVar,
3591 ResultLocIdField,
35923591 ResultLocIdReturn,
35933592 ResultLocIdPeer,
35943593 ResultLocIdPeerParent,
......@@ -3615,14 +3614,6 @@ struct ResultLocVar {
36153614 ZigVar *var;
36163615};
36173616
3618struct ResultLocField {
3619 ResultLoc base;
3620
3621 ResultLoc *parent;
3622 Buf *name;
3623 IrInstruction *container_type;
3624};
3625
36263617struct ResultLocReturn {
36273618 ResultLoc base;
36283619};
src/ir.cpp-42
......@@ -14504,28 +14504,6 @@ static ZigType *ir_result_loc_expected_type(IrAnalyze *ira, IrInstruction *suspe
1450414504 return nullptr;
1450514505 case ResultLocIdInstruction:
1450614506 return result_loc->source_instruction->child->value.type;
14507 case ResultLocIdField: {
14508 if (result_loc->resolved_loc != nullptr) {
14509 ZigType *ptr_type = result_loc->resolved_loc->value.type;
14510 assert(ptr_type->id == ZigTypeIdPointer);
14511 return ptr_type->data.pointer.child_type;
14512 }
14513 ResultLocField *result_loc_field = reinterpret_cast<ResultLocField *>(result_loc);
14514 ZigType *container_type = ir_resolve_type(ira, result_loc_field->container_type->child);
14515 if (type_is_invalid(container_type))
14516 return ira->codegen->builtin_types.entry_invalid;
14517 if (container_type->id == ZigTypeIdStruct) {
14518 TypeStructField *field = find_struct_type_field(container_type, result_loc_field->name);
14519 if (field == nullptr) {
14520 return ira->codegen->builtin_types.entry_invalid;
14521 }
14522 return field->type_entry;
14523 } else if (container_type->id == ZigTypeIdUnion) {
14524 zig_panic("TODO");
14525 } else {
14526 zig_unreachable();
14527 }
14528 }
1452914507 case ResultLocIdReturn:
1453014508 return ira->explicit_return_type;
1453114509 case ResultLocIdPeer:
......@@ -14606,26 +14584,6 @@ static IrInstruction *ir_resolve_result(IrAnalyze *ira, IrInstruction *suspend_s
1460614584 result_loc->resolved_loc = result_loc->source_instruction->child;
1460714585 return result_loc->resolved_loc;
1460814586 }
14609 case ResultLocIdField: {
14610 ResultLocField *result_loc_field = reinterpret_cast<ResultLocField *>(result_loc);
14611
14612 ZigType *container_type = ir_resolve_type(ira, result_loc_field->container_type->child);
14613 if (type_is_invalid(container_type))
14614 return ira->codegen->invalid_instruction;
14615
14616 IrInstruction *parent_result_loc = ir_resolve_result(ira, suspend_source_instr,
14617 result_loc_field->parent, container_type, nullptr);
14618 if (parent_result_loc == nullptr || type_is_invalid(parent_result_loc->value.type) ||
14619 parent_result_loc->value.type->id == ZigTypeIdUnreachable)
14620 {
14621 return parent_result_loc;
14622 }
14623
14624 result_loc->written = true;
14625 result_loc->resolved_loc = ir_analyze_container_field_ptr(ira, result_loc_field->name,
14626 suspend_source_instr, parent_result_loc, container_type);
14627 return result_loc->resolved_loc;
14628 }
1462914587 case ResultLocIdReturn: {
1463014588 bool is_comptime = value != nullptr && value->value.special != ConstValSpecialRuntime;
1463114589 if (is_comptime) return nullptr;
src/ir_print.cpp-8
......@@ -213,12 +213,6 @@ static void ir_print_result_loc_instruction(IrPrint *irp, ResultLocInstruction *
213213 fprintf(irp->f, ")");
214214}
215215
216static void ir_print_result_loc_field(IrPrint *irp, ResultLocField *result_loc_field) {
217 fprintf(irp->f, "field(name=%s,type=", buf_ptr(result_loc_field->name));
218 ir_print_other_instruction(irp, result_loc_field->container_type);
219 fprintf(irp->f, ")");
220}
221
222216static void ir_print_result_loc_peer(IrPrint *irp, ResultLocPeer *result_loc_peer) {
223217 fprintf(irp->f, "peer(next=");
224218 ir_print_other_block(irp, result_loc_peer->next_bb);
......@@ -239,8 +233,6 @@ static void ir_print_result_loc(IrPrint *irp, ResultLoc *result_loc) {
239233 return ir_print_result_loc_var(irp, (ResultLocVar *)result_loc);
240234 case ResultLocIdInstruction:
241235 return ir_print_result_loc_instruction(irp, (ResultLocInstruction *)result_loc);
242 case ResultLocIdField:
243 return ir_print_result_loc_field(irp, (ResultLocField *)result_loc);
244236 case ResultLocIdPeer:
245237 return ir_print_result_loc_peer(irp, (ResultLocPeer *)result_loc);
246238 case ResultLocIdPeerParent: