diff -Naur pristine-gcc-4.5.0/gcc/common.opt gcc-4.5.0/gcc/common.opt --- pristine-gcc-4.5.0/gcc/common.opt 2010-03-18 08:31:09.000000000 +0530 +++ gcc-4.5.0/gcc/common.opt 2010-07-06 02:15:03.000000000 +0530 @@ -1571,4 +1571,8 @@ Common RejectNegative Negative(shared) Create a position independent executable +fdump-new-rtl-pass +Common Report Var(flag_dump_new_rtl_pass) +Dump information to the file + ; This comment is to ensure we retain the blank line above. diff -Naur pristine-gcc-4.5.0/gcc/Makefile.in gcc-4.5.0/gcc/Makefile.in --- pristine-gcc-4.5.0/gcc/Makefile.in 2010-04-02 13:19:06.000000000 +0530 +++ gcc-4.5.0/gcc/Makefile.in 2010-07-06 02:15:03.000000000 +0530 @@ -1401,7 +1401,8 @@ version.o \ vmsdbgout.o \ web.o \ - xcoffout.o + xcoffout.o \ + new_rtl_pass.o # Target object files. OBJS-md = $(out_object_file) @@ -3344,6 +3345,8 @@ insn-config.h $(BASIC_BLOCK_H) $(RECOG_H) $(OBSTACK_H) $(BITMAP_H) \ $(EXPR_H) $(EXCEPT_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 \ diff -Naur pristine-gcc-4.5.0/gcc/new_rtl_pass.c gcc-4.5.0/gcc/new_rtl_pass.c --- pristine-gcc-4.5.0/gcc/new_rtl_pass.c 1970-01-01 05:30:00.000000000 +0530 +++ gcc-4.5.0/gcc/new_rtl_pass.c 2010-07-06 02:15:03.000000000 +0530 @@ -0,0 +1,134 @@ +#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 rtl_opt_pass pass_new_rtl = +{ + RTL_PASS, + "new_rtl_pass", /* 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 */ +}; + + +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); + 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) + { + if(flag_dump_new_rtl_pass){ + fprintf(dump_file,"\n\t Count = %d\n", count); + fprintf(dump_file,";; End of basic block %d\n",bbno-1); + } + } + if(flag_dump_new_rtl_pass){ + fprintf(dump_file,"\n;; Start of basic block %d\n",bbno); + count = 0; + } + } + } + if(is_insn){ + rtx subexp = XEXP(insn,5); + eval_rtx(subexp); + } + } + if(flag_dump_new_rtl_pass){ + fprintf(dump_file,"\n\t Count = %d\n", count); + fprintf(dump_file,";; End of basic block %d\n\n",bbno); + } + return 0; +} + +void eval_rtx(rtx exp) +{ + rtx temp; + static int cnt=0; + 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\n",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 pristine-gcc-4.5.0/gcc/passes.c gcc-4.5.0/gcc/passes.c --- pristine-gcc-4.5.0/gcc/passes.c 2010-04-03 01:24:46.000000000 +0530 +++ gcc-4.5.0/gcc/passes.c 2010-07-06 02:15:03.000000000 +0530 @@ -956,8 +956,10 @@ NEXT_PASS (pass_mudflap_2); NEXT_PASS (pass_cleanup_cfg_post_optimizing); NEXT_PASS (pass_warn_function_noreturn); - + NEXT_PASS (pass_expand); + /* Added this line */ + NEXT_PASS (pass_new_rtl); NEXT_PASS (pass_rest_of_compilation); { diff -Naur pristine-gcc-4.5.0/gcc/tree-pass.h gcc-4.5.0/gcc/tree-pass.h --- pristine-gcc-4.5.0/gcc/tree-pass.h 2010-04-03 01:24:46.000000000 +0530 +++ gcc-4.5.0/gcc/tree-pass.h 2010-07-06 02:15:03.000000000 +0530 @@ -461,6 +461,10 @@ extern struct gimple_opt_pass pass_fixup_cfg; extern struct rtl_opt_pass pass_expand; + +/* Added this line */ +extern struct rtl_opt_pass pass_new_rtl; + extern struct rtl_opt_pass pass_init_function; extern struct rtl_opt_pass pass_jump; extern struct rtl_opt_pass pass_rtl_eh; diff -Naur pristine-gcc-4.5.0/Makefile.in gcc-4.5.0/Makefile.in --- pristine-gcc-4.5.0/Makefile.in 2010-02-17 16:31:44.000000000 +0530 +++ gcc-4.5.0/Makefile.in 2010-07-06 02:16:58.000000000 +0530 @@ -14815,6 +14815,8 @@ $(TARGET-gcc)) @endif gcc +cc1: + make all-gcc TARGET-gcc=cc1$(exeext) .PHONY: all-stage1-gcc maybe-all-stage1-gcc