⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stupid.c

📁 这是完整的gcc源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
      /* Some regnos disappear from the rtl.  Ignore them to avoid crash.  */      if (regno_reg_rtx[r] == 0)	continue;      /* Now find the best hard-register class for this pseudo register */      if (N_REG_CLASSES > 1)	{	  class = reg_preferred_class (r);	  reg_renumber[r] = stupid_find_reg (reg_n_calls_crossed[r], class,					     PSEUDO_REGNO_MODE (r),					     reg_where_born[r],					     reg_where_dead[r],					     reg_crosses_blocks[r]);	}      else	reg_renumber[r] = -1;      /* If no reg available in that class,	 try any reg.  */      if (reg_renumber[r] == -1)	reg_renumber[r] = stupid_find_reg (reg_n_calls_crossed[r],					   GENERAL_REGS,					   PSEUDO_REGNO_MODE (r),					   reg_where_born[r],					   reg_where_dead[r],					   reg_crosses_blocks[r]);    }  if (file)    dump_flow_info (file);}/* Comparison function for qsort.   Returns -1 (1) if register *R1P is higher priority than *R2P.  */static intstupid_reg_compare (r1p, r2p)     int *r1p, *r2p;{  register int r1 = *r1p, r2 = *r2p;  register int len1 = reg_where_dead[r1] - reg_where_born[r1];  register int len2 = reg_where_dead[r2] - reg_where_born[r2];  int tem;  tem = len2 - len1;  if (tem != 0) return tem;  tem = reg_n_refs[r1] - reg_n_refs[r2];  if (tem != 0) return tem;  /* If regs are equally good, sort by regno,     so that the results of qsort leave nothing to chance.  */  return r1 - r2;}/* Find a block of SIZE words of hard registers in reg_class CLASS   that can hold a value of machine-mode MODE     (but actually we test only the first of the block for holding MODE)   currently free from after insn whose suid is BIRTH   through the insn whose suid is DEATH,   and return the number of the first of them.   Return -1 if such a block cannot be found.   If CALL_PRESERVED is nonzero, insist on registers preserved   over subroutine calls, and return -1 if cannot find such.   If CROSSES_BLOCKS is nonzero, reject registers for which   PRESERVE_DEATH_INFO_REGNO_P is true.  */static intstupid_find_reg (call_preserved, class, mode,		 born_insn, dead_insn, crosses_blocks)     int call_preserved;     enum reg_class class;     enum machine_mode mode;     int born_insn, dead_insn;     int crosses_blocks;{  register int i, ins;#ifdef HARD_REG_SET  register		/* Declare them register if they are scalars.  */#endif    HARD_REG_SET used, this_reg;  COPY_HARD_REG_SET (used,		     call_preserved ? call_used_reg_set : fixed_reg_set);  for (ins = born_insn; ins < dead_insn; ins++)    IOR_HARD_REG_SET (used, after_insn_hard_regs[ins]);  IOR_COMPL_HARD_REG_SET (used, reg_class_contents[(int) class]);  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)    {#ifdef REG_ALLOC_ORDER      int regno = reg_alloc_order[i];#else      int regno = i;#endif      /* If we need reasonable death info on this hard reg,	 don't use it for anything whose life spans a label or a jump.  */#ifdef PRESERVE_DEATH_INFO_REGNO_P      if (PRESERVE_DEATH_INFO_REGNO_P (regno)	  && crosses_blocks)	continue;#endif      /* If a register has screwy overlap problems,	 don't use it at all if not optimizing.	 Actually this is only for the 387 stack register,	 and it's because subsequent code won't work.  */#ifdef OVERLAPPING_REGNO_P      if (OVERLAPPING_REGNO_P (regno))	continue;#endif      if (! TEST_HARD_REG_BIT (used, regno)	  && HARD_REGNO_MODE_OK (regno, mode))	{	  register int j;	  register int size1 = HARD_REGNO_NREGS (regno, mode);	  for (j = 1; j < size1 && ! TEST_HARD_REG_BIT (used, regno + j); j++);	  if (j == size1)	    {	      CLEAR_HARD_REG_SET (this_reg);	      while (--j >= 0)		SET_HARD_REG_BIT (this_reg, regno + j);	      for (ins = born_insn; ins < dead_insn; ins++)		{		  IOR_HARD_REG_SET (after_insn_hard_regs[ins], this_reg);		}	      return regno;	    }#ifndef REG_ALLOC_ORDER	  i += j;			/* Skip starting points we know will lose */#endif	}    }  return -1;}/* Walk X, noting all assignments and references to registers   and recording what they imply about life spans.   INSN is the current insn, supplied so we can find its suid.  */static voidstupid_mark_refs (x, insn)     rtx x, insn;{  register RTX_CODE code = GET_CODE (x);  register char *fmt;  register int regno, i;  if (code == SET || code == CLOBBER)    {      if (SET_DEST (x) != 0 && GET_CODE (SET_DEST (x)) == REG)	{	  /* Register is being assigned.  */	  regno = REGNO (SET_DEST (x));	  /* For hard regs, update the where-live info.  */	  if (regno < FIRST_PSEUDO_REGISTER)	    {	      register int j		= HARD_REGNO_NREGS (regno, GET_MODE (SET_DEST (x)));	      while (--j >= 0)		{		  regs_ever_live[regno+j] = 1;		  regs_live[regno+j] = 0;		  /* The following line is for unused outputs;		     they do get stored even though never used again.  */		  MARK_LIVE_AFTER (insn, regno);		  /* When a hard reg is clobbered, mark it in use		     just before this insn, so it is live all through.  */		  if (code == CLOBBER)		    SET_HARD_REG_BIT (after_insn_hard_regs[INSN_SUID (insn)],				      regno);		}	    }	  /* For pseudo regs, record where born, where dead, number of	     times used, and whether live across a call.  */	  else	    {	      /* Update the life-interval bounds of this pseudo reg.  */	      /* When a pseudo-reg is CLOBBERed, it is born just before		 the clobbering insn.  When setting, just after.  */	      int where_born = INSN_SUID (insn) - (code == CLOBBER);	      reg_where_born[regno] = where_born;	      /* The reg must live at least one insn even		 in it is never again used--because it has to go		 in SOME hard reg.  */	      if (reg_where_dead[regno] < where_born + 1)		reg_where_dead[regno] = where_born + 1;	      /* Count the refs of this reg.  */	      reg_n_refs[regno]++;	      if (last_call_suid < reg_where_dead[regno])		reg_n_calls_crossed[regno] += 1;	      if (last_jump_suid < reg_where_dead[regno]		  || last_label_suid < reg_where_dead[regno])		reg_crosses_blocks[regno] = 1;	    }	}      /* Record references from the value being set,	 or from addresses in the place being set if that's not a reg.	 If setting a SUBREG, we treat the entire reg as *used*.  */      if (code == SET)	{	  stupid_mark_refs (SET_SRC (x), insn);	  if (GET_CODE (SET_DEST (x)) != REG)	    stupid_mark_refs (SET_DEST (x), insn);	}      return;    }  /* Register value being used, not set.  */  if (code == REG)    {      regno = REGNO (x);      if (regno < FIRST_PSEUDO_REGISTER)	{	  /* Hard reg: mark it live for continuing scan of previous insns.  */	  register int j = HARD_REGNO_NREGS (regno, GET_MODE (x));	  while (--j >= 0)	    {	      regs_ever_live[regno+j] = 1;	      regs_live[regno+j] = 1;	    }	}      else	{	  /* Pseudo reg: record first use, last use and number of uses.  */	  reg_where_born[regno] = INSN_SUID (insn);	  reg_n_refs[regno]++;	  if (regs_live[regno] == 0)	    {	      regs_live[regno] = 1;	      reg_where_dead[regno] = INSN_SUID (insn);	    }	}      return;    }  /* Recursive scan of all other rtx's.  */  fmt = GET_RTX_FORMAT (code);  for (i = GET_RTX_LENGTH (code) - 1; i >= 0; i--)    {      if (fmt[i] == 'e')	stupid_mark_refs (XEXP (x, i), insn);      if (fmt[i] == 'E')	{	  register int j;	  for (j = XVECLEN (x, i) - 1; j >= 0; j--)	    stupid_mark_refs (XVECEXP (x, i, j), insn);	}    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -