diff -Naur ../original/gcc-4.3.1/gcc/common.opt gcc/common.opt --- ../original/gcc-4.3.1/gcc/common.opt 2008-01-22 19:41:44.000000000 +0530 +++ gcc/common.opt 2009-05-24 20:10:37.000000000 +0530 @@ -491,6 +491,10 @@ Common Report Var(flag_forward_propagate) Optimization Perform a forward propagation pass on RTL +fdump-new-rtl-pass +Common Report Var(flag_dump_new_rtl_pass) +Dump information to the file + ; Nonzero means don't put addresses of constant functions in registers. ; Used for compiling the Unix kernel, where strange substitutions are ; done on the assembly output. diff -Naur ../original/gcc-4.3.1/gcc/Makefile.in gcc/Makefile.in --- ../original/gcc-4.3.1/gcc/Makefile.in 2008-05-12 00:24:15.000000000 +0530 +++ gcc/Makefile.in 2009-05-24 20:11:48.000000000 +0530 @@ -1224,7 +1224,8 @@ version.o \ vmsdbgout.o \ web.o \ - xcoffout.o + xcoffout.o \ + new_rtl_pass.o # Target object files. OBJS-md = $(out_object_file) @@ -2882,6 +2883,8 @@ insn-config.h $(BASIC_BLOCK_H) $(RECOG_H) $(OBSTACK_H) bitmap.h \ $(EXPR_H) $(REGS_H) tree-pass.h $(DF_H) +new_rtl_pass.o : new_rtl_pass.c + $(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) \ $(RTL_H) $(REGS_H) hard-reg-set.h insn-config.h conditions.h \ output.h $(INSN_ATTR_H) $(SYSTEM_H) toplev.h $(TARGET_H) libfuncs.h \ @@ -3119,7 +3122,7 @@ $(srcdir)/ipa-reference.c $(srcdir)/tree-ssa-structalias.h \ $(srcdir)/tree-ssa-structalias.c $(srcdir)/tree-parloops.c \ $(srcdir)/omp-low.c $(srcdir)/varpool.c \ - $(srcdir)/targhooks.c $(out_file) $(srcdir)/passes.c $(srcdir)/cgraphunit.c \ + $(srcdir)/targhooks.c $(out_file) $(srcdir)/passes.c $(srcdir)/cgraphunit.c $(srcdir)/new_rtl_pass.c\ @all_gtfiles@ GTFILES_H = $(subst /,-, $(patsubst $(srcdir)/%,gt-%, $(patsubst %.c,%.h, \ diff -Naur ../original/gcc-4.3.1/gcc/new_rtl_pass.c gcc/new_rtl_pass.c --- ../original/gcc-4.3.1/gcc/new_rtl_pass.c 1970-01-01 05:30:00.000000000 +0530 +++ gcc/new_rtl_pass.c 2009-05-24 20:37:16.000000000 +0530 @@ -0,0 +1,126 @@ +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tree.h" +#include "rtl.h" +#include "tm_p.h" +#include "hard-reg-set.h" +#include "basic-block.h" +#include "output.h" +#include "flags.h" +#include "function.h" +#include "expr.h" +#include "ggc.h" +#include "langhooks.h" +#include "diagnostic.h" +#include "tree-flow.h" +#include "timevar.h" +#include "tree-dump.h" +#include "tree-pass.h" +#include "toplev.h" +#include "except.h" +#include "cfgloop.h" +#include "cfglayout.h" +#include "tree-ssa-propagate.h" +#include "value-prof.h" +#include "pointer-set.h" +#include "tree-inline.h" +#include "vec.h" +#include "errors.h" +#include "hashtab.h" +#include "cgraph.h" +#include "regs.h" + + +int new_rtl_pass_main(void); +extern FILE * dump_file; + +struct tree_opt_pass pass_new_rtl = +{ + "cs715", /* name */ + NULL, /* gate */ + new_rtl_pass_main, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + 0, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0, /* todo_flags_finish */ + 0 /* letter */ +}; + + +int count=0; + +int new_rtl_pass_main(void) +{ + basic_block bb; + rtx last; + rtx insn; + int code, type; + int bbno; + rtx opd1,opd2; + count = 0; + for (insn = get_insns(), last = get_last_insn(), last = NEXT_INSN(last); insn != last; insn = NEXT_INSN (insn)) + { + int is_insn; + is_insn = INSN_P (insn); + if(flag_dump_new_rtl_pass) + print_rtl_single(dump_file,insn); + code = GET_CODE(insn); + if(code==NOTE) + { + type = (int)XINT(insn,5); + if(type==NOTE_INSN_BASIC_BLOCK) + { + bb = (basic_block)XEXP(insn,3); + bbno = bb->index; + if(bbno>2) + { + printf("\n\t Count = %d\n", count); + printf(";; End of basic block %d\n",bbno-1); + } + printf("\n;; Start of basic block %d",bbno); + count = 0; + } + } + if(is_insn){ + rtx subexp = XEXP(insn,5); + //printf("\nName : %s\tLength = %d\tFormat = %s",GET_RTX_NAME(code),GET_RTX_LENGTH(code),GET_RTX_FORMAT(code)); + eval_rtx(subexp); + } + } + printf("\n\t Count = %d\n", count); + printf(";; End of basic block %d\n\n",bbno); + return 0; +} + +void eval_rtx(rtx exp) +{ + rtx temp; + int veclen,i; + int rt_code = GET_CODE(exp); + switch(rt_code) + { + case SET: + if(flag_dump_new_rtl_pass){ + fprintf(dump_file,"\nSet statement %d : \t",count+1); + print_rtl_single(dump_file,exp);} + count++; + break; + case PARALLEL: + veclen = XVECLEN(exp, 0); + for(i = 0; i < veclen; i++) + { + temp = XVECEXP(exp, 0, i); + eval_rtx(temp); + } + break; + default: + break; + } +} diff -Naur ../original/gcc-4.3.1/gcc/passes.c gcc/passes.c --- ../original/gcc-4.3.1/gcc/passes.c 2008-01-22 18:57:52.000000000 +0530 +++ gcc/passes.c 2009-05-24 20:09:46.000000000 +0530 @@ -682,6 +682,7 @@ NEXT_PASS (pass_mudflap_2); NEXT_PASS (pass_free_cfg_annotations); NEXT_PASS (pass_expand); + NEXT_PASS (pass_new_rtl); NEXT_PASS (pass_rest_of_compilation); { struct tree_opt_pass **p = &pass_rest_of_compilation.sub; diff -Naur ../original/gcc-4.3.1/gcc/tree-pass.h gcc/tree-pass.h --- ../original/gcc-4.3.1/gcc/tree-pass.h 2008-02-13 16:45:51.000000000 +0530 +++ gcc/tree-pass.h 2009-05-24 20:09:18.000000000 +0530 @@ -247,6 +247,9 @@ extern struct tree_opt_pass pass_refactor_eh; extern struct tree_opt_pass pass_lower_eh; extern struct tree_opt_pass pass_build_cfg; + +extern struct tree_opt_pass pass_new_rtl; + extern struct tree_opt_pass pass_tree_profile; extern struct tree_opt_pass pass_early_tree_profile; extern struct tree_opt_pass pass_cleanup_cfg;