ir.c
// Add memcpy calls for struct/union -> struct/union copies
Add memcpy calls for struct/union -> struct/union copies
Add memcpy calls for struct / union - > struct / union copies
void process_struct_and_union_copies(Function *function) {
    for (Tac *ir = function->ir; ir; ir = ir->next) {
        if (ir->operation != IR_MOVE) continue;
        if (ir->src1->type->type != TYPE_STRUCT_OR_UNION) continue;
        if (ir->dst->type->type != ir->src1->type->type) panic("Mismatched struct/union copy type");
        int size = get_type_size(ir->dst->type);
        Value *dst = ir->dst;
        Value *src1 = ir->src1;
        ir->operation = IR_NOP;
        ir->dst = 0;
        ir->src1 = 0;
        add_memory_copy(function, ir, dst, src1, size);
    }
}
void process_struct_and_union_copies ( Function * function ) { for ( Tac * ir = function -> ir ; ir ; ir = ir -> next ) { if ( ir -> operation != IR_MOVE ) continue ; if ( ir -> src1 -> type -> type != TYPE_STRUCT_OR_UNION ) continue ; if ( ir -> dst -> type -> type != ir -> src1 -> type -> type ) panic ( " " ) ; int size = get_type_size ( ir -> dst -> type ) ; Value * dst = ir -> dst ; Value * src1 = ir -> src1 ; ir -> operation = IR_NOP ; ir -> dst = 0 ; ir -> src1 = 0 ; add_memory_copy ( function , ir , dst , src1 , size ) ; } }
Add memcpy calls for struct/union -> struct/union copies
Add memcpy calls for struct / union - > struct / union copies