From: Jakub Jelinek Date: Mon, 5 Oct 2020 07:34:42 +0000 (+0200) Subject: options: Save and restore opts_set for Optimization and Target options fallout X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3c022a4c732163549ee999fb0b1846215cf0a671;p=gcc.git options: Save and restore opts_set for Optimization and Target options fallout > This breaks ia64: > > In file included from ./tm.h:23, > from ../../gcc/gencheck.c:23: > ./options.h:7816:40: error: ISO C++ forbids zero-size array 'explicit_mask' [-Werror=pedantic] > 7816 | unsigned HOST_WIDE_INT explicit_mask[0]; > | ^ > ./options.h:7816:26: error: zero-size array member 'cl_target_option::explicit_mask' not at end of 'struct cl_target_option' [-Werror=pedantic] > 7816 | unsigned HOST_WIDE_INT explicit_mask[0]; > | ^~~~~~~~~~~~~ > ./options.h:7812:16: note: in the definition of 'struct cl_target_option' > 7812 | struct GTY(()) cl_target_option > | ^~~~~~~~~~~~~~~~ Oops, sorry. The following patch should fix that and should also fix streaming of the new explicit_mask_* members. 2020-10-05 Jakub Jelinek * opth-gen.awk: Don't emit explicit_mask array if n_target_explicit is equal to n_target_explicit_mask. * optc-save-gen.awk: Compute has_target_explicit_mask and if false, don't emit code iterating over explicit_mask array elements. Stream also explicit_mask_* target members. --- diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk index 56a5df3d33e..5169acd5f58 100644 --- a/gcc/optc-save-gen.awk +++ b/gcc/optc-save-gen.awk @@ -689,6 +689,10 @@ for (i = 0; i < n_target_string; i++) { if (j != 0) { print " ptr->explicit_mask[" k "] = mask;"; } +has_target_explicit_mask = 0; +if (j != 0 || k != 0) { + has_target_explicit_mask = 1; +} print "}"; @@ -1075,9 +1079,11 @@ for (i = 0; i < n_target_val; i++) { print " return false;"; } -print " for (size_t i = 0; i < sizeof (ptr1->explicit_mask) / sizeof (ptr1->explicit_mask[0]); i++)"; -print " if (ptr1->explicit_mask[i] != ptr2->explicit_mask[i])"; -print " return false;" +if (has_target_explicit_mask) { + print " for (size_t i = 0; i < sizeof (ptr1->explicit_mask) / sizeof (ptr1->explicit_mask[0]); i++)"; + print " if (ptr1->explicit_mask[i] != ptr2->explicit_mask[i])"; + print " return false;" +} for (i = 0; i < n_target_other; i++) { if (var_target_other[i] in var_target_explicit_mask) { @@ -1121,8 +1127,10 @@ for (i = 0; i < n_target_val; i++) { name = var_target_val[i] print " hstate.add_hwi (ptr->" name");"; } -print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)"; -print " hstate.add_hwi (ptr->explicit_mask[i]);"; +if (has_target_explicit_mask) { + print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)"; + print " hstate.add_hwi (ptr->explicit_mask[i]);"; +} for (i = 0; i < n_target_other; i++) { if (var_target_other[i] in var_target_explicit_mask) @@ -1159,8 +1167,22 @@ for (i = 0; i < n_target_val; i++) { print " bp_pack_value (bp, ptr->" name", 64);"; } -print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)"; -print " bp_pack_value (bp, ptr->explicit_mask[i], 64);"; +if (has_target_explicit_mask) { + print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)"; + print " bp_pack_value (bp, ptr->explicit_mask[i], 64);"; +} + +for (i = 0; i < n_target_other; i++) { + if (var_target_other[i] in var_target_explicit_mask) { + print " bp_pack_value (bp, ptr->explicit_mask_" var_target_other[i] ", 64);"; + } +} + +for (i = 0; i < n_target_int; i++) { + if (var_target_int[i] in var_target_explicit_mask) { + print " bp_pack_value (bp, ptr->explicit_mask_" var_target_int[i] ", 64);"; + } +} print "}"; @@ -1188,8 +1210,22 @@ for (i = 0; i < n_target_val; i++) { print " ptr->" name" = (" var_target_val_type[i] ") bp_unpack_value (bp, 64);"; } -print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)"; -print " ptr->explicit_mask[i] = bp_unpack_value (bp, 64);"; +if (has_target_explicit_mask) { + print " for (size_t i = 0; i < sizeof (ptr->explicit_mask) / sizeof (ptr->explicit_mask[0]); i++)"; + print " ptr->explicit_mask[i] = bp_unpack_value (bp, 64);"; +} + +for (i = 0; i < n_target_other; i++) { + if (var_target_other[i] in var_target_explicit_mask) { + print " ptr->explicit_mask_" var_target_other[i] " = bp_unpack_value (bp, 64);"; + } +} + +for (i = 0; i < n_target_int; i++) { + if (var_target_int[i] in var_target_explicit_mask) { + print " ptr->explicit_mask_" var_target_int[i] " = bp_unpack_value (bp, 64);"; + } +} print "}"; diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk index a1ca579f24f..a456b51e893 100644 --- a/gcc/opth-gen.awk +++ b/gcc/opth-gen.awk @@ -291,7 +291,10 @@ for (i = 0; i < n_target_char; i++) { } print " /* " n_target_explicit - n_target_explicit_mask " members */"; -print " unsigned HOST_WIDE_INT explicit_mask[" int ((n_target_explicit - n_target_explicit_mask + 63) / 64) "];"; +if (n_target_explicit > n_target_explicit_mask) { + print " unsigned HOST_WIDE_INT explicit_mask[" \ + int ((n_target_explicit - n_target_explicit_mask + 63) / 64) "];"; +} for (i = 0; i < n_target_explicit_mask; i++) { print " " var_target_explicit_mask[i] ";";