aboutsummaryrefslogtreecommitdiff
path: root/gcc/df-scan.c
diff options
context:
space:
mode:
authorbergner <bergner@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-02 20:08:06 +0000
committerbergner <bergner@138bc75d-0d04-0410-961f-82ee72b054a4>2011-02-02 20:08:06 +0000
commit486f84fdff5cbcb4dd0bcd180cbcbdb1e1098c00 (patch)
tree2a6c8c9833162d25bb4977072dccdd2ac9b0af48 /gcc/df-scan.c
parentd89b98b541cb61cfed09e9f91f8bcd31c60f8051 (diff)
PR rtl-optimization/47525
* df-scan.c: Update copyright years. (df_get_call_refs): Do not mark global registers as DF_REF_REG_USE and non-clobber DF_REF_REG_DEF for calls to const and pure functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169768 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/df-scan.c')
-rw-r--r--gcc/df-scan.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/gcc/df-scan.c b/gcc/df-scan.c
index 1400d2569b0..42b4b145c02 100644
--- a/gcc/df-scan.c
+++ b/gcc/df-scan.c
@@ -1,6 +1,6 @@
/* Scanning of rtl for dataflow analysis.
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009, 2010 Free Software Foundation, Inc.
+ 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
Originally contributed by Michael P. Hayes
(m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com)
Major rewrite contributed by Danny Berlin (dberlin@dberlin.org)
@@ -3360,16 +3360,19 @@ df_get_call_refs (struct df_collection_rec * collection_rec,
NULL, bb, insn_info, DF_REF_REG_USE,
DF_REF_CALL_STACK_USAGE | flags);
- /* Calls may also reference any of the global registers,
- so they are recorded as used. */
- for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
- if (global_regs[i])
- {
- df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i],
- NULL, bb, insn_info, DF_REF_REG_USE, flags);
- df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i],
- NULL, bb, insn_info, DF_REF_REG_DEF, flags);
- }
+ /* Calls to const functions cannot access any global registers and calls to
+ pure functions cannot set them. All other calls may reference any of the
+ global registers, so they are recorded as used. */
+ if (!RTL_CONST_CALL_P (insn_info->insn))
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (global_regs[i])
+ {
+ df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i],
+ NULL, bb, insn_info, DF_REF_REG_USE, flags);
+ if (!RTL_PURE_CALL_P (insn_info->insn))
+ df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i],
+ NULL, bb, insn_info, DF_REF_REG_DEF, flags);
+ }
is_sibling_call = SIBLING_CALL_P (insn_info->insn);
EXECUTE_IF_SET_IN_BITMAP (regs_invalidated_by_call_regset, 0, ui, bi)