📄 predicates.md
字号:
;; Predicate definitions for IA-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.;; True if OP is a valid operand for the MEM of a CALL insn.(define_predicate "call_operand" (ior (match_code "symbol_ref") (match_operand 0 "register_operand")));; True if OP refers to any kind of symbol.;; For roughly the same reasons that pmode_register_operand exists, this;; predicate ignores its mode argument.(define_special_predicate "symbolic_operand" (match_code "symbol_ref,const,label_ref"));; True if OP is a SYMBOL_REF which refers to a function.(define_predicate "function_operand" (and (match_code "symbol_ref") (match_test "SYMBOL_REF_FUNCTION_P (op)")));; True if OP refers to a symbol in the sdata section.(define_predicate "sdata_symbolic_operand" (match_code "symbol_ref,const"){ HOST_WIDE_INT offset = 0, size = 0; switch (GET_CODE (op)) { case CONST: op = XEXP (op, 0); if (GET_CODE (op) != PLUS || GET_CODE (XEXP (op, 0)) != SYMBOL_REF || GET_CODE (XEXP (op, 1)) != CONST_INT) return false; offset = INTVAL (XEXP (op, 1)); op = XEXP (op, 0); /* FALLTHRU */ case SYMBOL_REF: if (CONSTANT_POOL_ADDRESS_P (op)) { size = GET_MODE_SIZE (get_pool_mode (op)); if (size > ia64_section_threshold) return false; } else { tree t; if (!SYMBOL_REF_LOCAL_P (op) || !SYMBOL_REF_SMALL_P (op)) return false; /* Note that in addition to DECLs, we can get various forms of constants here. */ t = SYMBOL_REF_DECL (op); if (DECL_P (t)) t = DECL_SIZE_UNIT (t); else t = TYPE_SIZE_UNIT (TREE_TYPE (t)); if (t && host_integerp (t, 0)) { size = tree_low_cst (t, 0); if (size < 0) size = 0; } } /* Deny the stupid user trick of addressing outside the object. Such things quickly result in GPREL22 relocation overflows. Of course, they're also highly undefined. From a pure pedant's point of view they deserve a slap on the wrist (such as provided by a relocation overflow), but that just leads to bugzilla noise. */ return (offset >= 0 && offset <= size); default: abort (); }});; True if OP refers to a symbol in the small address area.(define_predicate "small_addr_symbolic_operand" (match_code "symbol_ref,const"){ switch (GET_CODE (op)) { case CONST: op = XEXP (op, 0); if (GET_CODE (op) != PLUS || GET_CODE (XEXP (op, 0)) != SYMBOL_REF || GET_CODE (XEXP (op, 1)) != CONST_INT) return false; op = XEXP (op, 0); /* FALLTHRU */ case SYMBOL_REF: return SYMBOL_REF_SMALL_ADDR_P (op); default: gcc_unreachable (); }});; True if OP refers to a symbol with which we may use any offset.(define_predicate "any_offset_symbol_operand" (match_code "symbol_ref"){ if (TARGET_NO_PIC || TARGET_AUTO_PIC) return true; if (SYMBOL_REF_SMALL_ADDR_P (op)) return true; if (SYMBOL_REF_FUNCTION_P (op)) return false; if (sdata_symbolic_operand (op, mode)) return true; return false;});; True if OP refers to a symbol with which we may use 14-bit aligned offsets.;; False if OP refers to a symbol with which we may not use any offset at any;; time.(define_predicate "aligned_offset_symbol_operand" (and (match_code "symbol_ref") (match_test "! SYMBOL_REF_FUNCTION_P (op)")));; True if OP refers to a symbol, and is appropriate for a GOT load.(define_predicate "got_symbolic_operand" (match_operand 0 "symbolic_operand" ""){ HOST_WIDE_INT addend = 0; switch (GET_CODE (op)) { case LABEL_REF: return true; case CONST: /* Accept only (plus (symbol_ref) (const_int)). */ op = XEXP (op, 0); if (GET_CODE (op) != PLUS || GET_CODE (XEXP (op, 0)) != SYMBOL_REF || GET_CODE (XEXP (op, 1)) != CONST_INT) return false; addend = INTVAL (XEXP (op, 1)); op = XEXP (op, 0); /* FALLTHRU */ case SYMBOL_REF: /* These symbols shouldn't be used with got loads. */ if (SYMBOL_REF_SMALL_ADDR_P (op)) return false; if (SYMBOL_REF_TLS_MODEL (op) != 0) return false; if (any_offset_symbol_operand (op, mode)) return true; /* The low 14 bits of the constant have been forced to zero so that we do not use up so many GOT entries. Prevent cse from undoing this. */ if (aligned_offset_symbol_operand (op, mode)) return (addend & 0x3fff) == 0; return addend == 0; default: gcc_unreachable (); }});; Return true if OP is a valid thread local storage symbolic operand.(define_predicate "tls_symbolic_operand" (match_code "symbol_ref,const"){ switch (GET_CODE (op)) { case SYMBOL_REF: return SYMBOL_REF_TLS_MODEL (op) != 0; case CONST: op = XEXP (op, 0); if (GET_CODE (op) != PLUS || GET_CODE (XEXP (op, 0)) != SYMBOL_REF || GET_CODE (XEXP (op, 1)) != CONST_INT) return false; /* We only allow certain offsets for certain tls models. */ switch (SYMBOL_REF_TLS_MODEL (XEXP (op, 0))) { case TLS_MODEL_GLOBAL_DYNAMIC: case TLS_MODEL_LOCAL_DYNAMIC: return false; case TLS_MODEL_INITIAL_EXEC: return (INTVAL (XEXP (op, 1)) & 0x3fff) == 0; case TLS_MODEL_LOCAL_EXEC: return true; default: return false; } default: gcc_unreachable (); }});; Return true if OP is a local-dynamic thread local storage symbolic operand.(define_predicate "ld_tls_symbolic_operand" (and (match_code "symbol_ref") (match_test "SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_DYNAMIC")));; Return true if OP is an initial-exec thread local storage symbolic operand.(define_predicate "ie_tls_symbolic_operand" (match_code "symbol_ref,const"){ switch (GET_CODE (op)) { case CONST: op = XEXP (op, 0); if (GET_CODE (op) != PLUS || GET_CODE (XEXP (op, 0)) != SYMBOL_REF || GET_CODE (XEXP (op, 1)) != CONST_INT || (INTVAL (XEXP (op, 1)) & 0x3fff) != 0) return false; op = XEXP (op, 0); /* FALLTHRU */ case SYMBOL_REF: return SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_INITIAL_EXEC; default: gcc_unreachable (); }});; Return true if OP is a local-exec thread local storage symbolic operand.(define_predicate "le_tls_symbolic_operand" (match_code "symbol_ref,const"){ switch (GET_CODE (op)) { case CONST: op = XEXP (op, 0); if (GET_CODE (op) != PLUS || GET_CODE (XEXP (op, 0)) != SYMBOL_REF || GET_CODE (XEXP (op, 1)) != CONST_INT) return false; op = XEXP (op, 0); /* FALLTHRU */ case SYMBOL_REF: return SYMBOL_REF_TLS_MODEL (op) == TLS_MODEL_LOCAL_EXEC; default: gcc_unreachable (); }});; Like nonimmediate_operand, but don't allow MEMs that try to use a;; POST_MODIFY with a REG as displacement.(define_predicate "destination_operand" (and (match_operand 0 "nonimmediate_operand") (match_test "GET_CODE (op) != MEM || GET_CODE (XEXP (op, 0)) != POST_MODIFY || GET_CODE (XEXP (XEXP (XEXP (op, 0), 1), 1)) != REG")));; Like memory_operand, but don't allow post-increments.(define_predicate "not_postinc_memory_operand" (and (match_operand 0 "memory_operand") (match_test "GET_RTX_CLASS (GET_CODE (XEXP (op, 0))) != RTX_AUTOINC")));; True if OP is a general operand, with some restrictions on symbols.(define_predicate "move_operand" (match_operand 0 "general_operand"){ switch (GET_CODE (op)) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -