📄 predicates.md
字号:
/* Otherwise, a decl is "near" if it is defined in the same section. */ if (flag_function_sections) return false; op_decl = SYMBOL_REF_DECL (op); if (DECL_ONE_ONLY (current_function_decl) || (op_decl && DECL_ONE_ONLY (op_decl))) return false; cfun_sec = DECL_SECTION_NAME (current_function_decl); op_sec = op_decl ? DECL_SECTION_NAME (op_decl) : NULL; return ((!cfun_sec && !op_sec) || (cfun_sec && op_sec && strcmp (TREE_STRING_POINTER (cfun_sec), TREE_STRING_POINTER (op_sec)) == 0));});; Return 1 if OP is a valid operand for the MEM of a CALL insn.;;;; For TARGET_ABI_OSF, we want to restrict to R27 or a pseudo.;; For TARGET_ABI_UNICOSMK, we want to restrict to registers.(define_predicate "call_operand" (if_then_else (match_code "reg") (match_test "!TARGET_ABI_OSF || REGNO (op) == 27 || REGNO (op) > LAST_VIRTUAL_REGISTER") (and (match_test "!TARGET_ABI_UNICOSMK") (match_code "symbol_ref"))));; Return true if OP is a LABEL_REF, or SYMBOL_REF or CONST referencing;; a (non-tls) variable known to be defined in this file.(define_predicate "local_symbolic_operand" (match_code "label_ref,const,symbol_ref"){ if (GET_CODE (op) == LABEL_REF) return 1; 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) != SYMBOL_REF) return 0; return SYMBOL_REF_LOCAL_P (op) && !SYMBOL_REF_TLS_MODEL (op);});; Return true if OP is a SYMBOL_REF or CONST referencing a variable;; known to be defined in this file in the small data area.(define_predicate "small_symbolic_operand" (match_code "const,symbol_ref"){ if (! TARGET_SMALL_DATA) return 0; 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) != SYMBOL_REF) return 0; /* ??? There's no encode_section_info equivalent for the rtl constant pool, so SYMBOL_FLAG_SMALL never gets set. */ if (CONSTANT_POOL_ADDRESS_P (op)) return GET_MODE_SIZE (get_pool_mode (op)) <= g_switch_value; return (SYMBOL_REF_LOCAL_P (op) && SYMBOL_REF_SMALL_P (op) && SYMBOL_REF_TLS_MODEL (op) == 0);});; Return true if OP is a SYMBOL_REF or CONST referencing a variable;; not known (or known not) to be defined in this file.(define_predicate "global_symbolic_operand" (match_code "const,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) != SYMBOL_REF) return 0; return !SYMBOL_REF_LOCAL_P (op) && !SYMBOL_REF_TLS_MODEL (op);});; Returns 1 if OP is a symbolic operand, i.e. a symbol_ref or a label_ref,;; possibly with an offset.(define_predicate "symbolic_operand" (ior (match_code "symbol_ref,label_ref") (and (match_code "const") (match_test "GET_CODE (XEXP (op,0)) == PLUS && GET_CODE (XEXP (XEXP (op,0), 0)) == SYMBOL_REF && GET_CODE (XEXP (XEXP (op,0), 1)) == CONST_INT"))));; Return true if OP is valid for 16-bit DTP relative relocations.(define_predicate "dtp16_symbolic_operand" (and (match_code "const") (match_test "tls_symbolic_operand_1 (op, 16, UNSPEC_DTPREL)")));; Return true if OP is valid for 32-bit DTP relative relocations.(define_predicate "dtp32_symbolic_operand" (and (match_code "const") (match_test "tls_symbolic_operand_1 (op, 32, UNSPEC_DTPREL)")));; Return true if OP is valid for 64-bit DTP relative relocations.(define_predicate "gotdtp_symbolic_operand" (and (match_code "const") (match_test "tls_symbolic_operand_1 (op, 64, UNSPEC_DTPREL)")));; Return true if OP is valid for 16-bit TP relative relocations.(define_predicate "tp16_symbolic_operand" (and (match_code "const") (match_test "tls_symbolic_operand_1 (op, 16, UNSPEC_TPREL)")));; Return true if OP is valid for 32-bit TP relative relocations.(define_predicate "tp32_symbolic_operand" (and (match_code "const") (match_test "tls_symbolic_operand_1 (op, 32, UNSPEC_TPREL)")));; Return true if OP is valid for 64-bit TP relative relocations.(define_predicate "gottp_symbolic_operand" (and (match_code "const") (match_test "tls_symbolic_operand_1 (op, 64, UNSPEC_TPREL)")));; Return 1 if this memory address is a known aligned register plus;; a constant. It must be a valid address. This means that we can do;; this as an aligned reference plus some offset.;;;; Take into account what reload will do. Oh god this is awful.;; The horrible comma-operator construct below is to prevent genrecog;; from thinking that this predicate accepts REG and SUBREG. We don't;; use recog during reload, so pretending these codes are accepted ;; pessimizes things a tad.(define_predicate "aligned_memory_operand" (ior (match_test "op = resolve_reload_operand (op), 0") (match_code "mem")){ rtx base; if (MEM_ALIGN (op) >= 32) return 1; op = XEXP (op, 0); /* LEGITIMIZE_RELOAD_ADDRESS creates (plus (plus reg const_hi) const_lo) sorts of constructs. Dig for the real base register. */ if (reload_in_progress && GET_CODE (op) == PLUS && GET_CODE (XEXP (op, 0)) == PLUS) base = XEXP (XEXP (op, 0), 0); else { if (! memory_address_p (mode, op)) return 0; base = (GET_CODE (op) == PLUS ? XEXP (op, 0) : op); } return (GET_CODE (base) == REG && REGNO_POINTER_ALIGN (REGNO (base)) >= 32);});; Similar, but return 1 if OP is a MEM which is not alignable.(define_predicate "unaligned_memory_operand" (ior (match_test "op = resolve_reload_operand (op), 0") (match_code "mem")){ rtx base; if (MEM_ALIGN (op) >= 32) return 0; op = XEXP (op, 0); /* LEGITIMIZE_RELOAD_ADDRESS creates (plus (plus reg const_hi) const_lo) sorts of constructs. Dig for the real base register. */ if (reload_in_progress && GET_CODE (op) == PLUS && GET_CODE (XEXP (op, 0)) == PLUS) base = XEXP (XEXP (op, 0), 0); else { if (! memory_address_p (mode, op)) return 0; base = (GET_CODE (op) == PLUS ? XEXP (op, 0) : op); } return (GET_CODE (base) == REG && REGNO_POINTER_ALIGN (REGNO (base)) < 32);});; Return 1 if OP is any memory location. During reload a pseudo matches.(define_predicate "any_memory_operand" (ior (match_code "mem,reg") (and (match_code "subreg") (match_test "GET_CODE (SUBREG_REG (op)) == REG"))));; Return 1 if OP is either a register or an unaligned memory location.(define_predicate "reg_or_unaligned_mem_operand" (ior (match_operand 0 "register_operand") (match_operand 0 "unaligned_memory_operand")));; Return 1 is OP is a memory location that is not a reference;; (using an AND) to an unaligned location. Take into account;; what reload will do.(define_predicate "normal_memory_operand" (ior (match_test "op = resolve_reload_operand (op), 0") (and (match_code "mem") (match_test "GET_CODE (XEXP (op, 0)) != AND"))));; Returns 1 if OP is not an eliminable register.;;;; This exists to cure a pathological abort in the s8addq (et al) patterns,;;;; long foo () { long t; bar(); return (long) &t * 26107; };;;; which run afoul of a hack in reload to cure a (presumably) similar;; problem with lea-type instructions on other targets. But there is;; one of us and many of them, so work around the problem by selectively;; preventing combine from making the optimization.(define_predicate "reg_not_elim_operand" (match_operand 0 "register_operand"){ if (GET_CODE (op) == SUBREG) op = SUBREG_REG (op); return op != frame_pointer_rtx && op != arg_pointer_rtx;});; Accept a register, but not a subreg of any kind. This allows us to;; avoid pathological cases in reload wrt data movement common in ;; int->fp conversion. */(define_predicate "reg_no_subreg_operand" (and (match_code "reg") (match_operand 0 "register_operand")));; Return 1 if OP is a valid Alpha comparison operator for "cmp" style;; instructions.(define_predicate "alpha_comparison_operator" (match_code "eq,le,lt,leu,ltu"));; Similarly, but with swapped operands.(define_predicate "alpha_swapped_comparison_operator" (match_code "eq,ge,gt,gtu,gtu"));; Return 1 if OP is a valid Alpha comparison operator against zero;; for "bcc" style instructions.(define_predicate "alpha_zero_comparison_operator" (match_code "eq,ne,le,lt,leu,ltu"));; Return 1 if OP is a signed comparison operation.(define_predicate "signed_comparison_operator" (match_code "eq,ne,le,lt,ge,gt"));; Return 1 if OP is a valid Alpha floating point comparison operator.(define_predicate "alpha_fp_comparison_operator" (match_code "eq,le,lt,unordered"));; Return 1 if this is a divide or modulus operator.(define_predicate "divmod_operator" (match_code "div,mod,udiv,umod"));; Return 1 if this is a float->int conversion operator.(define_predicate "fix_operator" (match_code "fix,unsigned_fix"));; Recognize an addition operation that includes a constant. Used to;; convince reload to canonize (plus (plus reg c1) c2) during register;; elimination.(define_predicate "addition_operation" (and (match_code "plus") (match_test "register_operand (XEXP (op, 0), mode) && GET_CODE (XEXP (op, 1)) == CONST_INT && CONST_OK_FOR_LETTER_P (INTVAL (XEXP (op, 1)), 'K')")));; For TARGET_EXPLICIT_RELOCS, we don't obfuscate a SYMBOL_REF to a;; small symbolic operand until after reload. At which point we need;; to replace (mem (symbol_ref)) with (mem (lo_sum $29 symbol_ref));; so that sched2 has the proper dependency information. */(define_predicate "some_small_symbolic_operand" (match_code "set,parallel,prefetch,unspec,unspec_volatile"){ /* Avoid search unless necessary. */ if (!TARGET_EXPLICIT_RELOCS || !reload_completed) return false; return for_each_rtx (&op, some_small_symbolic_operand_int, NULL);})
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -