functions.c
// Write a value to va_list. This could be either directly from the stack or from
// an lvalue in a register.
Write a value to va_list. This could be either directly from the stack or from
an lvalue in a register.
Write a value to va_list . This could be either directly from the stack or from an lvalue in a register .
static Tac *write_to_va_list(Function *function, Tac *ir, Value *va_list, Value *value, int offset) {
    Value *dst = dup_value(va_list);
    if (va_list->vreg) {
        Value *tmp = dup_value(dst);
        tmp->is_lvalue = 1;
        tmp->offset = offset;
        tmp->type = value->type;
        ir = insert_instruction_after_from_operation(ir, IR_MOVE, tmp, value, 0);
    }
    else {
    dst->type = value->type;
        dst->offset = offset;
        ir = insert_instruction_after_from_operation(ir, IR_MOVE, dst, value, 0);
    }
}
static Tac * write_to_va_list ( Function * function , Tac * ir , Value * va_list , Value * value , int offset ) { Value * dst = dup_value ( va_list ) ; if ( va_list -> vreg ) { Value * tmp = dup_value ( dst ) ; tmp -> is_lvalue = 1 ; tmp -> offset = offset ; tmp -> type = value -> type ; ir = insert_instruction_after_from_operation ( ir , IR_MOVE , tmp , value , 0 ) ; } else { dst -> type = value -> type ; dst -> offset = offset ; ir = insert_instruction_after_from_operation ( ir , IR_MOVE , dst , value , 0 ) ; } }
Write a value to va_list.
Write a value to va_list .
// va_list is a pointer in a register. Load it, add the offset to it, then // write to the pointer. // Write to the stack