[Ada] Generate fewer conditional branches around For loops
Eric Botcazou
ebotcazou@adacore.com
Fri Apr 16 11:58:00 GMT 2010
The goal of this patch is to generate fewer conditional branches around loops
with a For iteration scheme and dynamic bounds. The strategy is two-fold:
at -O0, try to generate the loop forms with the fewer conditional branches
directly; at -O1 or above, try to generate the do-while form expected by the
loop optimizer directly, so that loop header copying is bypassed.
Tested on x86_64-suse-linux, applied on the mainline.
2010-04-16 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/ada-tree.def (LOOP_STMT): Change to 4-operand nodes.
* gcc-interface/ada-tree.h (LOOP_STMT_TOP_COND, LOOP_STMT_BOT_COND):
Merge into...
(LOOP_STMT_COND): ...this.
(LOOP_STMT_BOTTOM_COND_P): New flag.
(LOOP_STMT_TOP_UPDATE_P): Likewise.
* gcc-interface/trans.c (can_equal_min_or_max_val_p): New function.
(can_equal_min_val_p): New static inline function.
(can_equal_max_val_p): Likewise.
(Loop_Statement_to_gnu): Use build4 in lieu of build5 and adjust to
new LOOP_STMT semantics. Use two different strategies depending on
whether optimization is enabled to translate the loop.
(gnat_gimplify_stmt) <LOOP_STMT>: Adjust to new LOOP_STMT semantics.
--
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 15158 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100416/b3142043/attachment.bin>
More information about the Gcc-patches
mailing list