return m_full_and_partial_reg_clobbers;
}
+ /* Return the set of registers that a function call is allowed to alter
+ partially but not fully; i.e. those in full_and_partial_reg_clobbers ()
+ but not in full_reg_clobbers ().
+
+ If a register X is in this set and if we don't know which parts of
+ X are live (typically because we don't bother to track X's mode),
+ then the conservative assumptions are:
+
+ - to ignore the call when computing reaching definitions
+ - to treat X as clobbered when computing availability
+
+ For example, if we have:
+
+ A: X := Y
+ B: call that partially clobbers X
+ C: ... := ... X ...
+
+ and don't track the mode of X when computing reaching definitions,
+ then the conservative assumption is that A's definition survives
+ until C. But if we have:
+
+ A: X := Y
+ B: call that partially clobbers X
+ C: ... := ... Y ...
+
+ and don't track the mode of X when computing availability, then the
+ conservative assumption is that Y is not available in X at C. */
+ HARD_REG_SET
+ only_partial_reg_clobbers () const
+ {
+ return full_and_partial_reg_clobbers () & ~full_reg_clobbers ();
+ }
+
/* Return the set of registers that cannot be used to hold a value of
mode MODE across a function call. That is:
return m_mask & m_base_abi->full_and_partial_reg_clobbers ();
}
+ HARD_REG_SET
+ only_partial_reg_clobbers () const
+ {
+ return m_mask & m_base_abi->only_partial_reg_clobbers ();
+ }
+
HARD_REG_SET
mode_clobbers (machine_mode mode) const
{
#include "rtl.h"
#include "df.h"
#include "gcse-common.h"
-
+#include "regs.h"
+#include "function-abi.h"
/* Record all of the canonicalized MEMs of record_last_mem_set_info's insn.
Note we store a pair of elements in the list, so they have to be
switch (code)
{
case REG:
- {
- df_ref def;
- for (def = DF_REG_DEF_CHAIN (REGNO (x));
- def;
- def = DF_REF_NEXT_REG (def))
- bitmap_clear_bit (bmap[DF_REF_BB (def)->index], indx);
- }
+ {
+ df_ref def;
+ for (def = DF_REG_DEF_CHAIN (REGNO (x));
+ def;
+ def = DF_REF_NEXT_REG (def))
+ bitmap_clear_bit (bmap[DF_REF_BB (def)->index], indx);
+
+ /* Check for hard registers that are partially clobbered (but not
+ fully clobbered) by calls. Such partial clobbers do not have
+ an associated definition or use in the DF representation,
+ but they do prevent the register from being transparent.
+
+ ??? The check here is fairly crude. We could instead maintain
+ separate blocks_with_calls bitmaps for each ABI. */
+ if (HARD_REGISTER_P (x))
+ for (unsigned int i = 0; i < NUM_ABI_IDS; ++i)
+ {
+ const predefined_function_abi &abi = function_abis[i];
+ if (abi.initialized_p ()
+ && overlaps_hard_reg_set_p (abi.only_partial_reg_clobbers (),
+ GET_MODE (x), REGNO (x)))
+ {
+ bitmap_iterator bi;
+ unsigned bb_index;
+ EXECUTE_IF_SET_IN_BITMAP (blocks_with_calls, 0, bb_index, bi)
+ bitmap_clear_bit (bmap[bb_index], indx);
+ break;
+ }
+ }
+ }
return;