blob: 3d11e00243e38a74229562d8eccef3bbe9340ec2 [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);
Jiri Olsa87d650b2015-04-22 21:10:24 +0200277 ABORT_ON(parse_events_add_numeric(data, list, type, config, $3));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100278 parse_events__free_terms($3);
Jiri Olsab847cbd2012-05-21 09:12:51 +0200279 $$ = list;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100280}
281|
Jiri Olsacf3506d2012-07-04 00:00:43 +0200282value_sym sep_slash_dc
Jiri Olsa8f707d82012-03-15 20:09:16 +0100283{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300284 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600285 struct list_head *list;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100286 int type = $1 >> 16;
287 int config = $1 & 255;
288
David Ahernc5cd8ac2013-07-02 13:27:25 -0600289 ALLOC_LIST(list);
Jiri Olsa87d650b2015-04-22 21:10:24 +0200290 ABORT_ON(parse_events_add_numeric(data, list, type, config, NULL));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200291 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100292}
293
294event_legacy_cache:
295PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT
296{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300297 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600298 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200299
David Ahernc5cd8ac2013-07-02 13:27:25 -0600300 ALLOC_LIST(list);
301 ABORT_ON(parse_events_add_cache(list, &data->idx, $1, $3, $5));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200302 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100303}
304|
305PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT
306{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300307 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600308 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200309
David Ahernc5cd8ac2013-07-02 13:27:25 -0600310 ALLOC_LIST(list);
311 ABORT_ON(parse_events_add_cache(list, &data->idx, $1, $3, NULL));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200312 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100313}
314|
315PE_NAME_CACHE_TYPE
316{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300317 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600318 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200319
David Ahernc5cd8ac2013-07-02 13:27:25 -0600320 ALLOC_LIST(list);
321 ABORT_ON(parse_events_add_cache(list, &data->idx, $1, NULL, NULL));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200322 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100323}
324
325event_legacy_mem:
Jacob Shin3741eb92014-05-29 17:26:51 +0200326PE_PREFIX_MEM PE_VALUE '/' PE_VALUE ':' PE_MODIFIER_BP sep_dc
327{
328 struct parse_events_evlist *data = _data;
329 struct list_head *list;
330
331 ALLOC_LIST(list);
332 ABORT_ON(parse_events_add_breakpoint(list, &data->idx,
333 (void *) $2, $6, $4));
334 $$ = list;
335}
336|
337PE_PREFIX_MEM PE_VALUE '/' PE_VALUE sep_dc
338{
339 struct parse_events_evlist *data = _data;
340 struct list_head *list;
341
342 ALLOC_LIST(list);
343 ABORT_ON(parse_events_add_breakpoint(list, &data->idx,
344 (void *) $2, NULL, $4));
345 $$ = list;
346}
347|
Jiri Olsa89812fc2012-03-15 20:09:15 +0100348PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
349{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300350 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600351 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200352
David Ahernc5cd8ac2013-07-02 13:27:25 -0600353 ALLOC_LIST(list);
354 ABORT_ON(parse_events_add_breakpoint(list, &data->idx,
Jacob Shin3741eb92014-05-29 17:26:51 +0200355 (void *) $2, $4, 0));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200356 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100357}
358|
359PE_PREFIX_MEM PE_VALUE sep_dc
360{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300361 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600362 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200363
David Ahernc5cd8ac2013-07-02 13:27:25 -0600364 ALLOC_LIST(list);
365 ABORT_ON(parse_events_add_breakpoint(list, &data->idx,
Jacob Shin3741eb92014-05-29 17:26:51 +0200366 (void *) $2, NULL, 0));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200367 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100368}
369
370event_legacy_tracepoint:
Alexander Yarygin2b9032e2014-04-25 17:34:05 +0200371PE_NAME '-' PE_NAME ':' PE_NAME
372{
373 struct parse_events_evlist *data = _data;
374 struct list_head *list;
375 char sys_name[128];
376 snprintf(&sys_name, 128, "%s-%s", $1, $3);
377
378 ALLOC_LIST(list);
379 ABORT_ON(parse_events_add_tracepoint(list, &data->idx, &sys_name, $5));
380 $$ = list;
381}
382|
Jiri Olsa89812fc2012-03-15 20:09:15 +0100383PE_NAME ':' PE_NAME
384{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300385 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600386 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200387
David Ahernc5cd8ac2013-07-02 13:27:25 -0600388 ALLOC_LIST(list);
Jiri Olsa492d9772015-04-22 21:10:23 +0200389 if (parse_events_add_tracepoint(list, &data->idx, $1, $3)) {
390 struct parse_events_error *error = data->error;
391
392 error->idx = @1.first_column;
393 error->str = strdup("unknown tracepoint");
394 return -1;
395 }
Jiri Olsab847cbd2012-05-21 09:12:51 +0200396 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100397}
398
399event_legacy_numeric:
400PE_VALUE ':' PE_VALUE
401{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300402 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600403 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200404
David Ahernc5cd8ac2013-07-02 13:27:25 -0600405 ALLOC_LIST(list);
Jiri Olsa87d650b2015-04-22 21:10:24 +0200406 ABORT_ON(parse_events_add_numeric(data, list, (u32)$1, $3, NULL));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200407 $$ = list;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100408}
409
410event_legacy_raw:
411PE_RAW
412{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300413 struct parse_events_evlist *data = _data;
David Ahernc5cd8ac2013-07-02 13:27:25 -0600414 struct list_head *list;
Jiri Olsab847cbd2012-05-21 09:12:51 +0200415
David Ahernc5cd8ac2013-07-02 13:27:25 -0600416 ALLOC_LIST(list);
Jiri Olsa87d650b2015-04-22 21:10:24 +0200417 ABORT_ON(parse_events_add_numeric(data, list, PERF_TYPE_RAW, $1, NULL));
Jiri Olsab847cbd2012-05-21 09:12:51 +0200418 $$ = list;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100419}
420
Jiri Olsa89efb022012-08-08 12:14:14 +0200421start_terms: event_config
Jiri Olsa90e2b222012-06-15 14:31:40 +0800422{
Arnaldo Carvalho de Melo23b63392013-01-18 16:56:57 -0300423 struct parse_events_terms *data = _data;
Jiri Olsa90e2b222012-06-15 14:31:40 +0800424 data->terms = $1;
425}
426
Jiri Olsa8f707d82012-03-15 20:09:16 +0100427event_config:
428event_config ',' event_term
429{
430 struct list_head *head = $1;
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300431 struct parse_events_term *term = $3;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100432
433 ABORT_ON(!head);
434 list_add_tail(&term->list, head);
435 $$ = $1;
436}
437|
438event_term
439{
440 struct list_head *head = malloc(sizeof(*head));
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300441 struct parse_events_term *term = $1;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100442
443 ABORT_ON(!head);
444 INIT_LIST_HEAD(head);
445 list_add_tail(&term->list, head);
446 $$ = head;
447}
448
449event_term:
450PE_NAME '=' PE_NAME
451{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300452 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100453
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300454 ABORT_ON(parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_USER,
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200455 $1, $3, &@1, &@3));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100456 $$ = term;
457}
458|
459PE_NAME '=' PE_VALUE
460{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300461 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100462
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300463 ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200464 $1, $3, &@1, &@3));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100465 $$ = term;
466}
467|
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200468PE_NAME '=' PE_VALUE_SYM_HW
469{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300470 struct parse_events_term *term;
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200471 int config = $3 & 255;
472
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300473 ABORT_ON(parse_events_term__sym_hw(&term, $1, config));
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200474 $$ = term;
475}
476|
Jiri Olsa8f707d82012-03-15 20:09:16 +0100477PE_NAME
478{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300479 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100480
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300481 ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200482 $1, 1, &@1, NULL));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100483 $$ = term;
484}
485|
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200486PE_VALUE_SYM_HW
487{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300488 struct parse_events_term *term;
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200489 int config = $1 & 255;
490
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300491 ABORT_ON(parse_events_term__sym_hw(&term, NULL, config));
Jiri Olsa1d33d6d2012-10-10 14:53:17 +0200492 $$ = term;
493}
494|
Jiri Olsa6b5fc392012-05-21 09:12:53 +0200495PE_TERM '=' PE_NAME
496{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300497 struct parse_events_term *term;
Jiri Olsa6b5fc392012-05-21 09:12:53 +0200498
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200499 ABORT_ON(parse_events_term__str(&term, (int)$1, NULL, $3, &@1, &@3));
Jiri Olsa6b5fc392012-05-21 09:12:53 +0200500 $$ = term;
501}
502|
Jiri Olsa8f707d82012-03-15 20:09:16 +0100503PE_TERM '=' PE_VALUE
504{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300505 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100506
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200507 ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, $3, &@1, &@3));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100508 $$ = term;
509}
510|
511PE_TERM
512{
Arnaldo Carvalho de Melo6cee6cd2013-01-18 16:29:49 -0300513 struct parse_events_term *term;
Jiri Olsa8f707d82012-03-15 20:09:16 +0100514
Jiri Olsacecf3a2e2015-04-22 21:10:20 +0200515 ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1, &@1, NULL));
Jiri Olsa8f707d82012-03-15 20:09:16 +0100516 $$ = term;
Jiri Olsa89812fc2012-03-15 20:09:15 +0100517}
518
519sep_dc: ':' |
520
Jiri Olsa8f707d82012-03-15 20:09:16 +0100521sep_slash_dc: '/' | ':' |
522
Jiri Olsa89812fc2012-03-15 20:09:15 +0100523%%
524
Jiri Olsa6297d422015-04-22 21:10:17 +0200525void parse_events_error(YYLTYPE *loc, void *data,
526 void *scanner __maybe_unused,
Irina Tirdea1d037ca2012-09-11 01:15:03 +0300527 char const *msg __maybe_unused)
Jiri Olsa89812fc2012-03-15 20:09:15 +0100528{
Jiri Olsa6297d422015-04-22 21:10:17 +0200529 parse_events_evlist_error(data, loc->last_column, "parser error");
Jiri Olsa89812fc2012-03-15 20:09:15 +0100530}