[Ada] Improve 'Val implementation for some enumeration types
2020-06-03 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* einfo.ads (Enum_Pos_To_Rep): Adjust description.
* exp_attr.adb (Expand_N_Attribute_Reference) <Pred>:
Reimplement in the case of an enumeration type with non-standard
but contiguous representation.
<Succ>: Likewise.
<Val>: Likewise.
* exp_ch3.adb (Expand_Freeze_Enumeration_Type): Count the
literals in the first loop. If the representation is
contiguous, just build the index type of the array type and set
Enum_Pos_To_Rep to it.