This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: i386-linux cross sh-elf breakage
On Wed, May 17, 2000 at 01:47:16PM -0500, Clinton Popetz wrote:
> Is it ok to also set no_new_pseudos there, and to have recompute_reg_usage
> check this to determine how much work to do (or is there a flag to indicate
> "life info is up to date"?) The reason I ask is that scheduling hasn't run
> yet...
Hmm. Somehow I'd got it into my head that mode switching happened
after scheduling. (I'm not altogether sure that doing it before
scheduling is a good idea, once we start handling c99 fp rounding
mode issues on regular risc machines. OTOH, as-is scheduling is
just as likely to make the mode switching problem worse as better.)
I think a combination of these suggestions would be best. Something
like the following comes to mind.
r~
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/toplev.c,v
retrieving revision 1.338
diff -c -p -d -r1.338 toplev.c
*** toplev.c 2000/05/17 08:15:26 1.338
--- toplev.c 2000/05/17 20:36:51
*************** rest_of_compilation (decl)
*** 3234,3245 ****
ggc_collect ();
}
! if (optimize && n_basic_blocks)
{
timevar_push (TV_GCSE);
! optimize_mode_switching (NULL_PTR);
timevar_pop (TV_GCSE);
}
#ifdef INSN_SCHEDULING
--- 3234,3255 ----
ggc_collect ();
}
! #ifdef OPTIMIZE_MODE_SWITCHING
! if (optimize)
{
timevar_push (TV_GCSE);
!
! if (optimize_mode_switching (NULL_PTR))
! {
! /* We did work, and so had to regenerate global life information.
! Take advantage of this and don't re-recompute register life
! information below. */
! no_new_pseudos = 1;
! }
!
timevar_pop (TV_GCSE);
}
+ #endif
#ifdef INSN_SCHEDULING
*************** rest_of_compilation (decl)
*** 3280,3288 ****
RUN_JUMP_AFTER_RELOAD records whether or not we need to rerun the
jump optimizer after register allocation and reloading are finished. */
! /* We recomputed reg usage as part of updating the rest
! of life info during sched. */
! if (! flag_schedule_insns)
{
recompute_reg_usage (insns, ! optimize_size);
--- 3290,3296 ----
RUN_JUMP_AFTER_RELOAD records whether or not we need to rerun the
jump optimizer after register allocation and reloading are finished. */
! if (! no_new_pseudos)
{
recompute_reg_usage (insns, ! optimize_size);
Index: lcm.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/lcm.c,v
retrieving revision 1.14
diff -c -p -d -r1.14 lcm.c
*** lcm.c 2000/02/28 12:21:24 1.14
--- lcm.c 2000/05/17 20:36:51
*************** reg_becomes_live (reg, setter, live)
*** 958,973 ****
nregs--)
SET_HARD_REG_BIT (* (HARD_REG_SET *) live, regno + nregs);
}
- #endif
! /* Find all insns that need a particular mode
! setting, and insert the necessary mode switches. */
! void
optimize_mode_switching (file)
! FILE *file ATTRIBUTE_UNUSED;
{
- #ifdef OPTIMIZE_MODE_SWITCHING
rtx insn;
int bb, e;
edge eg;
--- 958,971 ----
nregs--)
SET_HARD_REG_BIT (* (HARD_REG_SET *) live, regno + nregs);
}
! /* Find all insns that need a particular mode setting, and insert the
! necessary mode switches. Return true if we did work. */
! int
optimize_mode_switching (file)
! FILE *file;
{
rtx insn;
int bb, e;
edge eg;
*************** optimize_mode_switching (file)
*** 994,1000 ****
}
if (! n_entities)
! return;
#ifdef MODE_USES_IN_EXIT_BLOCK
/* For some ABIs a particular mode setting is required at function exit. */
--- 992,998 ----
}
if (! n_entities)
! return 0;
#ifdef MODE_USES_IN_EXIT_BLOCK
/* For some ABIs a particular mode setting is required at function exit. */
*************** optimize_mode_switching (file)
*** 1017,1023 ****
else if (NEXT_INSN (use) == BLOCK_HEAD (bb))
BLOCK_HEAD (bb) = NEXT_INSN (insn);
}
! #endif
/* Create the bitmap vectors. */
--- 1015,1021 ----
else if (NEXT_INSN (use) == BLOCK_HEAD (bb))
BLOCK_HEAD (bb) = NEXT_INSN (insn);
}
! #endif /* MODE_USES_IN_EXIT_BLOCK */
/* Create the bitmap vectors. */
*************** optimize_mode_switching (file)
*** 1034,1040 ****
struct bb_info *info = bb_info[j];
/* Determine what the first use (if any) need for a mode of entity E is.
! This will be th mode that is anticipatable for this block.
Also compute the initial transparency settings. */
for (bb = 0 ; bb < n_basic_blocks; bb++)
{
--- 1032,1038 ----
struct bb_info *info = bb_info[j];
/* Determine what the first use (if any) need for a mode of entity E is.
! This will be the mode that is anticipatable for this block.
Also compute the initial transparency settings. */
for (bb = 0 ; bb < n_basic_blocks; bb++)
{
*************** optimize_mode_switching (file)
*** 1253,1257 ****
if (need_commit)
commit_edge_insertions ();
! #endif /* OPTIMIZE_MODE_SWITCHING */
}
--- 1251,1268 ----
if (need_commit)
commit_edge_insertions ();
!
! /* Ideally we'd figure out what blocks were affected and start from
! there, but this is enormously complicated by commit_edge_insertions,
! which would screw up any indicies we'd collected, and also need to
! be involved in the update. Bail and recompute global life info for
! everything. */
!
! allocate_reg_life_data ();
! update_life_info (NULL, UPDATE_LIFE_GLOBAL_RM_NOTES,
! (PROP_DEATH_NOTES | PROP_KILL_DEAD_CODE
! | PROP_SCAN_DEAD_CODE | PROP_REG_INFO));
!
! return 1;
}
+ #endif /* OPTIMIZE_MODE_SWITCHING */
Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/basic-block.h,v
retrieving revision 1.65
diff -c -p -d -r1.65 basic-block.h
*** basic-block.h 2000/04/27 05:03:35 1.65
--- basic-block.h 2000/05/17 20:36:51
*************** extern struct edge_list *pre_edge_rev_lc
*** 450,456 ****
sbitmap **));
extern void compute_available PARAMS ((sbitmap *, sbitmap *,
sbitmap *, sbitmap *));
! extern void optimize_mode_switching PARAMS ((FILE *));
/* In emit-rtl.c. */
extern rtx emit_block_insn_after PARAMS ((rtx, rtx, basic_block));
--- 450,456 ----
sbitmap **));
extern void compute_available PARAMS ((sbitmap *, sbitmap *,
sbitmap *, sbitmap *));
! extern int optimize_mode_switching PARAMS ((FILE *));
/* In emit-rtl.c. */
extern rtx emit_block_insn_after PARAMS ((rtx, rtx, basic_block));