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

📄 m68k.c

📁 早期freebsd实现
💻 C
📖 第 1 页 / 共 4 页
字号:
     sets it up, and that is an undefined circumstance.  */  if (optype0 == PUSHOP || optype1 == PUSHOP      || (optype0 == REGOP && optype1 == REGOP	  && REGNO (operands[0]) == REGNO (latehalf[1])))    {      /* Make any unoffsettable addresses point at high-numbered word.  */      if (addreg0)	output_asm_insn ("addql %#4,%0", &addreg0);      if (addreg1)	output_asm_insn ("addql %#4,%0", &addreg1);      /* Do that word.  */      output_asm_insn (singlemove_string (latehalf), latehalf);      /* Undo the adds we just did.  */      if (addreg0)	output_asm_insn ("subql %#4,%0", &addreg0);      if (addreg1)	output_asm_insn ("subql %#4,%0", &addreg1);      /* Do low-numbered word.  */      return singlemove_string (operands);    }  /* Normal case: do the two words, low-numbered first.  */  output_asm_insn (singlemove_string (operands), operands);  /* Make any unoffsettable addresses point at high-numbered word.  */  if (addreg0)    output_asm_insn ("addql %#4,%0", &addreg0);  if (addreg1)    output_asm_insn ("addql %#4,%0", &addreg1);  /* Do that word.  */  output_asm_insn (singlemove_string (latehalf), latehalf);  /* Undo the adds we just did.  */  if (addreg0)    output_asm_insn ("subql %#4,%0", &addreg0);  if (addreg1)    output_asm_insn ("subql %#4,%0", &addreg1);  return "";}/* Return a REG that occurs in ADDR with coefficient 1.   ADDR can be effectively incremented by incrementing REG.  */static rtxfind_addr_reg (addr)     rtx addr;{  while (GET_CODE (addr) == PLUS)    {      if (GET_CODE (XEXP (addr, 0)) == REG)	addr = XEXP (addr, 0);      else if (GET_CODE (XEXP (addr, 1)) == REG)	addr = XEXP (addr, 1);      else if (CONSTANT_P (XEXP (addr, 0)))	addr = XEXP (addr, 1);      else if (CONSTANT_P (XEXP (addr, 1)))	addr = XEXP (addr, 0);      else	abort ();    }  if (GET_CODE (addr) == REG)    return addr;  abort ();}/* Store in cc_status the expressions that the condition codes will   describe after execution of an instruction whose pattern is EXP.   Do not alter them if the instruction would not alter the cc's.  *//* On the 68000, all the insns to store in an address register fail to   set the cc's.  However, in some cases these instructions can make it   possibly invalid to use the saved cc's.  In those cases we clear out   some or all of the saved cc's so they won't be used.  */notice_update_cc (exp, insn)     rtx exp;     rtx insn;{  /* If the cc is being set from the fpa and the expression is not an     explicit floating point test instruction (which has code to deal with     this), reinit the CC.  */  if (((cc_status.value1 && FPA_REG_P (cc_status.value1))       || (cc_status.value2 && FPA_REG_P (cc_status.value2)))      && !(GET_CODE (exp) == PARALLEL	   && GET_CODE (XVECEXP (exp, 0, 0)) == SET	   && XEXP (XVECEXP (exp, 0, 0), 0) == cc0_rtx))    {      CC_STATUS_INIT;     }  else if (GET_CODE (exp) == SET)    {      if (GET_CODE (SET_SRC (exp)) == CALL)	{	  CC_STATUS_INIT; 	}      else if (ADDRESS_REG_P (SET_DEST (exp)))	{	  if (cc_status.value1	      && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value1))	    cc_status.value1 = 0;	  if (cc_status.value2	      && reg_overlap_mentioned_p (SET_DEST (exp), cc_status.value2))	    cc_status.value2 = 0; 	}      else if (!FP_REG_P (SET_DEST (exp))	       && SET_DEST (exp) != cc0_rtx	       && (FP_REG_P (SET_SRC (exp))		   || GET_CODE (SET_SRC (exp)) == FIX		   || GET_CODE (SET_SRC (exp)) == FLOAT_TRUNCATE		   || GET_CODE (SET_SRC (exp)) == FLOAT_EXTEND))	{	  CC_STATUS_INIT; 	}      /* A pair of move insns doesn't produce a useful overall cc.  */      else if (!FP_REG_P (SET_DEST (exp))	       && !FP_REG_P (SET_SRC (exp))	       && GET_MODE_SIZE (GET_MODE (SET_SRC (exp))) > 4	       && (GET_CODE (SET_SRC (exp)) == REG		   || GET_CODE (SET_SRC (exp)) == MEM		   || GET_CODE (SET_SRC (exp)) == CONST_DOUBLE))	{	  CC_STATUS_INIT; 	}      else if (GET_CODE (SET_SRC (exp)) == CALL)	{	  CC_STATUS_INIT; 	}      else if (XEXP (exp, 0) != pc_rtx)	{	  cc_status.flags = 0;	  cc_status.value1 = XEXP (exp, 0);	  cc_status.value2 = XEXP (exp, 1);	}    }  else if (GET_CODE (exp) == PARALLEL	   && GET_CODE (XVECEXP (exp, 0, 0)) == SET)    {      if (ADDRESS_REG_P (XEXP (XVECEXP (exp, 0, 0), 0)))	CC_STATUS_INIT;      else if (XEXP (XVECEXP (exp, 0, 0), 0) != pc_rtx)	{	  cc_status.flags = 0;	  cc_status.value1 = XEXP (XVECEXP (exp, 0, 0), 0);	  cc_status.value2 = XEXP (XVECEXP (exp, 0, 0), 1);	}    }  else    CC_STATUS_INIT;  if (cc_status.value2 != 0      && ADDRESS_REG_P (cc_status.value2)      && GET_MODE (cc_status.value2) == QImode)    CC_STATUS_INIT;  if (cc_status.value2 != 0      && !(cc_status.value1 && FPA_REG_P (cc_status.value1)))    switch (GET_CODE (cc_status.value2))      {      case PLUS: case MINUS: case MULT:      case DIV: case UDIV: case MOD: case UMOD: case NEG:      case ASHIFT: case LSHIFT: case ASHIFTRT: case LSHIFTRT:      case ROTATE: case ROTATERT:	if (GET_MODE (cc_status.value2) != VOIDmode)	  cc_status.flags |= CC_NO_OVERFLOW;	break;      case ZERO_EXTEND:	/* (SET r1 (ZERO_EXTEND r2)) on this machine	   ends with a move insn moving r2 in r2's mode.	   Thus, the cc's are set for r2.	   This can set N bit spuriously. */	cc_status.flags |= CC_NOT_NEGATIVE;       }  if (cc_status.value1 && GET_CODE (cc_status.value1) == REG      && cc_status.value2      && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2))    cc_status.value2 = 0;  if (((cc_status.value1 && FP_REG_P (cc_status.value1))       || (cc_status.value2 && FP_REG_P (cc_status.value2)))      && !((cc_status.value1 && FPA_REG_P (cc_status.value1))	   || (cc_status.value2 && FPA_REG_P (cc_status.value2))))    cc_status.flags = CC_IN_68881;}char *output_move_const_double (operands)     rtx *operands;{#ifdef SUPPORT_SUN_FPA  if (TARGET_FPA && FPA_REG_P (operands[0]))    {      int code = standard_sun_fpa_constant_p (operands[1]);      if (code != 0)	{	  static char buf[40];	  sprintf (buf, "fpmove%%.d %%%%%d,%%0", code & 0x1ff);	  return buf;	}      return "fpmove%.d %1,%0";    }  else#endif    {      int code = standard_68881_constant_p (operands[1]);      if (code != 0)	{	  static char buf[40];	  sprintf (buf, "fmovecr %%#0x%x,%%0", code & 0xff);	  return buf;	}      return "fmove%.d %1,%0";    }}char *output_move_const_single (operands)     rtx *operands;{#ifdef SUPPORT_SUN_FPA  if (TARGET_FPA)    {      int code = standard_sun_fpa_constant_p (operands[1]);      if (code != 0)	{	  static char buf[40];	  sprintf (buf, "fpmove%%.s %%%%%d,%%0", code & 0x1ff);	  return buf;	}      return "fpmove%.s %1,%0";    }  else#endif /* defined SUPPORT_SUN_FPA */    {      int code = standard_68881_constant_p (operands[1]);      if (code != 0)	{	  static char buf[40];	  sprintf (buf, "fmovecr %%#0x%x,%%0", code & 0xff);	  return buf;	}      return "fmove%.s %f1,%0";    }}/* Return nonzero if X, a CONST_DOUBLE, has a value that we can get   from the "fmovecr" instruction.   The value, anded with 0xff, gives the code to use in fmovecr   to get the desired constant.  *//* ??? This code should be fixed for cross-compilation. */intstandard_68881_constant_p (x)     rtx x;{  register double d;  /* fmovecr must be emulated on the 68040, so it shouldn't be used at all. */  if (TARGET_68040)    return 0;#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT  if (! flag_pretend_float)    return 0;#endif  REAL_VALUE_FROM_CONST_DOUBLE (d, x);  if (d == 0)    return 0x0f;  /* Note: there are various other constants available     but it is a nuisance to put in their values here.  */  if (d == 1)    return 0x32;  if (d == 10)    return 0x33;  if (d == 100)    return 0x34;  if (d == 10000)    return 0x35;  if (d == 1e8)    return 0x36;  if (GET_MODE (x) == SFmode)    return 0;  if (d == 1e16)    return 0x37;  /* larger powers of ten in the constants ram are not used     because they are not equal to a `double' C constant.  */  return 0;}/* If X is a floating-point constant, return the logarithm of X base 2,   or 0 if X is not a power of 2.  */intfloating_exact_log2 (x)     rtx x;{  register double d, d1;  int i;#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT  if (! flag_pretend_float)    return 0;#endif  REAL_VALUE_FROM_CONST_DOUBLE (d, x);  if (! (d > 0))    return 0;  for (d1 = 1.0, i = 0; d1 < d; d1 *= 2.0, i++)    ;  if (d == d1)    return i;  return 0;}#ifdef SUPPORT_SUN_FPA/* Return nonzero if X, a CONST_DOUBLE, has a value that we can get   from the Sun FPA's constant RAM.   The value returned, anded with 0x1ff, gives the code to use in fpmove   to get the desired constant. */#define S_E (2.718281745910644531)#define D_E (2.718281828459045091)#define S_PI (3.141592741012573242)#define D_PI (3.141592653589793116)#define S_SQRT2 (1.414213538169860840)#define D_SQRT2 (1.414213562373095145)#define S_LOG2ofE (1.442695021629333496)#define D_LOG2ofE (1.442695040888963387)#define S_LOG2of10 (3.321928024291992188)#define D_LOG2of10 (3.321928024887362182)#define S_LOGEof2 (0.6931471824645996094)#define D_LOGEof2 (0.6931471805599452862)#define S_LOGEof10 (2.302585124969482442)#define D_LOGEof10 (2.302585092994045901)#define S_LOG10of2 (0.3010300099849700928)#define D_LOG10of2 (0.3010299956639811980)#define S_LOG10ofE (0.4342944920063018799)#define D_LOG10ofE (0.4342944819032518167)/* This code should be fixed for cross-compilation. */intstandard_sun_fpa_constant_p (x)     rtx x;{  register double d;#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT  if (! flag_pretend_float)    return 0;#endif  REAL_VALUE_FROM_CONST_DOUBLE (d, x);  if (d == 0.0)    return 0x200;		/* 0 once 0x1ff is anded with it */  if (d == 1.0)    return 0xe;  if (d == 0.5)    return 0xf;  if (d == -1.0)    return 0x10;  if (d == 2.0)    return 0x11;  if (d == 3.0)    return 0xB1;  if (d == 4.0)    return 0x12;  if (d == 8.0)    return 0x13;  if (d == 0.25)    return 0x15;  if (d == 0.125)    return 0x16;  if (d == 10.0)    return 0x17;  if (d == -(1.0/2.0))    return 0x2E;/* * Stuff that looks different if it's single or double */  if (GET_MODE (x) == SFmode)    {      if (d == S_E)	return 0x8;      if (d == (2*S_PI))	return 0x9;      if (d == S_PI)	return 0xA;      if (d == (S_PI / 2.0))	return 0xB;      if (d == S_SQRT2)	return 0xC;      if (d == (1.0 / S_SQRT2))	return 0xD;      /* Large powers of 10 in the constant 	 ram are not used because they are	 not equal to a C double constant  */      if (d == -(S_PI / 2.0))	return 0x27;      if (d == S_LOG2ofE)	return 0x28;      if (d == S_LOG2of10)	return 0x29;      if (d == S_LOGEof2)	return 0x2A;      if (d == S_LOGEof10)	return 0x2B;      if (d == S_LOG10of2)	return 0x2C;      if (d == S_LOG10ofE)	return 0x2D;    }  else    {      if (d == D_E)	return 0x8;      if (d == (2*D_PI))	return 0x9;      if (d == D_PI)	return 0xA;      if (d == (D_PI / 2.0))	return 0xB;      if (d == D_SQRT2)	return 0xC;      if (d == (1.0 / D_SQRT2))	return 0xD;      /* Large powers of 10 in the constant 	 ram are not used because they are	 not equal to a C double constant  */      if (d == -(D_PI / 2.0))	return 0x27;      if (d == D_LOG2ofE)	return 0x28;      if (d == D_LOG2of10)	return 0x29;      if (d == D_LOGEof2)	return 0x2A;      if (d == D_LOGEof10)	return 0x2B;      if (d == D_LOG10of2)	return 0x2C;      if (d == D_LOG10ofE)	return 0x2D;    }  return 0x0;}#endif /* define SUPPORT_SUN_FPA *//* A C compound statement to output to stdio stream STREAM the   assembler syntax for an instruction operand X.  X is an RTL   expression.   CODE is a value that can be used to specify one of several ways   of printing the operand.  It is used when identical operands   must be printed differently depending on the context.  CODE   comes from the `%' specification that was used to request   printing of the operand.  If the specification was just `%DIGIT'   then CODE is 0; if the specification was `%LTR DIGIT' then CODE   is the ASCII code for LTR.   If X is a register, this macro should print the register's name.   The names can be found in an array `reg_names' whose type is   `char *[]'.  `reg_names' is initialized from `REGISTER_NAMES'.   When the machine description has a specification `%PUNCT' (a `%'   followed by a punctuation character), this macro is called with   a null pointer for X and the punctuation character for CODE.   The m68k specific codes are:   '.' for dot needed in Motorola-style opcode names.   '-' for an operand pushing on the stack:       sp@-, -(sp) or -(%sp) depending on the style of syntax.   '+' for an operand pushing on the stack:       sp@+, (sp)+ or (%sp)+ depending on the style of syntax.   '@' for a reference to the top word on the stack:

⌨️ 快捷键说明

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