functions.c
// This implements the reverse of make_sse_struct_or_union_arg_move_instructions
This implements the reverse of make_sse_struct_or_union_arg_move_instructions
This implements the reverse of make_sse_struct_or_union_arg_move_instructions
static int make_sse_struct_or_union_move_from_register_to_stack_instructions(
        Function *function, Tac *ir, Type *type, FunctionParamLocation* pl,
        int register_index, int stack_index, RegisterSet *register_set, int param_register_vreg) {
    if (debug_function_param_mapping)
        printf("Adding param move from sse register %d size %d to stack_index %d, offset %d\n", register_index, pl->stru_size, stack_index, pl->stru_offset);
    if (!param_register_vreg) param_register_vreg = ++function->vreg_count;
    Value *param_register = new_value();
    param_register->vreg = param_register_vreg;
    int live_range_preg = register_set->sse_registers[register_index];
    param_register->live_range_preg = live_range_preg;
    if (pl->stru_size == 4) {
        param_register->type = new_type(TYPE_FLOAT);
        Value *dst = make_param_dst_on_stack(TYPE_FLOAT, stack_index, pl->stru_offset);
        insert_instruction_from_operation(ir, IR_MOVE, dst, param_register, 0, 1);
    }
    else if (pl->stru_size == 8 && pl->stru_member_count == 1) {
        param_register->type = new_type(TYPE_DOUBLE);
        Value *dst = make_param_dst_on_stack(TYPE_DOUBLE, stack_index, pl->stru_offset);
        insert_instruction_from_operation(ir, IR_MOVE, dst, param_register, 0, 1);
    }
    else {
        param_register->type = new_type(TYPE_DOUBLE);
        Value *temp_int = new_value();
        temp_int->type = new_type(TYPE_LONG);
        temp_int->vreg = ++function->vreg_count;
        insert_instruction_from_operation(ir, IR_MOVE_PREG_CLASS, temp_int, param_register, 0, 1);
        Value *dst = make_param_dst_on_stack(TYPE_LONG, stack_index, pl->stru_offset);
        insert_instruction_from_operation(ir, IR_MOVE, dst, temp_int, 0, 1);
    }
    return live_range_preg;
}
static int make_sse_struct_or_union_move_from_register_to_stack_instructions ( Function * function , Tac * ir , Type * type , FunctionParamLocation * pl , int register_index , int stack_index , RegisterSet * register_set , int param_register_vreg ) { if ( debug_function_param_mapping ) printf ( " \n " , register_index , pl -> stru_size , stack_index , pl -> stru_offset ) ; if ( ! param_register_vreg ) param_register_vreg = ++ function -> vreg_count ; Value * param_register = new_value ( ) ; param_register -> vreg = param_register_vreg ; int live_range_preg = register_set -> sse_registers [ register_index ] ; param_register -> live_range_preg = live_range_preg ; if ( pl -> stru_size == 4 ) { param_register -> type = new_type ( TYPE_FLOAT ) ; Value * dst = make_param_dst_on_stack ( TYPE_FLOAT , stack_index , pl -> stru_offset ) ; insert_instruction_from_operation ( ir , IR_MOVE , dst , param_register , 0 , 1 ) ; } else if ( pl -> stru_size == 8 && pl -> stru_member_count == 1 ) { param_register -> type = new_type ( TYPE_DOUBLE ) ; Value * dst = make_param_dst_on_stack ( TYPE_DOUBLE , stack_index , pl -> stru_offset ) ; insert_instruction_from_operation ( ir , IR_MOVE , dst , param_register , 0 , 1 ) ; } else { param_register -> type = new_type ( TYPE_DOUBLE ) ; Value * temp_int = new_value ( ) ; temp_int -> type = new_type ( TYPE_LONG ) ; temp_int -> vreg = ++ function -> vreg_count ; insert_instruction_from_operation ( ir , IR_MOVE_PREG_CLASS , temp_int , param_register , 0 , 1 ) ; Value * dst = make_param_dst_on_stack ( TYPE_LONG , stack_index , pl -> stru_offset ) ; insert_instruction_from_operation ( ir , IR_MOVE , dst , temp_int , 0 , 1 ) ; } return live_range_preg ; }
This implements the reverse of make_sse_struct_or_union_arg_move_instructions
This implements the reverse of make_sse_struct_or_union_arg_move_instructions
// Make param register value // Move a single float // Move a single double // Move two floats. It must first be copied into an integer register and then // copied to the stack.