diff options
author | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-23 03:55:36 +0000 |
---|---|---|
committer | hp <hp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-03-23 03:55:36 +0000 |
commit | 64d5fb6a673d142101ac222b683d8829d85e9673 (patch) | |
tree | 1170a3a1c1f2485f21dace07e688e18f211fa1b8 /gcc/stmt.c | |
parent | 439a6dcaf0af95c43c83a0033b32cc1a2ee5f73e (diff) | |
download | gcc-64d5fb6a673d142101ac222b683d8829d85e9673.tar.gz |
* doc/tm.texi (TARGET_MD_ASM_CLOBBERS): Adjust wording to not
imply that this is called once, independent of asms in code.
Adjust to now being pased output and input lists. Mention helper
function decl_overlaps_hard_reg_set_p.
* hooks.c (hook_tree_tree_tree_tree_3rd_identity): Rename from
hook_tree_tree_identity and to take three trees, returning third.
* hooks.h (hook_tree_tree_tree_tree_3rd_identity): Adjust the
prototype.
* stmt.c: include hard-reg-set.h before tree.h.
(decl_overlaps_hard_reg_set_p): New function, broken out from...
(decl_conflicts_with_clobbers_p): Call
decl_overlaps_hard_reg_set_p.
(expand_asm_operands): Pass output and input lists in call to
targetm.md_asm_clobbers.
* target-def.h (TARGET_MD_ASM_CLOBBERS): Define as
hook_tree_tree_tree_tree_3rd_identity.
* target.h (struct gcc_target.md_asm_clobbers): Take three tree
parameters.
* tree.h [HARD_CONST] (decl_overlaps_hard_reg_set_p): Prototype.
* config/i386/i386.c (ix86_md_asm_clobbers): Adjust to three
parameters, first two unused.
* config/cris/cris.c (cris_md_asm_clobbers): Adjust to added
parameters. Only add MOF to clobbers if there's no 'h' mentioned
in constraint letters and MOF is not mentioned as a asm-declared
register in neither of the input and output lists.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96923 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r-- | gcc/stmt.c | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c index 9a1df90ef22..2e292028bdb 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -31,6 +31,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tm.h" #include "rtl.h" +#include "hard-reg-set.h" #include "tree.h" #include "tm_p.h" #include "flags.h" @@ -39,7 +40,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "insn-config.h" #include "expr.h" #include "libfuncs.h" -#include "hard-reg-set.h" #include "recog.h" #include "machmode.h" #include "toplev.h" @@ -558,15 +558,12 @@ parse_input_constraint (const char **constraint_p, int input_num, return true; } -/* Check for overlap between registers marked in CLOBBERED_REGS and - anything inappropriate in DECL. Emit error and return TRUE for error, - FALSE for ok. */ +/* Return true iff there's an overlap between REGS and DECL, where DECL + can be an asm-declared register. */ -static bool -decl_conflicts_with_clobbers_p (tree decl, const HARD_REG_SET clobbered_regs) +bool +decl_overlaps_hard_reg_set_p (tree decl, const HARD_REG_SET regs) { - /* Conflicts between asm-declared register variables and the clobber - list are not allowed. */ if ((TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL) && DECL_REGISTER (decl) && REG_P (DECL_RTL (decl)) @@ -579,18 +576,34 @@ decl_conflicts_with_clobbers_p (tree decl, const HARD_REG_SET clobbered_regs) regno < (REGNO (reg) + hard_regno_nregs[REGNO (reg)][GET_MODE (reg)]); regno++) - if (TEST_HARD_REG_BIT (clobbered_regs, regno)) - { - error ("asm-specifier for variable %qs conflicts with " - "asm clobber list", - IDENTIFIER_POINTER (DECL_NAME (decl))); - - /* Reset registerness to stop multiple errors emitted for a - single variable. */ - DECL_REGISTER (decl) = 0; - return true; - } + if (TEST_HARD_REG_BIT (regs, regno)) + return true; + } + + return false; +} + + +/* Check for overlap between registers marked in CLOBBERED_REGS and + anything inappropriate in DECL. Emit error and return TRUE for error, + FALSE for ok. */ + +static bool +decl_conflicts_with_clobbers_p (tree decl, const HARD_REG_SET clobbered_regs) +{ + /* Conflicts between asm-declared register variables and the clobber + list are not allowed. */ + if (decl_overlaps_hard_reg_set_p (decl, clobbered_regs)) + { + error ("asm-specifier for variable %qs conflicts with asm clobber list", + IDENTIFIER_POINTER (DECL_NAME (decl))); + + /* Reset registerness to stop multiple errors emitted for a single + variable. */ + DECL_REGISTER (decl) = 0; + return true; } + return false; } @@ -656,7 +669,7 @@ expand_asm_operands (tree string, tree outputs, tree inputs, Case in point is when the i386 backend moved from cc0 to a hard reg -- maintaining source-level compatibility means automatically clobbering the flags register. */ - clobbers = targetm.md_asm_clobbers (clobbers); + clobbers = targetm.md_asm_clobbers (outputs, inputs, clobbers); /* Count the number of meaningful clobbered registers, ignoring what we would ignore later. */ |