comparison gcc/reload.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Search an insn for pseudo regs that must be in hard regs and are not. 1 /* Search an insn for pseudo regs that must be in hard regs and are not.
2 Copyright (C) 1987-2018 Free Software Foundation, Inc. 2 Copyright (C) 1987-2020 Free Software Foundation, Inc.
3 3
4 This file is part of GCC. 4 This file is part of GCC.
5 5
6 GCC is free software; you can redistribute it and/or modify it under 6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free 7 the terms of the GNU General Public License as published by the Free
103 #include "ira.h" 103 #include "ira.h"
104 #include "recog.h" 104 #include "recog.h"
105 #include "rtl-error.h" 105 #include "rtl-error.h"
106 #include "reload.h" 106 #include "reload.h"
107 #include "addresses.h" 107 #include "addresses.h"
108 #include "params.h" 108 #include "function-abi.h"
109 109
110 /* True if X is a constant that can be forced into the constant pool. 110 /* True if X is a constant that can be forced into the constant pool.
111 MODE is the mode of the operand, or VOIDmode if not known. */ 111 MODE is the mode of the operand, or VOIDmode if not known. */
112 #define CONST_POOL_OK_P(MODE, X) \ 112 #define CONST_POOL_OK_P(MODE, X) \
113 ((MODE) != VOIDmode \ 113 ((MODE) != VOIDmode \
406 registers for correct code. We fail here to prevent the possibility of 406 registers for correct code. We fail here to prevent the possibility of
407 silently generating incorrect code later. 407 silently generating incorrect code later.
408 408
409 The convention is that secondary input reloads are valid only if the 409 The convention is that secondary input reloads are valid only if the
410 secondary_class is different from class. If you have such a case, you 410 secondary_class is different from class. If you have such a case, you
411 can not use secondary reloads, you must work around the problem some 411 cannot use secondary reloads, you must work around the problem some
412 other way. 412 other way.
413 413
414 Allow this when a reload_in/out pattern is being used. I.e. assume 414 Allow this when a reload_in/out pattern is being used. I.e. assume
415 that the generated code handles this case. */ 415 that the generated code handles this case. */
416 416
6526 /* Overly conservative. */ 6526 /* Overly conservative. */
6527 if (GET_CODE (x) == STRICT_LOW_PART 6527 if (GET_CODE (x) == STRICT_LOW_PART
6528 || GET_RTX_CLASS (GET_CODE (x)) == RTX_AUTOINC) 6528 || GET_RTX_CLASS (GET_CODE (x)) == RTX_AUTOINC)
6529 x = XEXP (x, 0); 6529 x = XEXP (x, 0);
6530 6530
6531 /* If either argument is a constant, then modifying X can not affect IN. */ 6531 /* If either argument is a constant, then modifying X cannot affect IN. */
6532 if (CONSTANT_P (x) || CONSTANT_P (in)) 6532 if (CONSTANT_P (x) || CONSTANT_P (in))
6533 return 0; 6533 return 0;
6534 else if (GET_CODE (x) == SUBREG && MEM_P (SUBREG_REG (x))) 6534 else if (GET_CODE (x) == SUBREG && MEM_P (SUBREG_REG (x)))
6535 return refers_to_mem_for_reload_p (in); 6535 return refers_to_mem_for_reload_p (in);
6536 else if (GET_CODE (x) == SUBREG) 6536 else if (GET_CODE (x) == SUBREG)
6714 p = PREV_INSN (p); 6714 p = PREV_INSN (p);
6715 if (p && DEBUG_INSN_P (p)) 6715 if (p && DEBUG_INSN_P (p))
6716 continue; 6716 continue;
6717 num++; 6717 num++;
6718 if (p == 0 || LABEL_P (p) 6718 if (p == 0 || LABEL_P (p)
6719 || num > PARAM_VALUE (PARAM_MAX_RELOAD_SEARCH_INSNS)) 6719 || num > param_max_reload_search_insns)
6720 return 0; 6720 return 0;
6721 6721
6722 /* Don't reuse register contents from before a setjmp-type 6722 /* Don't reuse register contents from before a setjmp-type
6723 function call; on the second return (from the longjmp) it 6723 function call; on the second return (from the longjmp) it
6724 might have been clobbered by a later reuse. It doesn't 6724 might have been clobbered by a later reuse. It doesn't
6902 6902
6903 /* Don't trust the conversion past a function call 6903 /* Don't trust the conversion past a function call
6904 if either of the two is in a call-clobbered register, or memory. */ 6904 if either of the two is in a call-clobbered register, or memory. */
6905 if (CALL_P (p)) 6905 if (CALL_P (p))
6906 { 6906 {
6907 int i;
6908
6909 if (goal_mem || need_stable_sp) 6907 if (goal_mem || need_stable_sp)
6910 return 0; 6908 return 0;
6911 6909
6912 if (regno >= 0 && regno < FIRST_PSEUDO_REGISTER) 6910 function_abi callee_abi = insn_callee_abi (p);
6913 for (i = 0; i < nregs; ++i) 6911 if (regno >= 0
6914 if (call_used_regs[regno + i] 6912 && regno < FIRST_PSEUDO_REGISTER
6915 || targetm.hard_regno_call_part_clobbered (regno + i, mode)) 6913 && callee_abi.clobbers_reg_p (mode, regno))
6916 return 0; 6914 return 0;
6917 6915
6918 if (valueno >= 0 && valueno < FIRST_PSEUDO_REGISTER) 6916 if (valueno >= 0
6919 for (i = 0; i < valuenregs; ++i) 6917 && valueno < FIRST_PSEUDO_REGISTER
6920 if (call_used_regs[valueno + i] 6918 && callee_abi.clobbers_reg_p (mode, valueno))
6921 || targetm.hard_regno_call_part_clobbered (valueno + i, 6919 return 0;
6922 mode))
6923 return 0;
6924 } 6920 }
6925 6921
6926 if (INSN_P (p)) 6922 if (INSN_P (p))
6927 { 6923 {
6928 pat = PATTERN (p); 6924 pat = PATTERN (p);