diff options
author | wehle <wehle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-21 06:59:43 +0000 |
---|---|---|
committer | wehle <wehle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-03-21 06:59:43 +0000 |
commit | c352cbc71ff5c15ef6a4c17267216600ca4e1dfe (patch) | |
tree | 6b14d4c2f9960628888847cc9e4f77a205cf4a8c /gcc/rtlanal.c | |
parent | 2c1e3faec8b2f227462473d12576142d93100c7d (diff) | |
download | gcc-c352cbc71ff5c15ef6a4c17267216600ca4e1dfe.tar.gz |
* alias.c: (nonlocal_mentioned_p): Use for_each_rtx.
(nonlocal_mentioned_p_1): New function.
(nonlocal_referenced_p, nonlocal_referenced_p_1): Likewise.
(nonlocal_set_p, nonlocal_set_p_1): Likewise.
(mark_constant_function): Recognize pure functions.
* rtl.h (global_reg_mentioned_p): New prototype.
* rtlanal.c (global_reg_mentioned_p,
global_reg_mentioned_p_1): New function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51113 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r-- | gcc/rtlanal.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 70cbbf8e21d..79ccf9d4bc0 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -30,6 +30,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm_p.h" /* Forward declarations */ +static int global_reg_mentioned_p_1 PARAMS ((rtx *, void *)); static void set_of_1 PARAMS ((rtx, rtx, void *)); static void insn_dependent_p_1 PARAMS ((rtx, rtx, void *)); static int computed_jump_p_1 PARAMS ((rtx)); @@ -483,6 +484,82 @@ get_jump_table_offset (insn, earliest) return x; } +/* A subroutine of global_reg_mentioned_p, returns 1 if *LOC mentions + a global register. */ + +static int +global_reg_mentioned_p_1 (loc, data) + rtx *loc; + void *data ATTRIBUTE_UNUSED; +{ + int regno; + rtx x = *loc; + + if (! x) + return 0; + + switch (GET_CODE (x)) + { + case SUBREG: + if (GET_CODE (SUBREG_REG (x)) == REG) + { + if (REGNO (SUBREG_REG (x)) < FIRST_PSEUDO_REGISTER + && global_regs[subreg_regno (x)]) + return 1; + return 0; + } + break; + + case REG: + regno = REGNO (x); + if (regno < FIRST_PSEUDO_REGISTER && global_regs[regno]) + return 1; + return 0; + + case SCRATCH: + case PC: + case CC0: + case CONST_INT: + case CONST_DOUBLE: + case CONST: + case LABEL_REF: + return 0; + + case CALL: + /* A non-constant call might use a global register. */ + return 1; + + default: + break; + } + + return 0; +} + +/* Returns non-zero if X mentions a global register. */ + +int +global_reg_mentioned_p (x) + rtx x; +{ + + if (INSN_P (x)) + { + if (GET_CODE (x) == CALL_INSN) + { + if (! CONST_OR_PURE_CALL_P (x)) + return 1; + x = CALL_INSN_FUNCTION_USAGE (x); + if (x == 0) + return 0; + } + else + x = PATTERN (x); + } + + return for_each_rtx (&x, global_reg_mentioned_p_1, NULL); +} + /* Return the number of places FIND appears within X. If COUNT_DEST is zero, we do not count occurrences inside the destination of a SET. */ |