2 %name-prefix "parse_events_"
3 %parse-param {struct list_head *list}
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
48 struct list_head *head;
49 struct parse_events__term *term;
54 events ',' event | event
57 event_def PE_MODIFIER_EVENT
59 ABORT_ON(parse_events_modifier(list, $2));
64 event_def: event_legacy_symbol |
65 event_legacy_cache sep_dc |
67 event_legacy_tracepoint sep_dc |
68 event_legacy_numeric sep_dc |
69 event_legacy_raw sep_dc
72 PE_VALUE_SYM '/' event_config '/'
75 int config = $1 & 255;
77 ABORT_ON(parse_events_add_numeric(list, idx, type, config, $3));
78 parse_events__free_terms($3);
81 PE_VALUE_SYM sep_slash_dc
84 int config = $1 & 255;
86 ABORT_ON(parse_events_add_numeric(list, idx, type, config, NULL));
90 PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT
92 ABORT_ON(parse_events_add_cache(list, idx, $1, $3, $5));
95 PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT
97 ABORT_ON(parse_events_add_cache(list, idx, $1, $3, NULL));
102 ABORT_ON(parse_events_add_cache(list, idx, $1, NULL, NULL));
106 PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
108 ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) $2, $4));
111 PE_PREFIX_MEM PE_VALUE sep_dc
113 ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) $2, NULL));
116 event_legacy_tracepoint:
119 ABORT_ON(parse_events_add_tracepoint(list, idx, $1, $3));
122 event_legacy_numeric:
123 PE_VALUE ':' PE_VALUE
125 ABORT_ON(parse_events_add_numeric(list, idx, $1, $3, NULL));
131 ABORT_ON(parse_events_add_numeric(list, idx, PERF_TYPE_RAW, $1, NULL));
135 event_config ',' event_term
137 struct list_head *head = $1;
138 struct parse_events__term *term = $3;
141 list_add_tail(&term->list, head);
147 struct list_head *head = malloc(sizeof(*head));
148 struct parse_events__term *term = $1;
151 INIT_LIST_HEAD(head);
152 list_add_tail(&term->list, head);
159 struct parse_events__term *term;
161 ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_STR,
168 struct parse_events__term *term;
170 ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_NUM,
177 struct parse_events__term *term;
179 ABORT_ON(parse_events__new_term(&term, PARSE_EVENTS__TERM_TYPE_NUM,
186 struct parse_events__term *term;
188 ABORT_ON(parse_events__new_term(&term, $1, NULL, NULL, $3));
194 struct parse_events__term *term;
196 ABORT_ON(parse_events__new_term(&term, $1, NULL, NULL, 1));
202 sep_slash_dc: '/' | ':' |
206 void parse_events_error(struct list_head *list __used, int *idx __used,
207 char const *msg __used)