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

📄 predicates.md

📁 Mac OS X 10.4.9 for x86 Source Code gcc 实现源代码
💻 MD
📖 第 1 页 / 共 2 页
字号:
;; Predicate definitions for IA-32 and x86-64.;; Copyright (C) 2004, 2005 Free Software Foundation, Inc.;;;; This file is part of GCC.;;;; GCC 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.;;;; GCC 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 GCC; see the file COPYING.  If not, write to;; the Free Software Foundation, 59 Temple Place - Suite 330,;; Boston, MA 02111-1307, USA.;; Return nonzero if OP is either a i387 or SSE fp register.(define_predicate "any_fp_register_operand"  (and (match_code "reg")       (match_test "ANY_FP_REGNO_P (REGNO (op))")));; Return nonzero if OP is an i387 fp register.(define_predicate "fp_register_operand"  (and (match_code "reg")       (match_test "FP_REGNO_P (REGNO (op))")));; Return nonzero if OP is a non-fp register_operand.(define_predicate "register_and_not_any_fp_reg_operand"  (and (match_code "reg")       (not (match_test "ANY_FP_REGNO_P (REGNO (op))"))));; Return nonzero if OP is a register operand other than an i387 fp register.(define_predicate "register_and_not_fp_reg_operand"  (and (match_code "reg")       (not (match_test "FP_REGNO_P (REGNO (op))"))));; True if the operand is an MMX register.(define_predicate "mmx_reg_operand"  (and (match_code "reg")       (match_test "MMX_REGNO_P (REGNO (op))")));; True if the operand is a Q_REGS class register.(define_predicate "q_regs_operand"  (match_operand 0 "register_operand"){  if (GET_CODE (op) == SUBREG)    op = SUBREG_REG (op);  return ANY_QI_REG_P (op);});; Return true if op is a NON_Q_REGS class register.(define_predicate "non_q_regs_operand"  (match_operand 0 "register_operand"){  if (GET_CODE (op) == SUBREG)    op = SUBREG_REG (op);  return NON_QI_REG_P (op);});; Match an SI or HImode register for a zero_extract.(define_special_predicate "ext_register_operand"  (match_operand 0 "register_operand"){  if ((!TARGET_64BIT || GET_MODE (op) != DImode)      && GET_MODE (op) != SImode && GET_MODE (op) != HImode)    return 0;  if (GET_CODE (op) == SUBREG)    op = SUBREG_REG (op);  /* Be careful to accept only registers having upper parts.  */  return REGNO (op) > LAST_VIRTUAL_REGISTER || REGNO (op) < 4;});; Return true if op is the flags register.(define_predicate "flags_reg_operand"  (and (match_code "reg")       (match_test "REGNO (op) == FLAGS_REG")));; Return 1 if VALUE can be stored in a sign extended immediate field.(define_predicate "x86_64_immediate_operand"  (match_code "const_int,symbol_ref,label_ref,const"){  if (!TARGET_64BIT)    return immediate_operand (op, mode);  switch (GET_CODE (op))    {    case CONST_INT:      /* CONST_DOUBLES never match, since HOST_BITS_PER_WIDE_INT is known         to be at least 32 and this all acceptable constants are	 represented as CONST_INT.  */      if (HOST_BITS_PER_WIDE_INT == 32)	return 1;      else	{	  HOST_WIDE_INT val = trunc_int_for_mode (INTVAL (op), DImode);	  return trunc_int_for_mode (val, SImode) == val;	}      break;    case SYMBOL_REF:      /* For certain code models, the symbolic references are known to fit.	 in CM_SMALL_PIC model we know it fits if it is local to the shared	 library.  Don't count TLS SYMBOL_REFs here, since they should fit	 only if inside of UNSPEC handled below.  */      /* TLS symbols are not constant.  */      if (tls_symbolic_operand (op, Pmode))	return false;      return (ix86_cmodel == CM_SMALL || ix86_cmodel == CM_KERNEL);    case LABEL_REF:      /* For certain code models, the code is near as well.  */      return (ix86_cmodel == CM_SMALL || ix86_cmodel == CM_MEDIUM	      || ix86_cmodel == CM_KERNEL);    case CONST:      /* We also may accept the offsetted memory references in certain	 special cases.  */      if (GET_CODE (XEXP (op, 0)) == UNSPEC)	switch (XINT (XEXP (op, 0), 1))	  {	  case UNSPEC_GOTPCREL:	  case UNSPEC_DTPOFF:	  case UNSPEC_GOTNTPOFF:	  case UNSPEC_NTPOFF:	    return 1;	  default:	    break;	  }      if (GET_CODE (XEXP (op, 0)) == PLUS)	{	  rtx op1 = XEXP (XEXP (op, 0), 0);	  rtx op2 = XEXP (XEXP (op, 0), 1);	  HOST_WIDE_INT offset;	  if (ix86_cmodel == CM_LARGE)	    return 0;	  if (GET_CODE (op2) != CONST_INT)	    return 0;	  offset = trunc_int_for_mode (INTVAL (op2), DImode);	  switch (GET_CODE (op1))	    {	    case SYMBOL_REF:	      /* For CM_SMALL assume that latest object is 16MB before		 end of 31bits boundary.  We may also accept pretty		 large negative constants knowing that all objects are		 in the positive half of address space.  */	      if (ix86_cmodel == CM_SMALL		  && offset < 16*1024*1024		  && trunc_int_for_mode (offset, SImode) == offset)		return 1;	      /* For CM_KERNEL we know that all object resist in the		 negative half of 32bits address space.  We may not		 accept negative offsets, since they may be just off		 and we may accept pretty large positive ones.  */	      if (ix86_cmodel == CM_KERNEL		  && offset > 0		  && trunc_int_for_mode (offset, SImode) == offset)		return 1;	      break;	    case LABEL_REF:	      /* These conditions are similar to SYMBOL_REF ones, just the		 constraints for code models differ.  */	      if ((ix86_cmodel == CM_SMALL || ix86_cmodel == CM_MEDIUM)		  && offset < 16*1024*1024		  && trunc_int_for_mode (offset, SImode) == offset)		return 1;	      if (ix86_cmodel == CM_KERNEL		  && offset > 0		  && trunc_int_for_mode (offset, SImode) == offset)		return 1;	      break;	    case UNSPEC:	      switch (XINT (op1, 1))		{		case UNSPEC_DTPOFF:		case UNSPEC_NTPOFF:		  if (offset > 0		      && trunc_int_for_mode (offset, SImode) == offset)		    return 1;		}	      break;	    default:	      break;	    }	}      break;      default:	abort ();    }  return 0;});; Return 1 if VALUE can be stored in the zero extended immediate field.(define_predicate "x86_64_zext_immediate_operand"  (match_code "const_double,const_int,symbol_ref,label_ref,const"){  switch (GET_CODE (op))    {    case CONST_DOUBLE:      if (HOST_BITS_PER_WIDE_INT == 32)	return (GET_MODE (op) == VOIDmode && !CONST_DOUBLE_HIGH (op));      else	return 0;    case CONST_INT:      if (HOST_BITS_PER_WIDE_INT == 32)	return INTVAL (op) >= 0;      else	return !(INTVAL (op) & ~(HOST_WIDE_INT) 0xffffffff);    case SYMBOL_REF:      /* For certain code models, the symbolic references are known to fit.  */      /* TLS symbols are not constant.  */      if (tls_symbolic_operand (op, Pmode))	return false;      return ix86_cmodel == CM_SMALL;    case LABEL_REF:      /* For certain code models, the code is near as well.  */      return ix86_cmodel == CM_SMALL || ix86_cmodel == CM_MEDIUM;    case CONST:      /* We also may accept the offsetted memory references in certain	 special cases.  */      if (GET_CODE (XEXP (op, 0)) == PLUS)	{	  rtx op1 = XEXP (XEXP (op, 0), 0);	  rtx op2 = XEXP (XEXP (op, 0), 1);	  if (ix86_cmodel == CM_LARGE)	    return 0;	  switch (GET_CODE (op1))	    {	    case SYMBOL_REF:	      /* For small code model we may accept pretty large positive		 offsets, since one bit is available for free.  Negative		 offsets are limited by the size of NULL pointer area		 specified by the ABI.  */	      if (ix86_cmodel == CM_SMALL		  && GET_CODE (op2) == CONST_INT		  && trunc_int_for_mode (INTVAL (op2), DImode) > -0x10000		  && trunc_int_for_mode (INTVAL (op2), SImode) == INTVAL (op2))		return 1;	      /* ??? For the kernel, we may accept adjustment of		 -0x10000000, since we know that it will just convert		 negative address space to positive, but perhaps this		 is not worthwhile.  */	      break;	    case LABEL_REF:	      /* These conditions are similar to SYMBOL_REF ones, just the		 constraints for code models differ.  */	      if ((ix86_cmodel == CM_SMALL || ix86_cmodel == CM_MEDIUM)		  && GET_CODE (op2) == CONST_INT		  && trunc_int_for_mode (INTVAL (op2), DImode) > -0x10000		  && trunc_int_for_mode (INTVAL (op2), SImode) == INTVAL (op2))		return 1;	      break;	    default:	      return 0;	    }	}      break;    default:      abort ();    }  return 0;});; Return nonzero if OP is general operand representable on x86_64.(define_predicate "x86_64_general_operand"  (if_then_else (match_test "TARGET_64BIT")    (ior (match_operand 0 "nonimmediate_operand")	 (match_operand 0 "x86_64_immediate_operand"))    (match_operand 0 "general_operand")));; Return nonzero if OP is general operand representable on x86_64;; as either sign extended or zero extended constant.(define_predicate "x86_64_szext_general_operand"  (if_then_else (match_test "TARGET_64BIT")    (ior (match_operand 0 "nonimmediate_operand")	 (ior (match_operand 0 "x86_64_immediate_operand")	      (match_operand 0 "x86_64_zext_immediate_operand")))    (match_operand 0 "general_operand")));; Return nonzero if OP is nonmemory operand representable on x86_64.(define_predicate "x86_64_nonmemory_operand"  (if_then_else (match_test "TARGET_64BIT")    (ior (match_operand 0 "register_operand")	 (match_operand 0 "x86_64_immediate_operand"))    (match_operand 0 "nonmemory_operand")));; Return nonzero if OP is nonmemory operand representable on x86_64.(define_predicate "x86_64_szext_nonmemory_operand"  (if_then_else (match_test "TARGET_64BIT")    (ior (match_operand 0 "register_operand")	 (ior (match_operand 0 "x86_64_immediate_operand")	      (match_operand 0 "x86_64_zext_immediate_operand")))    (match_operand 0 "nonmemory_operand")));; Return nonzero if OP is nonmemory operand acceptable by movabs patterns.(define_predicate "x86_64_movabs_operand"  (if_then_else (match_test "!TARGET_64BIT || !flag_pic")    (match_operand 0 "nonmemory_operand")    (ior (match_operand 0 "register_operand")	 (and (match_operand 0 "const_double_operand")	      (match_test "GET_MODE_SIZE (mode) <= 8")))));; Returns nonzero if OP is either a symbol reference or a sum of a symbol;; reference and a constant.(define_predicate "symbolic_operand"  (match_code "symbol_ref,label_ref,const"){  switch (GET_CODE (op))    {    case SYMBOL_REF:    case LABEL_REF:      return 1;    case CONST:      op = XEXP (op, 0);      if (GET_CODE (op) == SYMBOL_REF	  || GET_CODE (op) == LABEL_REF	  || (GET_CODE (op) == UNSPEC	      && (XINT (op, 1) == UNSPEC_GOT		  || XINT (op, 1) == UNSPEC_GOTOFF		  || XINT (op, 1) == UNSPEC_GOTPCREL)))	return 1;      if (GET_CODE (op) != PLUS	  || GET_CODE (XEXP (op, 1)) != CONST_INT)	return 0;      op = XEXP (op, 0);      if (GET_CODE (op) == SYMBOL_REF	  || GET_CODE (op) == LABEL_REF)	return 1;      /* Only @GOTOFF gets offsets.  */      if (GET_CODE (op) != UNSPEC	  || XINT (op, 1) != UNSPEC_GOTOFF)	return 0;      op = XVECEXP (op, 0, 0);      if (GET_CODE (op) == SYMBOL_REF	  || GET_CODE (op) == LABEL_REF)	return 1;      return 0;    default:      abort ();    }});; Return true if the operand contains a @GOT or @GOTOFF reference.(define_predicate "pic_symbolic_operand"  (match_code "const"){  op = XEXP (op, 0);  if (TARGET_64BIT)    {      if (GET_CODE (op) == UNSPEC	  && XINT (op, 1) == UNSPEC_GOTPCREL)	return 1;      if (GET_CODE (op) == PLUS	  && GET_CODE (XEXP (op, 0)) == UNSPEC	  && XINT (XEXP (op, 0), 1) == UNSPEC_GOTPCREL)	return 1;    }  else    {      if (GET_CODE (op) == UNSPEC)	return 1;      if (GET_CODE (op) != PLUS	  || GET_CODE (XEXP (op, 1)) != CONST_INT)	return 0;      op = XEXP (op, 0);      if (GET_CODE (op) == UNSPEC)	return 1;    }  return 0;});; Return true if OP is a symbolic operand that resolves locally.(define_predicate "local_symbolic_operand"  (match_code "const,label_ref,symbol_ref"){  if (GET_CODE (op) == CONST      && GET_CODE (XEXP (op, 0)) == PLUS      && GET_CODE (XEXP (XEXP (op, 0), 1)) == CONST_INT)    op = XEXP (XEXP (op, 0), 0);  if (GET_CODE (op) == LABEL_REF)    return 1;  if (GET_CODE (op) != SYMBOL_REF)    return 0;  if (SYMBOL_REF_LOCAL_P (op))    return 1;  /* There is, however, a not insubstantial body of code in the rest of     the compiler that assumes it can just stick the results of     ASM_GENERATE_INTERNAL_LABEL in a symbol_ref and have done.  */  /* ??? This is a hack.  Should update the body of the compiler to     always create a DECL an invoke targetm.encode_section_info.  */  if (strncmp (XSTR (op, 0), internal_label_prefix,	       internal_label_prefix_len) == 0)    return 1;  return 0;});; Test for various thread-local symbols.(define_predicate "tls_symbolic_operand"  (and (match_code "symbol_ref")       (match_test "SYMBOL_REF_TLS_MODEL (op) != 0")))(define_predicate "global_dynamic_symbolic_operand"  (and (match_code "symbol_ref")       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_GLOBAL_DYNAMIC")))(define_predicate "local_dynamic_symbolic_operand"  (and (match_code "symbol_ref")       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_DYNAMIC")))(define_predicate "initial_exec_symbolic_operand"  (and (match_code "symbol_ref")       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_INITIAL_EXEC")))(define_predicate "local_exec_symbolic_operand"  (and (match_code "symbol_ref")       (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_EXEC")));; Test for a pc-relative call operand(define_predicate "constant_call_address_operand"  (ior (match_code "symbol_ref")       (match_operand 0 "local_symbolic_operand")));; True for any non-virtual or eliminable register.  Used in places where;; instantiation of such a register may cause the pattern to not be recognized.(define_predicate "register_no_elim_operand"  (match_operand 0 "register_operand"){  if (GET_CODE (op) == SUBREG)    op = SUBREG_REG (op);  return !(op == arg_pointer_rtx	   || op == frame_pointer_rtx	   || (REGNO (op) >= FIRST_PSEUDO_REGISTER	       && REGNO (op) <= LAST_VIRTUAL_REGISTER));});; Similarly, but include the stack pointer.  This is used to prevent esp;; from being used as an index reg.(define_predicate "index_register_operand"  (match_operand 0 "register_operand"){  if (GET_CODE (op) == SUBREG)

⌨️ 快捷键说明

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