summaryrefslogtreecommitdiffstats
path: root/gcc/ada/exp_util.ads
diff options
context:
space:
mode:
authorgingell <gingell@138bc75d-0d04-0410-961f-82ee72b054a4>2002-03-28 15:33:09 +0000
committergingell <gingell@138bc75d-0d04-0410-961f-82ee72b054a4>2002-03-28 15:33:09 +0000
commit226494a382d663c05017fcc4922273e874c384eb (patch)
treede291fbe38321eee24920156c79d6252aa6b59ba /gcc/ada/exp_util.ads
parentfcb1a9563eb5c90ff41c1397f161a6c59b5e039a (diff)
downloadppe42-gcc-226494a382d663c05017fcc4922273e874c384eb.tar.gz
ppe42-gcc-226494a382d663c05017fcc4922273e874c384eb.zip
* checks.ads:
(Remove_Checks): New procedure * checks.adb: (Remove_Checks): New procedure * exp_util.adb: Use new Duplicate_Subexpr functions (Duplicate_Subexpr_No_Checks): New procedure (Duplicate_Subexpr_No_Checks_Orig): New procedure (Duplicate_Subexpr): Restore original form (checks duplicated) (Duplicate_Subexpr): Call Remove_Checks * exp_util.ads: (Duplicate_Subexpr_No_Checks): New procedure (Duplicate_Subexpr_No_Checks_Orig): New procedure Add 2002 to copyright notice * sem_util.adb: Use new Duplicate_Subexpr functions * sem_eval.adb: (Eval_Indexed_Component): This is the place to call Constant_Array_Ref and to replace the value. We simply merge the code of this function in here, since it is now no longer used elsewhere. This fixes the problem of the back end not realizing we were clever enough to see that this was constant. (Expr_Val): Remove call to Constant_Array_Ref (Expr_Rep_Val): Remove call to Constant_Array_Ref Minor reformatting (Constant_Array_Ref): Deal with string literals (patch suggested by Zack Weinberg on the gcc list) * exp_util.adb: Duplicate_Subexpr_No_Checks_Orig => Duplicate_Subexpr_Move_Checks. * exp_util.ads: Duplicate_Subexpr_No_Checks_Orig => Duplicate_Subexpr_Move_Checks. * sem_eval.adb: (Constant_Array_Ref): Verify that constant value of array exists before retrieving it (it may a private protected component in a function). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@51513 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_util.ads')
-rw-r--r--gcc/ada/exp_util.ads28
1 files changed, 27 insertions, 1 deletions
diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads
index 3c215b0f2d4..c83b97ef1e0 100644
--- a/gcc/ada/exp_util.ads
+++ b/gcc/ada/exp_util.ads
@@ -7,7 +7,7 @@
-- S p e c --
-- --
-- --
--- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2002 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -243,6 +243,32 @@ package Exp_Util is
-- 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 a
-- name (e.g. the prefix of an attribute reference).
+ --
+ -- 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;
+ -- 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
+ -- expression is unconditionally elaborated before the duplicated
+ -- 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;
+ -- 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 (the duplicated expression) will retain the original checks.
+ -- This is appropriate for use when the duplicated expression is sure
+ -- to be elaborated before the original expression Exp, so that there
+ -- is no need to repeat the checks.
procedure Ensure_Defined (Typ : Entity_Id; N : Node_Id);
-- This procedure ensures that type referenced by Typ is defined. For the
OpenPOWER on IntegriCloud