reordering of passes
P. Pavan Kumar
pavankumar@cse.iitb.ac.in
Thu Jun 21 15:04:00 GMT 2007
Hi,
I have change the sequence order of basic block reorder
pass(pass_reorder_blocks) and put it before pass_postreload_cse pass in
the passes.c file. I successfully build the gcc version
4-2.0.
Original sequence
------------------
NEXT_PASS (pass_postreload_cse);
NEXT_PASS (pass_gcse2);
NEXT_PASS (pass_flow2);
NEXT_PASS (pass_rtl_seqabstr);
NEXT_PASS (pass_stack_adjustments);
NEXT_PASS (pass_peephole2);
NEXT_PASS (pass_if_after_reload);
NEXT_PASS (pass_regrename);
NEXT_PASS (pass_branch_target_load_optimize);
NEXT_PASS (pass_leaf_regs);
NEXT_PASS (pass_reorder_blocks);
After changing
-----------------
NEXT_PASS (pass_reorder_blocks);
NEXT_PASS (pass_postreload_cse);
NEXT_PASS (pass_gcse2);
NEXT_PASS (pass_flow2);
NEXT_PASS (pass_rtl_seqabstr);
NEXT_PASS (pass_stack_adjustments);
NEXT_PASS (pass_peephole2);
NEXT_PASS (pass_if_after_reload);
NEXT_PASS (pass_regrename);
NEXT_PASS (pass_branch_target_load_optimize);
NEXT_PASS (pass_leaf_regs);
and i have executed stringreverse.c program
#include<stdio.h>
main()
{
int i;
char line[1024];
while(getline(line,sizeof line)>0)
{
reverse(line);
printf("%s",line);
}
}
int getline(char a[],int len)
{
int i,c;
for(i=0;i<(len-1)&&(c=getchar())!=EOF&&c!='\n';++i)
a[i]=c;
if(c=='\n')
{
a[i]=c;
i++;
}
a[i]='\0';
return i;
}
int reverse(char a[])
{
int i,j;
char ch;
for(i=0;a[i]!='\0';i++)
{}
--i;
for(j=0;j<i;j++)
{
ch=a[j];
a[j]=a[i];
a[i]=ch;
--i;
}
return 0;
}
the output is correct when the program is executed with original gcc
but with modified sequence of gcc Segmentfault is coming. can anyone tell
me what could be the reason.
Thanks in advance
Pavan,
Home: http://www.cse.iitb.ac.in/~pavankumar
More information about the Gcc-help
mailing list