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

Re: Question about gcse.c vs cc0


On 05/29/2012 03:03 AM, Steven Bosscher wrote:
Hello,

In gcse.c:insert_insn_end_basic_block() I found the following code:

#ifdef HAVE_cc0
       /* FIXME: 'twould be nice to call prev_cc0_setter here but it aborts
          if cc0 isn't set.  */
       note = find_reg_note (insn, REG_CC_SETTER, NULL_RTX);
       if (note)
         insn = XEXP (note, 0);
       else
         {
           rtx maybe_cc0_setter = prev_nonnote_insn (insn);
           if (maybe_cc0_setter
               &&  INSN_P (maybe_cc0_setter)
               &&  sets_cc0_p (PATTERN (maybe_cc0_setter)))
             insn = maybe_cc0_setter;
         }
#endif

How can this work? As far as grep understands, only link_cc0_insns
creates REG_CC_SETTER notes, but that function is only called from
reorg.c (and even then, only if it makes a transformation). So NOTE
will always be NULL.

Are REG_CC_SETTER/REG_CC_USER notes supposed to exist before dbr_sched?
Well, we're talking about code that is 14 years old... I really don't remember.


P.S. The code goes on to use prev_nonnote_insn, which may cross basic block boundaries, so prev_nonnote_insn_bb should be used instead.
On a cc0 target, this is not true.

jeff


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