From 504943f42f62f346f09a85e1f8cfaaf1eb734df9 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Thu, 12 Nov 2015 07:31:38 +0000 Subject: [PATCH] gen-pass-instances.awk: Add pass_num, prefix and postfix vars in handle_line 2015-11-12 Tom de Vries * gen-pass-instances.awk (handle_line): Add pass_num, prefix and postfix vars. From-SVN: r230212 --- gcc/ChangeLog | 5 +++++ gcc/gen-pass-instances.awk | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f35859552e7..f2c866f30a6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-11-12 Tom de Vries + + * gen-pass-instances.awk (handle_line): Add pass_num, prefix and postfix + vars. + 2015-11-12 Tom de Vries * gen-pass-instances.awk (handle_line): Add comments. diff --git a/gcc/gen-pass-instances.awk b/gcc/gen-pass-instances.awk index 3d5e8b6817a..1aced74bab1 100644 --- a/gcc/gen-pass-instances.awk +++ b/gcc/gen-pass-instances.awk @@ -61,17 +61,22 @@ function handle_line() pass_starts_at = where + len_of_start; pass_name = substr(line, pass_starts_at, len_of_pass_name); + # Find prefix (until and including pass_name) + prefix = substr(line, 1, pass_starts_at + len_of_pass_name - 1) + + # Find postfix (after pass_name) + postfix = substr(line, pass_starts_at + len_of_pass_name) + # Set pass_counts if (pass_name in pass_counts) pass_counts[pass_name]++; else pass_counts[pass_name] = 1; + pass_num = pass_counts[pass_name]; + # Print call expression with extra pass_num argument - printf "%s, %s%s\n", - substr(line, 1, pass_starts_at + len_of_pass_name - 1), - pass_counts[pass_name], - substr(line, pass_starts_at + len_of_pass_name); + printf "%s, %s%s\n", prefix, pass_num, postfix; } { handle_line() } -- 2.30.2