diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2011-06-18 10:18:38 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2011-06-18 10:18:38 +0000 |
commit | 7e4680c1a2cf543559a1db79368a2d476f1c233c (patch) | |
tree | a7356c2f1b6f9502b952ce84f57e10fc9f2fe1b8 /gcc/ada/gcc-interface/trans.c | |
parent | 0e27699a8a99b215173bd62e83e91f9d7128a826 (diff) | |
download | gcc-7e4680c1a2cf543559a1db79368a2d476f1c233c.zip gcc-7e4680c1a2cf543559a1db79368a2d476f1c233c.tar.gz gcc-7e4680c1a2cf543559a1db79368a2d476f1c233c.tar.bz2 |
einfo.ads (Address_Taken): Document use for the second argument of Asm_Input and Asm_Output attributes.
* einfo.ads (Address_Taken): Document use for the second argument of
Asm_Input and Asm_Output attributes.
* sem_attr.adb (Analyze_Attribute) <Attribute_Asm_Input>: If the second
argument is an entity name, then set Address_Taken on it.
<Attribute_Asm_Output>: Likewise.
* gcc-interface/trans.c (lvalue_required_for_attribute_p): Handle the
Attr_Asm_Input and Attr_Asm_Output attributes explicitly.
(gnat_to_gnu) <N_Code_Statement>: If an operand is going to end up in
memory and is a CONST_DECL, retrieve its corresponding VAR_DECL.
From-SVN: r175171
Diffstat (limited to 'gcc/ada/gcc-interface/trans.c')
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index ca47e93..8e949a8 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -706,6 +706,8 @@ lvalue_required_for_attribute_p (Node_Id gnat_node) case Attr_First_Bit: case Attr_Last_Bit: case Attr_Bit: + case Attr_Asm_Input: + case Attr_Asm_Output: default: return 1; } @@ -5489,9 +5491,15 @@ gnat_to_gnu (Node_Id gnat_node) mark it addressable. Note that we don't test allows_mem like in the input case below; this is modelled on the C front-end. */ - if (!allows_reg - && !gnat_mark_addressable (output)) - output = error_mark_node; + if (!allows_reg) + { + STRIP_NOPS (output); + if (TREE_CODE (output) == CONST_DECL + && DECL_CONST_CORRESPONDING_VAR (output)) + output = DECL_CONST_CORRESPONDING_VAR (output); + if (!gnat_mark_addressable (output)) + output = error_mark_node; + } } else output = error_mark_node; @@ -5511,9 +5519,15 @@ gnat_to_gnu (Node_Id gnat_node) { /* If the operand is going to end up in memory, mark it addressable. */ - if (!allows_reg && allows_mem - && !gnat_mark_addressable (input)) - input = error_mark_node; + if (!allows_reg && allows_mem) + { + STRIP_NOPS (input); + if (TREE_CODE (input) == CONST_DECL + && DECL_CONST_CORRESPONDING_VAR (input)) + input = DECL_CONST_CORRESPONDING_VAR (input); + if (!gnat_mark_addressable (input)) + input = error_mark_node; + } } else input = error_mark_node; |