target/whirl.c
static void move_back_from_reg(WhirlCodeSegment *segment, RingState *state, Reg reg) {
    generate_op_command(segment, state, OP_ONE);

    for (int i = reg + REG_START_POS; i < EXTRA_TMP1; i++) {
        generate_op_command(segment, state, OP_DADD);
    }

    generate_math_command(segment, state, MATH_STORE);
    generate_op_command(segment, state, OP_DADD);
    generate_op_command(segment, state, OP_STORE);
    generate_math_command(segment, state, MATH_LOAD);
    generate_math_command(segment, state, MATH_NEG);
    generate_math_command(segment, state, MATH_STORE);
    generate_op_command(segment, state, OP_LOAD);
    generate_op_command(segment, state, OP_DADD);
    generate_math_command(segment, state, MATH_LOAD);

    for (int i = 0; i < EXTRA_TMP1; i++) {
        generate_op_command(segment, state, OP_DADD);
    }
}
// Starting from the given register, move back to the first memory position.
// preserving the value in the math ring. 
Starting from the given register, move back to the first memory position.
preserving the value in the math ring.
Starting from the given register move back to the first memory position . preserving the value in the math ring .
static void move_back_from_reg(WhirlCodeSegment *segment, RingState *state, Reg reg) {
    generate_op_command(segment, state, OP_ONE);
    for (int i = reg + REG_START_POS; i < EXTRA_TMP1; i++) {
        generate_op_command(segment, state, OP_DADD);
    }
    generate_math_command(segment, state, MATH_STORE);
    generate_op_command(segment, state, OP_DADD);
    generate_op_command(segment, state, OP_STORE);
    generate_math_command(segment, state, MATH_LOAD);
    generate_math_command(segment, state, MATH_NEG);
    generate_math_command(segment, state, MATH_STORE);
    generate_op_command(segment, state, OP_LOAD);
    generate_op_command(segment, state, OP_DADD);
    generate_math_command(segment, state, MATH_LOAD);
    for (int i = 0; i < EXTRA_TMP1; i++) {
        generate_op_command(segment, state, OP_DADD);
    }
}
static void move_back_from_reg ( WhirlCodeSegment * segment , RingState * state , Reg reg ) { generate_op_command ( segment , state , OP_ONE ) ; for ( int i = reg + REG_START_POS ; i < EXTRA_TMP1 ; i ++ ) { generate_op_command ( segment , state , OP_DADD ) ; } generate_math_command ( segment , state , MATH_STORE ) ; generate_op_command ( segment , state , OP_DADD ) ; generate_op_command ( segment , state , OP_STORE ) ; generate_math_command ( segment , state , MATH_LOAD ) ; generate_math_command ( segment , state , MATH_NEG ) ; generate_math_command ( segment , state , MATH_STORE ) ; generate_op_command ( segment , state , OP_LOAD ) ; generate_op_command ( segment , state , OP_DADD ) ; generate_math_command ( segment , state , MATH_LOAD ) ; for ( int i = 0 ; i < EXTRA_TMP1 ; i ++ ) { generate_op_command ( segment , state , OP_DADD ) ; } }
Starting from the given register, move back to the first memory position.
Starting from the given register move back to the first memory position .