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

📄 h8300.c

📁 Mac OS X 10.4.9 for x86 Source Code gcc 实现源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
	  }	if (-4 <= n || n <= 4)	  {	    switch ((int) n)	      {	      case 0:		*total = 0;		return true;	      case 1:	      case 2:	      case -1:	      case -2:		*total = 0 + (outer_code == SET);		return true;	      case 4:	      case -4:		if (TARGET_H8300H || TARGET_H8300S)		  *total = 0 + (outer_code == SET);		else		  *total = 1;		return true;	      }	  }	*total = 1;	return true;      }    case CONST:    case LABEL_REF:    case SYMBOL_REF:      if (TARGET_H8300SX)	{	  /* See comment for CONST_INT.  */	  *total = 0;	  return true;	}      *total = 3;      return true;    case CONST_DOUBLE:      *total = 20;      return true;    case AND:      if (!h8300_dst_operand (XEXP (x, 0), VOIDmode)	  || !h8300_src_operand (XEXP (x, 1), VOIDmode))	return false;      *total = COSTS_N_INSNS (h8300_and_costs (x));      return true;    /* We say that MOD and DIV are so expensive because otherwise we'll       generate some really horrible code for division of a power of two.  */    case MOD:    case DIV:    case UMOD:    case UDIV:      if (TARGET_H8300SX)	switch (GET_MODE (x))	  {	  case QImode:	  case HImode:	    *total = COSTS_N_INSNS (optimize_size ? 4 : 10);	    return false;	  case SImode:	    *total = COSTS_N_INSNS (optimize_size ? 4 : 18);	    return false;	  default:	    break;	  }      *total = COSTS_N_INSNS (12);      return true;    case MULT:      if (TARGET_H8300SX)	switch (GET_MODE (x))	  {	  case QImode:	  case HImode:	    *total = COSTS_N_INSNS (2);	    return false;	  case SImode:	    *total = COSTS_N_INSNS (5);	    return false;	  default:	    break;	  }      *total = COSTS_N_INSNS (4);      return true;    case ASHIFT:    case ASHIFTRT:    case LSHIFTRT:      if (h8sx_binary_shift_operator (x, VOIDmode))	{	  *total = COSTS_N_INSNS (2);	  return false;	}      else if (h8sx_unary_shift_operator (x, VOIDmode))	{	  *total = COSTS_N_INSNS (1);	  return false;	}      *total = COSTS_N_INSNS (h8300_shift_costs (x));      return true;    case ROTATE:    case ROTATERT:      if (GET_MODE (x) == HImode)	*total = 2;      else	*total = 8;      return true;    default:      *total = COSTS_N_INSNS (1);      return false;    }}/* Documentation for the machine specific operand escapes:   'E' like s but negative.   'F' like t but negative.   'G' constant just the negative   'R' print operand as a byte:8 address if appropriate, else fall back to       'X' handling.   'S' print operand as a long word   'T' print operand as a word   'V' find the set bit, and print its number.   'W' find the clear bit, and print its number.   'X' print operand as a byte   'Y' print either l or h depending on whether last 'Z' operand < 8 or >= 8.       If this operand isn't a register, fall back to 'R' handling.   'Z' print int & 7.   'c' print the opcode corresponding to rtl   'e' first word of 32 bit value - if reg, then least reg. if mem       then least. if const then most sig word   'f' second word of 32 bit value - if reg, then biggest reg. if mem       then +2. if const then least sig word   'j' print operand as condition code.   'k' print operand as reverse condition code.   'm' convert an integer operand to a size suffix (.b, .w or .l)   'o' print an integer without a leading '#'   's' print as low byte of 16 bit value   't' print as high byte of 16 bit value   'w' print as low byte of 32 bit value   'x' print as 2nd byte of 32 bit value   'y' print as 3rd byte of 32 bit value   'z' print as msb of 32 bit value*//* Return assembly language string which identifies a comparison type.  */static const char *cond_string (enum rtx_code code){  switch (code)    {    case NE:      return "ne";    case EQ:      return "eq";    case GE:      return "ge";    case GT:      return "gt";    case LE:      return "le";    case LT:      return "lt";    case GEU:      return "hs";    case GTU:      return "hi";    case LEU:      return "ls";    case LTU:      return "lo";    default:      abort ();    }}/* Print operand X using operand code CODE to assembly language output file   FILE.  */voidprint_operand (FILE *file, rtx x, int code){  /* This is used for communication between codes V,W,Z and Y.  */  static int bitint;  switch (code)    {    case 'E':      switch (GET_CODE (x))	{	case REG:	  fprintf (file, "%sl", names_big[REGNO (x)]);	  break;	case CONST_INT:	  fprintf (file, "#%ld", (-INTVAL (x)) & 0xff);	  break;	default:	  abort ();	}      break;    case 'F':      switch (GET_CODE (x))	{	case REG:	  fprintf (file, "%sh", names_big[REGNO (x)]);	  break;	case CONST_INT:	  fprintf (file, "#%ld", ((-INTVAL (x)) & 0xff00) >> 8);	  break;	default:	  abort ();	}      break;    case 'G':      if (GET_CODE (x) != CONST_INT)	abort ();      fprintf (file, "#%ld", 0xff & (-INTVAL (x)));      break;    case 'S':      if (GET_CODE (x) == REG)	fprintf (file, "%s", names_extended[REGNO (x)]);      else	goto def;      break;    case 'T':      if (GET_CODE (x) == REG)	fprintf (file, "%s", names_big[REGNO (x)]);      else	goto def;      break;    case 'V':      bitint = exact_log2 (INTVAL (x) & 0xff);      if (bitint == -1)	abort ();      fprintf (file, "#%d", bitint);      break;    case 'W':      bitint = exact_log2 ((~INTVAL (x)) & 0xff);      if (bitint == -1)	abort ();      fprintf (file, "#%d", bitint);      break;    case 'R':    case 'X':      if (GET_CODE (x) == REG)	fprintf (file, "%s", byte_reg (x, 0));      else	goto def;      break;    case 'Y':      if (bitint == -1)	abort ();      if (GET_CODE (x) == REG)	fprintf (file, "%s%c", names_big[REGNO (x)], bitint > 7 ? 'h' : 'l');      else	print_operand (file, x, 'R');      bitint = -1;      break;    case 'Z':      bitint = INTVAL (x);      fprintf (file, "#%d", bitint & 7);      break;    case 'c':      switch (GET_CODE (x))	{	case IOR:	  fprintf (file, "or");	  break;	case XOR:	  fprintf (file, "xor");	  break;	case AND:	  fprintf (file, "and");	  break;	default:	  break;	}      break;    case 'e':      switch (GET_CODE (x))	{	case REG:	  if (TARGET_H8300)	    fprintf (file, "%s", names_big[REGNO (x)]);	  else	    fprintf (file, "%s", names_upper_extended[REGNO (x)]);	  break;	case MEM:	  print_operand (file, x, 0);	  break;	case CONST_INT:	  fprintf (file, "#%ld", ((INTVAL (x) >> 16) & 0xffff));	  break;	case CONST_DOUBLE:	  {	    long val;	    REAL_VALUE_TYPE rv;	    REAL_VALUE_FROM_CONST_DOUBLE (rv, x);	    REAL_VALUE_TO_TARGET_SINGLE (rv, val);	    fprintf (file, "#%ld", ((val >> 16) & 0xffff));	    break;	  }	default:	  abort ();	  break;	}      break;    case 'f':      switch (GET_CODE (x))	{	case REG:	  if (TARGET_H8300)	    fprintf (file, "%s", names_big[REGNO (x) + 1]);	  else	    fprintf (file, "%s", names_big[REGNO (x)]);	  break;	case MEM:	  x = adjust_address (x, HImode, 2);	  print_operand (file, x, 0);	  break;	case CONST_INT:	  fprintf (file, "#%ld", INTVAL (x) & 0xffff);	  break;	case CONST_DOUBLE:	  {	    long val;	    REAL_VALUE_TYPE rv;	    REAL_VALUE_FROM_CONST_DOUBLE (rv, x);	    REAL_VALUE_TO_TARGET_SINGLE (rv, val);	    fprintf (file, "#%ld", (val & 0xffff));	    break;	  }	default:	  abort ();	}      break;    case 'j':      fputs (cond_string (GET_CODE (x)), file);      break;    case 'k':      fputs (cond_string (reverse_condition (GET_CODE (x))), file);      break;    case 'm':      if (GET_CODE (x) != CONST_INT)	abort ();      if (INTVAL (x) == 1)	fputs (".b", file);      else if (INTVAL (x) == 2)	fputs (".w", file);      else if (INTVAL (x) == 4)	fputs (".l", file);      else	abort ();      break;    case 'o':      print_operand_address (file, x);      break;    case 's':      if (GET_CODE (x) == CONST_INT)	fprintf (file, "#%ld", (INTVAL (x)) & 0xff);      else	fprintf (file, "%s", byte_reg (x, 0));      break;    case 't':      if (GET_CODE (x) == CONST_INT)	fprintf (file, "#%ld", (INTVAL (x) >> 8) & 0xff);      else	fprintf (file, "%s", byte_reg (x, 1));      break;    case 'w':      if (GET_CODE (x) == CONST_INT)	fprintf (file, "#%ld", INTVAL (x) & 0xff);      else	fprintf (file, "%s",		 byte_reg (x, TARGET_H8300 ? 2 : 0));      break;    case 'x':      if (GET_CODE (x) == CONST_INT)	fprintf (file, "#%ld", (INTVAL (x) >> 8) & 0xff);      else	fprintf (file, "%s",		 byte_reg (x, TARGET_H8300 ? 3 : 1));      break;    case 'y':      if (GET_CODE (x) == CONST_INT)	fprintf (file, "#%ld", (INTVAL (x) >> 16) & 0xff);      else	fprintf (file, "%s", byte_reg (x, 0));      break;    case 'z':      if (GET_CODE (x) == CONST_INT)	fprintf (file, "#%ld", (INTVAL (x) >> 24) & 0xff);      else	fprintf (file, "%s", byte_reg (x, 1));      break;    default:    def:      switch (GET_CODE (x))	{	case REG:	  switch (GET_MODE (x))	    {	    case QImode:#if 0 /* Is it asm ("mov.b %0,r2l", ...) */	      fprintf (file, "%s", byte_reg (x, 0));#else /* ... or is it asm ("mov.b %0l,r2l", ...) */	      fprintf (file, "%s", names_big[REGNO (x)]);#endif	      break;	    case HImode:	      fprintf (file, "%s", names_big[REGNO (x)]);	      break;	    case SImode:	    case SFmode:	      fprintf (file, "%s", names_extended[REGNO (x)]);	      break;	    default:	      abort ();	    }	  break;	case MEM:	  {	    rtx addr = XEXP (x, 0);	    fprintf (file, "@");	    output_address (addr);	    /* Add a length suffix to constant addresses.  Although this	       is often unnecessary, it helps to avoid ambiguity in the	       syntax of mova.  If we wrote an insn like:		    mova/w.l @(1,@foo.b),er0	       then .b would be considered part of the symbol name.	       Adding a length after foo will avoid this.  */	    if (CONSTANT_P (addr))	      switch (code)		{		case 'R':		  /* Used for mov.b and bit operations.  */		  if (h8300_eightbit_constant_address_p (addr))		    {		      fprintf (file, ":8");		      break;		    }		  /* Fall through.  We should not get here if we are		     processing bit operations on H8/300 or H8/300H		     because 'U' constraint does not allow bit		     operations on the tiny area on these machines.  */		case 'X':		case 'T':		case 'S':		  if (h8300_constant_length (addr) == 2)		    fprintf (file, ":16");		  else		    fprintf (file, ":32");		  break;		default:		  break;		}	  }	  break;	case CONST_INT:	case SYMBOL_REF:	case CONST:	case LABEL_REF:	  fprintf (file, "#");	  print_operand_address (file, x);	  break;	case CONST_DOUBLE:	  {	    long val;	    REAL_VALUE_TYPE rv;	    REAL_VALUE_FROM_CONST_DOUBLE (rv, x);	    REAL_VALUE_TO_TARGET_SINGLE (rv, val);	    fprintf (file, "#%ld", val);	    break;

⌨️ 快捷键说明

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