diff options
Diffstat (limited to 'tools/perf/util/parse-events.y')
-rw-r--r-- | tools/perf/util/parse-events.y | 93 |
1 files changed, 69 insertions, 24 deletions
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index d9637da7333..362cc59332a 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -1,7 +1,6 @@ %name-prefix "parse_events_" %parse-param {struct list_head *list_all} -%parse-param {struct list_head *list_event} %parse-param {int *idx} %{ @@ -41,6 +40,14 @@ do { \ %type <str> PE_MODIFIER_BP %type <head> event_config %type <term> event_term +%type <head> event_pmu +%type <head> event_legacy_symbol +%type <head> event_legacy_cache +%type <head> event_legacy_mem +%type <head> event_legacy_tracepoint +%type <head> event_legacy_numeric +%type <head> event_legacy_raw +%type <head> event_def %union { @@ -62,13 +69,13 @@ event_def PE_MODIFIER_EVENT * (there could be more events added for multiple tracepoint * definitions via '*?'. */ - ABORT_ON(parse_events_modifier(list_event, $2)); - parse_events_update_lists(list_event, list_all); + ABORT_ON(parse_events_modifier($1, $2)); + parse_events_update_lists($1, list_all); } | event_def { - parse_events_update_lists(list_event, list_all); + parse_events_update_lists($1, list_all); } event_def: event_pmu | @@ -82,71 +89,102 @@ event_def: event_pmu | event_pmu: PE_NAME '/' event_config '/' { - ABORT_ON(parse_events_add_pmu(list_event, idx, $1, $3)); + struct list_head *list = NULL; + + ABORT_ON(parse_events_add_pmu(&list, idx, $1, $3)); parse_events__free_terms($3); + $$ = list; } event_legacy_symbol: PE_VALUE_SYM '/' event_config '/' { + struct list_head *list = NULL; int type = $1 >> 16; int config = $1 & 255; - ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, $3)); + ABORT_ON(parse_events_add_numeric(&list, idx, type, config, $3)); parse_events__free_terms($3); + $$ = list; } | PE_VALUE_SYM sep_slash_dc { + struct list_head *list = NULL; int type = $1 >> 16; int config = $1 & 255; - ABORT_ON(parse_events_add_numeric(list_event, idx, type, config, NULL)); + ABORT_ON(parse_events_add_numeric(&list, idx, type, config, NULL)); + $$ = list; } event_legacy_cache: PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT { - ABORT_ON(parse_events_add_cache(list_event, idx, $1, $3, $5)); + struct list_head *list = NULL; + + ABORT_ON(parse_events_add_cache(&list, idx, $1, $3, $5)); + $$ = list; } | PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT { - ABORT_ON(parse_events_add_cache(list_event, idx, $1, $3, NULL)); + struct list_head *list = NULL; + + ABORT_ON(parse_events_add_cache(&list, idx, $1, $3, NULL)); + $$ = list; } | PE_NAME_CACHE_TYPE { - ABORT_ON(parse_events_add_cache(list_event, idx, $1, NULL, NULL)); + struct list_head *list = NULL; + + ABORT_ON(parse_events_add_cache(&list, idx, $1, NULL, NULL)); + $$ = list; } event_legacy_mem: PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc { - ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) $2, $4)); + struct list_head *list = NULL; + + ABORT_ON(parse_events_add_breakpoint(&list, idx, (void *) $2, $4)); + $$ = list; } | PE_PREFIX_MEM PE_VALUE sep_dc { - ABORT_ON(parse_events_add_breakpoint(list_event, idx, (void *) $2, NULL)); + struct list_head *list = NULL; + + ABORT_ON(parse_events_add_breakpoint(&list, idx, (void *) $2, NULL)); + $$ = list; } event_legacy_tracepoint: PE_NAME ':' PE_NAME { - ABORT_ON(parse_events_add_tracepoint(list_event, idx, $1, $3)); + struct list_head *list = NULL; + + ABORT_ON(parse_events_add_tracepoint(&list, idx, $1, $3)); + $$ = list; } event_legacy_numeric: PE_VALUE ':' PE_VALUE { - ABORT_ON(parse_events_add_numeric(list_event, idx, $1, $3, NULL)); + struct list_head *list = NULL; + + ABORT_ON(parse_events_add_numeric(&list, idx, $1, $3, NULL)); + $$ = list; } event_legacy_raw: PE_RAW { - ABORT_ON(parse_events_add_numeric(list_event, idx, PERF_TYPE_RAW, $1, NULL)); + struct list_head *list = NULL; + + ABORT_ON(parse_events_add_numeric(&list, idx, PERF_TYPE_RAW, $1, NULL)); + $$ = list; } event_config: @@ -176,8 +214,8 @@ PE_NAME '=' PE_NAME { struct parse_events__term *term; - ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_STR, - $1, $3, 0)); + ABORT_ON(parse_events__term_str(&term, PARSE_EVENTS__TERM_TYPE_USER, + $1, $3)); $$ = term; } | @@ -185,8 +223,8 @@ PE_NAME '=' PE_VALUE { struct parse_events__term *term; - ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_NUM, - $1, NULL, $3)); + ABORT_ON(parse_events__term_num(&term, PARSE_EVENTS__TERM_TYPE_USER, + $1, $3)); $$ = term; } | @@ -194,8 +232,16 @@ PE_NAME { struct parse_events__term *term; - ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_NUM, - $1, NULL, 1)); + ABORT_ON(parse_events__term_num(&term, PARSE_EVENTS__TERM_TYPE_USER, + $1, 1)); + $$ = term; +} +| +PE_TERM '=' PE_NAME +{ + struct parse_events__term *term; + + ABORT_ON(parse_events__term_str(&term, $1, NULL, $3)); $$ = term; } | @@ -203,7 +249,7 @@ PE_TERM '=' PE_VALUE { struct parse_events__term *term; - ABORT_ON(parse_events__new_term(&term, $1, NULL, NULL, $3)); + ABORT_ON(parse_events__term_num(&term, $1, NULL, $3)); $$ = term; } | @@ -211,7 +257,7 @@ PE_TERM { struct parse_events__term *term; - ABORT_ON(parse_events__new_term(&term, $1, NULL, NULL, 1)); + ABORT_ON(parse_events__term_num(&term, $1, NULL, 1)); $$ = term; } @@ -222,7 +268,6 @@ sep_slash_dc: '/' | ':' | %% void parse_events_error(struct list_head *list_all __used, - struct list_head *list_event __used, int *idx __used, char const *msg __used) { |