xref: /linux/tools/perf/util/parse-events.y (revision ad96227349901838e1a7f96f1dc22d96a97520c0)
1ac20de6fSZheng Yan %pure-parser
246010ab2SJiri Olsa %parse-param {void *_data}
3ac20de6fSZheng Yan %parse-param {void *scanner}
4ac20de6fSZheng Yan %lex-param {void* scanner}
589812fc8SJiri Olsa 
689812fc8SJiri Olsa %{
789812fc8SJiri Olsa 
889812fc8SJiri Olsa #define YYDEBUG 1
989812fc8SJiri Olsa 
1089812fc8SJiri Olsa #include <linux/compiler.h>
1189812fc8SJiri Olsa #include <linux/list.h>
12d944c4eeSBorislav Petkov #include <linux/types.h>
1389812fc8SJiri Olsa #include "util.h"
1489812fc8SJiri Olsa #include "parse-events.h"
15ac20de6fSZheng Yan #include "parse-events-bison.h"
1689812fc8SJiri Olsa 
17ac20de6fSZheng Yan extern int parse_events_lex (YYSTYPE* lvalp, void* scanner);
1889812fc8SJiri Olsa 
1989812fc8SJiri Olsa #define ABORT_ON(val) \
2089812fc8SJiri Olsa do { \
2189812fc8SJiri Olsa 	if (val) \
2289812fc8SJiri Olsa 		YYABORT; \
2389812fc8SJiri Olsa } while (0)
2489812fc8SJiri Olsa 
25c5cd8ac0SDavid Ahern #define ALLOC_LIST(list) \
26c5cd8ac0SDavid Ahern do { \
27c5cd8ac0SDavid Ahern 	list = malloc(sizeof(*list)); \
28c5cd8ac0SDavid Ahern 	ABORT_ON(!list);              \
29c5cd8ac0SDavid Ahern 	INIT_LIST_HEAD(list);         \
30c5cd8ac0SDavid Ahern } while (0)
31c5cd8ac0SDavid Ahern 
3297f63e4aSNamhyung Kim static inc_group_count(struct list_head *list,
3397f63e4aSNamhyung Kim 		       struct parse_events_evlist *data)
3497f63e4aSNamhyung Kim {
3597f63e4aSNamhyung Kim 	/* Count groups only have more than 1 members */
3697f63e4aSNamhyung Kim 	if (!list_is_last(list->next, list))
3797f63e4aSNamhyung Kim 		data->nr_groups++;
3897f63e4aSNamhyung Kim }
3997f63e4aSNamhyung Kim 
4089812fc8SJiri Olsa %}
4189812fc8SJiri Olsa 
4290e2b22dSJiri Olsa %token PE_START_EVENTS PE_START_TERMS
43cf3506dcSJiri Olsa %token PE_VALUE PE_VALUE_SYM_HW PE_VALUE_SYM_SW PE_RAW PE_TERM
44ac2ba9f3SRobert Richter %token PE_EVENT_NAME
4589812fc8SJiri Olsa %token PE_NAME
4689812fc8SJiri Olsa %token PE_MODIFIER_EVENT PE_MODIFIER_BP
4789812fc8SJiri Olsa %token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT
4889efb029SJiri Olsa %token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP
4989812fc8SJiri Olsa %token PE_ERROR
5089812fc8SJiri Olsa %type <num> PE_VALUE
51cf3506dcSJiri Olsa %type <num> PE_VALUE_SYM_HW
52cf3506dcSJiri Olsa %type <num> PE_VALUE_SYM_SW
5389812fc8SJiri Olsa %type <num> PE_RAW
548f707d84SJiri Olsa %type <num> PE_TERM
5589812fc8SJiri Olsa %type <str> PE_NAME
5689812fc8SJiri Olsa %type <str> PE_NAME_CACHE_TYPE
5789812fc8SJiri Olsa %type <str> PE_NAME_CACHE_OP_RESULT
5889812fc8SJiri Olsa %type <str> PE_MODIFIER_EVENT
5989812fc8SJiri Olsa %type <str> PE_MODIFIER_BP
60ac2ba9f3SRobert Richter %type <str> PE_EVENT_NAME
61cf3506dcSJiri Olsa %type <num> value_sym
628f707d84SJiri Olsa %type <head> event_config
638f707d84SJiri Olsa %type <term> event_term
64b847cbdcSJiri Olsa %type <head> event_pmu
65b847cbdcSJiri Olsa %type <head> event_legacy_symbol
66b847cbdcSJiri Olsa %type <head> event_legacy_cache
67b847cbdcSJiri Olsa %type <head> event_legacy_mem
68b847cbdcSJiri Olsa %type <head> event_legacy_tracepoint
69b847cbdcSJiri Olsa %type <head> event_legacy_numeric
70b847cbdcSJiri Olsa %type <head> event_legacy_raw
71b847cbdcSJiri Olsa %type <head> event_def
72ac2ba9f3SRobert Richter %type <head> event_mod
73ac2ba9f3SRobert Richter %type <head> event_name
7489efb029SJiri Olsa %type <head> event
7589efb029SJiri Olsa %type <head> events
7689efb029SJiri Olsa %type <head> group_def
7789efb029SJiri Olsa %type <head> group
7889efb029SJiri Olsa %type <head> groups
7989812fc8SJiri Olsa 
8089812fc8SJiri Olsa %union
8189812fc8SJiri Olsa {
8289812fc8SJiri Olsa 	char *str;
83b527bab5SRobert Richter 	u64 num;
848f707d84SJiri Olsa 	struct list_head *head;
856cee6cd3SArnaldo Carvalho de Melo 	struct parse_events_term *term;
8689812fc8SJiri Olsa }
8789812fc8SJiri Olsa %%
8889812fc8SJiri Olsa 
8990e2b22dSJiri Olsa start:
9089efb029SJiri Olsa PE_START_EVENTS start_events
9190e2b22dSJiri Olsa |
9289efb029SJiri Olsa PE_START_TERMS  start_terms
9389efb029SJiri Olsa 
9489efb029SJiri Olsa start_events: groups
9589efb029SJiri Olsa {
9623b6339bSArnaldo Carvalho de Melo 	struct parse_events_evlist *data = _data;
9789efb029SJiri Olsa 
9889efb029SJiri Olsa 	parse_events_update_lists($1, &data->list);
9989efb029SJiri Olsa }
10089efb029SJiri Olsa 
10189efb029SJiri Olsa groups:
10289efb029SJiri Olsa groups ',' group
10389efb029SJiri Olsa {
10489efb029SJiri Olsa 	struct list_head *list  = $1;
10589efb029SJiri Olsa 	struct list_head *group = $3;
10689efb029SJiri Olsa 
10789efb029SJiri Olsa 	parse_events_update_lists(group, list);
10889efb029SJiri Olsa 	$$ = list;
10989efb029SJiri Olsa }
11089efb029SJiri Olsa |
11189efb029SJiri Olsa groups ',' event
11289efb029SJiri Olsa {
11389efb029SJiri Olsa 	struct list_head *list  = $1;
11489efb029SJiri Olsa 	struct list_head *event = $3;
11589efb029SJiri Olsa 
11689efb029SJiri Olsa 	parse_events_update_lists(event, list);
11789efb029SJiri Olsa 	$$ = list;
11889efb029SJiri Olsa }
11989efb029SJiri Olsa |
12089efb029SJiri Olsa group
12189efb029SJiri Olsa |
12289efb029SJiri Olsa event
12389efb029SJiri Olsa 
12489efb029SJiri Olsa group:
12589efb029SJiri Olsa group_def ':' PE_MODIFIER_EVENT
12689efb029SJiri Olsa {
12789efb029SJiri Olsa 	struct list_head *list = $1;
12889efb029SJiri Olsa 
12989efb029SJiri Olsa 	ABORT_ON(parse_events__modifier_group(list, $3));
13089efb029SJiri Olsa 	$$ = list;
13189efb029SJiri Olsa }
13289efb029SJiri Olsa |
13389efb029SJiri Olsa group_def
13489efb029SJiri Olsa 
13589efb029SJiri Olsa group_def:
13689efb029SJiri Olsa PE_NAME '{' events '}'
13789efb029SJiri Olsa {
13889efb029SJiri Olsa 	struct list_head *list = $3;
13989efb029SJiri Olsa 
14097f63e4aSNamhyung Kim 	inc_group_count(list, _data);
14163dab225SArnaldo Carvalho de Melo 	parse_events__set_leader($1, list);
14289efb029SJiri Olsa 	$$ = list;
14389efb029SJiri Olsa }
14489efb029SJiri Olsa |
14589efb029SJiri Olsa '{' events '}'
14689efb029SJiri Olsa {
14789efb029SJiri Olsa 	struct list_head *list = $2;
14889efb029SJiri Olsa 
14997f63e4aSNamhyung Kim 	inc_group_count(list, _data);
15063dab225SArnaldo Carvalho de Melo 	parse_events__set_leader(NULL, list);
15189efb029SJiri Olsa 	$$ = list;
15289efb029SJiri Olsa }
15390e2b22dSJiri Olsa 
15489812fc8SJiri Olsa events:
15589efb029SJiri Olsa events ',' event
15689efb029SJiri Olsa {
15789efb029SJiri Olsa 	struct list_head *event = $3;
15889efb029SJiri Olsa 	struct list_head *list  = $1;
15989efb029SJiri Olsa 
16089efb029SJiri Olsa 	parse_events_update_lists(event, list);
16189efb029SJiri Olsa 	$$ = list;
16289efb029SJiri Olsa }
16389efb029SJiri Olsa |
16489efb029SJiri Olsa event
16589812fc8SJiri Olsa 
166ac2ba9f3SRobert Richter event: event_mod
167ac2ba9f3SRobert Richter 
168ac2ba9f3SRobert Richter event_mod:
169ac2ba9f3SRobert Richter event_name PE_MODIFIER_EVENT
17089812fc8SJiri Olsa {
17189efb029SJiri Olsa 	struct list_head *list = $1;
17246010ab2SJiri Olsa 
1735d7be90eSJiri Olsa 	/*
1745d7be90eSJiri Olsa 	 * Apply modifier on all events added by single event definition
1755d7be90eSJiri Olsa 	 * (there could be more events added for multiple tracepoint
1765d7be90eSJiri Olsa 	 * definitions via '*?'.
1775d7be90eSJiri Olsa 	 */
178f5b1135bSJiri Olsa 	ABORT_ON(parse_events__modifier_event(list, $2, false));
17989efb029SJiri Olsa 	$$ = list;
18089812fc8SJiri Olsa }
18189812fc8SJiri Olsa |
182ac2ba9f3SRobert Richter event_name
183ac2ba9f3SRobert Richter 
184ac2ba9f3SRobert Richter event_name:
185ac2ba9f3SRobert Richter PE_EVENT_NAME event_def
186ac2ba9f3SRobert Richter {
187ac2ba9f3SRobert Richter 	ABORT_ON(parse_events_name($2, $1));
188ac2ba9f3SRobert Richter 	free($1);
189ac2ba9f3SRobert Richter 	$$ = $2;
190ac2ba9f3SRobert Richter }
191ac2ba9f3SRobert Richter |
19289812fc8SJiri Olsa event_def
19389812fc8SJiri Olsa 
1945f537a26SJiri Olsa event_def: event_pmu |
1955f537a26SJiri Olsa 	   event_legacy_symbol |
19689812fc8SJiri Olsa 	   event_legacy_cache sep_dc |
19789812fc8SJiri Olsa 	   event_legacy_mem |
19889812fc8SJiri Olsa 	   event_legacy_tracepoint sep_dc |
19989812fc8SJiri Olsa 	   event_legacy_numeric sep_dc |
20089812fc8SJiri Olsa 	   event_legacy_raw sep_dc
20189812fc8SJiri Olsa 
2025f537a26SJiri Olsa event_pmu:
2035f537a26SJiri Olsa PE_NAME '/' event_config '/'
2045f537a26SJiri Olsa {
20523b6339bSArnaldo Carvalho de Melo 	struct parse_events_evlist *data = _data;
206c5cd8ac0SDavid Ahern 	struct list_head *list;
207b847cbdcSJiri Olsa 
208c5cd8ac0SDavid Ahern 	ALLOC_LIST(list);
209c5cd8ac0SDavid Ahern 	ABORT_ON(parse_events_add_pmu(list, &data->idx, $1, $3));
2105f537a26SJiri Olsa 	parse_events__free_terms($3);
211b847cbdcSJiri Olsa 	$$ = list;
2125f537a26SJiri Olsa }
213*ad962273SAdrian Hunter |
214*ad962273SAdrian Hunter PE_NAME '/' '/'
215*ad962273SAdrian Hunter {
216*ad962273SAdrian Hunter 	struct parse_events_evlist *data = _data;
217*ad962273SAdrian Hunter 	struct list_head *list;
218*ad962273SAdrian Hunter 
219*ad962273SAdrian Hunter 	ALLOC_LIST(list);
220*ad962273SAdrian Hunter 	ABORT_ON(parse_events_add_pmu(list, &data->idx, $1, NULL));
221*ad962273SAdrian Hunter 	$$ = list;
222*ad962273SAdrian Hunter }
2235f537a26SJiri Olsa 
224cf3506dcSJiri Olsa value_sym:
225cf3506dcSJiri Olsa PE_VALUE_SYM_HW
226cf3506dcSJiri Olsa |
227cf3506dcSJiri Olsa PE_VALUE_SYM_SW
228cf3506dcSJiri Olsa 
22989812fc8SJiri Olsa event_legacy_symbol:
230cf3506dcSJiri Olsa value_sym '/' event_config '/'
23189812fc8SJiri Olsa {
23223b6339bSArnaldo Carvalho de Melo 	struct parse_events_evlist *data = _data;
233c5cd8ac0SDavid Ahern 	struct list_head *list;
23489812fc8SJiri Olsa 	int type = $1 >> 16;
23589812fc8SJiri Olsa 	int config = $1 & 255;
23689812fc8SJiri Olsa 
237c5cd8ac0SDavid Ahern 	ALLOC_LIST(list);
238c5cd8ac0SDavid Ahern 	ABORT_ON(parse_events_add_numeric(list, &data->idx,
23946010ab2SJiri Olsa 					  type, config, $3));
2408f707d84SJiri Olsa 	parse_events__free_terms($3);
241b847cbdcSJiri Olsa 	$$ = list;
2428f707d84SJiri Olsa }
2438f707d84SJiri Olsa |
244cf3506dcSJiri Olsa value_sym sep_slash_dc
2458f707d84SJiri Olsa {
24623b6339bSArnaldo Carvalho de Melo 	struct parse_events_evlist *data = _data;
247c5cd8ac0SDavid Ahern 	struct list_head *list;
2488f707d84SJiri Olsa 	int type = $1 >> 16;
2498f707d84SJiri Olsa 	int config = $1 & 255;
2508f707d84SJiri Olsa 
251c5cd8ac0SDavid Ahern 	ALLOC_LIST(list);
252c5cd8ac0SDavid Ahern 	ABORT_ON(parse_events_add_numeric(list, &data->idx,
25346010ab2SJiri Olsa 					  type, config, NULL));
254b847cbdcSJiri Olsa 	$$ = list;
25589812fc8SJiri Olsa }
25689812fc8SJiri Olsa 
25789812fc8SJiri Olsa event_legacy_cache:
25889812fc8SJiri Olsa PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT
25989812fc8SJiri Olsa {
26023b6339bSArnaldo Carvalho de Melo 	struct parse_events_evlist *data = _data;
261c5cd8ac0SDavid Ahern 	struct list_head *list;
262b847cbdcSJiri Olsa 
263c5cd8ac0SDavid Ahern 	ALLOC_LIST(list);
264c5cd8ac0SDavid Ahern 	ABORT_ON(parse_events_add_cache(list, &data->idx, $1, $3, $5));
265b847cbdcSJiri Olsa 	$$ = list;
26689812fc8SJiri Olsa }
26789812fc8SJiri Olsa |
26889812fc8SJiri Olsa PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT
26989812fc8SJiri Olsa {
27023b6339bSArnaldo Carvalho de Melo 	struct parse_events_evlist *data = _data;
271c5cd8ac0SDavid Ahern 	struct list_head *list;
272b847cbdcSJiri Olsa 
273c5cd8ac0SDavid Ahern 	ALLOC_LIST(list);
274c5cd8ac0SDavid Ahern 	ABORT_ON(parse_events_add_cache(list, &data->idx, $1, $3, NULL));
275b847cbdcSJiri Olsa 	$$ = list;
27689812fc8SJiri Olsa }
27789812fc8SJiri Olsa |
27889812fc8SJiri Olsa PE_NAME_CACHE_TYPE
27989812fc8SJiri Olsa {
28023b6339bSArnaldo Carvalho de Melo 	struct parse_events_evlist *data = _data;
281c5cd8ac0SDavid Ahern 	struct list_head *list;
282b847cbdcSJiri Olsa 
283c5cd8ac0SDavid Ahern 	ALLOC_LIST(list);
284c5cd8ac0SDavid Ahern 	ABORT_ON(parse_events_add_cache(list, &data->idx, $1, NULL, NULL));
285b847cbdcSJiri Olsa 	$$ = list;
28689812fc8SJiri Olsa }
28789812fc8SJiri Olsa 
28889812fc8SJiri Olsa event_legacy_mem:
28989812fc8SJiri Olsa PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
29089812fc8SJiri Olsa {
29123b6339bSArnaldo Carvalho de Melo 	struct parse_events_evlist *data = _data;
292c5cd8ac0SDavid Ahern 	struct list_head *list;
293b847cbdcSJiri Olsa 
294c5cd8ac0SDavid Ahern 	ALLOC_LIST(list);
295c5cd8ac0SDavid Ahern 	ABORT_ON(parse_events_add_breakpoint(list, &data->idx,
29646010ab2SJiri Olsa 					     (void *) $2, $4));
297b847cbdcSJiri Olsa 	$$ = list;
29889812fc8SJiri Olsa }
29989812fc8SJiri Olsa |
30089812fc8SJiri Olsa PE_PREFIX_MEM PE_VALUE sep_dc
30189812fc8SJiri Olsa {
30223b6339bSArnaldo Carvalho de Melo 	struct parse_events_evlist *data = _data;
303c5cd8ac0SDavid Ahern 	struct list_head *list;
304b847cbdcSJiri Olsa 
305c5cd8ac0SDavid Ahern 	ALLOC_LIST(list);
306c5cd8ac0SDavid Ahern 	ABORT_ON(parse_events_add_breakpoint(list, &data->idx,
30746010ab2SJiri Olsa 					     (void *) $2, NULL));
308b847cbdcSJiri Olsa 	$$ = list;
30989812fc8SJiri Olsa }
31089812fc8SJiri Olsa 
31189812fc8SJiri Olsa event_legacy_tracepoint:
3122b9032e0SAlexander Yarygin PE_NAME '-' PE_NAME ':' PE_NAME
3132b9032e0SAlexander Yarygin {
3142b9032e0SAlexander Yarygin 	struct parse_events_evlist *data = _data;
3152b9032e0SAlexander Yarygin 	struct list_head *list;
3162b9032e0SAlexander Yarygin 	char sys_name[128];
3172b9032e0SAlexander Yarygin 	snprintf(&sys_name, 128, "%s-%s", $1, $3);
3182b9032e0SAlexander Yarygin 
3192b9032e0SAlexander Yarygin 	ALLOC_LIST(list);
3202b9032e0SAlexander Yarygin 	ABORT_ON(parse_events_add_tracepoint(list, &data->idx, &sys_name, $5));
3212b9032e0SAlexander Yarygin 	$$ = list;
3222b9032e0SAlexander Yarygin }
3232b9032e0SAlexander Yarygin |
32489812fc8SJiri Olsa PE_NAME ':' PE_NAME
32589812fc8SJiri Olsa {
32623b6339bSArnaldo Carvalho de Melo 	struct parse_events_evlist *data = _data;
327c5cd8ac0SDavid Ahern 	struct list_head *list;
328b847cbdcSJiri Olsa 
329c5cd8ac0SDavid Ahern 	ALLOC_LIST(list);
330c5cd8ac0SDavid Ahern 	ABORT_ON(parse_events_add_tracepoint(list, &data->idx, $1, $3));
331b847cbdcSJiri Olsa 	$$ = list;
33289812fc8SJiri Olsa }
33389812fc8SJiri Olsa 
33489812fc8SJiri Olsa event_legacy_numeric:
33589812fc8SJiri Olsa PE_VALUE ':' PE_VALUE
33689812fc8SJiri Olsa {
33723b6339bSArnaldo Carvalho de Melo 	struct parse_events_evlist *data = _data;
338c5cd8ac0SDavid Ahern 	struct list_head *list;
339b847cbdcSJiri Olsa 
340c5cd8ac0SDavid Ahern 	ALLOC_LIST(list);
341c5cd8ac0SDavid Ahern 	ABORT_ON(parse_events_add_numeric(list, &data->idx, (u32)$1, $3, NULL));
342b847cbdcSJiri Olsa 	$$ = list;
34389812fc8SJiri Olsa }
34489812fc8SJiri Olsa 
34589812fc8SJiri Olsa event_legacy_raw:
34689812fc8SJiri Olsa PE_RAW
34789812fc8SJiri Olsa {
34823b6339bSArnaldo Carvalho de Melo 	struct parse_events_evlist *data = _data;
349c5cd8ac0SDavid Ahern 	struct list_head *list;
350b847cbdcSJiri Olsa 
351c5cd8ac0SDavid Ahern 	ALLOC_LIST(list);
352c5cd8ac0SDavid Ahern 	ABORT_ON(parse_events_add_numeric(list, &data->idx,
35346010ab2SJiri Olsa 					  PERF_TYPE_RAW, $1, NULL));
354b847cbdcSJiri Olsa 	$$ = list;
3558f707d84SJiri Olsa }
3568f707d84SJiri Olsa 
35789efb029SJiri Olsa start_terms: event_config
35890e2b22dSJiri Olsa {
35923b6339bSArnaldo Carvalho de Melo 	struct parse_events_terms *data = _data;
36090e2b22dSJiri Olsa 	data->terms = $1;
36190e2b22dSJiri Olsa }
36290e2b22dSJiri Olsa 
3638f707d84SJiri Olsa event_config:
3648f707d84SJiri Olsa event_config ',' event_term
3658f707d84SJiri Olsa {
3668f707d84SJiri Olsa 	struct list_head *head = $1;
3676cee6cd3SArnaldo Carvalho de Melo 	struct parse_events_term *term = $3;
3688f707d84SJiri Olsa 
3698f707d84SJiri Olsa 	ABORT_ON(!head);
3708f707d84SJiri Olsa 	list_add_tail(&term->list, head);
3718f707d84SJiri Olsa 	$$ = $1;
3728f707d84SJiri Olsa }
3738f707d84SJiri Olsa |
3748f707d84SJiri Olsa event_term
3758f707d84SJiri Olsa {
3768f707d84SJiri Olsa 	struct list_head *head = malloc(sizeof(*head));
3776cee6cd3SArnaldo Carvalho de Melo 	struct parse_events_term *term = $1;
3788f707d84SJiri Olsa 
3798f707d84SJiri Olsa 	ABORT_ON(!head);
3808f707d84SJiri Olsa 	INIT_LIST_HEAD(head);
3818f707d84SJiri Olsa 	list_add_tail(&term->list, head);
3828f707d84SJiri Olsa 	$$ = head;
3838f707d84SJiri Olsa }
3848f707d84SJiri Olsa 
3858f707d84SJiri Olsa event_term:
3868f707d84SJiri Olsa PE_NAME '=' PE_NAME
3878f707d84SJiri Olsa {
3886cee6cd3SArnaldo Carvalho de Melo 	struct parse_events_term *term;
3898f707d84SJiri Olsa 
3906cee6cd3SArnaldo Carvalho de Melo 	ABORT_ON(parse_events_term__str(&term, PARSE_EVENTS__TERM_TYPE_USER,
39116fa7e82SJiri Olsa 					$1, $3));
3928f707d84SJiri Olsa 	$$ = term;
3938f707d84SJiri Olsa }
3948f707d84SJiri Olsa |
3958f707d84SJiri Olsa PE_NAME '=' PE_VALUE
3968f707d84SJiri Olsa {
3976cee6cd3SArnaldo Carvalho de Melo 	struct parse_events_term *term;
3988f707d84SJiri Olsa 
3996cee6cd3SArnaldo Carvalho de Melo 	ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
40016fa7e82SJiri Olsa 					$1, $3));
4018f707d84SJiri Olsa 	$$ = term;
4028f707d84SJiri Olsa }
4038f707d84SJiri Olsa |
4041d33d6dcSJiri Olsa PE_NAME '=' PE_VALUE_SYM_HW
4051d33d6dcSJiri Olsa {
4066cee6cd3SArnaldo Carvalho de Melo 	struct parse_events_term *term;
4071d33d6dcSJiri Olsa 	int config = $3 & 255;
4081d33d6dcSJiri Olsa 
4096cee6cd3SArnaldo Carvalho de Melo 	ABORT_ON(parse_events_term__sym_hw(&term, $1, config));
4101d33d6dcSJiri Olsa 	$$ = term;
4111d33d6dcSJiri Olsa }
4121d33d6dcSJiri Olsa |
4138f707d84SJiri Olsa PE_NAME
4148f707d84SJiri Olsa {
4156cee6cd3SArnaldo Carvalho de Melo 	struct parse_events_term *term;
4168f707d84SJiri Olsa 
4176cee6cd3SArnaldo Carvalho de Melo 	ABORT_ON(parse_events_term__num(&term, PARSE_EVENTS__TERM_TYPE_USER,
41816fa7e82SJiri Olsa 					$1, 1));
4198f707d84SJiri Olsa 	$$ = term;
4208f707d84SJiri Olsa }
4218f707d84SJiri Olsa |
4221d33d6dcSJiri Olsa PE_VALUE_SYM_HW
4231d33d6dcSJiri Olsa {
4246cee6cd3SArnaldo Carvalho de Melo 	struct parse_events_term *term;
4251d33d6dcSJiri Olsa 	int config = $1 & 255;
4261d33d6dcSJiri Olsa 
4276cee6cd3SArnaldo Carvalho de Melo 	ABORT_ON(parse_events_term__sym_hw(&term, NULL, config));
4281d33d6dcSJiri Olsa 	$$ = term;
4291d33d6dcSJiri Olsa }
4301d33d6dcSJiri Olsa |
4316b5fc39bSJiri Olsa PE_TERM '=' PE_NAME
4326b5fc39bSJiri Olsa {
4336cee6cd3SArnaldo Carvalho de Melo 	struct parse_events_term *term;
4346b5fc39bSJiri Olsa 
4356cee6cd3SArnaldo Carvalho de Melo 	ABORT_ON(parse_events_term__str(&term, (int)$1, NULL, $3));
4366b5fc39bSJiri Olsa 	$$ = term;
4376b5fc39bSJiri Olsa }
4386b5fc39bSJiri Olsa |
4398f707d84SJiri Olsa PE_TERM '=' PE_VALUE
4408f707d84SJiri Olsa {
4416cee6cd3SArnaldo Carvalho de Melo 	struct parse_events_term *term;
4428f707d84SJiri Olsa 
4436cee6cd3SArnaldo Carvalho de Melo 	ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, $3));
4448f707d84SJiri Olsa 	$$ = term;
4458f707d84SJiri Olsa }
4468f707d84SJiri Olsa |
4478f707d84SJiri Olsa PE_TERM
4488f707d84SJiri Olsa {
4496cee6cd3SArnaldo Carvalho de Melo 	struct parse_events_term *term;
4508f707d84SJiri Olsa 
4516cee6cd3SArnaldo Carvalho de Melo 	ABORT_ON(parse_events_term__num(&term, (int)$1, NULL, 1));
4528f707d84SJiri Olsa 	$$ = term;
45389812fc8SJiri Olsa }
45489812fc8SJiri Olsa 
45589812fc8SJiri Olsa sep_dc: ':' |
45689812fc8SJiri Olsa 
4578f707d84SJiri Olsa sep_slash_dc: '/' | ':' |
4588f707d84SJiri Olsa 
45989812fc8SJiri Olsa %%
46089812fc8SJiri Olsa 
4611d037ca1SIrina Tirdea void parse_events_error(void *data __maybe_unused, void *scanner __maybe_unused,
4621d037ca1SIrina Tirdea 			char const *msg __maybe_unused)
46389812fc8SJiri Olsa {
46489812fc8SJiri Olsa }
465