FictionTools/z88dk/src/sccz80/codegen.c
/* Multiply the primary register by the length of some variable */
Multiply the primary register by the length of some variable
Multiply the primary register by the length of some variable
void scale(Kind type, Type *tag)
{
    switch (type) {
    case KIND_INT:
    case KIND_PTR:
        ol("add\thl,hl");
        break;
    case KIND_CPTR:
        threereg();
        break;
    case KIND_LONG:
        ol("add\thl,hl");
        ol("add\thl,hl");
        break;
    case KIND_DOUBLE:
        if ( c_fp_size == 4 ) {
            ol("add\thl,hl");
            ol("add\thl,hl");
        } else {
            sixreg();
        }
        break;
    case KIND_STRUCT:
        quikmult(KIND_INT, tag->size, YES);
        break;
    default:
        break;
    }
}
void scale ( Kind type , Type * tag ) { switch ( type ) { case KIND_INT : case KIND_PTR : ol ( " \t " ) ; break ; case KIND_CPTR : threereg ( ) ; break ; case KIND_LONG : ol ( " \t " ) ; ol ( " \t " ) ; break ; case KIND_DOUBLE : if ( c_fp_size == 4 ) { ol ( " \t " ) ; ol ( " \t " ) ; } else { sixreg ( ) ; } break ; case KIND_STRUCT : quikmult ( KIND_INT , tag -> size , YES ) ; break ; default : break ; } }
Multiply the primary register by the length of some variable
Multiply the primary register by the length of some variable
/* try to avoid multiplying if possible */