aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-09-16 10:04:32 +0200
committerJakub Jelinek <jakub@redhat.com>2020-09-16 10:04:32 +0200
commitd29a7cd6f4d4e9cf91987464fd080de79a0c7d31 (patch)
tree55434d3f2026efd4f598ca607da8a703b171ebeb
parentbd909071ac04e94f4b6f0baab64d0687ec55681d (diff)
downloadgcc-d29a7cd6f4d4e9cf91987464fd080de79a0c7d31.zip
gcc-d29a7cd6f4d4e9cf91987464fd080de79a0c7d31.tar.gz
gcc-d29a7cd6f4d4e9cf91987464fd080de79a0c7d31.tar.bz2
options, lto: Optimize streaming of optimization nodes
When working on the previous patch, I've noticed that all cl_optimization fields appart from strings are streamed with bp_pack_value (..., 64); so we waste quite a lot of space, given that many of the options are just booleans or char options and there are 450-ish of them. Fixed by streaming the number of bits the corresponding fields have. While for char fields we have also range information, except for 3 it is either -128, 127 or 0, 255, so it didn't seem worth it to bother with using range-ish packing. 2020-09-16 Jakub Jelinek <jakub@redhat.com> * optc-save-gen.awk: In cl_optimization_stream_out use bp_pack_var_len_{int,unsigned} instead of bp_pack_value. In cl_optimization_stream_in use bp_unpack_var_len_{int,unsigned} instead of bp_unpack_value. Formatting fix.
-rw-r--r--gcc/optc-save-gen.awk17
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk
index 2e4787e..b5c27f7 100644
--- a/gcc/optc-save-gen.awk
+++ b/gcc/optc-save-gen.awk
@@ -1257,8 +1257,10 @@ for (i = 0; i < n_opt_val; i++) {
otype = var_opt_val_type[i];
if (otype ~ "^const char \\**$")
print " bp_pack_string (ob, bp, ptr->" name", true);";
+ else if (otype ~ "^unsigned")
+ print " bp_pack_var_len_unsigned (bp, ptr->" name");";
else
- print " bp_pack_value (bp, ptr->" name", 64);";
+ print " bp_pack_var_len_int (bp, ptr->" name");";
}
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);";
@@ -1274,14 +1276,15 @@ print "{";
for (i = 0; i < n_opt_val; i++) {
name = var_opt_val[i]
otype = var_opt_val_type[i];
- if (otype ~ "^const char \\**$")
- {
- print " ptr->" name" = bp_unpack_string (data_in, bp);";
- print " if (ptr->" name")";
- print " ptr->" name" = xstrdup (ptr->" name");";
+ if (otype ~ "^const char \\**$") {
+ print " ptr->" name" = bp_unpack_string (data_in, bp);";
+ print " if (ptr->" name")";
+ print " ptr->" name" = xstrdup (ptr->" name");";
}
+ else if (otype ~ "^unsigned")
+ print " ptr->" name" = (" var_opt_val_type[i] ") bp_unpack_var_len_unsigned (bp);";
else
- print " ptr->" name" = (" var_opt_val_type[i] ") bp_unpack_value (bp, 64);";
+ print " ptr->" name" = (" var_opt_val_type[i] ") bp_unpack_var_len_int (bp);";
}
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);";