TARGET_MACHINE_DEPENDENT_REORG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I try to port gcc 8.4.0 for toy architecture and have implemented next code:
/* part of gcc/config/toy/toy.c */
#undef TARGET_MACHINE_DEPENDENT_REORG
#define TARGET_MACHINE_DEPENDENT_REORG toy_reorg

#undef TARGET_CAN_USE_DOLOOP_P
#define TARGET_CAN_USE_DOLOOP_P toy_can_use_doloop_p

static void hwloop_fail (hwloop_info loop)
{
    printf("hwloop_fail\n");
    fflush(stdout);
}

static rtx hwloop_pattern_reg (rtx_insn *insn)
{
    printf("hwloop_pattern_reg\n");
    fflush(stdout);

    rtx reg;

    if (!JUMP_P (insn) || recog_memoized (insn) != CODE_FOR_loop_end)
        return NULL_RTX;

    reg = SET_DEST (XVECEXP (PATTERN (insn), 0, 1));
    if (!REG_P (reg))
        return NULL_RTX;
    return reg;
}

static bool hwloop_optimize (hwloop_info loop)
{
    printf("hwloop_optimize\n");
    fflush(stdout);
    return true;
}

static struct hw_doloop_hooks toy_doloop_hooks =
{
    hwloop_pattern_reg,
    hwloop_optimize,
    hwloop_fail
};

static void toy_reorg_loops (void)
{
    printf ("toy_reorg_loops\n");
    reorg_loops (false, &toy_doloop_hooks);
}


static void toy_reorg(void)
{
    printf ("toy_reorg\n");
    fflush(stdout);
    compute_bb_for_insn();
    df_analyze();
    toy_reorg_loops();
}

static bool toy_can_use_doloop_p (const widest_int &, const widest_int
&iterations_max,
               unsigned int, bool)
{
    printf ("toy_can_use_doloop_p\n");
    fflush(stdout);
    return true;
}

But when i compile code with loops i don't see any printf message.
It looks like I haven't entered toy_reorg().

./toy-linux-gcc -O3 -S matmul.c

/*matmul.c*/
void MatMul(const int x[5][50], const int w[50][1], int y[5][1])
{
    for(uint i=0; i<5; ++i){
       for(uint j=0; j<50; ++j){
          for(uint k=0; k<1; ++k){
             y[i][k]+=x[i][j]*w[j][k];
          }
       }
    }
}



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux