From 3861ac19e8dac9915c6022dbaa64bd974ece6000 Mon Sep 17 00:00:00 2001 From: Bob Duff <duff@adacore.com> Date: Tue, 10 Dec 2024 08:56:45 -0500 Subject: [PATCH] ada: cleanup documentation for shift and rotate Documentation updated. gcc/ada/ChangeLog: * sinfo.ads (Shift_Count_OK): Update comments. (Is_Power_Of_2_For_Shift): Likewise. --- gcc/ada/sinfo.ads | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads index 3db084ef391f..2b82ab345d63 100644 --- a/gcc/ada/sinfo.ads +++ b/gcc/ada/sinfo.ads @@ -1812,16 +1812,15 @@ package Sinfo is -- A flag set on an aggregate that uses parentheses as delimiters -- Is_Power_Of_2_For_Shift - -- A flag present only in N_Op_Expon nodes. It is set when the - -- exponentiation is of the form 2 ** N, where the type of N is an - -- unsigned integral subtype whose size does not exceed the size of - -- Standard_Integer (i.e. a type that can be safely converted to - -- Natural), and the exponentiation appears as the right operand of an - -- integer multiplication or an integer division where the dividend is - -- unsigned. It is also required that overflow checking is off for both - -- the exponentiation and the multiply/divide node. If this set of - -- conditions holds, and the flag is set, then the division or - -- multiplication can be (and is) converted to a shift. + -- Present in N_Op_Expon nodes. It is set when the exponentiation is of + -- the form 2 ** N, where the type of N is an integer subtype whose size + -- does not exceed the size of Standard.Integer (i.e. a type that can be + -- safely converted to Natural), and the exponentiation appears as the + -- right operand of an integer multiplication or an integer division + -- where the dividend is unsigned. It is also required that overflow + -- checking is off for both the exponentiation and the multiply/divide + -- node. If this set of conditions holds, and the flag is set, then the + -- division or multiplication is converted to a shift. -- Is_Preelaborable_Call -- Present in call marker nodes. Set when the related call is non-static @@ -2291,7 +2290,8 @@ package Sinfo is -- known to be in range, i.e. is in the range from zero to word length -- minus one. If this flag is not set, then the shift count may be -- outside this range, i.e. larger than the word length, and the code - -- must ensure that such shift counts give the appropriate result. + -- generated by the back end must ensure that such shift counts give the + -- appropriate result. -- Source_Type -- Used in an N_Validate_Unchecked_Conversion node to point to the @@ -7738,15 +7738,13 @@ package Sinfo is -- operator names. Note that for a given shift operation, one node -- covers all possible types, as for normal operators. - -- Note: it is perfectly permissible for the expander to generate - -- shift operation nodes directly, in which case they will be analyzed - -- and parsed in the usual manner. - -- Sprint syntax: shift-function-name!(expr, count) - -- Note: the Left_Opnd field holds the first argument (the value to - -- be shifted). The Right_Opnd field holds the second argument (the - -- shift count). The Chars field is the name of the intrinsic function. + -- The Left_Opnd field holds the first argument (the value to be + -- shifted). The Right_Opnd field holds the second argument (the shift + -- count). The Chars field is the name of the intrinsic function. + -- The back end is responsible for generating correct code in the case + -- of large shift counts (in which case Shift_Count_OK will be False). -- N_Op_Rotate_Left -- Sloc points to the function name -- GitLab