aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_util.ads
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-08-01 16:37:00 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2014-08-01 16:37:00 +0200
commita43f6434dbf7bd6aa5f1a123c917b2f5f91e75ae (patch)
treedfe0e0bf035c4c94c1fdec3041497cf35897adc4 /gcc/ada/exp_util.ads
parentbdc193bad16766de82346ac6191a49e0771662c6 (diff)
downloadgcc-a43f6434dbf7bd6aa5f1a123c917b2f5f91e75ae.zip
gcc-a43f6434dbf7bd6aa5f1a123c917b2f5f91e75ae.tar.gz
gcc-a43f6434dbf7bd6aa5f1a123c917b2f5f91e75ae.tar.bz2
[multiple changes]
2014-08-01 Robert Dewar <dewar@adacore.com> * sem_ch8.adb, opt.ads Minor comment updates. 2014-08-01 Hristian Kirtchev <kirtchev@adacore.com> * exp_intr.adb (Expand_Unc_Deallocation): Request a renaming from the side effects removal machinery. * exp_util.adb (Duplicate_Subexpr): Add formal parameter Renaming_Req. Update the nested call to Remove_Side_Effects. (Duplicate_Subexpr_No_Checks): Add formal parameter Renaming_Req. Update the nested call to Remove_Side_Effects. (Duplicate_Subexpr_Move_Checks): Add formal parameter Renaming_Req. Update the nested call to Remove_Side_Effects. (Remove_Side_Effects): Add formal parameter Renaming_Req. Generate an object renaming declaration when the caller requests it. * exp_util.ads (Duplicate_Subexpr): Add formal parameter Renaming_Req. Update comment on usage. (Duplicate_Subexpr_No_Checks): Add formal parameter Renaming_Req. (Duplicate_Subexpr_Move_Checks): Add formal parameter Renaming_Req. From-SVN: r213480
Diffstat (limited to 'gcc/ada/exp_util.ads')
-rw-r--r--gcc/ada/exp_util.ads39
1 files changed, 26 insertions, 13 deletions
diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads
index 0483f8f..a62ca9f 100644
--- a/gcc/ada/exp_util.ads
+++ b/gcc/ada/exp_util.ads
@@ -330,8 +330,9 @@ package Exp_Util is
-- be the earliest point at which they are used.
function Duplicate_Subexpr
- (Exp : Node_Id;
- Name_Req : Boolean := False) return Node_Id;
+ (Exp : Node_Id;
+ Name_Req : Boolean := False;
+ Renaming_Req : Boolean := False) return Node_Id;
-- Given the node for a subexpression, this function makes a logical copy
-- of the subexpression, and returns it. This is intended for use when the
-- expansion of an expression needs to repeat part of it. For example,
@@ -343,17 +344,25 @@ package Exp_Util is
-- expression and the returned result then become references to this saved
-- value. Exp must be analyzed on entry. On return, Exp is analyzed, but
-- the caller is responsible for analyzing the returned copy after it is
- -- attached to the tree. The Name_Req flag is set to ensure that the result
- -- is suitable for use in a context requiring name (e.g. the prefix of an
- -- attribute reference).
+ -- attached to the tree.
+ --
+ -- The Name_Req flag is set to ensure that the result is suitable for use
+ -- in a context requiring a name (for example, the prefix of an attribute
+ -- reference) (can't this just be a qualification in Ada 2012???).
+ --
+ -- The Renaming_Req flag is set to produce an object renaming declaration
+ -- rather than an object declaration. This is valid only if the expression
+ -- Exp designates a renamable object. This is used for example in the case
+ -- of an unchecked deallocation, to make sure the object gets set to null.
--
-- Note that if there are any run time checks in Exp, these same checks
-- will be duplicated in the returned duplicated expression. The two
-- following functions allow this behavior to be modified.
function Duplicate_Subexpr_No_Checks
- (Exp : Node_Id;
- Name_Req : Boolean := False) return Node_Id;
+ (Exp : Node_Id;
+ Name_Req : Boolean := False;
+ Renaming_Req : Boolean := False) return Node_Id;
-- Identical in effect to Duplicate_Subexpr, except that Remove_Checks
-- is called on the result, so that the duplicated expression does not
-- include checks. This is appropriate for use when Exp, the original
@@ -361,8 +370,9 @@ package Exp_Util is
-- expression, so that there is no need to repeat any checks.
function Duplicate_Subexpr_Move_Checks
- (Exp : Node_Id;
- Name_Req : Boolean := False) return Node_Id;
+ (Exp : Node_Id;
+ Name_Req : Boolean := False;
+ Renaming_Req : Boolean := False) return Node_Id;
-- Identical in effect to Duplicate_Subexpr, except that Remove_Checks is
-- called on Exp after the duplication is complete, so that the original
-- expression does not include checks. In this case the result returned
@@ -808,6 +818,7 @@ package Exp_Util is
procedure Remove_Side_Effects
(Exp : Node_Id;
Name_Req : Boolean := False;
+ Renaming_Req : Boolean := False;
Variable_Ref : Boolean := False);
-- Given the node for a subexpression, this function replaces the node if
-- necessary by an equivalent subexpression that is guaranteed to be side
@@ -816,10 +827,12 @@ package Exp_Util is
-- to which Exp is attached. Exp must be analyzed and resolved before the
-- call and is analyzed and resolved on return. Name_Req may only be set to
-- True if Exp has the form of a name, and the effect is to guarantee that
- -- any replacement maintains the form of name. If Variable_Ref is set to
- -- TRUE, a variable is considered as side effect (used in implementing
- -- Force_Evaluation). Note: after call to Remove_Side_Effects, it is
- -- safe to call New_Copy_Tree to obtain a copy of the resulting expression.
+ -- any replacement maintains the form of name. If Renaming_Req is set to
+ -- TRUE, the routine produces an object renaming reclaration capturing the
+ -- expression. If Variable_Ref is set to TRUE, a variable is considered as
+ -- side effect (used in implementing Force_Evaluation). Note: after call to
+ -- Remove_Side_Effects, it is safe to call New_Copy_Tree to obtain a copy
+ -- of the resulting expression.
function Represented_As_Scalar (T : Entity_Id) return Boolean;
-- Returns True iff the implementation of this type in code generation