Value Range Propagation Patch -- Part 1 of 2
John Wehle
john@feith.com
Mon Apr 3 10:54:00 GMT 2000
This patch implements a value range propagation pass.
This patch passes make bootstrap and make check on FreeBSD-3.4 x86,
IBM AIX 4.3, Solaris 2.5.1 SPARC, and Solaris 2.5.1 x86.
ChangeLog:
Sun Apr 2 01:42:03 EST 2000 John Wehle (john@feith.com)
* Makefile.in (vrp.o): New rule.
(OBJS): Add vrp.o.
* rtl.h (value_range_prop): New declaration.
* toplev.c (enum dump_file_index): Add vrp entry.
(struct dump_file): Likewise.
(vrp_time): New global variable.
(compile_file): Initialize and print vrp_time.
(rest_of_compilation): Call value_range_prop when optimizing.
Enjoy!
-- John Wehle
------------------8<------------------------8<------------------------
*** gcc/Makefile.in.ORIGINAL Sat Apr 1 18:25:30 2000
--- gcc/Makefile.in Sat Apr 1 22:06:53 2000
*************** OBJS = diagnostic.o \
*** 673,679 ****
function.o stmt.o except.o expr.o calls.o expmed.o explow.o optabs.o real.o \
builtins.o intl.o varasm.o rtl.o print-rtl.o rtlanal.o emit-rtl.o genrtl.o \
dbxout.o sdbout.o dwarfout.o dwarf2out.o xcoffout.o bitmap.o alias.o gcse.o \
! integrate.o jump.o cse.o loop.o unroll.o flow.o combine.o varray.o \
regclass.o regmove.o local-alloc.o global.o reload.o reload1.o caller-save.o \
insn-peep.o reorg.o haifa-sched.o final.o recog.o reg-stack.o \
insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o lcm.o \
--- 673,679 ----
function.o stmt.o except.o expr.o calls.o expmed.o explow.o optabs.o real.o \
builtins.o intl.o varasm.o rtl.o print-rtl.o rtlanal.o emit-rtl.o genrtl.o \
dbxout.o sdbout.o dwarfout.o dwarf2out.o xcoffout.o bitmap.o alias.o gcse.o \
! vrp.o integrate.o jump.o cse.o loop.o unroll.o flow.o combine.o varray.o \
regclass.o regmove.o local-alloc.o global.o reload.o reload1.o caller-save.o \
insn-peep.o reorg.o haifa-sched.o final.o recog.o reg-stack.o \
insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o lcm.o \
*************** simplify-rtx.o : simplify-rtx.c $(CONFIG
*** 1571,1576 ****
--- 1571,1579 ----
output.h function.h cselib.h ggc.h $(srcdir)/../include/obstack.h
cse.o : cse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h output.h function.h ggc.h
+ vrp.o : vrp.c $(CONFIG_H) system.h toplev.h $(RTL_H) $(TREE_H) $(REGS_H) \
+ flags.h real.h insn-config.h $(RECOG_H) $(BASIC_BLOCK_H) output.h \
+ function.h expr.h
gcse.o : gcse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h \
flags.h real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) \
function.h output.h toplev.h
*** gcc/rtl.h.ORIGINAL Sat Apr 1 18:26:13 2000
--- gcc/rtl.h Sat Apr 1 22:08:08 2000
*************** extern rtx expand_mult_highpart PARAMS
*** 1612,1617 ****
--- 1612,1622 ----
unsigned HOST_WIDE_INT, rtx,
int, int));
+ /* In vrp.c */
+ #ifdef BUFSIZ
+ extern int value_range_prop PARAMS ((rtx, int, FILE *));
+ #endif
+
/* In gcse.c */
#ifdef BUFSIZ
extern int gcse_main PARAMS ((rtx, FILE *));
*** gcc/toplev.c.ORIGINAL Sat Apr 1 18:26:30 2000
--- gcc/toplev.c Sat Apr 1 22:16:23 2000
*************** enum dump_file_index
*** 256,261 ****
--- 256,262 ----
DFI_addressof,
DFI_ssa,
DFI_ussa,
+ DFI_vrp,
DFI_gcse,
DFI_loop,
DFI_cse2,
*************** struct dump_file_info dump_file[DFI_MAX]
*** 288,293 ****
--- 289,295 ----
{ "addressof", 'F', 0, 0, 0 },
{ "ssa", 'e', 1, 0, 0 },
{ "ussa", 'e', 1, 0, 0 }, /* Yes, duplicate enable switch. */
+ { "vrp", 'V', 1, 0, 0 },
{ "gcse", 'G', 1, 0, 0 },
{ "loop", 'L', 1, 0, 0 },
{ "cse2", 't', 1, 0, 0 },
*************** int varconst_time;
*** 1400,1405 ****
--- 1402,1408 ----
int integration_time;
int jump_time;
int cse_time;
+ int vrp_time;
int gcse_time;
int loop_time;
int cse2_time;
*************** compile_file (name)
*** 2149,2154 ****
--- 2152,2158 ----
integration_time = 0;
jump_time = 0;
cse_time = 0;
+ vrp_time = 0;
gcse_time = 0;
loop_time = 0;
cse2_time = 0;
*************** compile_file (name)
*** 2549,2554 ****
--- 2553,2559 ----
print_time ("integration", integration_time);
print_time ("jump", jump_time);
print_time ("cse", cse_time);
+ print_time ("vrp", vrp_time);
print_time ("gcse", gcse_time);
print_time ("loop", loop_time);
print_time ("cse2", cse2_time);
*************** rest_of_compilation (decl)
*** 3033,3038 ****
--- 3038,3069 ----
/* Life analysis used in SSA adds log_links but these shouldn't
be there until the flow stage, so clear them away. */
clear_log_links (insns);
+
+ if (ggc_p)
+ ggc_collect ();
+ }
+
+ /* Perform value range propagation. */
+
+ if (optimize > 0)
+ {
+ open_dump_file (DFI_vrp, decl);
+
+ TIMEVAR (vrp_time, tem = value_range_prop (insns, 1, rtl_dump_file));
+
+ /* If value range propagation altered any jumps, rerun jump
+ optimizations to clean things up. */
+ if (tem)
+ TIMEVAR (jump_time, jump_optimize (insns, !JUMP_CROSS_JUMP,
+ !JUMP_NOOP_MOVES,
+ !JUMP_AFTER_REGSCAN));
+
+ /* Value range propagation may make some instructions trivially dead.
+ Run this after jump optmizations remove all the unreachable code
+ so that unreachable code will not keep values live. */
+ TIMEVAR (vrp_time, delete_trivially_dead_insns (insns, max_reg_num ()));
+
+ close_dump_file (DFI_vrp, print_rtl, insns);
if (ggc_p)
ggc_collect ();
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: john@feith.com |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------
More information about the Gcc-patches
mailing list