functions.c
// Add a IR_MOVE instruction from a value to a function call register
// function_call_*_register_arg_index ensures that dst will become the actual
// x86_64 physical register rdi, rsi, etc
Add a IR_MOVE instruction from a value to a function call register
function_call_*_register_arg_index ensures that dst will become the actual
x86_64 physical register rdi, rsi, etc
Add a IR_MOVE instruction from a value to a function call register function_call_ * _register_arg_index ensures that dst will become the actual x86_64 physical register rdi rsi etc
static int add_arg_move_to_register(Function *function, Tac *ir, Type *type, Value *param, int preg_class, int register_index, RegisterSet *register_set) {
    int *arg_registers = preg_class == PC_INT ? int_arg_registers : sse_arg_registers;
    Tac *tac = new_instruction(IR_MOVE);
    tac->dst = new_value();
    tac->dst->type = dup_type(type);
    tac->dst->vreg = ++function->vreg_count;
    tac->dst->live_range_preg = preg_class == PC_INT ? register_set->int_registers[register_index] : register_set->sse_registers[register_index];
    tac->src1 = param;
    tac->src1->preferred_live_range_preg_index = arg_registers[register_index];
    if (debug_function_arg_mapping) printf("Adding arg move from register for preg-class=%d register_index=%d\n", preg_class, register_index);
    insert_instruction(ir, tac, 1);
    return tac->dst->vreg;
}
static int add_arg_move_to_register ( Function * function , Tac * ir , Type * type , Value * param , int preg_class , int register_index , RegisterSet * register_set ) { int * arg_registers = preg_class == PC_INT ? int_arg_registers : sse_arg_registers ; Tac * tac = new_instruction ( IR_MOVE ) ; tac -> dst = new_value ( ) ; tac -> dst -> type = dup_type ( type ) ; tac -> dst -> vreg = ++ function -> vreg_count ; tac -> dst -> live_range_preg = preg_class == PC_INT ? register_set -> int_registers [ register_index ] : register_set -> sse_registers [ register_index ] ; tac -> src1 = param ; tac -> src1 -> preferred_live_range_preg_index = arg_registers [ register_index ] ; if ( debug_function_arg_mapping ) printf ( " \n " , preg_class , register_index ) ; insert_instruction ( ir , tac , 1 ) ; return tac -> dst -> vreg ; }
Add a IR_MOVE instruction from a value to a function call register
function_call_*_register_arg_index ensures that dst will become the actual
x86_64 physical register rdi, rsi, etc
Add a IR_MOVE instruction from a value to a function call register function_call_ * _register_arg_index ensures that dst will become the actual x86_64 physical register rdi rsi etc
// dst // src