[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC 8/13][odr] Add --odr/--no-odr and --odr-mode=<basic,link> command line options
- To: dwz@sourceware.org, jakub@redhat.com
- Subject: Re: [RFC 8/13][odr] Add --odr/--no-odr and --odr-mode=<basic,link> command line options
- From: Tom de Vries <tdevries@suse.de>
- Date: Wed, 11 Dec 2019 16:01:09 +0100
- Authentication-results: sourceware.org; auth=none
- Autocrypt: addr=tdevries@suse.de; keydata= xsBNBF0ltCcBCADDhsUnMMdEXiHFfqJdXeRvgqSEUxLCy/pHek88ALuFnPTICTwkf4g7uSR7 HvOFUoUyu8oP5mNb4VZHy3Xy8KRZGaQuaOHNhZAT1xaVo6kxjswUi3vYgGJhFMiLuIHdApoc u5f7UbV+egYVxmkvVLSqsVD4pUgHeSoAcIlm3blZ1sDKviJCwaHxDQkVmSsGXImaAU+ViJ5l CwkvyiiIifWD2SoOuFexZyZ7RUddLosgsO0npVUYbl6dEMq2a5ijGF6/rBs1m3nAoIgpXk6P TCKlSWVW6OCneTaKM5C387972qREtiArTakRQIpvDJuiR2soGfdeJ6igGA1FZjU+IsM5ABEB AAHNH1RvbSBkZSBWcmllcyA8dGRldnJpZXNAc3VzZS5kZT7CwKsEEwEIAD4WIQSsnSe5hKbL MK1mGmjuhV2rbOJEoAUCXSW0JwIbAwUJA8JnAAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAh CRDuhV2rbOJEoBYhBKydJ7mEpsswrWYaaO6FXats4kSgc48H/Ra2lq5p3dHsrlQLqM7N68Fo eRDf3PMevXyMlrCYDGLVncQwMw3O/AkousktXKQ42DPJh65zoXB22yUt8m0g12xkLax98KFJ 5NyUloa6HflLl+wQL/uZjIdNUQaHQLw3HKwRMVi4l0/Jh/TygYG1Dtm8I4o708JS4y8GQxoQ UL0z1OM9hyM3gI2WVTTyprsBHy2EjMOu/2Xpod95pF8f90zBLajy6qXEnxlcsqreMaqmkzKn 3KTZpWRxNAS/IH3FbGQ+3RpWkNGSJpwfEMVCeyK5a1n7yt1podd1ajY5mA1jcaUmGppqx827 8TqyteNe1B/pbiUt2L/WhnTgW1NC1QDOwE0EXSW0JwEIAM99H34Bu4MKM7HDJVt864MXbx7B 1M93wVlpJ7Uq+XDFD0A0hIal028j+h6jA6bhzWto4RUfDl/9mn1StngNVFovvwtfzbamp6+W pKHZm9X5YvlIwCx131kTxCNDcF+/adRW4n8CU3pZWYmNVqhMUiPLxElA6QhXTtVBh1RkjCZQ Kmbd1szvcOfaD8s+tJABJzNZsmO2hVuFwkDrRN8Jgrh92a+yHQPd9+RybW2l7sJv26nkUH5Z 5s84P6894ebgimcprJdAkjJTgprl1nhgvptU5M9Uv85Pferoh2groQEAtRPlCGrZ2/2qVNe9 XJfSYbiyedvApWcJs5DOByTaKkcAEQEAAcLAkwQYAQgAJhYhBKydJ7mEpsswrWYaaO6FXats 4kSgBQJdJbQnAhsMBQkDwmcAACEJEO6FXats4kSgFiEErJ0nuYSmyzCtZhpo7oVdq2ziRKD3 twf7BAQBZ8TqR812zKAD7biOnWIJ0McV72PFBxmLIHp24UVe0ZogtYMxSWKLg3csh0yLVwc7 H3vldzJ9AoK3Qxp0Q6K/rDOeUy3HMqewQGcqrsRRh0NXDIQk5CgSrZslPe47qIbe3O7ik/MC q31FNIAQJPmKXX25B115MMzkSKlv4udfx7KdyxHrTSkwWZArLQiEZj5KG4cCKhIoMygPTA3U yGaIvI/BGOtHZ7bEBVUCFDFfOWJ26IOCoPnSVUvKPEOH9dv+sNy7jyBsP5QxeTqwxC/1ZtNS DUCSFQjqA6bEGwM22dP8OUY6SC94x1G81A9/xbtm9LQxKm0EiDH8KBMLfQ==
- Cc: Michael Matz <matz@suse.de>
- Delivered-to: listarch-dwz@sourceware.org
- Delivered-to: mailing list dwz@sourceware.org
- In-reply-to: <20191210171954.GA13996@delia>
- List-help: <mailto:dwz-help@sourceware.org>
- List-id: <dwz.sourceware.org>
- List-post: <mailto:dwz@sourceware.org>
- List-subscribe: <mailto:dwz-subscribe@sourceware.org>
- Mailing-list: contact dwz-help@sourceware.org; run by ezmlm
- References: <20191210171954.GA13996@delia>
- Sender: dwz-owner@sourceware.org
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.1
On 10-12-2019 18:19, Tom de Vries wrote:
> Hi,
>
> Add optimization options --odr/--no-odr and --odr-mode=<basic|link>, making
> the optimization user accessible.
>
> Any comments?
>
This updated patch also updates usage, like so (reformatted slightly
here to deal with wrapping):
...
$ dwz -?
dwz: Usage:
dwz [common options] [-h] [-m COMMONFILE] [-M NAME | -r] [FILES]
dwz [common options] -o OUTFILE FILE
dwz [ -v | -? ]
Common options:
...
--odr
--no-odr Enable/disable one definition rule
optimization.
Default value: Enabled.
--odr-mode <basic|link> Set aggressiveness level of one definition
rule optimization.
Default value: link.
...
Thanks,
- Tom
[odr] Add --odr/--no-odr and --odr-mode=<basic,link> command line options
Add optimization options --odr/--no-odr and --odr-mode=<basic|link>, making
the optimization user accessible.
2019-12-10 Tom de Vries <tdevries@suse.de>
* dwz.c (odr_parsed, no_odr_parsed, int odr_mode_parsed): New variable.
(dwz_options, dwz_common_options_help): Add --odr, --no-odr and
--odr-mode entries.
(print_options_help): Allow entries with NULL short_name and NULL msg.
(main): Handle --odr, --no-odr and --odr-mode.
---
dwz.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 65 insertions(+), 15 deletions(-)
diff --git a/dwz.c b/dwz.c
index 319a23c..866ea77 100644
--- a/dwz.c
+++ b/dwz.c
@@ -184,6 +184,9 @@ static enum die_count_methods die_count_method = estimate;
int odr = 0;
enum odr_mode { ODR_BASIC, ODR_LINK };
enum odr_mode odr_mode = ODR_LINK;
+int odr_parsed = 0;
+int no_odr_parsed = 0;
+int odr_mode_parsed = 0;
typedef struct
{
@@ -13826,6 +13829,9 @@ static struct option dwz_options[] =
{ "devel-die-count-method",
required_argument, &die_count_method_parsed, 1 },
#endif
+ { "odr", no_argument, &odr_parsed, 1 },
+ { "no-odr", no_argument, &no_odr_parsed, 1 },
+ { "odr-mode", required_argument, &odr_mode_parsed, 1 },
{ NULL, no_argument, 0, 0 }
};
@@ -13848,7 +13854,13 @@ static struct option_help dwz_common_options_help[] =
"Handle files larger than this limit using a slower and more memory"
" usage friendly mode and don't optimize those files in multifile mode." },
{ "L", "max-die-limit", "<COUNT|none>", "50 million DIEs",
- "Don't optimize files larger than this limit." }
+ "Don't optimize files larger than this limit." },
+ { NULL, "odr", NULL, NULL,
+ NULL },
+ { NULL, "no-odr", NULL, "Enabled",
+ "Enable/disable one definition rule optimization." },
+ { NULL, "odr-mode", "<basic|link>", "link",
+ "Set aggressiveness level of one definition rule optimization." }
};
/* Describe single-file command line options. */
@@ -13957,12 +13969,20 @@ print_options_help (struct option_help *options_help, unsigned int n,
len += 2;
s = options_help[i].short_name;
- fprintf (stderr, "-%s", s);
- len += 2;
+ if (s)
+ {
+ fprintf (stderr, "-%s", s);
+ len += 2;
+ }
s = options_help[i].long_name;
- fprintf (stderr, ", --%s", s);
- len += 4 + strlen (s);
+ if (len == 4)
+ {
+ fprintf (stderr, ", ");
+ len += 2;
+ }
+ fprintf (stderr, "--%s", s);
+ len += 2 + strlen (s);
s = options_help[i].argument;
if (s)
@@ -13971,18 +13991,20 @@ print_options_help (struct option_help *options_help, unsigned int n,
len += 1 + strlen (s);
}
- if (len > indent)
- {
- fprintf (stderr, "\n");
- do_indent (indent);
- }
- else
- do_indent (indent - len);
- len = indent;
-
s = options_help[i].msg;
- wrap (indent, limit, s);
+ if (s)
+ {
+ if (len > indent)
+ {
+ fprintf (stderr, "\n");
+ do_indent (indent);
+ }
+ else
+ do_indent (indent - len);
+ len = indent;
+ wrap (indent, limit, s);
+ }
fprintf (stderr, "\n");
s = options_help[i].default_value;
@@ -14112,6 +14134,34 @@ main (int argc, char *argv[])
error (1, 0, "invalid argument --devel-die-count-method %s",
optarg);
}
+ if (odr_parsed)
+ {
+ assert (!no_odr_parsed);
+ odr = 1;
+ odr_parsed = 0;
+ }
+ if (no_odr_parsed)
+ {
+ assert (!odr_parsed);
+ odr = 0;
+ no_odr_parsed = 0;
+ }
+ if (odr_mode_parsed)
+ {
+ odr_mode_parsed = 0;
+ if (strcmp (optarg, "basic") == 0)
+ {
+ odr_mode = ODR_BASIC;
+ break;
+ }
+ if (strcmp (optarg, "link") == 0)
+ {
+ odr_mode = ODR_LINK;
+ break;
+ }
+ error (1, 0, "invalid argument --odr-mode %s",
+ optarg);
+ }
break;
case 'o':