public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Iterating over RTL in Graphite
@ 2012-02-17  9:53 Arnaldo
  2012-02-17 22:52 ` David Malcolm
  0 siblings, 1 reply; 12+ messages in thread
From: Arnaldo @ 2012-02-17  9:53 UTC (permalink / raw)
  To: gcc

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-03-05 15:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-17  9:53 Iterating over RTL in Graphite Arnaldo
2012-02-17 22:52 ` David Malcolm
2012-02-18 10:37   ` Tobias Grosser
2012-02-18 22:54     ` Arnaldo
2012-03-05 13:51       ` Arnaldo
2012-03-05 13:58         ` Richard Guenther
2012-03-05 14:00         ` Michael Matz
2012-03-05 14:52           ` Arnaldo
2012-03-05 14:58             ` Richard Guenther
2012-03-05 15:24             ` David Edelsohn
2012-03-05 15:31               ` Arnaldo
2012-03-05 15:37                 ` Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).