blob: 84596617b355561288ae92bc4db1636442a63e78 [file] [log] [blame]
Zheng Yanac20de6f2012-06-15 14:31:39 +08001%pure-parser
Jiri Olsa46010ab2012-06-15 14:31:38 +08002%parse-param {void *_data}
Zheng Yanac20de6f2012-06-15 14:31:39 +08003%parse-param {void *scanner}
4%lex-param {void* scanner}
Jiri Olsa6297d422015-04-22 21:10:17 +02005%locations
Jiri Olsa89812fc2012-03-15 20:09:15 +01006
7%{
8
9#define YYDEBUG 1
10
11#include <linux/compiler.h>
12#include <linux/list.h>
Borislav Petkovd944c4e2014-04-25 21:31:02 +020013#include <linux/types.h>
Jiri Olsa89812fc2012-03-15 20:09:15 +010014#include "util.h"
15#include "parse-events.h"
Zheng Yanac20de6f2012-06-15 14:31:39 +080016#include "parse-events-bison.h"
Jiri Olsa89812fc2012-03-15 20:09:15 +010017
Jiri Olsa89812fc2012-03-15 20:09:15 +010018#define ABORT_ON(val) \
19do { \
20 if (val) \
21 YYABORT; \
22} while (0)
23
David Ahernc5cd8ac2013-07-02 13:27:25 -060024#define ALLOC_LIST(list) \
25do { \
26 list = malloc(sizeof(*list)); \
27 ABORT_ON(!list); \
28 INIT_LIST_HEAD(list); \
29} while (0)
30
Namhyung Kim97f63e42013-01-22 18:09:29 +090031static 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 Olsa89812fc2012-03-15 20:09:15 +010039%}
40
Jiri Olsa90e2b222012-06-15 14:31:40 +080041%token PE_START_EVENTS PE_START_TERMS
Jiri Olsacf3506d2012-07-04 00:00:43 +020042%token PE_VALUE PE_VALUE_SYM_HW PE_VALUE_SYM_SW PE_RAW PE_TERM
Robert Richterac2ba9f2012-08-16 21:10:21 +020043%token PE_EVENT_NAME
Jiri Olsa89812fc2012-03-15 20:09:15 +010044%token PE_NAME
45%token PE_MODIFIER_EVENT PE_MODIFIER_BP
46%token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT
Jiri Olsa89efb022012-08-08 12:14:14 +020047%token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP
Jiri Olsa89812fc2012-03-15 20:09:15 +010048%token PE_ERROR
Kan Liangba32a452014-10-07 11:08:51 -040049%token PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT
Jiri Olsa89812fc2012-03-15 20:09:15 +010050%type <num> PE_VALUE
Jiri Olsacf3506d2012-07-04 00:00:43 +020051%type <num> PE_VALUE_SYM_HW
52%type <num> PE_VALUE_SYM_SW
Jiri Olsa89812fc2012-03-15 20:09:15 +010053%type <num> PE_RAW
Jiri Olsa8f707d82012-03-15 20:09:16 +010054%type <num> PE_TERM
Jiri Olsa89812fc2012-03-15 20:09:15 +010055%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 Richterac2ba9f2012-08-16 21:10:21 +020060%type <str> PE_EVENT_NAME
Kan Liangba32a452014-10-07 11:08:51 -040061%type <str> PE_PMU_EVENT_PRE PE_PMU_EVENT_SUF PE_KERNEL_PMU_EVENT
Jiri Olsacf3506d2012-07-04 00:00:43 +020062%type <num> value_sym
Jiri Olsa8f707d82012-03-15 20:09:16 +010063%type <head> event_config
64%type <term> event_term
Jiri Olsab847cbd2012-05-21 09:12:51 +020065%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 Richterac2ba9f2012-08-16 21:10:21 +020073%type <head> event_mod
74%type <head> event_name
Jiri Olsa89efb022012-08-08 12:14:14 +020075%type <head> event
76%type <head> events
77%type <head> group_def
78%type <head> group
79%type <head> groups
Jiri Olsa89812fc2012-03-15 20:09:15 +010080
81%union
82{
83 char *str;
Robert Richterb527bab2012-08-07 19:43:13 +020084 u64 num;
Jiri Olsa8f707d82012-03-15 20:09:16 +010085 struct list_head *head;
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -030086 struct parse_events_term *term;
Jiri Olsa89812fc2012-03-15 20:09:15 +010087}
88%%
89
Jiri Olsa90e2b222012-06-15 14:31:40 +080090start:
Jiri Olsa89efb022012-08-08 12:14:14 +020091PE_START_EVENTS start_events
Jiri Olsa90e2b222012-06-15 14:31:40 +080092|
Jiri Olsa89efb022012-08-08 12:14:14 +020093PE_START_TERMS start_terms
94
95start_events: groups
96{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -030097 struct parse_events_evlist *data = _data;
Jiri Olsa89efb022012-08-08 12:14:14 +020098
99 parse_events_update_lists($1, &data->list);
100}
101
102groups:
103groups ',' 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|
112groups ',' 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|
121group
122|
123event
124
125group:
126group_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|
134group_def
135
136group_def:
137PE_NAME '{' events '}'
138{
139 struct list_head *list = $3;
140
Namhyung Kim97f63e42013-01-22 18:09:29 +0900141 inc_group_count(list, _data);
Arnaldo Carvalho de Melo63dab222012-08-14 16:35:48 -0300142 parse_events__set_leader($1, list);
Jiri Olsa89efb022012-08-08 12:14:14 +0200143 $$ = list;
144}
145|
146'{' events '}'
147{
148 struct list_head *list = $2;
149
Namhyung Kim97f63e42013-01-22 18:09:29 +0900150 inc_group_count(list, _data);
Arnaldo Carvalho de Melo63dab222012-08-14 16:35:48 -0300151 parse_events__set_leader(NULL, list);
Jiri Olsa89efb022012-08-08 12:14:14 +0200152 $$ = list;
153}
Jiri Olsa90e2b222012-06-15 14:31:40 +0800154
Jiri Olsa89812fc2012-03-15 20:09:15 +0100155events:
Jiri Olsa89efb022012-08-08 12:14:14 +0200156events ',' 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|
165event
Jiri Olsa89812fc2012-03-15 20:09:15 +0100166
Robert Richterac2ba9f2012-08-16 21:10:21 +0200167event: event_mod
168
169event_mod:
170event_name PE_MODIFIER_EVENT
Jiri Olsa89812fc2012-03-15 20:09:15 +0100171{
Jiri Olsa89efb022012-08-08 12:14:14 +0200172 struct list_head *list = $1;
Jiri Olsa46010ab2012-06-15 14:31:38 +0800173
Jiri Olsa5d7be902012-03-20 19:15:40 +0100174 /*
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 Olsaf5b11352012-08-08 12:21:54 +0200179 ABORT_ON(parse_events__modifier_event(list, $2, false));
Jiri Olsa89efb022012-08-08 12:14:14 +0200180 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100181}
182|
Robert Richterac2ba9f2012-08-16 21:10:21 +0200183event_name
184
185event_name:
186PE_EVENT_NAME event_def
187{
188 ABORT_ON(parse_events_name($2, $1));
189 free($1);
190 $$ = $2;
191}
192|
Jiri Olsa89812fc2012-03-15 20:09:15 +0100193event_def
194
Jiri Olsa5f537a22012-03-15 20:09:18 +0100195event_def: event_pmu |
196 event_legacy_symbol |
Jiri Olsa89812fc2012-03-15 20:09:15 +0100197 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 Olsa5f537a22012-03-15 20:09:18 +0100203event_pmu:
204PE_NAME '/' event_config '/'
205{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300206 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600207 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200208
David Ahernc5cd8ac2013-07-02 13:27:25 -0600209 ALLOC_LIST(list);
Jiri Olsa36adec82015-04-22 21:10:19 +0200210 ABORT_ON(parse_events_add_pmu(data, list, $1, $3));
Jiri Olsa5f537a22012-03-15 20:09:18 +0100211 parse_events__free_terms($3);
Jiri Olsab847cbd2012-05-21 09:12:51 +0200212 $$ = list;
Jiri Olsa5f537a22012-03-15 20:09:18 +0100213}
Adrian Hunterad962272014-08-15 22:08:40 +0300214|
215PE_NAME '/' '/'
216{
217 struct parse_events_evlist *data = _data;
218 struct list_head *list;
219
220 ALLOC_LIST(list);
Jiri Olsa36adec82015-04-22 21:10:19 +0200221 ABORT_ON(parse_events_add_pmu(data, list, $1, NULL));
Adrian Hunterad962272014-08-15 22:08:40 +0300222 $$ = list;
223}
Kan Liangba32a452014-10-07 11:08:51 -0400224|
225PE_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 Olsa36adec82015-04-22 21:10:19 +0200238 ABORT_ON(parse_events_add_pmu(data, list, "cpu", head));
Kan Liangba32a452014-10-07 11:08:51 -0400239 parse_events__free_terms(head);
240 $$ = list;
241}
242|
243PE_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 Olsa5f537a22012-03-15 20:09:18 +0100262
Jiri Olsacf3506d2012-07-04 00:00:43 +0200263value_sym:
264PE_VALUE_SYM_HW
265|
266PE_VALUE_SYM_SW
267
Jiri Olsa89812fc2012-03-15 20:09:15 +0100268event_legacy_symbol:
Jiri Olsacf3506d2012-07-04 00:00:43 +0200269value_sym '/' event_config '/'
Jiri Olsa89812fc2012-03-15 20:09:15 +0100270{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300271 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600272 struct list_head *list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100273 int type = $1 >> 16;
274 int config = $1 & 255;
275
David Ahernc5cd8ac2013-07-02 13:27:25 -0600276 ALLOC_LIST(list);
277 ABORT_ON(parse_events_add_numeric(list, &data->idx,
Jiri Olsa46010ab2012-06-15 14:31:38 +0800278 type, config, $3));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100279 parse_events__free_terms($3);
Jiri Olsab847cbd2012-05-21 09:12:51 +0200280 $$ = list;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100281}
282|
Jiri Olsacf3506d2012-07-04 00:00:43 +0200283value_sym sep_slash_dc
Jiri Olsa8f707d82012-03-15 20:09:16 +0100284{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300285 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600286 struct list_head *list;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100287 int type = $1 >> 16;
288 int config = $1 & 255;
289
David Ahernc5cd8ac2013-07-02 13:27:25 -0600290 ALLOC_LIST(list);
291 ABORT_ON(parse_events_add_numeric(list, &data->idx,
Jiri Olsa46010ab2012-06-15 14:31:38 +0800292 type, config, NULL));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200293 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100294}
295
296event_legacy_cache:
297PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT
298{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300299 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600300 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200301
David Ahernc5cd8ac2013-07-02 13:27:25 -0600302 ALLOC_LIST(list);
303 ABORT_ON(parse_events_add_cache(list, &data->idx, $1, $3, $5));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200304 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100305}
306|
307PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT
308{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300309 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600310 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200311
David Ahernc5cd8ac2013-07-02 13:27:25 -0600312 ALLOC_LIST(list);
313 ABORT_ON(parse_events_add_cache(list, &data->idx, $1, $3, NULL));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200314 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100315}
316|
317PE_NAME_CACHE_TYPE
318{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300319 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600320 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200321
David Ahernc5cd8ac2013-07-02 13:27:25 -0600322 ALLOC_LIST(list);
323 ABORT_ON(parse_events_add_cache(list, &data->idx, $1, NULL, NULL));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200324 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100325}
326
327event_legacy_mem:
Jacob Shin3741eb92014-05-29 17:26:51 +0200328PE_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|
339PE_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 Olsa89812fc2012-03-15 20:09:15 +0100350PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
351{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300352 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600353 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200354
David Ahernc5cd8ac2013-07-02 13:27:25 -0600355 ALLOC_LIST(list);
356 ABORT_ON(parse_events_add_breakpoint(list, &data->idx,
Jacob Shin3741eb92014-05-29 17:26:51 +0200357 (void *) $2, $4, 0));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200358 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100359}
360|
361PE_PREFIX_MEM PE_VALUE sep_dc
362{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300363 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600364 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200365
David Ahernc5cd8ac2013-07-02 13:27:25 -0600366 ALLOC_LIST(list);
367 ABORT_ON(parse_events_add_breakpoint(list, &data->idx,
Jacob Shin3741eb92014-05-29 17:26:51 +0200368 (void *) $2, NULL, 0));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200369 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100370}
371
372event_legacy_tracepoint:
Alexander Yarygin2b9032e2014-04-25 17:34:05 +0200373PE_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 Olsa89812fc2012-03-15 20:09:15 +0100385PE_NAME ':' PE_NAME
386{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300387 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600388 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200389
David Ahernc5cd8ac2013-07-02 13:27:25 -0600390 ALLOC_LIST(list);
391 ABORT_ON(parse_events_add_tracepoint(list, &data->idx, $1, $3));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200392 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100393}
394
395event_legacy_numeric:
396PE_VALUE ':' PE_VALUE
397{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300398 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600399 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200400
David Ahernc5cd8ac2013-07-02 13:27:25 -0600401 ALLOC_LIST(list);
402 ABORT_ON(parse_events_add_numeric(list, &data->idx, (u32)$1, $3, NULL));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200403 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100404}
405
406event_legacy_raw:
407PE_RAW
408{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300409 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600410 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200411
David Ahernc5cd8ac2013-07-02 13:27:25 -0600412 ALLOC_LIST(list);
413 ABORT_ON(parse_events_add_numeric(list, &data->idx,
Jiri Olsa46010ab2012-06-15 14:31:38 +0800414 PERF_TYPE_RAW, $1, NULL));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200415 $$ = list;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100416}
417
Jiri Olsa89efb022012-08-08 12:14:14 +0200418start_terms: event_config
Jiri Olsa90e2b222012-06-15 14:31:40 +0800419{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300420 struct parse_events_terms *data = _data;
Jiri Olsa90e2b222012-06-15 14:31:40 +0800421 data->terms = $1;
422}
423
Jiri Olsa8f707d82012-03-15 20:09:16 +0100424event_config:
425event_config ',' event_term
426{
427 struct list_head *head = $1;
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300428 struct parse_events_term *term = $3;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100429
430 ABORT_ON(!head);
431 list_add_tail(&term->list, head);
432 $$ = $1;
433}
434|
435event_term
436{
437 struct list_head *head = malloc(sizeof(*head));
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300438 struct parse_events_term *term = $1;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100439
440 ABORT_ON(!head);
441 INIT_LIST_HEAD(head);
442 list_add_tail(&term->list, head);
443 $$ = head;
444}
445
446event_term:
447PE_NAME '=' PE_NAME
448{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300449 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100450
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300451 ABORT_ON(parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_USER,
Jiri Olsa16fa7e82012-04-25 18:24:57 +0200452 $1, $3));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100453 $$ = term;
454}
455|
456PE_NAME '=' PE_VALUE
457{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300458 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100459
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300460 ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
Jiri Olsa16fa7e82012-04-25 18:24:57 +0200461 $1, $3));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100462 $$ = term;
463}
464|
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200465PE_NAME '=' PE_VALUE_SYM_HW
466{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300467 struct parse_events_term *term;
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200468 int config = $3 & 255;
469
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300470 ABORT_ON(parse_events_term__sym_hw(&term, $1, config));
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200471 $$ = term;
472}
473|
Jiri Olsa8f707d82012-03-15 20:09:16 +0100474PE_NAME
475{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300476 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100477
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300478 ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
Jiri Olsa16fa7e82012-04-25 18:24:57 +0200479 $1, 1));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100480 $$ = term;
481}
482|
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200483PE_VALUE_SYM_HW
484{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300485 struct parse_events_term *term;
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200486 int config = $1 & 255;
487
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300488 ABORT_ON(parse_events_term__sym_hw(&term, NULL, config));
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200489 $$ = term;
490}
491|
Jiri Olsa6b5fc392012-05-21 09:12:53 +0200492PE_TERM '=' PE_NAME
493{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300494 struct parse_events_term *term;
Jiri Olsa6b5fc392012-05-21 09:12:53 +0200495
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300496 ABORT_ON(parse_events_term__str(&term, (int)$1, NULL, $3));
Jiri Olsa6b5fc392012-05-21 09:12:53 +0200497 $$ = term;
498}
499|
Jiri Olsa8f707d82012-03-15 20:09:16 +0100500PE_TERM '=' PE_VALUE
501{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300502 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100503
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300504 ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, $3));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100505 $$ = term;
506}
507|
508PE_TERM
509{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300510 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100511
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300512 ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100513 $$ = term;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100514}
515
516sep_dc: ':' |
517
Jiri Olsa8f707d82012-03-15 20:09:16 +0100518sep_slash_dc: '/' | ':' |
519
Jiri Olsa89812fc2012-03-15 20:09:15 +0100520%%
521
Jiri Olsa6297d422015-04-22 21:10:17 +0200522void parse_events_error(YYLTYPE *loc, void *data,
523 void *scanner __maybe_unused,
Irina Tirdea1d037ca2012-09-11 01:15:03 +0300524 char const *msg __maybe_unused)
Jiri Olsa89812fc2012-03-15 20:09:15 +0100525{
Jiri Olsa6297d422015-04-22 21:10:17 +0200526 parse_events_evlist_error(data, loc->last_column, "parser error");
Jiri Olsa89812fc2012-03-15 20:09:15 +0100527}