From c7e152b57d8f22c33077340f5684d8098062bdff Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 2 Oct 2012 10:04:47 +0200 Subject: [multiple changes] 2012-10-02 Robert Dewar * sem_dim.adb: Minor code reorganization. * sem_dim.ads: Add comment. 2012-10-02 Robert Dewar * checks.ads, exp_ch4.adb, checks.adb (Minimize_Eliminate_Overflow_Checks): Add Top_Level parameter to avoid unnecessary conversions to Bignum. Minor reformatting. 2012-10-02 Ed Schonberg * sem_ch6.adb (Process_PPCs): Generate invariant checks for a return value whose type is an access type and whose designated type has invariants. Ditto for in-out parameters and in-parameters of an access type. * exp_ch3.adb (Build_Component_Invariant_Call): Add invariant check for an access component whose designated type has invariants. From-SVN: r191956 --- gcc/ada/checks.ads | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'gcc/ada/checks.ads') diff --git a/gcc/ada/checks.ads b/gcc/ada/checks.ads index 9fd8034..583d558 100644 --- a/gcc/ada/checks.ads +++ b/gcc/ada/checks.ads @@ -260,9 +260,10 @@ package Checks is -- parameter is used to supply Sloc values for the constructed tree. procedure Minimize_Eliminate_Overflow_Checks - (N : Node_Id; - Lo : out Uint; - Hi : out Uint); + (N : Node_Id; + Lo : out Uint; + Hi : out Uint; + Top_Level : Boolean); -- This is the main routine for handling MINIMIZED and ELIMINATED overflow -- checks. On entry N is a node whose result is a signed integer subtype. -- If the node is an artihmetic operation, then a range analysis is carried @@ -321,6 +322,16 @@ package Checks is -- -- Note that if Bignum values appear, the caller must take care of doing -- the appropriate mark/release operation on the secondary stack. + -- + -- Top_Level is used to avoid inefficient unnecessary transitions into the + -- Bignum domain. If Top_Level is True, it means that the caller will have + -- to convert any Bignum value back to Long_Long_Integer, checking that the + -- value is in range. This is the normal case for a top level operator in + -- a subexpression. There is no point in going into Bignum mode to avoid an + -- overflow just so we can check for overflow the next moment. For calls + -- from comparisons and membership tests, and for all recursive calls, we + -- do want to transition into the Bignum domain if necessary. Note that + -- this setting is only relevant in ELIMINATED mode. ------------------------------------------------------- -- Control and Optimization of Range/Overflow Checks -- -- cgit v1.1