blob: 4b4459e67a0aeac425ff29a114072fd7b8c39d66 [file] [log] [blame]
Jiri Olsa89812fc2012-03-15 20:09:15 +01001
2%name-prefix "parse_events_"
3%parse-param {struct list_head *list}
4%parse-param {int *idx}
5
6%{
7
8#define YYDEBUG 1
9
10#include <linux/compiler.h>
11#include <linux/list.h>
12#include "types.h"
13#include "util.h"
14#include "parse-events.h"
15
16extern int parse_events_lex (void);
17
18#define ABORT_ON(val) \
19do { \
20 if (val) \
21 YYABORT; \
22} while (0)
23
24%}
25
26%token PE_VALUE PE_VALUE_SYM PE_RAW
27%token PE_NAME
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
31%token PE_ERROR
32%type <num> PE_VALUE
33%type <num> PE_VALUE_SYM
34%type <num> PE_RAW
35%type <str> PE_NAME
36%type <str> PE_NAME_CACHE_TYPE
37%type <str> PE_NAME_CACHE_OP_RESULT
38%type <str> PE_MODIFIER_EVENT
39%type <str> PE_MODIFIER_BP
40
41%union
42{
43 char *str;
44 unsigned long num;
45}
46%%
47
48events:
49events ',' event | event
50
51event:
52event_def PE_MODIFIER_EVENT
53{
54 ABORT_ON(parse_events_modifier(list, $2));
55}
56|
57event_def
58
59event_def: event_legacy_symbol sep_dc |
60 event_legacy_cache sep_dc |
61 event_legacy_mem |
62 event_legacy_tracepoint sep_dc |
63 event_legacy_numeric sep_dc |
64 event_legacy_raw sep_dc
65
66event_legacy_symbol:
67PE_VALUE_SYM
68{
69 int type = $1 >> 16;
70 int config = $1 & 255;
71
72 ABORT_ON(parse_events_add_numeric(list, idx, type, config));
73}
74
75event_legacy_cache:
76PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT '-' PE_NAME_CACHE_OP_RESULT
77{
78 ABORT_ON(parse_events_add_cache(list, idx, $1, $3, $5));
79}
80|
81PE_NAME_CACHE_TYPE '-' PE_NAME_CACHE_OP_RESULT
82{
83 ABORT_ON(parse_events_add_cache(list, idx, $1, $3, NULL));
84}
85|
86PE_NAME_CACHE_TYPE
87{
88 ABORT_ON(parse_events_add_cache(list, idx, $1, NULL, NULL));
89}
90
91event_legacy_mem:
92PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
93{
94 ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) $2, $4));
95}
96|
97PE_PREFIX_MEM PE_VALUE sep_dc
98{
99 ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) $2, NULL));
100}
101
102event_legacy_tracepoint:
103PE_NAME ':' PE_NAME
104{
105 ABORT_ON(parse_events_add_tracepoint(list, idx, $1, $3));
106}
107
108event_legacy_numeric:
109PE_VALUE ':' PE_VALUE
110{
111 ABORT_ON(parse_events_add_numeric(list, idx, $1, $3));
112}
113
114event_legacy_raw:
115PE_RAW
116{
117 ABORT_ON(parse_events_add_numeric(list, idx, PERF_TYPE_RAW, $1));
118}
119
120sep_dc: ':' |
121
122%%
123
124void parse_events_error(struct list_head *list __used, int *idx __used,
125 char const *msg __used)
126{
127}