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: Insn missing in Size optimization(-Os)


On 12/02/09 05:29, daniel tian wrote:
Hi,
   Addition information, I just found. It was deleted in function: void
set_insn_deleted (rtx insn), in emit-rtl.c.
   It is called by reload() in reload1.c.
   Here is the code in reload():

/* If a pseudo has no hard reg, delete the insns that made the equivalence.
      If that insn didn't set the register (i.e., it copied the register to
      memory), just delete that insn instead of the equivalencing insn plus
      anything now dead.  If we call delete_dead_insn on that insn, we may
      delete the insn that actually sets the register if the register dies
      there and that is incorrect.  */

   for (i = FIRST_PSEUDO_REGISTER; i<  max_regno; i++)
     {
       if (reg_renumber[i]<  0&&  reg_equiv_init[i] != 0)
	{
	  rtx list;
	  for (list = reg_equiv_init[i]; list; list = XEXP (list, 1))
	    {
	      rtx equiv_insn = XEXP (list, 0);

	      /* If we already deleted the insn or if it may trap, we can't
		 delete it.  The latter case shouldn't happen, but can
		 if an insn has a variable address, gets a REG_EH_REGION
		 note added to it, and then gets converted into a load
		 from a constant address.  */
	      if (NOTE_P (equiv_insn)
		  || can_throw_internal (equiv_insn))
		;
	      else if (reg_set_p (regno_reg_rtx[i], PATTERN (equiv_insn)))
		delete_dead_insn (equiv_insn);
	      else
		SET_INSN_DELETED (equiv_insn);
	    }
	}
     }

But I don't know why the pseudo register can not be fit into a hard
register. The insn :

  (insn:HI 8 6 11 2 movebug.c:12 (set (reg/f:SI 42)
        (symbol_ref:SI ("fun") [flags 0x3]<function_decl 0xb729ba10
fun>)) 15 {symbolic_address_load} (expr_list:REG_EQUIV (symbol_ref:SI
("fun") [flags 0x3]<function_decl 0xb729ba10 fun>)
        (nil)))

is obvious a very useful insn, not a dead one.
When a pseudo which has an equivalent form (via the REG_EQUIV note) fails to get a hard register, reload deletes the insn which sets the pseudo and instead will reload the equivalent form into a suitable hard register prior to use points.

What you want to do is look at the reloads generated for insn #9. I'd hazard a guess one of them loaded the value (symbol_ref ("fun")) into R0. Then for some reason (you'll have to figure that out), the reload insn which sets R0 was deleted (or possibly doesn't get emitted because reload thought it was unncessary).

jeff


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