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

📄 mn10300.md

📁 GCC编译器源代码
💻 MD
📖 第 1 页 / 共 3 页
字号:
;; GCC machine description for Matsushita MN10300;; Copyright (C) 1996, 1997 Free Software Foundation, Inc.;;   Contributed by Jeff Law (law@cygnus.com).;; This file is part of GNU CC.;; GNU CC is free software; you can redistribute it and/or modify;; it under the terms of the GNU General Public License as published by;; the Free Software Foundation; either version 2, or (at your option);; any later version.;; GNU CC is distributed in the hope that it will be useful,;; but WITHOUT ANY WARRANTY; without even the implied warranty of;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the;; GNU General Public License for more details.;; You should have received a copy of the GNU General Public License;; along with GNU CC; see the file COPYING.  If not, write to;; the Free Software Foundation, 59 Temple Place - Suite 330,;; Boston, MA 02111-1307, USA.;; The original PO technology requires these to be ordered by speed,;; so that assigner will pick the fastest.;; See file "rtl.def" for documentation on define_insn, match_*, et. al.;; Condition code settings.;; none - insn does not affect cc;; none_0hit - insn does not affect cc but it does modify operand 0;;	This attribute is used to keep track of when operand 0 changes.;; 	See the description of NOTICE_UPDATE_CC for more info.;; set_znv - insn sets z,n,v to usable values; c is unusable.;; set_zn  - insn sets z,n to usable values; v,c are unusable.;; compare - compare instruction;; invert -- like compare, but flags are inverted.;; clobber - value of cc is unknown(define_attr "cc" "none,none_0hit,set_znv,set_zn,compare,clobber,invert"  (const_string "clobber"));; ----------------------------------------------------------------------;; MOVE INSTRUCTIONS;; ----------------------------------------------------------------------;; movqi(define_expand "movqi"  [(set (match_operand:QI 0 "general_operand" "")	(match_operand:QI 1 "general_operand" ""))]  ""  "{  /* One of the ops has to be in a register */  if (!register_operand (operand0, QImode)      && !register_operand (operand1, QImode))    operands[1] = copy_to_mode_reg (QImode, operand1);}")(define_insn ""  [(set (match_operand:QI 0 "general_operand" "=d,*a,d,*a,d,*a,d,*a,d,m")	(match_operand:QI 1 "general_operand" "0,0,I,I,a,d,di,ia,m,d"))]  "register_operand (operands[0], QImode)   || register_operand (operands[1], QImode)"  "*{  switch (which_alternative)    {    case 0:    case 1:      return \"nop\";    case 2:      return \"clr %0\";    case 3:      if (zero_areg)	{	  rtx xoperands[2];	  xoperands[0] = operands[0];	  xoperands[1] = zero_areg;	  if (rtx_equal_p (xoperands[0], xoperands[1]))	    output_asm_insn (\"sub %1,%0\", xoperands);	  else	    output_asm_insn (\"mov %1,%0\", xoperands);	  return \"\";	}      /* FALLTHROUGH */    case 4:    case 5:    case 6:    case 7:      return \"mov %1,%0\";    case 8:    case 9:      return \"movbu %1,%0\";    }}"  [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")]);; movhi(define_expand "movhi"  [(set (match_operand:HI 0 "general_operand" "")	(match_operand:HI 1 "general_operand" ""))]  ""  "{  /* One of the ops has to be in a register */  if (!register_operand (operand1, HImode)      && !register_operand (operand0, HImode))    operands[1] = copy_to_mode_reg (HImode, operand1);}")(define_insn ""  [(set (match_operand:HI 0 "general_operand" "=d,*a,d,*a,d,*a,d,*a,d,m")	(match_operand:HI 1 "general_operand" "0,0,I,I,a,d,di,ia,m,d"))]  "register_operand (operands[0], HImode)   || register_operand (operands[1], HImode)"  "*{  switch (which_alternative)    {    case 0:    case 1:      return \"nop\";    case 2:      return \"clr %0\";    case 3:      if (zero_areg)	{	  rtx xoperands[2];	  xoperands[0] = operands[0];	  xoperands[1] = zero_areg;	  if (rtx_equal_p (xoperands[0], xoperands[1]))	    output_asm_insn (\"sub %1,%0\", xoperands);	  else	    output_asm_insn (\"mov %1,%0\", xoperands);	  return \"\";	}      /* FALLTHROUGH */    case 4:    case 5:    case 6:    case 7:      return \"mov %1,%0\";    case 8:    case 9:      return \"movhu %1,%0\";    }}"  [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")]);; movsi and helpers;; We use this to handle addition of two values when one operand is the;; stack pointer and the other is a memory reference of some kind.  Reload;; does not handle them correctly without this expander.(define_expand "reload_insi"  [(set (match_operand:SI 0 "register_operand" "=a")	(match_operand:SI 1 "impossible_plus_operand" ""))   (clobber (match_operand:SI 2 "register_operand" "=&r"))]  ""  "{  if (XEXP (operands[1], 0) == stack_pointer_rtx)    {      emit_move_insn (operands[0], XEXP (operands[1], 0));      if (GET_CODE (XEXP (operands[1], 1)) == SUBREG	  && (GET_MODE_SIZE (GET_MODE (XEXP (operands[1], 1)))	      > GET_MODE_SIZE (GET_MODE (SUBREG_REG (XEXP (operands[1], 1))))))	emit_move_insn (operands[2],			gen_rtx (ZERO_EXTEND, GET_MODE (XEXP (operands[1], 1)),				 SUBREG_REG (XEXP (operands[1], 1))));      else	emit_move_insn (operands[2], XEXP (operands[1], 1));    }  else    {      emit_move_insn (operands[0], XEXP (operands[1], 1));      if (GET_CODE (XEXP (operands[1], 0)) == SUBREG	  && (GET_MODE_SIZE (GET_MODE (XEXP (operands[1], 0)))	      > GET_MODE_SIZE (GET_MODE (SUBREG_REG (XEXP (operands[1], 0))))))	emit_move_insn (operands[2],			gen_rtx (ZERO_EXTEND, GET_MODE (XEXP (operands[1], 0)),				 SUBREG_REG (XEXP (operands[1], 0))));      else	emit_move_insn (operands[2], XEXP (operands[1], 0));    }  emit_insn (gen_addsi3 (operands[0], operands[0], operands[2]));  DONE;}")(define_expand "movsi"  [(set (match_operand:SI 0 "general_operand" "")	(match_operand:SI 1 "general_operand" ""))]  ""  "{  /* One of the ops has to be in a register */  if (!register_operand (operand1, SImode)      && !register_operand (operand0, SImode))    operands[1] = copy_to_mode_reg (SImode, operand1);}")(define_insn ""  [(set (match_operand:SI 0 "general_operand"				"=d,a,d,a,dm,dm,am,am,d,d,a,a,aR,x")	(match_operand:SI 1 "general_operand"				"0,0,I,I,d,a,d,a,dim,aim,dim,aim,x,aR"))]  "register_operand (operands[0], SImode)   || register_operand (operands[1], SImode)"  "*{  switch (which_alternative)    {    case 0:    case 1:      return \"nop\";    case 2:      return \"clr %0\";    case 3:      if (zero_areg)	{	  rtx xoperands[2];	  xoperands[0] = operands[0];	  xoperands[1] = zero_areg;	  if (rtx_equal_p (xoperands[0], xoperands[1]))	    output_asm_insn (\"sub %1,%0\", xoperands);	  else	    output_asm_insn (\"mov %1,%0\", xoperands);	  return \"\";	}      /* FALLTHROUGH */    case 4:    case 5:    case 6:    case 7:    case 8:    case 9:    case 10:    case 11:    case 12:    case 13:      return \"mov %1,%0\";    }}"  [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])(define_expand "movsf"  [(set (match_operand:SF 0 "general_operand" "")	(match_operand:SF 1 "general_operand" ""))]  ""  "{  /* One of the ops has to be in a register */  if (!register_operand (operand1, SFmode)      && !register_operand (operand0, SFmode))    operands[1] = copy_to_mode_reg (SFmode, operand1);}")(define_insn ""  [(set (match_operand:SF 0 "general_operand" "=d,a,d,a,dam,da")	(match_operand:SF 1 "general_operand" "0,0,G,G,da,daim"))]  "register_operand (operands[0], SFmode)   || register_operand (operands[1], SFmode)"  "*{  switch (which_alternative)    {    case 0:    case 1:      return \"nop\";    case 2:      return \"clr %0\";    case 3:      if (zero_areg)	{	  rtx xoperands[2];	  xoperands[0] = operands[0];	  xoperands[1] = zero_areg;	  if (rtx_equal_p (xoperands[0], xoperands[1]))	    output_asm_insn (\"sub %1,%0\", xoperands);	  else	    output_asm_insn (\"mov %1,%0\", xoperands);	  return \"\";	}      /* FALLTHROUGH */    case 4:    case 5:      return \"mov %1,%0\";    }}"  [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit")])(define_expand "movdi"  [(set (match_operand:DI 0 "general_operand" "")	(match_operand:DI 1 "general_operand" ""))]  ""  "{  /* One of the ops has to be in a register */  if (!register_operand (operand1, DImode)      && !register_operand (operand0, DImode))    operands[1] = copy_to_mode_reg (DImode, operand1);}")(define_insn ""  [(set (match_operand:DI 0 "general_operand"				"=d,a,d,a,dm,dm,am,am,d,d,a,a")	(match_operand:DI 1 "general_operand"				"0,0,I,I,d,a,d,a,dim,aim,dim,aim"))]  "register_operand (operands[0], DImode)   || register_operand (operands[1], DImode)"  "*{  long val[2];  REAL_VALUE_TYPE rv;  switch (which_alternative)    {      case 0:      case 1:	return \"nop\";      case 2:	return \"clr %L0\;clr %H0\";      case 3:	  {	    rtx xoperands[2];	    xoperands[0] = operands[0];	    xoperands[1] = zero_areg ? zero_areg : operands[1];	    if (rtx_equal_p (xoperands[0], xoperands[1]))	      output_asm_insn (\"sub %L1,%L0\;mov %L0,%H0\", xoperands);	    else	      output_asm_insn (\"mov %1,%L0\;mov %L0,%H0\", xoperands);	    return \"\";	  }      case 4:      case 5:      case 6:      case 7:      case 8:      case 9:      case 10:      case 11:	if (GET_CODE (operands[1]) == CONST_INT)	  {	    val[0] = INTVAL (operands[1]);	    val[1] = val[0] < 0 ? -1 : 0;	  }	if (GET_CODE (operands[1]) == CONST_DOUBLE)	  {	    if (GET_MODE (operands[1]) == DFmode)	      {		REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);		REAL_VALUE_TO_TARGET_DOUBLE (rv, val);	      }	    else if (GET_MODE (operands[1]) == VOIDmode		     || GET_MODE (operands[1]) == DImode)	      {		val[0] = CONST_DOUBLE_LOW (operands[1]);		val[1] = CONST_DOUBLE_HIGH (operands[1]);	      }	  }	if (GET_CODE (operands[1]) == MEM	    && reg_overlap_mentioned_p (operands[0], XEXP (operands[1], 0)))	  {	    rtx temp = operands[0];	    while (GET_CODE (temp) == SUBREG)	      temp = SUBREG_REG (temp);	    if (GET_CODE (temp) != REG)	      abort ();	    if (reg_overlap_mentioned_p (gen_rtx (REG, SImode, REGNO (temp)),					 XEXP (operands[1], 0)))	      return \"mov %H1,%H0\;mov %L1,%L0\";	    else	      return \"mov %L1,%L0\;mov %H1,%H0\";	      	  }	else if (GET_CODE (operands[1]) == MEM		 && CONSTANT_ADDRESS_P (XEXP (operands[1], 0))		 && REGNO_REG_CLASS (REGNO (operands[0])) == ADDRESS_REGS)	  {	    rtx xoperands[2];	    xoperands[0] = operands[0];	    xoperands[1] = XEXP (operands[1], 0);	    output_asm_insn (\"mov %1,%L0\;mov (4,%L0),%H0\;mov (%L0),%L0\",			     xoperands);	    return \"\";	  }	else	  {	    if ((GET_CODE (operands[1]) == CONST_INT		 || GET_CODE (operands[1]) == CONST_DOUBLE)		&& val[0] == 0)	      {		if (REGNO_REG_CLASS (REGNO (operands[0])) == DATA_REGS)		  output_asm_insn (\"clr %L0\", operands);	        else if (zero_areg)		  {		    rtx xoperands[2];		    xoperands[0] = operands[0];		    xoperands[1] = zero_areg;		    if (rtx_equal_p (xoperands[0], xoperands[1]))		      output_asm_insn (\"sub %L0,%L0\", xoperands);		    else		      output_asm_insn (\"mov %1,%L0\", xoperands);		  }		else		  output_asm_insn (\"mov %L1,%L0\", operands);	      }	    else	      output_asm_insn (\"mov %L1,%L0\", operands);	    if ((GET_CODE (operands[1]) == CONST_INT		 || GET_CODE (operands[1]) == CONST_DOUBLE)		&& val[1] == 0)	      {		if (REGNO_REG_CLASS (REGNO (operands[0])) == DATA_REGS)		  output_asm_insn (\"clr %H0\", operands);		else if (zero_areg)		  {		    rtx xoperands[2];		    xoperands[0] = operands[0];		    xoperands[1] = zero_areg;		    if (rtx_equal_p (xoperands[0], xoperands[1]))		      output_asm_insn (\"sub %H0,%H0\", xoperands);		    else		      output_asm_insn (\"mov %1,%H0\", xoperands);		  }		else		  output_asm_insn (\"mov %H1,%H0\", operands);	      }	    else if ((GET_CODE (operands[1]) == CONST_INT		      || GET_CODE (operands[1]) == CONST_DOUBLE)		     && val[0] == val[1])	      output_asm_insn (\"mov %L0,%H0\", operands);	    else	      output_asm_insn (\"mov %H1,%H0\", operands);	    return \"\";	  }    }}"  [(set_attr "cc" "none,none,clobber,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit,none_0hit")])(define_expand "movdf"  [(set (match_operand:DF 0 "general_operand" "")	(match_operand:DF 1 "general_operand" ""))]  ""  "{  /* One of the ops has to be in a register */  if (!register_operand (operand1, DFmode)      && !register_operand (operand0, DFmode))    operands[1] = copy_to_mode_reg (DFmode, operand1);}")

⌨️ 快捷键说明

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