This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi, I'mm currently looking at the dataflow branch for m68k mainly because of the new auto-inc-dec pass, I worked a bit on the old code in flow.c, but considering the new pass, I think it doesn't make much sense to continue it. I'm attaching my current patch and some test cases, but before delving deeper into the code, I have a few questions and I'd like to hear some opinions. Currently I only looked at the output and it misses some opportunities (not that my patch can do everything either :) ). One case is about multiple increments, the tree optimizer merges them and increments the register only once, so if one only looks at the size of the pointer value one misses them, e.g. something like this: (set (mem (reg)) (x)) (set (mem (plus (reg) (const_int 4))) (x)) (set (reg) (plus (reg) (const_int 8)) Another case are multiple uses of the register within an instruction, the old code didn't do this at all, the new code seems to do a bit better, but there as a rather tricky case I looked into, e.g. (set (mem) (plus (mem) (reg))) could be turned into: (set (post_inc (mem)) (plus (mem) (reg))) or (set (mem) (plus (pre_dec (mem)) (reg))) This is at least what operands_match_p() accepts, but hasn't been generated in a long time and has the potential to trigger bugs in the back end (e.g. m68k only looks only at one of the operands). A question would be now if there is a general interest in reactivating this, so gcc could generate a instruction like "add.l %d0,(%a0)+" for m68k. The more general question is whether someone is already working on further improvements, so I won't duplicate anything (which wouldn't be before I looked into the remaining m68k dataflow problems anyway. :) ). The dataflow porting document mentions other possible, but doesn't mention any examples. Anything I might have to look out for regardings the m68k post_inc/pre_dec addressing modes? bye, Roman
void f1(int *p, int i)
{
*--p = i;
}
int f1b(int *p, int i)
{
return *--p;
}
void f2(int *p, int i)
{
*--p = i++;
*--p = i;
}
int *f3(int *p, int i)
{
*p++ = i;
return p;
}
int *f4(int *p, int i)
{
*p++ = 1;
*p++ = 2;
return p;
}
int *f5(int *p, int i)
{
*p++ = i++;
*p++ = i;
return p;
}
void f6(int *p, int i)
{
while (--i) {
*p++ = 1;
*p++ = 2;
}
}
void f7(int *p, int i)
{
while (--i) {
*--p = 1;
*--p = 2;
}
}
void f8(int *p, int i)
{
*p++ = 1;
*p = 2;
}
void f9(int *p, int i)
{
*p++ += 1;
*p = 2;
}
void f10(int *p, int i)
{
*p++ = 1;
*p += 2;
}
Attachment:
autoinc.diff
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |