Zheng Yan | ac20de6f | 2012-06-15 14:31:39 +0800 | [diff] [blame] | 1 | %pure-parser |
Jiri Olsa | 46010ab | 2012-06-15 14:31:38 +0800 | [diff] [blame] | 2 | %parse-param {void *_data} |
Zheng Yan | ac20de6f | 2012-06-15 14:31:39 +0800 | [diff] [blame] | 3 | %parse-param {void *scanner} |
| 4 | %lex-param {void* scanner} |
Jiri Olsa | 6297d42 | 2015-04-22 21:10:17 +0200 | [diff] [blame] | 5 | %locations |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 6 | |
| 7 | %{ |
| 8 | |
| 9 | #define YYDEBUG 1 |
| 10 | |
| 11 | #include <linux/compiler.h> |
| 12 | #include <linux/list.h> |
Borislav Petkov | d944c4e | 2014-04-25 21:31:02 +0200 | [diff] [blame] | 13 | #include <linux/types.h> |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 14 | #include "util.h" |
| 15 | #include "parse-events.h" |
Zheng Yan | ac20de6f | 2012-06-15 14:31:39 +0800 | [diff] [blame] | 16 | #include "parse-events-bison.h" |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 17 | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 18 | #define ABORT_ON(val) \ |
| 19 | do { \ |
| 20 | if (val) \ |
| 21 | YYABORT; \ |
| 22 | } while (0) |
| 23 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 24 | #define ALLOC_LIST(list) \ |
| 25 | do { \ |
| 26 | list = malloc(sizeof(*list)); \ |
| 27 | ABORT_ON(!list); \ |
| 28 | INIT_LIST_HEAD(list); \ |
| 29 | } while (0) |
| 30 | |
Namhyung Kim | 97f63e4 | 2013-01-22 18:09:29 +0900 | [diff] [blame] | 31 | static inc_group_count(struct list_head *list, |
| 32 | struct parse_events_evlist *data) |
| 33 | { |
| 34 | /* Count groups only have more than 1 members */ |
| 35 | if (!list_is_last(list->next, list)) |
| 36 | data->nr_groups++; |
| 37 | } |
| 38 | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 39 | %} |
| 40 | |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 41 | %token PE_START_EVENTS PE_START_TERMS |
Jiri Olsa | cf3506d | 2012-07-04 00:00:43 +0200 | [diff] [blame] | 42 | %token PE_VALUE PE_VALUE_SYM_HW PE_VALUE_SYM_SW PE_RAW PE_TERM |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 43 | %token PE_EVENT_NAME |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 44 | %token PE_NAME |
| 45 | %token PE_MODIFIER_EVENT PE_MODIFIER_BP |
| 46 | %token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 47 | %token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 48 | %token PE_ERROR |
Kan Liang | ba32a45 | 2014-10-07 11:08:51 -0400 | [diff] [blame] | 49 | %token PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 50 | %type <num> PE_VALUE |
Jiri Olsa | cf3506d | 2012-07-04 00:00:43 +0200 | [diff] [blame] | 51 | %type <num> PE_VALUE_SYM_HW |
| 52 | %type <num> PE_VALUE_SYM_SW |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 53 | %type <num> PE_RAW |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 54 | %type <num> PE_TERM |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 55 | %type <str> PE_NAME |
| 56 | %type <str> PE_NAME_CACHE_TYPE |
| 57 | %type <str> PE_NAME_CACHE_OP_RESULT |
| 58 | %type <str> PE_MODIFIER_EVENT |
| 59 | %type <str> PE_MODIFIER_BP |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 60 | %type <str> PE_EVENT_NAME |
Kan Liang | ba32a45 | 2014-10-07 11:08:51 -0400 | [diff] [blame] | 61 | %type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT |
Jiri Olsa | cf3506d | 2012-07-04 00:00:43 +0200 | [diff] [blame] | 62 | %type <num> value_sym |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 63 | %type <head> event_config |
| 64 | %type <term> event_term |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 65 | %type <head> event_pmu |
| 66 | %type <head> event_legacy_symbol |
| 67 | %type <head> event_legacy_cache |
| 68 | %type <head> event_legacy_mem |
| 69 | %type <head> event_legacy_tracepoint |
| 70 | %type <head> event_legacy_numeric |
| 71 | %type <head> event_legacy_raw |
| 72 | %type <head> event_def |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 73 | %type <head> event_mod |
| 74 | %type <head> event_name |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 75 | %type <head> event |
| 76 | %type <head> events |
| 77 | %type <head> group_def |
| 78 | %type <head> group |
| 79 | %type <head> groups |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 80 | |
| 81 | %union |
| 82 | { |
| 83 | char *str; |
Robert Richter | b527bab | 2012-08-07 19:43:13 +0200 | [diff] [blame] | 84 | u64 num; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 85 | struct list_head *head; |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 86 | struct parse_events_term *term; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 87 | } |
| 88 | %% |
| 89 | |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 90 | start: |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 91 | PE_START_EVENTS start_events |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 92 | | |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 93 | PE_START_TERMS start_terms |
| 94 | |
| 95 | start_events: groups |
| 96 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 97 | struct parse_events_evlist *data = _data; |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 98 | |
| 99 | parse_events_update_lists($1, &data->list); |
| 100 | } |
| 101 | |
| 102 | groups: |
| 103 | groups ',' group |
| 104 | { |
| 105 | struct list_head *list = $1; |
| 106 | struct list_head *group = $3; |
| 107 | |
| 108 | parse_events_update_lists(group, list); |
| 109 | $$ = list; |
| 110 | } |
| 111 | | |
| 112 | groups ',' event |
| 113 | { |
| 114 | struct list_head *list = $1; |
| 115 | struct list_head *event = $3; |
| 116 | |
| 117 | parse_events_update_lists(event, list); |
| 118 | $$ = list; |
| 119 | } |
| 120 | | |
| 121 | group |
| 122 | | |
| 123 | event |
| 124 | |
| 125 | group: |
| 126 | group_def ':' PE_MODIFIER_EVENT |
| 127 | { |
| 128 | struct list_head *list = $1; |
| 129 | |
| 130 | ABORT_ON(parse_events__modifier_group(list, $3)); |
| 131 | $$ = list; |
| 132 | } |
| 133 | | |
| 134 | group_def |
| 135 | |
| 136 | group_def: |
| 137 | PE_NAME '{' events '}' |
| 138 | { |
| 139 | struct list_head *list = $3; |
| 140 | |
Namhyung Kim | 97f63e4 | 2013-01-22 18:09:29 +0900 | [diff] [blame] | 141 | inc_group_count(list, _data); |
Arnaldo Carvalho de Melo | 63dab22 | 2012-08-14 16:35:48 -0300 | [diff] [blame] | 142 | parse_events__set_leader($1, list); |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 143 | $$ = list; |
| 144 | } |
| 145 | | |
| 146 | '{' events '}' |
| 147 | { |
| 148 | struct list_head *list = $2; |
| 149 | |
Namhyung Kim | 97f63e4 | 2013-01-22 18:09:29 +0900 | [diff] [blame] | 150 | inc_group_count(list, _data); |
Arnaldo Carvalho de Melo | 63dab22 | 2012-08-14 16:35:48 -0300 | [diff] [blame] | 151 | parse_events__set_leader(NULL, list); |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 152 | $$ = list; |
| 153 | } |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 154 | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 155 | events: |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 156 | events ',' event |
| 157 | { |
| 158 | struct list_head *event = $3; |
| 159 | struct list_head *list = $1; |
| 160 | |
| 161 | parse_events_update_lists(event, list); |
| 162 | $$ = list; |
| 163 | } |
| 164 | | |
| 165 | event |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 166 | |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 167 | event: event_mod |
| 168 | |
| 169 | event_mod: |
| 170 | event_name PE_MODIFIER_EVENT |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 171 | { |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 172 | struct list_head *list = $1; |
Jiri Olsa | 46010ab | 2012-06-15 14:31:38 +0800 | [diff] [blame] | 173 | |
Jiri Olsa | 5d7be90 | 2012-03-20 19:15:40 +0100 | [diff] [blame] | 174 | /* |
| 175 | * Apply modifier on all events added by single event definition |
| 176 | * (there could be more events added for multiple tracepoint |
| 177 | * definitions via '*?'. |
| 178 | */ |
Jiri Olsa | f5b1135 | 2012-08-08 12:21:54 +0200 | [diff] [blame] | 179 | ABORT_ON(parse_events__modifier_event(list, $2, false)); |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 180 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 181 | } |
| 182 | | |
Robert Richter | ac2ba9f | 2012-08-16 21:10:21 +0200 | [diff] [blame] | 183 | event_name |
| 184 | |
| 185 | event_name: |
| 186 | PE_EVENT_NAME event_def |
| 187 | { |
| 188 | ABORT_ON(parse_events_name($2, $1)); |
| 189 | free($1); |
| 190 | $$ = $2; |
| 191 | } |
| 192 | | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 193 | event_def |
| 194 | |
Jiri Olsa | 5f537a2 | 2012-03-15 20:09:18 +0100 | [diff] [blame] | 195 | event_def: event_pmu | |
| 196 | event_legacy_symbol | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 197 | event_legacy_cache sep_dc | |
| 198 | event_legacy_mem | |
| 199 | event_legacy_tracepoint sep_dc | |
| 200 | event_legacy_numeric sep_dc | |
| 201 | event_legacy_raw sep_dc |
| 202 | |
Jiri Olsa | 5f537a2 | 2012-03-15 20:09:18 +0100 | [diff] [blame] | 203 | event_pmu: |
| 204 | PE_NAME '/' event_config '/' |
| 205 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 206 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 207 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 208 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 209 | ALLOC_LIST(list); |
Jiri Olsa | 36adec8 | 2015-04-22 21:10:19 +0200 | [diff] [blame^] | 210 | ABORT_ON(parse_events_add_pmu(data, list, $1, $3)); |
Jiri Olsa | 5f537a2 | 2012-03-15 20:09:18 +0100 | [diff] [blame] | 211 | parse_events__free_terms($3); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 212 | $$ = list; |
Jiri Olsa | 5f537a2 | 2012-03-15 20:09:18 +0100 | [diff] [blame] | 213 | } |
Adrian Hunter | ad96227 | 2014-08-15 22:08:40 +0300 | [diff] [blame] | 214 | | |
| 215 | PE_NAME '/' '/' |
| 216 | { |
| 217 | struct parse_events_evlist *data = _data; |
| 218 | struct list_head *list; |
| 219 | |
| 220 | ALLOC_LIST(list); |
Jiri Olsa | 36adec8 | 2015-04-22 21:10:19 +0200 | [diff] [blame^] | 221 | ABORT_ON(parse_events_add_pmu(data, list, $1, NULL)); |
Adrian Hunter | ad96227 | 2014-08-15 22:08:40 +0300 | [diff] [blame] | 222 | $$ = list; |
| 223 | } |
Kan Liang | ba32a45 | 2014-10-07 11:08:51 -0400 | [diff] [blame] | 224 | | |
| 225 | PE_KERNEL_PMU_EVENT sep_dc |
| 226 | { |
| 227 | struct parse_events_evlist *data = _data; |
| 228 | struct list_head *head; |
| 229 | struct parse_events_term *term; |
| 230 | struct list_head *list; |
| 231 | |
| 232 | ALLOC_LIST(head); |
| 233 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, |
| 234 | $1, 1)); |
| 235 | list_add_tail(&term->list, head); |
| 236 | |
| 237 | ALLOC_LIST(list); |
Jiri Olsa | 36adec8 | 2015-04-22 21:10:19 +0200 | [diff] [blame^] | 238 | ABORT_ON(parse_events_add_pmu(data, list, "cpu", head)); |
Kan Liang | ba32a45 | 2014-10-07 11:08:51 -0400 | [diff] [blame] | 239 | parse_events__free_terms(head); |
| 240 | $$ = list; |
| 241 | } |
| 242 | | |
| 243 | PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc |
| 244 | { |
| 245 | struct parse_events_evlist *data = _data; |
| 246 | struct list_head *head; |
| 247 | struct parse_events_term *term; |
| 248 | struct list_head *list; |
| 249 | char pmu_name[128]; |
| 250 | snprintf(&pmu_name, 128, "%s-%s", $1, $3); |
| 251 | |
| 252 | ALLOC_LIST(head); |
| 253 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, |
| 254 | &pmu_name, 1)); |
| 255 | list_add_tail(&term->list, head); |
| 256 | |
| 257 | ALLOC_LIST(list); |
| 258 | ABORT_ON(parse_events_add_pmu(list, &data->idx, "cpu", head)); |
| 259 | parse_events__free_terms(head); |
| 260 | $$ = list; |
| 261 | } |
Jiri Olsa | 5f537a2 | 2012-03-15 20:09:18 +0100 | [diff] [blame] | 262 | |
Jiri Olsa | cf3506d | 2012-07-04 00:00:43 +0200 | [diff] [blame] | 263 | value_sym: |
| 264 | PE_VALUE_SYM_HW |
| 265 | | |
| 266 | PE_VALUE_SYM_SW |
| 267 | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 268 | event_legacy_symbol: |
Jiri Olsa | cf3506d | 2012-07-04 00:00:43 +0200 | [diff] [blame] | 269 | value_sym '/' event_config '/' |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 270 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 271 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 272 | struct list_head *list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 273 | int type = $1 >> 16; |
| 274 | int config = $1 & 255; |
| 275 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 276 | ALLOC_LIST(list); |
| 277 | ABORT_ON(parse_events_add_numeric(list, &data->idx, |
Jiri Olsa | 46010ab | 2012-06-15 14:31:38 +0800 | [diff] [blame] | 278 | type, config, $3)); |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 279 | parse_events__free_terms($3); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 280 | $$ = list; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 281 | } |
| 282 | | |
Jiri Olsa | cf3506d | 2012-07-04 00:00:43 +0200 | [diff] [blame] | 283 | value_sym sep_slash_dc |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 284 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 285 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 286 | struct list_head *list; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 287 | int type = $1 >> 16; |
| 288 | int config = $1 & 255; |
| 289 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 290 | ALLOC_LIST(list); |
| 291 | ABORT_ON(parse_events_add_numeric(list, &data->idx, |
Jiri Olsa | 46010ab | 2012-06-15 14:31:38 +0800 | [diff] [blame] | 292 | type, config, NULL)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 293 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | event_legacy_cache: |
| 297 | PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT |
| 298 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 299 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 300 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 301 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 302 | ALLOC_LIST(list); |
| 303 | ABORT_ON(parse_events_add_cache(list, &data->idx, $1, $3, $5)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 304 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 305 | } |
| 306 | | |
| 307 | PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT |
| 308 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 309 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 310 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 311 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 312 | ALLOC_LIST(list); |
| 313 | ABORT_ON(parse_events_add_cache(list, &data->idx, $1, $3, NULL)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 314 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 315 | } |
| 316 | | |
| 317 | PE_NAME_CACHE_TYPE |
| 318 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 319 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 320 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 321 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 322 | ALLOC_LIST(list); |
| 323 | ABORT_ON(parse_events_add_cache(list, &data->idx, $1, NULL, NULL)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 324 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 325 | } |
| 326 | |
| 327 | event_legacy_mem: |
Jacob Shin | 3741eb9 | 2014-05-29 17:26:51 +0200 | [diff] [blame] | 328 | PE_PREFIX_MEM PE_VALUE '/' PE_VALUE ':' PE_MODIFIER_BP sep_dc |
| 329 | { |
| 330 | struct parse_events_evlist *data = _data; |
| 331 | struct list_head *list; |
| 332 | |
| 333 | ALLOC_LIST(list); |
| 334 | ABORT_ON(parse_events_add_breakpoint(list, &data->idx, |
| 335 | (void *) $2, $6, $4)); |
| 336 | $$ = list; |
| 337 | } |
| 338 | | |
| 339 | PE_PREFIX_MEM PE_VALUE '/' PE_VALUE sep_dc |
| 340 | { |
| 341 | struct parse_events_evlist *data = _data; |
| 342 | struct list_head *list; |
| 343 | |
| 344 | ALLOC_LIST(list); |
| 345 | ABORT_ON(parse_events_add_breakpoint(list, &data->idx, |
| 346 | (void *) $2, NULL, $4)); |
| 347 | $$ = list; |
| 348 | } |
| 349 | | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 350 | PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc |
| 351 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 352 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 353 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 354 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 355 | ALLOC_LIST(list); |
| 356 | ABORT_ON(parse_events_add_breakpoint(list, &data->idx, |
Jacob Shin | 3741eb9 | 2014-05-29 17:26:51 +0200 | [diff] [blame] | 357 | (void *) $2, $4, 0)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 358 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 359 | } |
| 360 | | |
| 361 | PE_PREFIX_MEM PE_VALUE sep_dc |
| 362 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 363 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 364 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 365 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 366 | ALLOC_LIST(list); |
| 367 | ABORT_ON(parse_events_add_breakpoint(list, &data->idx, |
Jacob Shin | 3741eb9 | 2014-05-29 17:26:51 +0200 | [diff] [blame] | 368 | (void *) $2, NULL, 0)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 369 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 370 | } |
| 371 | |
| 372 | event_legacy_tracepoint: |
Alexander Yarygin | 2b9032e | 2014-04-25 17:34:05 +0200 | [diff] [blame] | 373 | PE_NAME '-' PE_NAME ':' PE_NAME |
| 374 | { |
| 375 | struct parse_events_evlist *data = _data; |
| 376 | struct list_head *list; |
| 377 | char sys_name[128]; |
| 378 | snprintf(&sys_name, 128, "%s-%s", $1, $3); |
| 379 | |
| 380 | ALLOC_LIST(list); |
| 381 | ABORT_ON(parse_events_add_tracepoint(list, &data->idx, &sys_name, $5)); |
| 382 | $$ = list; |
| 383 | } |
| 384 | | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 385 | PE_NAME ':' PE_NAME |
| 386 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 387 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 388 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 389 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 390 | ALLOC_LIST(list); |
| 391 | ABORT_ON(parse_events_add_tracepoint(list, &data->idx, $1, $3)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 392 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 393 | } |
| 394 | |
| 395 | event_legacy_numeric: |
| 396 | PE_VALUE ':' PE_VALUE |
| 397 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 398 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 399 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 400 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 401 | ALLOC_LIST(list); |
| 402 | ABORT_ON(parse_events_add_numeric(list, &data->idx, (u32)$1, $3, NULL)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 403 | $$ = list; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 404 | } |
| 405 | |
| 406 | event_legacy_raw: |
| 407 | PE_RAW |
| 408 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 409 | struct parse_events_evlist *data = _data; |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 410 | struct list_head *list; |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 411 | |
David Ahern | c5cd8ac | 2013-07-02 13:27:25 -0600 | [diff] [blame] | 412 | ALLOC_LIST(list); |
| 413 | ABORT_ON(parse_events_add_numeric(list, &data->idx, |
Jiri Olsa | 46010ab | 2012-06-15 14:31:38 +0800 | [diff] [blame] | 414 | PERF_TYPE_RAW, $1, NULL)); |
Jiri Olsa | b847cbd | 2012-05-21 09:12:51 +0200 | [diff] [blame] | 415 | $$ = list; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 416 | } |
| 417 | |
Jiri Olsa | 89efb02 | 2012-08-08 12:14:14 +0200 | [diff] [blame] | 418 | start_terms: event_config |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 419 | { |
Arnaldo Carvalho de Melo | 23b6339 | 2013-01-18 16:56:57 -0300 | [diff] [blame] | 420 | struct parse_events_terms *data = _data; |
Jiri Olsa | 90e2b22 | 2012-06-15 14:31:40 +0800 | [diff] [blame] | 421 | data->terms = $1; |
| 422 | } |
| 423 | |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 424 | event_config: |
| 425 | event_config ',' event_term |
| 426 | { |
| 427 | struct list_head *head = $1; |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 428 | struct parse_events_term *term = $3; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 429 | |
| 430 | ABORT_ON(!head); |
| 431 | list_add_tail(&term->list, head); |
| 432 | $$ = $1; |
| 433 | } |
| 434 | | |
| 435 | event_term |
| 436 | { |
| 437 | struct list_head *head = malloc(sizeof(*head)); |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 438 | struct parse_events_term *term = $1; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 439 | |
| 440 | ABORT_ON(!head); |
| 441 | INIT_LIST_HEAD(head); |
| 442 | list_add_tail(&term->list, head); |
| 443 | $$ = head; |
| 444 | } |
| 445 | |
| 446 | event_term: |
| 447 | PE_NAME '=' PE_NAME |
| 448 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 449 | struct parse_events_term *term; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 450 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 451 | ABORT_ON(parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_USER, |
Jiri Olsa | 16fa7e8 | 2012-04-25 18:24:57 +0200 | [diff] [blame] | 452 | $1, $3)); |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 453 | $$ = term; |
| 454 | } |
| 455 | | |
| 456 | PE_NAME '=' PE_VALUE |
| 457 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 458 | struct parse_events_term *term; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 459 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 460 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, |
Jiri Olsa | 16fa7e8 | 2012-04-25 18:24:57 +0200 | [diff] [blame] | 461 | $1, $3)); |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 462 | $$ = term; |
| 463 | } |
| 464 | | |
Jiri Olsa | 1d33d6d | 2012-10-10 14:53:17 +0200 | [diff] [blame] | 465 | PE_NAME '=' PE_VALUE_SYM_HW |
| 466 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 467 | struct parse_events_term *term; |
Jiri Olsa | 1d33d6d | 2012-10-10 14:53:17 +0200 | [diff] [blame] | 468 | int config = $3 & 255; |
| 469 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 470 | ABORT_ON(parse_events_term__sym_hw(&term, $1, config)); |
Jiri Olsa | 1d33d6d | 2012-10-10 14:53:17 +0200 | [diff] [blame] | 471 | $$ = term; |
| 472 | } |
| 473 | | |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 474 | PE_NAME |
| 475 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 476 | struct parse_events_term *term; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 477 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 478 | ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER, |
Jiri Olsa | 16fa7e8 | 2012-04-25 18:24:57 +0200 | [diff] [blame] | 479 | $1, 1)); |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 480 | $$ = term; |
| 481 | } |
| 482 | | |
Jiri Olsa | 1d33d6d | 2012-10-10 14:53:17 +0200 | [diff] [blame] | 483 | PE_VALUE_SYM_HW |
| 484 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 485 | struct parse_events_term *term; |
Jiri Olsa | 1d33d6d | 2012-10-10 14:53:17 +0200 | [diff] [blame] | 486 | int config = $1 & 255; |
| 487 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 488 | ABORT_ON(parse_events_term__sym_hw(&term, NULL, config)); |
Jiri Olsa | 1d33d6d | 2012-10-10 14:53:17 +0200 | [diff] [blame] | 489 | $$ = term; |
| 490 | } |
| 491 | | |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 492 | PE_TERM '=' PE_NAME |
| 493 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 494 | struct parse_events_term *term; |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 495 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 496 | ABORT_ON(parse_events_term__str(&term, (int)$1, NULL, $3)); |
Jiri Olsa | 6b5fc39 | 2012-05-21 09:12:53 +0200 | [diff] [blame] | 497 | $$ = term; |
| 498 | } |
| 499 | | |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 500 | PE_TERM '=' PE_VALUE |
| 501 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 502 | struct parse_events_term *term; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 503 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 504 | ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, $3)); |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 505 | $$ = term; |
| 506 | } |
| 507 | | |
| 508 | PE_TERM |
| 509 | { |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 510 | struct parse_events_term *term; |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 511 | |
Arnaldo Carvalho de Melo | 6cee6cd | 2013-01-18 16:29:49 -0300 | [diff] [blame] | 512 | ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1)); |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 513 | $$ = term; |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 514 | } |
| 515 | |
| 516 | sep_dc: ':' | |
| 517 | |
Jiri Olsa | 8f707d8 | 2012-03-15 20:09:16 +0100 | [diff] [blame] | 518 | sep_slash_dc: '/' | ':' | |
| 519 | |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 520 | %% |
| 521 | |
Jiri Olsa | 6297d42 | 2015-04-22 21:10:17 +0200 | [diff] [blame] | 522 | void parse_events_error(YYLTYPE *loc, void *data, |
| 523 | void *scanner __maybe_unused, |
Irina Tirdea | 1d037ca | 2012-09-11 01:15:03 +0300 | [diff] [blame] | 524 | char const *msg __maybe_unused) |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 525 | { |
Jiri Olsa | 6297d42 | 2015-04-22 21:10:17 +0200 | [diff] [blame] | 526 | parse_events_evlist_error(data, loc->last_column, "parser error"); |
Jiri Olsa | 89812fc | 2012-03-15 20:09:15 +0100 | [diff] [blame] | 527 | } |