diff options
author | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-05-12 15:06:10 +0200 |
---|---|---|
committer | Erick Ochoa <erick.ochoa@theobroma-systems.com> | 2020-05-14 14:46:20 +0200 |
commit | fad38b1253bcc4e47e25a3a795b32798d521972b (patch) | |
tree | ccec9b7ee8308163acd3735fe7f72196f7020579 | |
parent | 44ac8e749cb905fda22bfb26b4d210e822666249 (diff) |
Filtering out types based on cli
-rw-r--r-- | gcc/ipa-hello-world.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/ipa-hello-world.c b/gcc/ipa-hello-world.c index b3f85d2e85c..e3ea729bbb9 100644 --- a/gcc/ipa-hello-world.c +++ b/gcc/ipa-hello-world.c @@ -224,6 +224,35 @@ compare_types_in_set(typeset &types) } } +static void +filter_out_types_in_set(typeset &types) +{ + // compare everything + if (!flag_tp_types_compared) return; + + const size_t buffer_size = 1024; + const size_t cli_length = strlen(flag_tp_comparison_functions); + gcc_assert(buffer_size > cli_length); + char whitelist[buffer_size]; + strcpy(whitelist, flag_tp_types_compared); + + bool name_allowed = false; + for (auto it = types.cbegin(); it != types.cend(); name_allowed ? ++it : it = types.erase(it)) + { + const_tree type = *it; + std::string observed_name = get_type_identifier(type); + char* saveptr = whitelist; + char* expected_name = NULL; + name_allowed = false; + + while (expected_name = strtok_r(saveptr, ",", &saveptr)) + { + name_allowed |= strcmp(expected_name, observed_name.c_str()) == 0; + } + } + +} + static unsigned int iphw_execute() { @@ -237,6 +266,7 @@ iphw_execute() collect_types_from_functions_with_gimple_body(node, types); } + filter_out_types_in_set(types); compare_types_in_set(types); return 0; } |