2 %name-prefix "parse_events_"
3 %parse-param {struct list_head *list_all}
4 %parse-param {int *idx}
10 #include <linux/compiler.h>
11 #include <linux/list.h>
14 #include "parse-events.h"
16 extern int parse_events_lex (void);
18 #define ABORT_ON(val) \
26 %token PE_VALUE PE_VALUE_SYM PE_RAW PE_TERM
28 %token PE_MODIFIER_EVENT PE_MODIFIER_BP
29 %token PE_NAME_CACHE_TYPE PE_NAME_CACHE_OP_RESULT
30 %token PE_PREFIX_MEM PE_PREFIX_RAW
33 %type <num> PE_VALUE_SYM
37 %type <str> PE_NAME_CACHE_TYPE
38 %type <str> PE_NAME_CACHE_OP_RESULT
39 %type <str> PE_MODIFIER_EVENT
40 %type <str> PE_MODIFIER_BP
41 %type <head> event_config
42 %type <term> event_term
43 %type <head> event_pmu
44 %type <head> event_legacy_symbol
45 %type <head> event_legacy_cache
46 %type <head> event_legacy_mem
47 %type <head> event_legacy_tracepoint
48 %type <head> event_legacy_numeric
49 %type <head> event_legacy_raw
50 %type <head> event_def
56 struct list_head *head;
57 struct parse_events__term *term;
62 events ',' event | event
65 event_def PE_MODIFIER_EVENT
68 * Apply modifier on all events added by single event definition
69 * (there could be more events added for multiple tracepoint
70 * definitions via '*?'.
72 ABORT_ON(parse_events_modifier($1, $2));
73 parse_events_update_lists($1, list_all);
78 parse_events_update_lists($1, list_all);
81 event_def: event_pmu |
83 event_legacy_cache sep_dc |
85 event_legacy_tracepoint sep_dc |
86 event_legacy_numeric sep_dc |
87 event_legacy_raw sep_dc
90 PE_NAME '/' event_config '/'
92 struct list_head *list = NULL;
94 ABORT_ON(parse_events_add_pmu(&list, idx, $1, $3));
95 parse_events__free_terms($3);
100 PE_VALUE_SYM '/' event_config '/'
102 struct list_head *list = NULL;
104 int config = $1 & 255;
106 ABORT_ON(parse_events_add_numeric(&list, idx, type, config, $3));
107 parse_events__free_terms($3);
111 PE_VALUE_SYM sep_slash_dc
113 struct list_head *list = NULL;
115 int config = $1 & 255;
117 ABORT_ON(parse_events_add_numeric(&list, idx, type, config, NULL));
122 PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT
124 struct list_head *list = NULL;
126 ABORT_ON(parse_events_add_cache(&list, idx, $1, $3, $5));
130 PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT
132 struct list_head *list = NULL;
134 ABORT_ON(parse_events_add_cache(&list, idx, $1, $3, NULL));
140 struct list_head *list = NULL;
142 ABORT_ON(parse_events_add_cache(&list, idx, $1, NULL, NULL));
147 PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
149 struct list_head *list = NULL;
151 ABORT_ON(parse_events_add_breakpoint(&list, idx, (void *) $2, $4));
155 PE_PREFIX_MEM PE_VALUE sep_dc
157 struct list_head *list = NULL;
159 ABORT_ON(parse_events_add_breakpoint(&list, idx, (void *) $2, NULL));
163 event_legacy_tracepoint:
166 struct list_head *list = NULL;
168 ABORT_ON(parse_events_add_tracepoint(&list, idx, $1, $3));
172 event_legacy_numeric:
173 PE_VALUE ':' PE_VALUE
175 struct list_head *list = NULL;
177 ABORT_ON(parse_events_add_numeric(&list, idx, $1, $3, NULL));
184 struct list_head *list = NULL;
186 ABORT_ON(parse_events_add_numeric(&list, idx, PERF_TYPE_RAW, $1, NULL));
191 event_config ',' event_term
193 struct list_head *head = $1;
194 struct parse_events__term *term = $3;
197 list_add_tail(&term->list, head);
203 struct list_head *head = malloc(sizeof(*head));
204 struct parse_events__term *term = $1;
207 INIT_LIST_HEAD(head);
208 list_add_tail(&term->list, head);
215 struct parse_events__term *term;
217 ABORT_ON(parse_events__term_str(&term, PARSE_EVENTS__TERM_TYPE_USER,
224 struct parse_events__term *term;
226 ABORT_ON(parse_events__term_num(&term, PARSE_EVENTS__TERM_TYPE_USER,
233 struct parse_events__term *term;
235 ABORT_ON(parse_events__term_num(&term, PARSE_EVENTS__TERM_TYPE_USER,
242 struct parse_events__term *term;
244 ABORT_ON(parse_events__term_str(&term, $1, NULL, $3));
250 struct parse_events__term *term;
252 ABORT_ON(parse_events__term_num(&term, $1, NULL, $3));
258 struct parse_events__term *term;
260 ABORT_ON(parse_events__term_num(&term, $1, NULL, 1));
266 sep_slash_dc: '/' | ':' |
270 void parse_events_error(struct list_head *list_all __used,
272 char const *msg __used)