+2019-05-29 Jakub Jelinek <jakub@redhat.com>
+
+ PR bootstrap/90543
+ * optc-save-gen.awk: In cl_optimization_print, use correct condition
+ for var_opt_string printing. In cl_optimization_print_diff, print
+ (null) instead of invoking undefined behavior if one of the
+ var_opt_string pointers is NULL and use && instead of first || in the
+ guarding condition. For var_target_other options, handle const char *
+ target variables similarly to const char * optimize node variables.
+
2019-05-29 Sam Tebbs <sam.tebbs@arm.com>
* config/aarch64/aarch64-builtins.c (aarch64_builtins): Add
}
for (i = 0; i < n_opt_string; i++) {
- print " if (ptr->x_" var_opt_char[i] ")";
+ print " if (ptr->x_" var_opt_string[i] ")";
print " fprintf (file, \"%*s%s (%s)\\n\",";
print " indent_to, \"\",";
print " \"" var_opt_string[i] "\",";
for (i = 0; i < n_opt_string; i++) {
name = var_opt_string[i]
print " if (ptr1->x_" name " != ptr2->x_" name "";
- print " || (!ptr1->x_" name" || !ptr2->x_" name
+ print " && (!ptr1->x_" name" || !ptr2->x_" name
print " || strcmp (ptr1->x_" name", ptr2->x_" name ")))";
print " fprintf (file, \"%*s%s (%s/%s)\\n\",";
print " indent_to, \"\",";
print " \"" name "\",";
- print " ptr1->x_" name ",";
- print " ptr2->x_" name ");";
+ print " ptr1->x_" name " ? ptr1->x_" name " : \"(null)\",";
+ print " ptr2->x_" name " ? ptr1->x_" name " : \"(null)\");";
print "";
}
n_target_short = 0;
n_target_int = 0;
n_target_enum = 0;
+n_target_string = 0;
n_target_other = 0;
if (have_save) {
if (otype == var_type(flags[i]))
var_target_range[name] = ""
}
+ else if (otype ~ "^const char \\**$")
+ var_target_string[n_target_string++] = name;
else
var_target_other[n_target_other++] = name;
}
print " ptr->x_" var_target_char[i] " = opts->x_" var_target_char[i] ";";
}
+for (i = 0; i < n_target_string; i++) {
+ print " ptr->x_" var_target_string[i] " = opts->x_" var_target_string[i] ";";
+}
+
print "}";
print "";
print " opts->x_" var_target_char[i] " = ptr->x_" var_target_char[i] ";";
}
+for (i = 0; i < n_target_string; i++) {
+ print " opts->x_" var_target_string[i] " = ptr->x_" var_target_string[i] ";";
+}
+
# This must occur after the normal variables in case the code depends on those
# variables.
print "";
print "";
}
+for (i = 0; i < n_target_string; i++) {
+ print " if (ptr->x_" var_target_string[i] ")";
+ print " fprintf (file, \"%*s%s (%s)\\n\",";
+ print " indent, \"\",";
+ print " \"" var_target_string[i] "\",";
+ print " ptr->x_" var_target_string[i] ");";
+ print "";
+}
+
print "";
print " if (targetm.target_option.print)";
print " targetm.target_option.print (file, indent, ptr);";
print "";
}
+for (i = 0; i < n_target_string; i++) {
+ name = var_target_string[i]
+ print " if (ptr1->x_" name " != ptr2->x_" name "";
+ print " && (!ptr1->x_" name" || !ptr2->x_" name
+ print " || strcmp (ptr1->x_" name", ptr2->x_" name ")))";
+ print " fprintf (file, \"%*s%s (%s/%s)\\n\",";
+ print " indent, \"\",";
+ print " \"" name "\",";
+ print " ptr1->x_" name " ? ptr1->x_" name " : \"(null)\",";
+ print " ptr2->x_" name " ? ptr1->x_" name " : \"(null)\");";
+ print "";
+}
+
print "}";
print "";