diff options
author | Caio Marcelo de Oliveira Filho <[email protected]> | 2019-01-17 13:06:04 -0800 |
---|---|---|
committer | Caio Marcelo de Oliveira Filho <[email protected]> | 2019-01-18 12:31:49 -0800 |
commit | cd56d79b59f367ef0c52d76fc5d37ecc87d0e84b (patch) | |
tree | de65d3d92fa4af45e2ba98663cbc459e90144836 /src/util | |
parent | 1952fd8d2ce90586bc20c0f24593b00604eb1592 (diff) |
nir: check NIR_SKIP to skip passes by name
Passes' function names, separated by comma, listed in NIR_SKIP
environment variable will be skipped in debug mode. The mechanism is
hooked into the _PASS macro, like NIR_PRINT.
The extra macro NIR_SKIP is available as a developer convenience, to
skip at pointer other than the passes entry points.
v2: Fix typo in NIR_SKIP macro. (Bas)
Reviewed-by: Alejandro PiƱeiro <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/debug.c | 14 | ||||
-rw-r--r-- | src/util/debug.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/util/debug.c b/src/util/debug.c index 2773b55cc4d..09de1a8bbe5 100644 --- a/src/util/debug.c +++ b/src/util/debug.c @@ -53,6 +53,20 @@ parse_debug_string(const char *debug, return flag; } +bool +comma_separated_list_contains(const char *list, const char *s) +{ + assert(list); + const size_t len = strlen(s); + + for (unsigned n; n = strcspn(list, ","), *list; list += MAX2(1, n)) { + if (n == len && !strncmp(list, s, n)) + return true; + } + + return false; +} + /** * Reads an environment variable and interprets its value as a boolean. * diff --git a/src/util/debug.h b/src/util/debug.h index 2e34ebe3421..bbcc1975545 100644 --- a/src/util/debug.h +++ b/src/util/debug.h @@ -40,6 +40,8 @@ uint64_t parse_debug_string(const char *debug, const struct debug_control *control); bool +comma_separated_list_contains(const char *list, const char *s); +bool env_var_as_boolean(const char *var_name, bool default_value); unsigned env_var_as_unsigned(const char *var_name, unsigned default_value); |