This is the mail archive of the gcc-help@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]

reordering of passes


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







Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]