Hello everyone,

I'm working on an extension to the Graphite pass of GCC 4.4.0.  My
intention is to associate costs to RTL instructions by adding them as
RTX attributes to a machine description file, and to read them back
during the Graphite pass by iterating through each basic block.

Is the RTL available during this optimization pass? I'm not sure this
is the case as I get a segfault when trying to iterate over the RTL
with the code below ("internal compiler error: Segmentation fault"). I
don't need the fully resolved RTL, just to be able to read the
attribute given an RTL instruction.

I've tried debugging the compiler with gdb but it can't find the
debugging symbols even though they're there.  I'll keep trying to get
gdb to work but any leads on reading these attributes from within
Graphite is greatly appreciated.

-Arnaldo


Code to iterate over RTL
-----------------------------------
graphite_bb_p gbb;
rtx insn;
int i;

for (i = 0; VEC_iterate (graphite_bb_p, SCOP_BBS (scop), i, gbb); i++)
{
    if (GBB_BB(gbb))
        for (insn = BB_HEAD (GBB_BB(gbb)); insn != NEXT_INSN (BB_END
(GBB_BB(gbb))); insn = NEXT_INSN (insn))
            if (INSN_P (insn))
                fprintf(dump_file, "RTL detected\n");
}


Test code
--------------
unsigned int image[N+K][N+K];
unsigned int filter[K][K];
unsigned int out[N][N];

// Init arrays ...

int main()
{
    int v = 0;
    int h = 0;
    int i = 0;
    int j = 0;
    unsigned int s = 0;

    for (v = 0; v < N; v++)
        for (h= 0; h < N; h++)
        {
            s = 0;
            for (i = 0; i < K; i++)
                for (j = 0; j < K; j++)
                    s += image[v+i][h+j] * filter[i][j];

            out[v][h] = s >> FACTOR;
        }

    return 0;
}


Compilation flags
-----------------
arm-unknown-eabi-gcc -O0 -mabi=aapcs-linux -mcpu=cortex-a8 -mfpu=neon
-mfloat-abi=softfp -fno-math-errno -fno-signed-zeros
-fno-tree-vectorize -Wall -I../../..//lib -I../../../ -O2 -floop-block
-floop-interchange -floop-strip-mine -ftree-vectorize
-fvect-cost-model -ftree-vectorizer-verbose=3 -fdump-tree-all
-fdump-rtl-expand   -c -o convolve.o convolve.c

Reply via email to