aboutsummaryrefslogtreecommitdiff
path: root/libiberty/spaces.c
diff options
context:
space:
mode:
authorAlexandre Oliva <oliva@adacore.com>2021-12-29 04:10:46 -0300
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-10 08:19:30 +0000
commitbf687b8085403b94209269e15491f286644ec10b (patch)
tree733cb752df74e859c1b174f36a19f7e5ecffcdf1 /libiberty/spaces.c
parent81d33c5c9211dd65b2ffd29424e403582e4542f9 (diff)
downloadgcc-bf687b8085403b94209269e15491f286644ec10b.zip
gcc-bf687b8085403b94209269e15491f286644ec10b.tar.gz
gcc-bf687b8085403b94209269e15491f286644ec10b.tar.bz2
[Ada] Optimize nonstandard boolean conversions
This patch improves the generated code for nonstandard boolean types. One of the improvements extends the code that avoids converting back to the nonstandard boolean type an expression computed as standard boolean, when it will be converted to a(nother) nonstandard boolean type. The other improvement involves using the literal representation constants in an If_Expression instead of dereferencing the T'Val array when converting to a (nonstandard) boolean type. Avoiding the array dereference enables the compiler middle-end to propagate the constants and perform optimizations based on them, to the point of obviating the improvement above. Unfortunately, the code generated with this alternate expansion tends to be slightly larger if it turns out to not enable any further optimization, though it's most certainly faster, especially on targets with conditional moves, more so if "store flag" is slow, as on x86. Still, the array dereference is more straightforward and shorter, so I've arranged for this alternate expansion to be used only when optimizing for speed. gcc/ada/ * exp_util.adb (Adjust_Result_Type): Leave result in Standard.Boolean if it's going to be converted to another boolean type. * exp_ch4.adb (Expand_N_Type_Conversion): When optimizing, convert to nonstandard booleans with an if_expression with boolean literals.
Diffstat (limited to 'libiberty/spaces.c')
0 files changed, 0 insertions, 0 deletions