public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-3220] options, lto: Optimize streaming of optimization nodes
@ 2020-09-16 8:15 Jakub Jelinek
0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2020-09-16 8:15 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:d29a7cd6f4d4e9cf91987464fd080de79a0c7d31
commit r11-3220-gd29a7cd6f4d4e9cf91987464fd080de79a0c7d31
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Sep 16 10:04:32 2020 +0200
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.
Diff:
---
gcc/optc-save-gen.awk | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk
index 2e4787ec57e..b5c27f70ece 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);";
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-16 8:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16 8:15 [gcc r11-3220] options, lto: Optimize streaming of optimization nodes Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).