blob: 38a0f21fc43384705c76017b5da72fd64b22ff31 [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,
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200234 $1, 1, &@1, NULL));
Kan Liangba32a452014-10-07 11:08:51 -0400235 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,
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200254 &pmu_name, 1, &@1, NULL));
Kan Liangba32a452014-10-07 11:08:51 -0400255 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);
Jiri Olsa492d9772015-04-22 21:10:23 +0200391 if (parse_events_add_tracepoint(list, &data->idx, $1, $3)) {
392 struct parse_events_error *error = data->error;
393
394 error->idx = @1.first_column;
395 error->str = strdup("unknown tracepoint");
396 return -1;
397 }
Jiri Olsab847cbd2012-05-21 09:12:51 +0200398 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100399}
400
401event_legacy_numeric:
402PE_VALUE ':' PE_VALUE
403{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300404 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600405 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200406
David Ahernc5cd8ac2013-07-02 13:27:25 -0600407 ALLOC_LIST(list);
408 ABORT_ON(parse_events_add_numeric(list, &data->idx, (u32)$1, $3, NULL));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200409 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100410}
411
412event_legacy_raw:
413PE_RAW
414{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300415 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600416 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200417
David Ahernc5cd8ac2013-07-02 13:27:25 -0600418 ALLOC_LIST(list);
419 ABORT_ON(parse_events_add_numeric(list, &data->idx,
Jiri Olsa46010ab2012-06-15 14:31:38 +0800420 PERF_TYPE_RAW, $1, NULL));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200421 $$ = list;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100422}
423
Jiri Olsa89efb022012-08-08 12:14:14 +0200424start_terms: event_config
Jiri Olsa90e2b222012-06-15 14:31:40 +0800425{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300426 struct parse_events_terms *data = _data;
Jiri Olsa90e2b222012-06-15 14:31:40 +0800427 data->terms = $1;
428}
429
Jiri Olsa8f707d82012-03-15 20:09:16 +0100430event_config:
431event_config ',' event_term
432{
433 struct list_head *head = $1;
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300434 struct parse_events_term *term = $3;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100435
436 ABORT_ON(!head);
437 list_add_tail(&term->list, head);
438 $$ = $1;
439}
440|
441event_term
442{
443 struct list_head *head = malloc(sizeof(*head));
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300444 struct parse_events_term *term = $1;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100445
446 ABORT_ON(!head);
447 INIT_LIST_HEAD(head);
448 list_add_tail(&term->list, head);
449 $$ = head;
450}
451
452event_term:
453PE_NAME '=' PE_NAME
454{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300455 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100456
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300457 ABORT_ON(parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_USER,
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200458 $1, $3, &@1, &@3));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100459 $$ = term;
460}
461|
462PE_NAME '=' PE_VALUE
463{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300464 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100465
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300466 ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200467 $1, $3, &@1, &@3));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100468 $$ = term;
469}
470|
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200471PE_NAME '=' PE_VALUE_SYM_HW
472{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300473 struct parse_events_term *term;
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200474 int config = $3 & 255;
475
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300476 ABORT_ON(parse_events_term__sym_hw(&term, $1, config));
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200477 $$ = term;
478}
479|
Jiri Olsa8f707d82012-03-15 20:09:16 +0100480PE_NAME
481{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300482 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100483
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300484 ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200485 $1, 1, &@1, NULL));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100486 $$ = term;
487}
488|
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200489PE_VALUE_SYM_HW
490{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300491 struct parse_events_term *term;
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200492 int config = $1 & 255;
493
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300494 ABORT_ON(parse_events_term__sym_hw(&term, NULL, config));
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200495 $$ = term;
496}
497|
Jiri Olsa6b5fc392012-05-21 09:12:53 +0200498PE_TERM '=' PE_NAME
499{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300500 struct parse_events_term *term;
Jiri Olsa6b5fc392012-05-21 09:12:53 +0200501
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200502 ABORT_ON(parse_events_term__str(&term, (int)$1, NULL, $3, &@1, &@3));
Jiri Olsa6b5fc392012-05-21 09:12:53 +0200503 $$ = term;
504}
505|
Jiri Olsa8f707d82012-03-15 20:09:16 +0100506PE_TERM '=' PE_VALUE
507{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300508 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100509
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200510 ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, $3, &@1, &@3));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100511 $$ = term;
512}
513|
514PE_TERM
515{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300516 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100517
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200518 ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1, &@1, NULL));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100519 $$ = term;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100520}
521
522sep_dc: ':' |
523
Jiri Olsa8f707d82012-03-15 20:09:16 +0100524sep_slash_dc: '/' | ':' |
525
Jiri Olsa89812fc2012-03-15 20:09:15 +0100526%%
527
Jiri Olsa6297d422015-04-22 21:10:17 +0200528void parse_events_error(YYLTYPE *loc, void *data,
529 void *scanner __maybe_unused,
Irina Tirdea1d037ca2012-09-11 01:15:03 +0300530 char const *msg __maybe_unused)
Jiri Olsa89812fc2012-03-15 20:09:15 +0100531{
Jiri Olsa6297d422015-04-22 21:10:17 +0200532 parse_events_evlist_error(data, loc->last_column, "parser error");
Jiri Olsa89812fc2012-03-15 20:09:15 +0100533}