diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-30 01:22:07 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-30 01:22:07 +0000 |
commit | fbc51f36e328057ba98e695ccdab52856ca68796 (patch) | |
tree | bfe96a23c68a90b5da0a5b5bfb8294fbe08ac645 /gcc/tree-gimple.c | |
parent | a8b2a8d55ccf7783b607c4629292af7fc41f6a28 (diff) | |
download | gcc-fbc51f36e328057ba98e695ccdab52856ca68796.tar.gz |
PR 17739
* tree-gimple.c (is_gimple_reg): Reject hard registers.
(is_gimple_asm_val): New.
* tree-gimple.h (is_gimple_asm_val): Declare.
* gimplify.c (gimplify_asm_expr): Use it.
* tree-pretty-print.c (print_declaration): Dump hard regs.
* tree-outof-ssa.c (check_replaceable): Don't check for hard regs.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-pre.c (is_undefined_value): Likewise.
* tree-ssa-copy.c (may_propagate_copy): Likewise.
(may_propagate_copy_into_asm): Protect DECL_HARD_REGISTER.
* tree-ssa.c (warn_uninit): Likewise.
* tree.h (DECL_HARD_REGISTER): Check for VAR_DECL.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88321 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-gimple.c')
-rw-r--r-- | gcc/tree-gimple.c | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/gcc/tree-gimple.c b/gcc/tree-gimple.c index 82b82a43fed..b2a2ad9a2bd 100644 --- a/gcc/tree-gimple.c +++ b/gcc/tree-gimple.c @@ -282,12 +282,35 @@ is_gimple_reg (tree t) if (TREE_CODE (t) == SSA_NAME) t = SSA_NAME_VAR (t); - return (is_gimple_variable (t) - && is_gimple_reg_type (TREE_TYPE (t)) - /* A volatile decl is not acceptable because we can't reuse it as - needed. We need to copy it into a temp first. */ - && ! TREE_THIS_VOLATILE (t) - && ! needs_to_live_in_memory (t)); + if (!is_gimple_variable (t)) + return false; + if (!is_gimple_reg_type (TREE_TYPE (t))) + return false; + + /* A volatile decl is not acceptable because we can't reuse it as + needed. We need to copy it into a temp first. */ + if (TREE_THIS_VOLATILE (t)) + return false; + + /* We define "registers" as things that can be renamed as needed, + which with our infrastructure does not apply to memory. */ + if (needs_to_live_in_memory (t)) + return false; + + /* Hard register variables are an interesting case. For those that + are call-clobbered, we don't know where all the calls are, since + we don't (want to) take into account which operations will turn + into libcalls at the rtl level. For those that are call-saved, + we don't currently model the fact that calls may in fact change + global hard registers, nor do we examine ASM_CLOBBERS at the tree + level, and so miss variable changes that might imply. All around, + it seems safest to not do too much optimization with these at the + tree level at all. We'll have to rely on the rtl optimizers to + clean this up, as there we've got all the appropriate bits exposed. */ + if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t)) + return false; + + return true; } /* Returns true if T is a GIMPLE formal temporary variable. */ @@ -349,6 +372,16 @@ is_gimple_val (tree t) return (is_gimple_variable (t) || is_gimple_min_invariant (t)); } +/* Similarly, but accept hard registers as inputs to asm statements. */ + +bool +is_gimple_asm_val (tree t) +{ + if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t)) + return true; + + return is_gimple_val (t); +} /* Return true if T is a GIMPLE minimal lvalue. */ |