This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
This patch does two things. First, if Use_Expressions_With_Actions is
set, then the normal case expansion of conditional actions is simplified
by using this node. Second if Back_End_Handles_Limited_Types is set,
then the special case expansion for limited types is eliminated.
The following test:
function EA_Cond_Expr
(a, b, c : Integer; s : String) return Boolean
is
begin
return (if b <= c then s (a .. b) = s (b .. c)
else s (a .. b) = s (c .. b));
end;
compiled with -gnatd.X to force use of Expression_With_Actions
(and also -gnatX -gnatpG) generates the following -gnatG output:
function ea_cond_expr (a : integer; b : integer; c : integer; s :
string) return boolean is
subtype ea_cond_expr__S1b is string (s'first(1) .. s'last(1));
begin
return (if b <= c then
do
[subtype ea_cond_expr__T3b is integer range a .. b]
[subtype ea_cond_expr__T4b is string (ea_cond_expr__T3b)]
reference ea_cond_expr__T4b
[subtype ea_cond_expr__T5b is integer range b .. c]
[subtype ea_cond_expr__T6b is string (ea_cond_expr__T5b)]
reference ea_cond_expr__T6b
in s (a .. b) = s (b .. c) end
else
do
[subtype ea_cond_expr__T7b is integer range a .. b]
[subtype ea_cond_expr__T8b is string (ea_cond_expr__T7b)]
reference ea_cond_expr__T8b
[subtype ea_cond_expr__T9b is integer range c .. b]
[subtype ea_cond_expr__T10b is string (ea_cond_expr__T9b)]
reference ea_cond_expr__T10b
in s (a .. b) = s (c .. b) end
);
end ea_cond_expr;
Tested on x86_64-pc-linux-gnu, committed on trunk
2010-06-18 Robert Dewar <dewar@adacore.com>
* debug.adb: New debug flag -gnatd.L to control
Back_End_Handles_Limited_Types.
* exp_ch4.adb (Expand_N_Conditional_Expression): Let back end handle
limited case if Back_End_Handles_Limited_Types is True.
(Expand_N_Conditional_Expression): Use N_Expression_With_Actions to
simplify expansion if Use_Expression_With_Actions is True.
* gnat1drv.adb (Adjust_Global_Switches): Set
Back_End_Handles_Limited_Types.
* opt.ads (Back_End_Handles_Limited_Types): New flag.
Attachment:
difs
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |