aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/Makefile17
-rw-r--r--tools/perf/builtin-test.c6
-rw-r--r--tools/perf/util/parse-events-bison.c1715
-rw-r--r--tools/perf/util/parse-events-bison.h79
-rw-r--r--tools/perf/util/parse-events-flex.c2225
-rw-r--r--tools/perf/util/parse-events-flex.h316
-rw-r--r--tools/perf/util/parse-events.c486
-rw-r--r--tools/perf/util/parse-events.h15
-rw-r--r--tools/perf/util/parse-events.l107
-rw-r--r--tools/perf/util/parse-events.y127
10 files changed, 4752 insertions, 341 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index bd328554aec..dfc80289d7f 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -61,6 +61,8 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
61 61
62CC = $(CROSS_COMPILE)gcc 62CC = $(CROSS_COMPILE)gcc
63AR = $(CROSS_COMPILE)ar 63AR = $(CROSS_COMPILE)ar
64FLEX = $(CROSS_COMPILE)flex
65BISON= $(CROSS_COMPILE)bison
64 66
65# Additional ARCH settings for x86 67# Additional ARCH settings for x86
66ifeq ($(ARCH),i386) 68ifeq ($(ARCH),i386)
@@ -357,6 +359,8 @@ LIB_OBJS += $(OUTPUT)util/session.o
357LIB_OBJS += $(OUTPUT)util/thread.o 359LIB_OBJS += $(OUTPUT)util/thread.o
358LIB_OBJS += $(OUTPUT)util/thread_map.o 360LIB_OBJS += $(OUTPUT)util/thread_map.o
359LIB_OBJS += $(OUTPUT)util/trace-event-parse.o 361LIB_OBJS += $(OUTPUT)util/trace-event-parse.o
362LIB_OBJS += $(OUTPUT)util/parse-events-flex.o
363LIB_OBJS += $(OUTPUT)util/parse-events-bison.o
360LIB_OBJS += $(OUTPUT)util/trace-event-read.o 364LIB_OBJS += $(OUTPUT)util/trace-event-read.o
361LIB_OBJS += $(OUTPUT)util/trace-event-info.o 365LIB_OBJS += $(OUTPUT)util/trace-event-info.o
362LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o 366LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o
@@ -645,6 +649,8 @@ ifndef V
645 QUIET_LINK = @echo ' ' LINK $@; 649 QUIET_LINK = @echo ' ' LINK $@;
646 QUIET_MKDIR = @echo ' ' MKDIR $@; 650 QUIET_MKDIR = @echo ' ' MKDIR $@;
647 QUIET_GEN = @echo ' ' GEN $@; 651 QUIET_GEN = @echo ' ' GEN $@;
652 QUIET_FLEX = @echo ' ' FLEX $@;
653 QUIET_BISON = @echo ' ' BISON $@;
648endif 654endif
649endif 655endif
650 656
@@ -725,6 +731,9 @@ $(OUTPUT)perf.o perf.spec \
725 $(SCRIPTS) \ 731 $(SCRIPTS) \
726 : $(OUTPUT)PERF-VERSION-FILE 732 : $(OUTPUT)PERF-VERSION-FILE
727 733
734.SUFFIXES:
735.SUFFIXES: .o .c .S .s
736
728$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS 737$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
729 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $< 738 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
730$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS 739$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
@@ -761,6 +770,9 @@ $(OUTPUT)util/ui/browsers/map.o: util/ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
761$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS 770$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
762 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< 771 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
763 772
773$(OUTPUT)util/parse-events-flex.o: util/parse-events-flex.c $(OUTPUT)PERF-CFLAGS
774 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $<
775
764$(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS 776$(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS
765 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $< 777 $(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
766 778
@@ -797,6 +809,7 @@ help:
797 @echo ' html - make html documentation' 809 @echo ' html - make html documentation'
798 @echo ' info - make GNU info documentation (access with info <foo>)' 810 @echo ' info - make GNU info documentation (access with info <foo>)'
799 @echo ' pdf - make pdf documentation' 811 @echo ' pdf - make pdf documentation'
812 @echo ' event-parser - make event parser code'
800 @echo ' TAGS - use etags to make tag information for source browsing' 813 @echo ' TAGS - use etags to make tag information for source browsing'
801 @echo ' tags - use ctags to make tag information for source browsing' 814 @echo ' tags - use ctags to make tag information for source browsing'
802 @echo ' cscope - use cscope to make interactive browsing database' 815 @echo ' cscope - use cscope to make interactive browsing database'
@@ -846,6 +859,10 @@ cscope:
846 $(RM) cscope* 859 $(RM) cscope*
847 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b 860 $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
848 861
862event-parser:
863 $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o util/parse-events-bison.c
864 $(QUIET_FLEX)$(FLEX) --header-file=util/parse-events-flex.h -t util/parse-events.l > util/parse-events-flex.c
865
849### Detect prefix changes 866### Detect prefix changes
850TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\ 867TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
851 $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ) 868 $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c
index 3e087ce8daa..844c53a49a5 100644
--- a/tools/perf/builtin-test.c
+++ b/tools/perf/builtin-test.c
@@ -650,7 +650,7 @@ static int test__checkevent_raw(struct perf_evlist *evlist)
650 650
651 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); 651 TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries);
652 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type); 652 TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->attr.type);
653 TEST_ASSERT_VAL("wrong config", 1 == evsel->attr.config); 653 TEST_ASSERT_VAL("wrong config", 0x1a == evsel->attr.config);
654 return 0; 654 return 0;
655} 655}
656 656
@@ -872,7 +872,7 @@ static struct test__event_st {
872 .check = test__checkevent_tracepoint_multi, 872 .check = test__checkevent_tracepoint_multi,
873 }, 873 },
874 { 874 {
875 .name = "r1", 875 .name = "r1a",
876 .check = test__checkevent_raw, 876 .check = test__checkevent_raw,
877 }, 877 },
878 { 878 {
@@ -916,7 +916,7 @@ static struct test__event_st {
916 .check = test__checkevent_tracepoint_multi_modifier, 916 .check = test__checkevent_tracepoint_multi_modifier,
917 }, 917 },
918 { 918 {
919 .name = "r1:kp", 919 .name = "r1a:kp",
920 .check = test__checkevent_raw_modifier, 920 .check = test__checkevent_raw_modifier,
921 }, 921 },
922 { 922 {
diff --git a/tools/perf/util/parse-events-bison.c b/tools/perf/util/parse-events-bison.c
new file mode 100644
index 00000000000..20fca263566
--- /dev/null
+++ b/tools/perf/util/parse-events-bison.c
@@ -0,0 +1,1715 @@
1/* A Bison parser, made by GNU Bison 2.4.3. */
2
3/* Skeleton implementation for Bison's Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
6 2009, 2010 Free Software Foundation, Inc.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21/* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34/* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
37/* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
43
44/* Identify Bison output. */
45#define YYBISON 1
46
47/* Bison version. */
48#define YYBISON_VERSION "2.4.3"
49
50/* Skeleton name. */
51#define YYSKELETON_NAME "yacc.c"
52
53/* Pure parsers. */
54#define YYPURE 0
55
56/* Push parsers. */
57#define YYPUSH 0
58
59/* Pull parsers. */
60#define YYPULL 1
61
62/* Using locations. */
63#define YYLSP_NEEDED 0
64
65/* Substitute the variable and function names. */
66#define yyparse parse_events_parse
67#define yylex parse_events_lex
68#define yyerror parse_events_error
69#define yylval parse_events_lval
70#define yychar parse_events_char
71#define yydebug parse_events_debug
72#define yynerrs parse_events_nerrs
73
74
75/* Copy the first part of user declarations. */
76
77/* Line 189 of yacc.c */
78#line 6 "util/parse-events.y"
79
80
81#define YYDEBUG 1
82
83#include <linux/compiler.h>
84#include <linux/list.h>
85#include "types.h"
86#include "util.h"
87#include "parse-events.h"
88
89extern int parse_events_lex (void);
90
91#define ABORT_ON(val) \
92do { \
93 if (val) \
94 YYABORT; \
95} while (0)
96
97
98
99/* Line 189 of yacc.c */
100#line 101 "util/parse-events-bison.c"
101
102/* Enabling traces. */
103#ifndef YYDEBUG
104# define YYDEBUG 0
105#endif
106
107/* Enabling verbose error messages. */
108#ifdef YYERROR_VERBOSE
109# undef YYERROR_VERBOSE
110# define YYERROR_VERBOSE 1
111#else
112# define YYERROR_VERBOSE 0
113#endif
114
115/* Enabling the token table. */
116#ifndef YYTOKEN_TABLE
117# define YYTOKEN_TABLE 0
118#endif
119
120
121/* Tokens. */
122#ifndef YYTOKENTYPE
123# define YYTOKENTYPE
124 /* Put the tokens into the symbol table, so that GDB and other debuggers
125 know about them. */
126 enum yytokentype {
127 PE_VALUE = 258,
128 PE_VALUE_SYM = 259,
129 PE_RAW = 260,
130 PE_NAME = 261,
131 PE_MODIFIER_EVENT = 262,
132 PE_MODIFIER_BP = 263,
133 PE_NAME_CACHE_TYPE = 264,
134 PE_NAME_CACHE_OP_RESULT = 265,
135 PE_PREFIX_MEM = 266,
136 PE_PREFIX_RAW = 267,
137 PE_ERROR = 268
138 };
139#endif
140
141
142
143#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
144typedef union YYSTYPE
145{
146
147/* Line 214 of yacc.c */
148#line 42 "util/parse-events.y"
149
150 char *str;
151 unsigned long num;
152
153
154
155/* Line 214 of yacc.c */
156#line 157 "util/parse-events-bison.c"
157} YYSTYPE;
158# define YYSTYPE_IS_TRIVIAL 1
159# define yystype YYSTYPE /* obsolescent; will be withdrawn */
160# define YYSTYPE_IS_DECLARED 1
161#endif
162
163
164/* Copy the second part of user declarations. */
165
166
167/* Line 264 of yacc.c */
168#line 169 "util/parse-events-bison.c"
169
170#ifdef short
171# undef short
172#endif
173
174#ifdef YYTYPE_UINT8
175typedef YYTYPE_UINT8 yytype_uint8;
176#else
177typedef unsigned char yytype_uint8;
178#endif
179
180#ifdef YYTYPE_INT8
181typedef YYTYPE_INT8 yytype_int8;
182#elif (defined __STDC__ || defined __C99__FUNC__ \
183 || defined __cplusplus || defined _MSC_VER)
184typedef signed char yytype_int8;
185#else
186typedef short int yytype_int8;
187#endif
188
189#ifdef YYTYPE_UINT16
190typedef YYTYPE_UINT16 yytype_uint16;
191#else
192typedef unsigned short int yytype_uint16;
193#endif
194
195#ifdef YYTYPE_INT16
196typedef YYTYPE_INT16 yytype_int16;
197#else
198typedef short int yytype_int16;
199#endif
200
201#ifndef YYSIZE_T
202# ifdef __SIZE_TYPE__
203# define YYSIZE_T __SIZE_TYPE__
204# elif defined size_t
205# define YYSIZE_T size_t
206# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
207 || defined __cplusplus || defined _MSC_VER)
208# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
209# define YYSIZE_T size_t
210# else
211# define YYSIZE_T unsigned int
212# endif
213#endif
214
215#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
216
217#ifndef YY_
218# if defined YYENABLE_NLS && YYENABLE_NLS
219# if ENABLE_NLS
220# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
221# define YY_(msgid) dgettext ("bison-runtime", msgid)
222# endif
223# endif
224# ifndef YY_
225# define YY_(msgid) msgid
226# endif
227#endif
228
229/* Suppress unused-variable warnings by "using" E. */
230#if ! defined lint || defined __GNUC__
231# define YYUSE(e) ((void) (e))
232#else
233# define YYUSE(e) /* empty */
234#endif
235
236/* Identity function, used to suppress warnings about constant conditions. */
237#ifndef lint
238# define YYID(n) (n)
239#else
240#if (defined __STDC__ || defined __C99__FUNC__ \
241 || defined __cplusplus || defined _MSC_VER)
242static int
243YYID (int yyi)
244#else
245static int
246YYID (yyi)
247 int yyi;
248#endif
249{
250 return yyi;
251}
252#endif
253
254#if ! defined yyoverflow || YYERROR_VERBOSE
255
256/* The parser invokes alloca or malloc; define the necessary symbols. */
257
258# ifdef YYSTACK_USE_ALLOCA
259# if YYSTACK_USE_ALLOCA
260# ifdef __GNUC__
261# define YYSTACK_ALLOC __builtin_alloca
262# elif defined __BUILTIN_VA_ARG_INCR
263# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
264# elif defined _AIX
265# define YYSTACK_ALLOC __alloca
266# elif defined _MSC_VER
267# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
268# define alloca _alloca
269# else
270# define YYSTACK_ALLOC alloca
271# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
272 || defined __cplusplus || defined _MSC_VER)
273# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
274# ifndef _STDLIB_H
275# define _STDLIB_H 1
276# endif
277# endif
278# endif
279# endif
280# endif
281
282# ifdef YYSTACK_ALLOC
283 /* Pacify GCC's `empty if-body' warning. */
284# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
285# ifndef YYSTACK_ALLOC_MAXIMUM
286 /* The OS might guarantee only one guard page at the bottom of the stack,
287 and a page size can be as small as 4096 bytes. So we cannot safely
288 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
289 to allow for a few compiler-allocated temporary stack slots. */
290# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
291# endif
292# else
293# define YYSTACK_ALLOC YYMALLOC
294# define YYSTACK_FREE YYFREE
295# ifndef YYSTACK_ALLOC_MAXIMUM
296# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
297# endif
298# if (defined __cplusplus && ! defined _STDLIB_H \
299 && ! ((defined YYMALLOC || defined malloc) \
300 && (defined YYFREE || defined free)))
301# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
302# ifndef _STDLIB_H
303# define _STDLIB_H 1
304# endif
305# endif
306# ifndef YYMALLOC
307# define YYMALLOC malloc
308# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
309 || defined __cplusplus || defined _MSC_VER)
310void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
311# endif
312# endif
313# ifndef YYFREE
314# define YYFREE free
315# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
316 || defined __cplusplus || defined _MSC_VER)
317void free (void *); /* INFRINGES ON USER NAME SPACE */
318# endif
319# endif
320# endif
321#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
322
323
324#if (! defined yyoverflow \
325 && (! defined __cplusplus \
326 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
327
328/* A type that is properly aligned for any stack member. */
329union yyalloc
330{
331 yytype_int16 yyss_alloc;
332 YYSTYPE yyvs_alloc;
333};
334
335/* The size of the maximum gap between one aligned stack and the next. */
336# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
337
338/* The size of an array large to enough to hold all stacks, each with
339 N elements. */
340# define YYSTACK_BYTES(N) \
341 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
342 + YYSTACK_GAP_MAXIMUM)
343
344/* Copy COUNT objects from FROM to TO. The source and destination do
345 not overlap. */
346# ifndef YYCOPY
347# if defined __GNUC__ && 1 < __GNUC__
348# define YYCOPY(To, From, Count) \
349 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
350# else
351# define YYCOPY(To, From, Count) \
352 do \
353 { \
354 YYSIZE_T yyi; \
355 for (yyi = 0; yyi < (Count); yyi++) \
356 (To)[yyi] = (From)[yyi]; \
357 } \
358 while (YYID (0))
359# endif
360# endif
361
362/* Relocate STACK from its old location to the new one. The
363 local variables YYSIZE and YYSTACKSIZE give the old and new number of
364 elements in the stack, and YYPTR gives the new location of the
365 stack. Advance YYPTR to a properly aligned location for the next
366 stack. */
367# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
368 do \
369 { \
370 YYSIZE_T yynewbytes; \
371 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
372 Stack = &yyptr->Stack_alloc; \
373 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
374 yyptr += yynewbytes / sizeof (*yyptr); \
375 } \
376 while (YYID (0))
377
378#endif
379
380/* YYFINAL -- State number of the termination state. */
381#define YYFINAL 20
382/* YYLAST -- Last index in YYTABLE. */
383#define YYLAST 27
384
385/* YYNTOKENS -- Number of terminals. */
386#define YYNTOKENS 17
387/* YYNNTS -- Number of nonterminals. */
388#define YYNNTS 11
389/* YYNRULES -- Number of rules. */
390#define YYNRULES 22
391/* YYNRULES -- Number of states. */
392#define YYNSTATES 39
393
394/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
395#define YYUNDEFTOK 2
396#define YYMAXUTOK 268
397
398#define YYTRANSLATE(YYX) \
399 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
400
401/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
402static const yytype_uint8 yytranslate[] =
403{
404 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
408 2, 2, 2, 2, 14, 15, 2, 2, 2, 2,
409 2, 2, 2, 2, 2, 2, 2, 2, 16, 2,
410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
427 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
428 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
429 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
430 5, 6, 7, 8, 9, 10, 11, 12, 13
431};
432
433#if YYDEBUG
434/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
435 YYRHS. */
436static const yytype_uint8 yyprhs[] =
437{
438 0, 0, 3, 7, 9, 12, 14, 17, 20, 22,
439 25, 28, 31, 33, 39, 43, 45, 51, 55, 59,
440 63, 65, 67
441};
442
443/* YYRHS -- A `-1'-separated list of the rules' RHS. */
444static const yytype_int8 yyrhs[] =
445{
446 18, 0, -1, 18, 14, 19, -1, 19, -1, 20,
447 7, -1, 20, -1, 21, 27, -1, 22, 27, -1,
448 23, -1, 24, 27, -1, 25, 27, -1, 26, 27,
449 -1, 4, -1, 9, 15, 10, 15, 10, -1, 9,
450 15, 10, -1, 9, -1, 11, 3, 16, 8, 27,
451 -1, 11, 3, 27, -1, 6, 16, 6, -1, 3,
452 16, 3, -1, 5, -1, 16, -1, -1
453};
454
455/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
456static const yytype_uint8 yyrline[] =
457{
458 0, 49, 49, 49, 52, 57, 59, 60, 61, 62,
459 63, 64, 67, 76, 81, 86, 92, 97, 103, 109,
460 115, 120, 120
461};
462#endif
463
464#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
465/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
466 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
467static const char *const yytname[] =
468{
469 "$end", "error", "$undefined", "PE_VALUE", "PE_VALUE_SYM", "PE_RAW",
470 "PE_NAME", "PE_MODIFIER_EVENT", "PE_MODIFIER_BP", "PE_NAME_CACHE_TYPE",
471 "PE_NAME_CACHE_OP_RESULT", "PE_PREFIX_MEM", "PE_PREFIX_RAW", "PE_ERROR",
472 "','", "'-'", "':'", "$accept", "events", "event", "event_def",
473 "event_legacy_symbol", "event_legacy_cache", "event_legacy_mem",
474 "event_legacy_tracepoint", "event_legacy_numeric", "event_legacy_raw",
475 "sep_dc", 0
476};
477#endif
478
479# ifdef YYPRINT
480/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
481 token YYLEX-NUM. */
482static const yytype_uint16 yytoknum[] =
483{
484 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
485 265, 266, 267, 268, 44, 45, 58
486};
487# endif
488
489/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
490static const yytype_uint8 yyr1[] =
491{
492 0, 17, 18, 18, 19, 19, 20, 20, 20, 20,
493 20, 20, 21, 22, 22, 22, 23, 23, 24, 25,
494 26, 27, 27
495};
496
497/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
498static const yytype_uint8 yyr2[] =
499{
500 0, 2, 3, 1, 2, 1, 2, 2, 1, 2,
501 2, 2, 1, 5, 3, 1, 5, 3, 3, 3,
502 1, 1, 0
503};
504
505/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
506 STATE-NUM when YYTABLE doesn't specify something else to do. Zero
507 means the default is an error. */
508static const yytype_uint8 yydefact[] =
509{
510 0, 0, 12, 20, 0, 15, 0, 0, 3, 5,
511 22, 22, 8, 22, 22, 22, 0, 0, 0, 22,
512 1, 0, 4, 21, 6, 7, 9, 10, 11, 19,
513 18, 14, 21, 17, 2, 0, 22, 13, 16
514};
515
516/* YYDEFGOTO[NTERM-NUM]. */
517static const yytype_int8 yydefgoto[] =
518{
519 -1, 7, 8, 9, 10, 11, 12, 13, 14, 15,
520 24
521};
522
523/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
524 STATE-NUM. */
525#define YYPACT_NINF -12
526static const yytype_int8 yypact[] =
527{
528 7, -10, -12, -12, -9, -6, 2, 1, -12, 10,
529 -2, -2, -12, -2, -2, -2, 16, 14, 11, 6,
530 -12, 7, -12, -12, -12, -12, -12, -12, -12, -12,
531 -12, 8, 18, -12, -12, 17, -2, -12, -12
532};
533
534/* YYPGOTO[NTERM-NUM]. */
535static const yytype_int8 yypgoto[] =
536{
537 -12, -12, 3, -12, -12, -12, -12, -12, -12, -12,
538 -11
539};
540
541/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
542 positive, shift that token. If negative, reduce the rule which
543 number is the opposite. If zero, do what YYDEFACT says.
544 If YYTABLE_NINF, syntax error. */
545#define YYTABLE_NINF -1
546static const yytype_uint8 yytable[] =
547{
548 25, 20, 26, 27, 28, 19, 16, 17, 33, 18,
549 1, 2, 3, 4, 23, 21, 5, 22, 6, 29,
550 30, 31, 32, 35, 34, 38, 36, 37
551};
552
553static const yytype_uint8 yycheck[] =
554{
555 11, 0, 13, 14, 15, 3, 16, 16, 19, 15,
556 3, 4, 5, 6, 16, 14, 9, 7, 11, 3,
557 6, 10, 16, 15, 21, 36, 8, 10
558};
559
560/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
561 symbol of state STATE-NUM. */
562static const yytype_uint8 yystos[] =
563{
564 0, 3, 4, 5, 6, 9, 11, 18, 19, 20,
565 21, 22, 23, 24, 25, 26, 16, 16, 15, 3,
566 0, 14, 7, 16, 27, 27, 27, 27, 27, 3,
567 6, 10, 16, 27, 19, 15, 8, 10, 27
568};
569
570#define yyerrok (yyerrstatus = 0)
571#define yyclearin (yychar = YYEMPTY)
572#define YYEMPTY (-2)
573#define YYEOF 0
574
575#define YYACCEPT goto yyacceptlab
576#define YYABORT goto yyabortlab
577#define YYERROR goto yyerrorlab
578
579
580/* Like YYERROR except do call yyerror. This remains here temporarily
581 to ease the transition to the new meaning of YYERROR, for GCC.
582 Once GCC version 2 has supplanted version 1, this can go. However,
583 YYFAIL appears to be in use. Nevertheless, it is formally deprecated
584 in Bison 2.4.2's NEWS entry, where a plan to phase it out is
585 discussed. */
586
587#define YYFAIL goto yyerrlab
588#if defined YYFAIL
589 /* This is here to suppress warnings from the GCC cpp's
590 -Wunused-macros. Normally we don't worry about that warning, but
591 some users do, and we want to make it easy for users to remove
592 YYFAIL uses, which will produce warnings from Bison 2.5. */
593#endif
594
595#define YYRECOVERING() (!!yyerrstatus)
596
597#define YYBACKUP(Token, Value) \
598do \
599 if (yychar == YYEMPTY && yylen == 1) \
600 { \
601 yychar = (Token); \
602 yylval = (Value); \
603 yytoken = YYTRANSLATE (yychar); \
604 YYPOPSTACK (1); \
605 goto yybackup; \
606 } \
607 else \
608 { \
609 yyerror (list, idx, YY_("syntax error: cannot back up")); \
610 YYERROR; \
611 } \
612while (YYID (0))
613
614
615#define YYTERROR 1
616#define YYERRCODE 256
617
618
619/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
620 If N is 0, then set CURRENT to the empty location which ends
621 the previous symbol: RHS[0] (always defined). */
622
623#define YYRHSLOC(Rhs, K) ((Rhs)[K])
624#ifndef YYLLOC_DEFAULT
625# define YYLLOC_DEFAULT(Current, Rhs, N) \
626 do \
627 if (YYID (N)) \
628 { \
629 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
630 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
631 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
632 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
633 } \
634 else \
635 { \
636 (Current).first_line = (Current).last_line = \
637 YYRHSLOC (Rhs, 0).last_line; \
638 (Current).first_column = (Current).last_column = \
639 YYRHSLOC (Rhs, 0).last_column; \
640 } \
641 while (YYID (0))
642#endif
643
644
645/* YY_LOCATION_PRINT -- Print the location on the stream.
646 This macro was not mandated originally: define only if we know
647 we won't break user code: when these are the locations we know. */
648
649#ifndef YY_LOCATION_PRINT
650# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
651# define YY_LOCATION_PRINT(File, Loc) \
652 fprintf (File, "%d.%d-%d.%d", \
653 (Loc).first_line, (Loc).first_column, \
654 (Loc).last_line, (Loc).last_column)
655# else
656# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
657# endif
658#endif
659
660
661/* YYLEX -- calling `yylex' with the right arguments. */
662
663#ifdef YYLEX_PARAM
664# define YYLEX yylex (YYLEX_PARAM)
665#else
666# define YYLEX yylex ()
667#endif
668
669/* Enable debugging if requested. */
670#if YYDEBUG
671
672# ifndef YYFPRINTF
673# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
674# define YYFPRINTF fprintf
675# endif
676
677# define YYDPRINTF(Args) \
678do { \
679 if (yydebug) \
680 YYFPRINTF Args; \
681} while (YYID (0))
682
683# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
684do { \
685 if (yydebug) \
686 { \
687 YYFPRINTF (stderr, "%s ", Title); \
688 yy_symbol_print (stderr, \
689 Type, Value, list, idx); \
690 YYFPRINTF (stderr, "\n"); \
691 } \
692} while (YYID (0))
693
694
695/*--------------------------------.
696| Print this symbol on YYOUTPUT. |
697`--------------------------------*/
698
699/*ARGSUSED*/
700#if (defined __STDC__ || defined __C99__FUNC__ \
701 || defined __cplusplus || defined _MSC_VER)
702static void
703yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *list, int *idx)
704#else
705static void
706yy_symbol_value_print (yyoutput, yytype, yyvaluep, list, idx)
707 FILE *yyoutput;
708 int yytype;
709 YYSTYPE const * const yyvaluep;
710 struct list_head *list;
711 int *idx;
712#endif
713{
714 if (!yyvaluep)
715 return;
716 YYUSE (list);
717 YYUSE (idx);
718# ifdef YYPRINT
719 if (yytype < YYNTOKENS)
720 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
721# else
722 YYUSE (yyoutput);
723# endif
724 switch (yytype)
725 {
726 default:
727 break;
728 }
729}
730
731
732/*--------------------------------.
733| Print this symbol on YYOUTPUT. |
734`--------------------------------*/
735
736#if (defined __STDC__ || defined __C99__FUNC__ \
737 || defined __cplusplus || defined _MSC_VER)
738static void
739yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, struct list_head *list, int *idx)
740#else
741static void
742yy_symbol_print (yyoutput, yytype, yyvaluep, list, idx)
743 FILE *yyoutput;
744 int yytype;
745 YYSTYPE const * const yyvaluep;
746 struct list_head *list;
747 int *idx;
748#endif
749{
750 if (yytype < YYNTOKENS)
751 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
752 else
753 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
754
755 yy_symbol_value_print (yyoutput, yytype, yyvaluep, list, idx);
756 YYFPRINTF (yyoutput, ")");
757}
758
759/*------------------------------------------------------------------.
760| yy_stack_print -- Print the state stack from its BOTTOM up to its |
761| TOP (included). |
762`------------------------------------------------------------------*/
763
764#if (defined __STDC__ || defined __C99__FUNC__ \
765 || defined __cplusplus || defined _MSC_VER)
766static void
767yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
768#else
769static void
770yy_stack_print (yybottom, yytop)
771 yytype_int16 *yybottom;
772 yytype_int16 *yytop;
773#endif
774{
775 YYFPRINTF (stderr, "Stack now");
776 for (; yybottom <= yytop; yybottom++)
777 {
778 int yybot = *yybottom;
779 YYFPRINTF (stderr, " %d", yybot);
780 }
781 YYFPRINTF (stderr, "\n");
782}
783
784# define YY_STACK_PRINT(Bottom, Top) \
785do { \
786 if (yydebug) \
787 yy_stack_print ((Bottom), (Top)); \
788} while (YYID (0))
789
790
791/*------------------------------------------------.
792| Report that the YYRULE is going to be reduced. |
793`------------------------------------------------*/
794
795#if (defined __STDC__ || defined __C99__FUNC__ \
796 || defined __cplusplus || defined _MSC_VER)
797static void
798yy_reduce_print (YYSTYPE *yyvsp, int yyrule, struct list_head *list, int *idx)
799#else
800static void
801yy_reduce_print (yyvsp, yyrule, list, idx)
802 YYSTYPE *yyvsp;
803 int yyrule;
804 struct list_head *list;
805 int *idx;
806#endif
807{
808 int yynrhs = yyr2[yyrule];
809 int yyi;
810 unsigned long int yylno = yyrline[yyrule];
811 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
812 yyrule - 1, yylno);
813 /* The symbols being reduced. */
814 for (yyi = 0; yyi < yynrhs; yyi++)
815 {
816 YYFPRINTF (stderr, " $%d = ", yyi + 1);
817 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
818 &(yyvsp[(yyi + 1) - (yynrhs)])
819 , list, idx);
820 YYFPRINTF (stderr, "\n");
821 }
822}
823
824# define YY_REDUCE_PRINT(Rule) \
825do { \
826 if (yydebug) \
827 yy_reduce_print (yyvsp, Rule, list, idx); \
828} while (YYID (0))
829
830/* Nonzero means print parse trace. It is left uninitialized so that
831 multiple parsers can coexist. */
832int yydebug;
833#else /* !YYDEBUG */
834# define YYDPRINTF(Args)
835# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
836# define YY_STACK_PRINT(Bottom, Top)
837# define YY_REDUCE_PRINT(Rule)
838#endif /* !YYDEBUG */
839
840
841/* YYINITDEPTH -- initial size of the parser's stacks. */
842#ifndef YYINITDEPTH
843# define YYINITDEPTH 200
844#endif
845
846/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
847 if the built-in stack extension method is used).
848
849 Do not make this value too large; the results are undefined if
850 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
851 evaluated with infinite-precision integer arithmetic. */
852
853#ifndef YYMAXDEPTH
854# define YYMAXDEPTH 10000
855#endif
856
857
858
859#if YYERROR_VERBOSE
860
861# ifndef yystrlen
862# if defined __GLIBC__ && defined _STRING_H
863# define yystrlen strlen
864# else
865/* Return the length of YYSTR. */
866#if (defined __STDC__ || defined __C99__FUNC__ \
867 || defined __cplusplus || defined _MSC_VER)
868static YYSIZE_T
869yystrlen (const char *yystr)
870#else
871static YYSIZE_T
872yystrlen (yystr)
873 const char *yystr;
874#endif
875{
876 YYSIZE_T yylen;
877 for (yylen = 0; yystr[yylen]; yylen++)
878 continue;
879 return yylen;
880}
881# endif
882# endif
883
884# ifndef yystpcpy
885# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
886# define yystpcpy stpcpy
887# else
888/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
889 YYDEST. */
890#if (defined __STDC__ || defined __C99__FUNC__ \
891 || defined __cplusplus || defined _MSC_VER)
892static char *
893yystpcpy (char *yydest, const char *yysrc)
894#else
895static char *
896yystpcpy (yydest, yysrc)
897 char *yydest;
898 const char *yysrc;
899#endif
900{
901 char *yyd = yydest;
902 const char *yys = yysrc;
903
904 while ((*yyd++ = *yys++) != '\0')
905 continue;
906
907 return yyd - 1;
908}
909# endif
910# endif
911
912# ifndef yytnamerr
913/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
914 quotes and backslashes, so that it's suitable for yyerror. The
915 heuristic is that double-quoting is unnecessary unless the string
916 contains an apostrophe, a comma, or backslash (other than
917 backslash-backslash). YYSTR is taken from yytname. If YYRES is
918 null, do not copy; instead, return the length of what the result
919 would have been. */
920static YYSIZE_T
921yytnamerr (char *yyres, const char *yystr)
922{
923 if (*yystr == '"')
924 {
925 YYSIZE_T yyn = 0;
926 char const *yyp = yystr;
927
928 for (;;)
929 switch (*++yyp)
930 {
931 case '\'':
932 case ',':
933 goto do_not_strip_quotes;
934
935 case '\\':
936 if (*++yyp != '\\')
937 goto do_not_strip_quotes;
938 /* Fall through. */
939 default:
940 if (yyres)
941 yyres[yyn] = *yyp;
942 yyn++;
943 break;
944
945 case '"':
946 if (yyres)
947 yyres[yyn] = '\0';
948 return yyn;
949 }
950 do_not_strip_quotes: ;
951 }
952
953 if (! yyres)
954 return yystrlen (yystr);
955
956 return yystpcpy (yyres, yystr) - yyres;
957}
958# endif
959
960/* Copy into YYRESULT an error message about the unexpected token
961 YYCHAR while in state YYSTATE. Return the number of bytes copied,
962 including the terminating null byte. If YYRESULT is null, do not
963 copy anything; just return the number of bytes that would be
964 copied. As a special case, return 0 if an ordinary "syntax error"
965 message will do. Return YYSIZE_MAXIMUM if overflow occurs during
966 size calculation. */
967static YYSIZE_T
968yysyntax_error (char *yyresult, int yystate, int yychar)
969{
970 int yyn = yypact[yystate];
971
972 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
973 return 0;
974 else
975 {
976 int yytype = YYTRANSLATE (yychar);
977 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
978 YYSIZE_T yysize = yysize0;
979 YYSIZE_T yysize1;
980 int yysize_overflow = 0;
981 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
982 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
983 int yyx;
984
985# if 0
986 /* This is so xgettext sees the translatable formats that are
987 constructed on the fly. */
988 YY_("syntax error, unexpected %s");
989 YY_("syntax error, unexpected %s, expecting %s");
990 YY_("syntax error, unexpected %s, expecting %s or %s");
991 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
992 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
993# endif
994 char *yyfmt;
995 char const *yyf;
996 static char const yyunexpected[] = "syntax error, unexpected %s";
997 static char const yyexpecting[] = ", expecting %s";
998 static char const yyor[] = " or %s";
999 char yyformat[sizeof yyunexpected
1000 + sizeof yyexpecting - 1
1001 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
1002 * (sizeof yyor - 1))];
1003 char const *yyprefix = yyexpecting;
1004
1005 /* Start YYX at -YYN if negative to avoid negative indexes in
1006 YYCHECK. */
1007 int yyxbegin = yyn < 0 ? -yyn : 0;
1008
1009 /* Stay within bounds of both yycheck and yytname. */
1010 int yychecklim = YYLAST - yyn + 1;
1011 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1012 int yycount = 1;
1013
1014 yyarg[0] = yytname[yytype];
1015 yyfmt = yystpcpy (yyformat, yyunexpected);
1016
1017 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1018 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
1019 {
1020 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1021 {
1022 yycount = 1;
1023 yysize = yysize0;
1024 yyformat[sizeof yyunexpected - 1] = '\0';
1025 break;
1026 }
1027 yyarg[yycount++] = yytname[yyx];
1028 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
1029 yysize_overflow |= (yysize1 < yysize);
1030 yysize = yysize1;
1031 yyfmt = yystpcpy (yyfmt, yyprefix);
1032 yyprefix = yyor;
1033 }
1034
1035 yyf = YY_(yyformat);
1036 yysize1 = yysize + yystrlen (yyf);
1037 yysize_overflow |= (yysize1 < yysize);
1038 yysize = yysize1;
1039
1040 if (yysize_overflow)
1041 return YYSIZE_MAXIMUM;
1042
1043 if (yyresult)
1044 {
1045 /* Avoid sprintf, as that infringes on the user's name space.
1046 Don't have undefined behavior even if the translation
1047 produced a string with the wrong number of "%s"s. */
1048 char *yyp = yyresult;
1049 int yyi = 0;
1050 while ((*yyp = *yyf) != '\0')
1051 {
1052 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
1053 {
1054 yyp += yytnamerr (yyp, yyarg[yyi++]);
1055 yyf += 2;
1056 }
1057 else
1058 {
1059 yyp++;
1060 yyf++;
1061 }
1062 }
1063 }
1064 return yysize;
1065 }
1066}
1067#endif /* YYERROR_VERBOSE */
1068
1069
1070/*-----------------------------------------------.
1071| Release the memory associated to this symbol. |
1072`-----------------------------------------------*/
1073
1074/*ARGSUSED*/
1075#if (defined __STDC__ || defined __C99__FUNC__ \
1076 || defined __cplusplus || defined _MSC_VER)
1077static void
1078yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, struct list_head *list, int *idx)
1079#else
1080static void
1081yydestruct (yymsg, yytype, yyvaluep, list, idx)
1082 const char *yymsg;
1083 int yytype;
1084 YYSTYPE *yyvaluep;
1085 struct list_head *list;
1086 int *idx;
1087#endif
1088{
1089 YYUSE (yyvaluep);
1090 YYUSE (list);
1091 YYUSE (idx);
1092
1093 if (!yymsg)
1094 yymsg = "Deleting";
1095 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1096
1097 switch (yytype)
1098 {
1099
1100 default:
1101 break;
1102 }
1103}
1104
1105/* Prevent warnings from -Wmissing-prototypes. */
1106#ifdef YYPARSE_PARAM
1107#if defined __STDC__ || defined __cplusplus
1108int yyparse (void *YYPARSE_PARAM);
1109#else
1110int yyparse ();
1111#endif
1112#else /* ! YYPARSE_PARAM */
1113#if defined __STDC__ || defined __cplusplus
1114int yyparse (struct list_head *list, int *idx);
1115#else
1116int yyparse ();
1117#endif
1118#endif /* ! YYPARSE_PARAM */
1119
1120
1121/* The lookahead symbol. */
1122int yychar;
1123
1124/* The semantic value of the lookahead symbol. */
1125YYSTYPE yylval;
1126
1127/* Number of syntax errors so far. */
1128int yynerrs;
1129
1130
1131
1132/*-------------------------.
1133| yyparse or yypush_parse. |
1134`-------------------------*/
1135
1136#ifdef YYPARSE_PARAM
1137#if (defined __STDC__ || defined __C99__FUNC__ \
1138 || defined __cplusplus || defined _MSC_VER)
1139int
1140yyparse (void *YYPARSE_PARAM)
1141#else
1142int
1143yyparse (YYPARSE_PARAM)
1144 void *YYPARSE_PARAM;
1145#endif
1146#else /* ! YYPARSE_PARAM */
1147#if (defined __STDC__ || defined __C99__FUNC__ \
1148 || defined __cplusplus || defined _MSC_VER)
1149int
1150yyparse (struct list_head *list, int *idx)
1151#else
1152int
1153yyparse (list, idx)
1154 struct list_head *list;
1155 int *idx;
1156#endif
1157#endif
1158{
1159
1160
1161 int yystate;
1162 /* Number of tokens to shift before error messages enabled. */
1163 int yyerrstatus;
1164
1165 /* The stacks and their tools:
1166 `yyss': related to states.
1167 `yyvs': related to semantic values.
1168
1169 Refer to the stacks thru separate pointers, to allow yyoverflow
1170 to reallocate them elsewhere. */
1171
1172 /* The state stack. */
1173 yytype_int16 yyssa[YYINITDEPTH];
1174 yytype_int16 *yyss;
1175 yytype_int16 *yyssp;
1176
1177 /* The semantic value stack. */
1178 YYSTYPE yyvsa[YYINITDEPTH];
1179 YYSTYPE *yyvs;
1180 YYSTYPE *yyvsp;
1181
1182 YYSIZE_T yystacksize;
1183
1184 int yyn;
1185 int yyresult;
1186 /* Lookahead token as an internal (translated) token number. */
1187 int yytoken;
1188 /* The variables used to return semantic value and location from the
1189 action routines. */
1190 YYSTYPE yyval;
1191
1192#if YYERROR_VERBOSE
1193 /* Buffer for error messages, and its allocated size. */
1194 char yymsgbuf[128];
1195 char *yymsg = yymsgbuf;
1196 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1197#endif
1198
1199#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1200
1201 /* The number of symbols on the RHS of the reduced rule.
1202 Keep to zero when no symbol should be popped. */
1203 int yylen = 0;
1204
1205 yytoken = 0;
1206 yyss = yyssa;
1207 yyvs = yyvsa;
1208 yystacksize = YYINITDEPTH;
1209
1210 YYDPRINTF ((stderr, "Starting parse\n"));
1211
1212 yystate = 0;
1213 yyerrstatus = 0;
1214 yynerrs = 0;
1215 yychar = YYEMPTY; /* Cause a token to be read. */
1216
1217 /* Initialize stack pointers.
1218 Waste one element of value and location stack
1219 so that they stay on the same level as the state stack.
1220 The wasted elements are never initialized. */
1221 yyssp = yyss;
1222 yyvsp = yyvs;
1223
1224 goto yysetstate;
1225
1226/*------------------------------------------------------------.
1227| yynewstate -- Push a new state, which is found in yystate. |
1228`------------------------------------------------------------*/
1229 yynewstate:
1230 /* In all cases, when you get here, the value and location stacks
1231 have just been pushed. So pushing a state here evens the stacks. */
1232 yyssp++;
1233
1234 yysetstate:
1235 *yyssp = yystate;
1236
1237 if (yyss + yystacksize - 1 <= yyssp)
1238 {
1239 /* Get the current used size of the three stacks, in elements. */
1240 YYSIZE_T yysize = yyssp - yyss + 1;
1241
1242#ifdef yyoverflow
1243 {
1244 /* Give user a chance to reallocate the stack. Use copies of
1245 these so that the &'s don't force the real ones into
1246 memory. */
1247 YYSTYPE *yyvs1 = yyvs;
1248 yytype_int16 *yyss1 = yyss;
1249
1250 /* Each stack pointer address is followed by the size of the
1251 data in use in that stack, in bytes. This used to be a
1252 conditional around just the two extra args, but that might
1253 be undefined if yyoverflow is a macro. */
1254 yyoverflow (YY_("memory exhausted"),
1255 &yyss1, yysize * sizeof (*yyssp),
1256 &yyvs1, yysize * sizeof (*yyvsp),
1257 &yystacksize);
1258
1259 yyss = yyss1;
1260 yyvs = yyvs1;
1261 }
1262#else /* no yyoverflow */
1263# ifndef YYSTACK_RELOCATE
1264 goto yyexhaustedlab;
1265# else
1266 /* Extend the stack our own way. */
1267 if (YYMAXDEPTH <= yystacksize)
1268 goto yyexhaustedlab;
1269 yystacksize *= 2;
1270 if (YYMAXDEPTH < yystacksize)
1271 yystacksize = YYMAXDEPTH;
1272
1273 {
1274 yytype_int16 *yyss1 = yyss;
1275 union yyalloc *yyptr =
1276 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1277 if (! yyptr)
1278 goto yyexhaustedlab;
1279 YYSTACK_RELOCATE (yyss_alloc, yyss);
1280 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1281# undef YYSTACK_RELOCATE
1282 if (yyss1 != yyssa)
1283 YYSTACK_FREE (yyss1);
1284 }
1285# endif
1286#endif /* no yyoverflow */
1287
1288 yyssp = yyss + yysize - 1;
1289 yyvsp = yyvs + yysize - 1;
1290
1291 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1292 (unsigned long int) yystacksize));
1293
1294 if (yyss + yystacksize - 1 <= yyssp)
1295 YYABORT;
1296 }
1297
1298 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1299
1300 if (yystate == YYFINAL)
1301 YYACCEPT;
1302
1303 goto yybackup;
1304
1305/*-----------.
1306| yybackup. |
1307`-----------*/
1308yybackup:
1309
1310 /* Do appropriate processing given the current state. Read a
1311 lookahead token if we need one and don't already have one. */
1312
1313 /* First try to decide what to do without reference to lookahead token. */
1314 yyn = yypact[yystate];
1315 if (yyn == YYPACT_NINF)
1316 goto yydefault;
1317
1318 /* Not known => get a lookahead token if don't already have one. */
1319
1320 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1321 if (yychar == YYEMPTY)
1322 {
1323 YYDPRINTF ((stderr, "Reading a token: "));
1324 yychar = YYLEX;
1325 }
1326
1327 if (yychar <= YYEOF)
1328 {
1329 yychar = yytoken = YYEOF;
1330 YYDPRINTF ((stderr, "Now at end of input.\n"));
1331 }
1332 else
1333 {
1334 yytoken = YYTRANSLATE (yychar);
1335 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1336 }
1337
1338 /* If the proper action on seeing token YYTOKEN is to reduce or to
1339 detect an error, take that action. */
1340 yyn += yytoken;
1341 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1342 goto yydefault;
1343 yyn = yytable[yyn];
1344 if (yyn <= 0)
1345 {
1346 if (yyn == 0 || yyn == YYTABLE_NINF)
1347 goto yyerrlab;
1348 yyn = -yyn;
1349 goto yyreduce;
1350 }
1351
1352 /* Count tokens shifted since error; after three, turn off error
1353 status. */
1354 if (yyerrstatus)
1355 yyerrstatus--;
1356
1357 /* Shift the lookahead token. */
1358 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1359
1360 /* Discard the shifted token. */
1361 yychar = YYEMPTY;
1362
1363 yystate = yyn;
1364 *++yyvsp = yylval;
1365
1366 goto yynewstate;
1367
1368
1369/*-----------------------------------------------------------.
1370| yydefault -- do the default action for the current state. |
1371`-----------------------------------------------------------*/
1372yydefault:
1373 yyn = yydefact[yystate];
1374 if (yyn == 0)
1375 goto yyerrlab;
1376 goto yyreduce;
1377
1378
1379/*-----------------------------.
1380| yyreduce -- Do a reduction. |
1381`-----------------------------*/
1382yyreduce:
1383 /* yyn is the number of a rule to reduce with. */
1384 yylen = yyr2[yyn];
1385
1386 /* If YYLEN is nonzero, implement the default value of the action:
1387 `$$ = $1'.
1388
1389 Otherwise, the following line sets YYVAL to garbage.
1390 This behavior is undocumented and Bison
1391 users should not rely upon it. Assigning to YYVAL
1392 unconditionally makes the parser a bit smaller, and it avoids a
1393 GCC warning that YYVAL may be used uninitialized. */
1394 yyval = yyvsp[1-yylen];
1395
1396
1397 YY_REDUCE_PRINT (yyn);
1398 switch (yyn)
1399 {
1400 case 4:
1401
1402/* Line 1464 of yacc.c */
1403#line 53 "util/parse-events.y"
1404 {
1405 ABORT_ON(parse_events_modifier(list, (yyvsp[(2) - (2)].str)));
1406;}
1407 break;
1408
1409 case 12:
1410
1411/* Line 1464 of yacc.c */
1412#line 68 "util/parse-events.y"
1413 {
1414 int type = (yyvsp[(1) - (1)].num) >> 16;
1415 int config = (yyvsp[(1) - (1)].num) & 255;
1416
1417 ABORT_ON(parse_events_add_numeric(list, idx, type, config));
1418;}
1419 break;
1420
1421 case 13:
1422
1423/* Line 1464 of yacc.c */
1424#line 77 "util/parse-events.y"
1425 {
1426 ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (5)].str), (yyvsp[(3) - (5)].str), (yyvsp[(5) - (5)].str)));
1427;}
1428 break;
1429
1430 case 14:
1431
1432/* Line 1464 of yacc.c */
1433#line 82 "util/parse-events.y"
1434 {
1435 ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str), NULL));
1436;}
1437 break;
1438
1439 case 15:
1440
1441/* Line 1464 of yacc.c */
1442#line 87 "util/parse-events.y"
1443 {
1444 ABORT_ON(parse_events_add_cache(list, idx, (yyvsp[(1) - (1)].str), NULL, NULL));
1445;}
1446 break;
1447
1448 case 16:
1449
1450/* Line 1464 of yacc.c */
1451#line 93 "util/parse-events.y"
1452 {
1453 ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) (yyvsp[(2) - (5)].num), (yyvsp[(4) - (5)].str)));
1454;}
1455 break;
1456
1457 case 17:
1458
1459/* Line 1464 of yacc.c */
1460#line 98 "util/parse-events.y"
1461 {
1462 ABORT_ON(parse_events_add_breakpoint(list, idx, (void *) (yyvsp[(2) - (3)].num), NULL));
1463;}
1464 break;
1465
1466 case 18:
1467
1468/* Line 1464 of yacc.c */
1469#line 104 "util/parse-events.y"
1470 {
1471 ABORT_ON(parse_events_add_tracepoint(list, idx, (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)));
1472;}
1473 break;
1474
1475 case 19:
1476
1477/* Line 1464 of yacc.c */
1478#line 110 "util/parse-events.y"
1479 {
1480 ABORT_ON(parse_events_add_numeric(list, idx, (yyvsp[(1) - (3)].num), (yyvsp[(3) - (3)].num)));
1481;}
1482 break;
1483
1484 case 20:
1485
1486/* Line 1464 of yacc.c */
1487#line 116 "util/parse-events.y"
1488 {
1489 ABORT_ON(parse_events_add_numeric(list, idx, PERF_TYPE_RAW, (yyvsp[(1) - (1)].num)));
1490;}
1491 break;
1492
1493
1494
1495/* Line 1464 of yacc.c */
1496#line 1497 "util/parse-events-bison.c"
1497 default: break;
1498 }
1499 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1500
1501 YYPOPSTACK (yylen);
1502 yylen = 0;
1503 YY_STACK_PRINT (yyss, yyssp);
1504
1505 *++yyvsp = yyval;
1506
1507 /* Now `shift' the result of the reduction. Determine what state
1508 that goes to, based on the state we popped back to and the rule
1509 number reduced by. */
1510
1511 yyn = yyr1[yyn];
1512
1513 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1514 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1515 yystate = yytable[yystate];
1516 else
1517 yystate = yydefgoto[yyn - YYNTOKENS];
1518
1519 goto yynewstate;
1520
1521
1522/*------------------------------------.
1523| yyerrlab -- here on detecting error |
1524`------------------------------------*/
1525yyerrlab:
1526 /* If not already recovering from an error, report this error. */
1527 if (!yyerrstatus)
1528 {
1529 ++yynerrs;
1530#if ! YYERROR_VERBOSE
1531 yyerror (list, idx, YY_("syntax error"));
1532#else
1533 {
1534 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
1535 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
1536 {
1537 YYSIZE_T yyalloc = 2 * yysize;
1538 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
1539 yyalloc = YYSTACK_ALLOC_MAXIMUM;
1540 if (yymsg != yymsgbuf)
1541 YYSTACK_FREE (yymsg);
1542 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
1543 if (yymsg)
1544 yymsg_alloc = yyalloc;
1545 else
1546 {
1547 yymsg = yymsgbuf;
1548 yymsg_alloc = sizeof yymsgbuf;
1549 }
1550 }
1551
1552 if (0 < yysize && yysize <= yymsg_alloc)
1553 {
1554 (void) yysyntax_error (yymsg, yystate, yychar);
1555 yyerror (list, idx, yymsg);
1556 }
1557 else
1558 {
1559 yyerror (list, idx, YY_("syntax error"));
1560 if (yysize != 0)
1561 goto yyexhaustedlab;
1562 }
1563 }
1564#endif
1565 }
1566
1567
1568
1569 if (yyerrstatus == 3)
1570 {
1571 /* If just tried and failed to reuse lookahead token after an
1572 error, discard it. */
1573
1574 if (yychar <= YYEOF)
1575 {
1576 /* Return failure if at end of input. */
1577 if (yychar == YYEOF)
1578 YYABORT;
1579 }
1580 else
1581 {
1582 yydestruct ("Error: discarding",
1583 yytoken, &yylval, list, idx);
1584 yychar = YYEMPTY;
1585 }
1586 }
1587
1588 /* Else will try to reuse lookahead token after shifting the error
1589 token. */
1590 goto yyerrlab1;
1591
1592
1593/*---------------------------------------------------.
1594| yyerrorlab -- error raised explicitly by YYERROR. |
1595`---------------------------------------------------*/
1596yyerrorlab:
1597
1598 /* Pacify compilers like GCC when the user code never invokes
1599 YYERROR and the label yyerrorlab therefore never appears in user
1600 code. */
1601 if (/*CONSTCOND*/ 0)
1602 goto yyerrorlab;
1603
1604 /* Do not reclaim the symbols of the rule which action triggered
1605 this YYERROR. */
1606 YYPOPSTACK (yylen);
1607 yylen = 0;
1608 YY_STACK_PRINT (yyss, yyssp);
1609 yystate = *yyssp;
1610 goto yyerrlab1;
1611
1612
1613/*-------------------------------------------------------------.
1614| yyerrlab1 -- common code for both syntax error and YYERROR. |
1615`-------------------------------------------------------------*/
1616yyerrlab1:
1617 yyerrstatus = 3; /* Each real token shifted decrements this. */
1618
1619 for (;;)
1620 {
1621 yyn = yypact[yystate];
1622 if (yyn != YYPACT_NINF)
1623 {
1624 yyn += YYTERROR;
1625 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1626 {
1627 yyn = yytable[yyn];
1628 if (0 < yyn)
1629 break;
1630 }
1631 }
1632
1633 /* Pop the current state because it cannot handle the error token. */
1634 if (yyssp == yyss)
1635 YYABORT;
1636
1637
1638 yydestruct ("Error: popping",
1639 yystos[yystate], yyvsp, list, idx);
1640 YYPOPSTACK (1);
1641 yystate = *yyssp;
1642 YY_STACK_PRINT (yyss, yyssp);
1643 }
1644
1645 *++yyvsp = yylval;
1646
1647
1648 /* Shift the error token. */
1649 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1650
1651 yystate = yyn;
1652 goto yynewstate;
1653
1654
1655/*-------------------------------------.
1656| yyacceptlab -- YYACCEPT comes here. |
1657`-------------------------------------*/
1658yyacceptlab:
1659 yyresult = 0;
1660 goto yyreturn;
1661
1662/*-----------------------------------.
1663| yyabortlab -- YYABORT comes here. |
1664`-----------------------------------*/
1665yyabortlab:
1666 yyresult = 1;
1667 goto yyreturn;
1668
1669#if !defined(yyoverflow) || YYERROR_VERBOSE
1670/*-------------------------------------------------.
1671| yyexhaustedlab -- memory exhaustion comes here. |
1672`-------------------------------------------------*/
1673yyexhaustedlab:
1674 yyerror (list, idx, YY_("memory exhausted"));
1675 yyresult = 2;
1676 /* Fall through. */
1677#endif
1678
1679yyreturn:
1680 if (yychar != YYEMPTY)
1681 yydestruct ("Cleanup: discarding lookahead",
1682 yytoken, &yylval, list, idx);
1683 /* Do not reclaim the symbols of the rule which action triggered
1684 this YYABORT or YYACCEPT. */
1685 YYPOPSTACK (yylen);
1686 YY_STACK_PRINT (yyss, yyssp);
1687 while (yyssp != yyss)
1688 {
1689 yydestruct ("Cleanup: popping",
1690 yystos[*yyssp], yyvsp, list, idx);
1691 YYPOPSTACK (1);
1692 }
1693#ifndef yyoverflow
1694 if (yyss != yyssa)
1695 YYSTACK_FREE (yyss);
1696#endif
1697#if YYERROR_VERBOSE
1698 if (yymsg != yymsgbuf)
1699 YYSTACK_FREE (yymsg);
1700#endif
1701 /* Make sure YYID is used. */
1702 return YYID (yyresult);
1703}
1704
1705
1706
1707/* Line 1684 of yacc.c */
1708#line 122 "util/parse-events.y"
1709
1710
1711void parse_events_error(struct list_head *list __used, int *idx __used,
1712 char const *msg __used)
1713{
1714}
1715
diff --git a/tools/perf/util/parse-events-bison.h b/tools/perf/util/parse-events-bison.h
new file mode 100644
index 00000000000..097a6323e6a
--- /dev/null
+++ b/tools/perf/util/parse-events-bison.h
@@ -0,0 +1,79 @@
1/* A Bison parser, made by GNU Bison 2.4.3. */
2
3/* Skeleton interface for Bison's Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
6 2009, 2010 Free Software Foundation, Inc.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20
21/* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34
35/* Tokens. */
36#ifndef YYTOKENTYPE
37# define YYTOKENTYPE
38 /* Put the tokens into the symbol table, so that GDB and other debuggers
39 know about them. */
40 enum yytokentype {
41 PE_VALUE = 258,
42 PE_VALUE_SYM = 259,
43 PE_RAW = 260,
44 PE_NAME = 261,
45 PE_MODIFIER_EVENT = 262,
46 PE_MODIFIER_BP = 263,
47 PE_NAME_CACHE_TYPE = 264,
48 PE_NAME_CACHE_OP_RESULT = 265,
49 PE_PREFIX_MEM = 266,
50 PE_PREFIX_RAW = 267,
51 PE_ERROR = 268
52 };
53#endif
54
55
56
57#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
58typedef union YYSTYPE
59{
60
61/* Line 1685 of yacc.c */
62#line 42 "util/parse-events.y"
63
64 char *str;
65 unsigned long num;
66
67
68
69/* Line 1685 of yacc.c */
70#line 71 "util/parse-events-bison.h"
71} YYSTYPE;
72# define YYSTYPE_IS_TRIVIAL 1
73# define yystype YYSTYPE /* obsolescent; will be withdrawn */
74# define YYSTYPE_IS_DECLARED 1
75#endif
76
77extern YYSTYPE parse_events_lval;
78
79
diff --git a/tools/perf/util/parse-events-flex.c b/tools/perf/util/parse-events-flex.c
new file mode 100644
index 00000000000..9e77ed6a0ec
--- /dev/null
+++ b/tools/perf/util/parse-events-flex.c
@@ -0,0 +1,2225 @@
1
2#line 3 "<stdout>"
3
4#define YY_INT_ALIGNED short int
5
6/* A lexical scanner generated by flex */
7
8#define yy_create_buffer parse_events__create_buffer
9#define yy_delete_buffer parse_events__delete_buffer
10#define yy_flex_debug parse_events__flex_debug
11#define yy_init_buffer parse_events__init_buffer
12#define yy_flush_buffer parse_events__flush_buffer
13#define yy_load_buffer_state parse_events__load_buffer_state
14#define yy_switch_to_buffer parse_events__switch_to_buffer
15#define yyin parse_events_in
16#define yyleng parse_events_leng
17#define yylex parse_events_lex
18#define yylineno parse_events_lineno
19#define yyout parse_events_out
20#define yyrestart parse_events_restart
21#define yytext parse_events_text
22#define yywrap parse_events_wrap
23#define yyalloc parse_events_alloc
24#define yyrealloc parse_events_realloc
25#define yyfree parse_events_free
26
27#define FLEX_SCANNER
28#define YY_FLEX_MAJOR_VERSION 2
29#define YY_FLEX_MINOR_VERSION 5
30#define YY_FLEX_SUBMINOR_VERSION 35
31#if YY_FLEX_SUBMINOR_VERSION > 0
32#define FLEX_BETA
33#endif
34
35/* First, we deal with platform-specific or compiler-specific issues. */
36
37/* begin standard C headers. */
38#include <stdio.h>
39#include <string.h>
40#include <errno.h>
41#include <stdlib.h>
42
43/* end standard C headers. */
44
45/* flex integer type definitions */
46
47#ifndef FLEXINT_H
48#define FLEXINT_H
49
50/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
51
52#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
53
54/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
55 * if you want the limit (max/min) macros for int types.
56 */
57#ifndef __STDC_LIMIT_MACROS
58#define __STDC_LIMIT_MACROS 1
59#endif
60
61#include <inttypes.h>
62typedef int8_t flex_int8_t;
63typedef uint8_t flex_uint8_t;
64typedef int16_t flex_int16_t;
65typedef uint16_t flex_uint16_t;
66typedef int32_t flex_int32_t;
67typedef uint32_t flex_uint32_t;
68#else
69typedef signed char flex_int8_t;
70typedef short int flex_int16_t;
71typedef int flex_int32_t;
72typedef unsigned char flex_uint8_t;
73typedef unsigned short int flex_uint16_t;
74typedef unsigned int flex_uint32_t;
75#endif /* ! C99 */
76
77/* Limits of integral types. */
78#ifndef INT8_MIN
79#define INT8_MIN (-128)
80#endif
81#ifndef INT16_MIN
82#define INT16_MIN (-32767-1)
83#endif
84#ifndef INT32_MIN
85#define INT32_MIN (-2147483647-1)
86#endif
87#ifndef INT8_MAX
88#define INT8_MAX (127)
89#endif
90#ifndef INT16_MAX
91#define INT16_MAX (32767)
92#endif
93#ifndef INT32_MAX
94#define INT32_MAX (2147483647)
95#endif
96#ifndef UINT8_MAX
97#define UINT8_MAX (255U)
98#endif
99#ifndef UINT16_MAX
100#define UINT16_MAX (65535U)
101#endif
102#ifndef UINT32_MAX
103#define UINT32_MAX (4294967295U)
104#endif
105
106#endif /* ! FLEXINT_H */
107
108#ifdef __cplusplus
109
110/* The "const" storage-class-modifier is valid. */
111#define YY_USE_CONST
112
113#else /* ! __cplusplus */
114
115/* C99 requires __STDC__ to be defined as 1. */
116#if defined (__STDC__)
117
118#define YY_USE_CONST
119
120#endif /* defined (__STDC__) */
121#endif /* ! __cplusplus */
122
123#ifdef YY_USE_CONST
124#define yyconst const
125#else
126#define yyconst
127#endif
128
129/* Returned upon end-of-file. */
130#define YY_NULL 0
131
132/* Promotes a possibly negative, possibly signed char to an unsigned
133 * integer for use as an array index. If the signed char is negative,
134 * we want to instead treat it as an 8-bit unsigned char, hence the
135 * double cast.
136 */
137#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
138
139/* Enter a start condition. This macro really ought to take a parameter,
140 * but we do it the disgusting crufty way forced on us by the ()-less
141 * definition of BEGIN.
142 */
143#define BEGIN (yy_start) = 1 + 2 *
144
145/* Translate the current start state into a value that can be later handed
146 * to BEGIN to return to the state. The YYSTATE alias is for lex
147 * compatibility.
148 */
149#define YY_START (((yy_start) - 1) / 2)
150#define YYSTATE YY_START
151
152/* Action number for EOF rule of a given start state. */
153#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
154
155/* Special action meaning "start processing a new file". */
156#define YY_NEW_FILE parse_events_restart(parse_events_in )
157
158#define YY_END_OF_BUFFER_CHAR 0
159
160/* Size of default input buffer. */
161#ifndef YY_BUF_SIZE
162#define YY_BUF_SIZE 16384
163#endif
164
165/* The state buf must be large enough to hold one state per character in the main buffer.
166 */
167#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
168
169#ifndef YY_TYPEDEF_YY_BUFFER_STATE
170#define YY_TYPEDEF_YY_BUFFER_STATE
171typedef struct yy_buffer_state *YY_BUFFER_STATE;
172#endif
173
174extern int parse_events_leng;
175
176extern FILE *parse_events_in, *parse_events_out;
177
178#define EOB_ACT_CONTINUE_SCAN 0
179#define EOB_ACT_END_OF_FILE 1
180#define EOB_ACT_LAST_MATCH 2
181
182 #define YY_LESS_LINENO(n)
183
184/* Return all but the first "n" matched characters back to the input stream. */
185#define yyless(n) \
186 do \
187 { \
188 /* Undo effects of setting up parse_events_text. */ \
189 int yyless_macro_arg = (n); \
190 YY_LESS_LINENO(yyless_macro_arg);\
191 *yy_cp = (yy_hold_char); \
192 YY_RESTORE_YY_MORE_OFFSET \
193 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
194 YY_DO_BEFORE_ACTION; /* set up parse_events_text again */ \
195 } \
196 while ( 0 )
197
198#define unput(c) yyunput( c, (yytext_ptr) )
199
200#ifndef YY_TYPEDEF_YY_SIZE_T
201#define YY_TYPEDEF_YY_SIZE_T
202typedef size_t yy_size_t;
203#endif
204
205#ifndef YY_STRUCT_YY_BUFFER_STATE
206#define YY_STRUCT_YY_BUFFER_STATE
207struct yy_buffer_state
208 {
209 FILE *yy_input_file;
210
211 char *yy_ch_buf; /* input buffer */
212 char *yy_buf_pos; /* current position in input buffer */
213
214 /* Size of input buffer in bytes, not including room for EOB
215 * characters.
216 */
217 yy_size_t yy_buf_size;
218
219 /* Number of characters read into yy_ch_buf, not including EOB
220 * characters.
221 */
222 int yy_n_chars;
223
224 /* Whether we "own" the buffer - i.e., we know we created it,
225 * and can realloc() it to grow it, and should free() it to
226 * delete it.
227 */
228 int yy_is_our_buffer;
229
230 /* Whether this is an "interactive" input source; if so, and
231 * if we're using stdio for input, then we want to use getc()
232 * instead of fread(), to make sure we stop fetching input after
233 * each newline.
234 */
235 int yy_is_interactive;
236
237 /* Whether we're considered to be at the beginning of a line.
238 * If so, '^' rules will be active on the next match, otherwise
239 * not.
240 */
241 int yy_at_bol;
242
243 int yy_bs_lineno; /**< The line count. */
244 int yy_bs_column; /**< The column count. */
245
246 /* Whether to try to fill the input buffer when we reach the
247 * end of it.
248 */
249 int yy_fill_buffer;
250
251 int yy_buffer_status;
252
253#define YY_BUFFER_NEW 0
254#define YY_BUFFER_NORMAL 1
255 /* When an EOF's been seen but there's still some text to process
256 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
257 * shouldn't try reading from the input source any more. We might
258 * still have a bunch of tokens to match, though, because of
259 * possible backing-up.
260 *
261 * When we actually see the EOF, we change the status to "new"
262 * (via parse_events_restart()), so that the user can continue scanning by
263 * just pointing parse_events_in at a new input file.
264 */
265#define YY_BUFFER_EOF_PENDING 2
266
267 };
268#endif /* !YY_STRUCT_YY_BUFFER_STATE */
269
270/* Stack of input buffers. */
271static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
272static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
273static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
274
275/* We provide macros for accessing buffer states in case in the
276 * future we want to put the buffer states in a more general
277 * "scanner state".
278 *
279 * Returns the top of the stack, or NULL.
280 */
281#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
282 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
283 : NULL)
284
285/* Same as previous macro, but useful when we know that the buffer stack is not
286 * NULL or when we need an lvalue. For internal use only.
287 */
288#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
289
290/* yy_hold_char holds the character lost when parse_events_text is formed. */
291static char yy_hold_char;
292static int yy_n_chars; /* number of characters read into yy_ch_buf */
293int parse_events_leng;
294
295/* Points to current character in buffer. */
296static char *yy_c_buf_p = (char *) 0;
297static int yy_init = 0; /* whether we need to initialize */
298static int yy_start = 0; /* start state number */
299
300/* Flag which is used to allow parse_events_wrap()'s to do buffer switches
301 * instead of setting up a fresh parse_events_in. A bit of a hack ...
302 */
303static int yy_did_buffer_switch_on_eof;
304
305void parse_events_restart (FILE *input_file );
306void parse_events__switch_to_buffer (YY_BUFFER_STATE new_buffer );
307YY_BUFFER_STATE parse_events__create_buffer (FILE *file,int size );
308void parse_events__delete_buffer (YY_BUFFER_STATE b );
309void parse_events__flush_buffer (YY_BUFFER_STATE b );
310void parse_events_push_buffer_state (YY_BUFFER_STATE new_buffer );
311void parse_events_pop_buffer_state (void );
312
313static void parse_events_ensure_buffer_stack (void );
314static void parse_events__load_buffer_state (void );
315static void parse_events__init_buffer (YY_BUFFER_STATE b,FILE *file );
316
317#define YY_FLUSH_BUFFER parse_events__flush_buffer(YY_CURRENT_BUFFER )
318
319YY_BUFFER_STATE parse_events__scan_buffer (char *base,yy_size_t size );
320YY_BUFFER_STATE parse_events__scan_string (yyconst char *yy_str );
321YY_BUFFER_STATE parse_events__scan_bytes (yyconst char *bytes,int len );
322
323void *parse_events_alloc (yy_size_t );
324void *parse_events_realloc (void *,yy_size_t );
325void parse_events_free (void * );
326
327#define yy_new_buffer parse_events__create_buffer
328
329#define yy_set_interactive(is_interactive) \
330 { \
331 if ( ! YY_CURRENT_BUFFER ){ \
332 parse_events_ensure_buffer_stack (); \
333 YY_CURRENT_BUFFER_LVALUE = \
334 parse_events__create_buffer(parse_events_in,YY_BUF_SIZE ); \
335 } \
336 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
337 }
338
339#define yy_set_bol(at_bol) \
340 { \
341 if ( ! YY_CURRENT_BUFFER ){\
342 parse_events_ensure_buffer_stack (); \
343 YY_CURRENT_BUFFER_LVALUE = \
344 parse_events__create_buffer(parse_events_in,YY_BUF_SIZE ); \
345 } \
346 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
347 }
348
349#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
350
351/* Begin user sect3 */
352
353typedef unsigned char YY_CHAR;
354
355FILE *parse_events_in = (FILE *) 0, *parse_events_out = (FILE *) 0;
356
357typedef int yy_state_type;
358
359extern int parse_events_lineno;
360
361int parse_events_lineno = 1;
362
363extern char *parse_events_text;
364#define yytext_ptr parse_events_text
365
366static yy_state_type yy_get_previous_state (void );
367static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
368static int yy_get_next_buffer (void );
369static void yy_fatal_error (yyconst char msg[] );
370
371/* Done after the current pattern has been matched and before the
372 * corresponding action - sets up parse_events_text.
373 */
374#define YY_DO_BEFORE_ACTION \
375 (yytext_ptr) = yy_bp; \
376 parse_events_leng = (size_t) (yy_cp - yy_bp); \
377 (yy_hold_char) = *yy_cp; \
378 *yy_cp = '\0'; \
379 (yy_c_buf_p) = yy_cp;
380
381#define YY_NUM_RULES 44
382#define YY_END_OF_BUFFER 45
383/* This struct is not used in this scanner,
384 but its presence is necessary. */
385struct yy_trans_info
386 {
387 flex_int32_t yy_verify;
388 flex_int32_t yy_nxt;
389 };
390static yyconst flex_int16_t yy_accept[425] =
391 { 0,
392 0, 0, 45, 44, 38, 41, 40, 39, 34, 34,
393 42, 43, 38, 38, 38, 38, 38, 38, 38, 38,
394 38, 38, 36, 38, 38, 38, 38, 38, 36, 37,
395 38, 38, 37, 37, 38, 34, 0, 38, 38, 38,
396 21, 38, 38, 38, 38, 38, 38, 38, 38, 38,
397 38, 38, 15, 38, 0, 38, 38, 38, 36, 0,
398 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
399 38, 38, 33, 33, 38, 38, 38, 38, 35, 38,
400 38, 0, 38, 38, 38, 24, 38, 38, 38, 38,
401 38, 38, 0, 38, 38, 38, 36, 0, 38, 38,
402
403 38, 0, 19, 20, 38, 38, 38, 38, 38, 38,
404 38, 30, 38, 38, 33, 33, 38, 38, 38, 38,
405 38, 38, 38, 0, 0, 38, 38, 38, 38, 0,
406 38, 38, 0, 38, 0, 22, 38, 38, 36, 0,
407 23, 38, 38, 19, 20, 26, 38, 32, 38, 38,
408 31, 25, 38, 38, 26, 38, 38, 38, 38, 38,
409 0, 38, 0, 0, 0, 0, 38, 38, 38, 38,
410 0, 38, 38, 0, 0, 38, 22, 38, 38, 36,
411 23, 0, 38, 26, 38, 38, 38, 38, 0, 38,
412 38, 38, 27, 0, 27, 0, 38, 0, 0, 0,
413
414 0, 38, 38, 24, 0, 0, 38, 0, 0, 0,
415 1, 38, 12, 0, 38, 0, 38, 0, 31, 0,
416 38, 38, 38, 0, 0, 38, 0, 0, 0, 38,
417 38, 0, 38, 0, 0, 0, 38, 0, 0, 0,
418 38, 0, 38, 0, 38, 0, 0, 38, 38, 38,
419 0, 38, 0, 0, 0, 38, 38, 0, 0, 7,
420 0, 0, 0, 0, 0, 0, 0, 38, 0, 38,
421 0, 38, 0, 0, 28, 38, 0, 0, 38, 0,
422 38, 0, 0, 0, 0, 0, 0, 10, 0, 0,
423 38, 0, 38, 0, 38, 0, 0, 38, 38, 0,
424
425 0, 38, 0, 0, 0, 0, 9, 0, 0, 0,
426 1, 0, 0, 0, 38, 0, 16, 0, 0, 28,
427 38, 0, 11, 38, 0, 0, 0, 0, 0, 0,
428 0, 0, 0, 0, 38, 0, 0, 12, 38, 0,
429 0, 0, 0, 0, 0, 6, 0, 0, 0, 0,
430 0, 4, 14, 13, 0, 0, 0, 0, 0, 0,
431 8, 0, 0, 0, 0, 0, 0, 0, 0, 0,
432 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
433 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
434 0, 0, 17, 0, 5, 15, 18, 0, 0, 29,
435
436 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
437 0, 0, 7, 3, 0, 0, 0, 2, 0, 0,
438 0, 0, 0, 0
439 } ;
440
441static yyconst flex_int32_t yy_ec[256] =
442 { 0,
443 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
444 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
445 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
446 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
447 1, 2, 1, 3, 4, 1, 5, 6, 7, 8,
448 9, 9, 9, 9, 9, 9, 9, 10, 1, 1,
449 11, 1, 2, 1, 12, 13, 14, 15, 12, 12,
450 2, 2, 16, 2, 2, 17, 2, 2, 2, 2,
451 2, 18, 2, 19, 2, 2, 2, 2, 2, 2,
452 1, 1, 1, 1, 2, 1, 20, 21, 22, 23,
453
454 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
455 34, 35, 2, 36, 37, 38, 39, 40, 41, 42,
456 43, 2, 1, 1, 1, 1, 1, 1, 1, 1,
457 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
458 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
459 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
460 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
461 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
462 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
463 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
464
465 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
466 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
467 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
468 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
469 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
470 1, 1, 1, 1, 1
471 } ;
472
473static yyconst flex_int32_t yy_meta[44] =
474 { 0,
475 1, 2, 1, 1, 1, 3, 3, 3, 3, 1,
476 1, 3, 3, 3, 3, 2, 2, 2, 2, 3,
477 3, 3, 3, 3, 3, 2, 2, 2, 2, 2,
478 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
479 2, 2, 2
480 } ;
481
482static yyconst flex_int16_t yy_base[427] =
483 { 0,
484 0, 0, 494, 495, 0, 495, 495, 495, 38, 42,
485 495, 495, 473, 459, 45, 467, 32, 20, 40, 53,
486 458, 469, 34, 62, 58, 58, 454, 452, 64, 98,
487 32, 466, 449, 0, 0, 81, 0, 446, 446, 478,
488 0, 467, 455, 457, 450, 54, 457, 455, 438, 452,
489 440, 433, 0, 449, 432, 452, 429, 428, 97, 428,
490 448, 433, 426, 105, 442, 432, 428, 104, 436, 421,
491 431, 432, 431, 77, 430, 95, 416, 424, 0, 431,
492 412, 103, 425, 424, 421, 0, 413, 441, 417, 405,
493 438, 410, 409, 426, 407, 406, 108, 405, 422, 410,
494
495 395, 111, 0, 0, 409, 397, 420, 393, 394, 390,
496 402, 0, 401, 399, 93, 116, 401, 391, 385, 390,
497 381, 414, 381, 76, 46, 380, 378, 381, 391, 390,
498 387, 386, 120, 385, 387, 0, 387, 368, 119, 384,
499 0, 400, 367, 495, 495, 365, 365, 495, 380, 363,
500 374, 0, 393, 372, 371, 355, 362, 368, 387, 366,
501 370, 349, 349, 366, 365, 347, 359, 345, 349, 353,
502 336, 374, 335, 113, 348, 338, 495, 336, 336, 0,
503 495, 350, 332, 0, 366, 331, 364, 330, 341, 327,
504 333, 339, 325, 339, 0, 343, 337, 338, 335, 334,
505
506 317, 321, 329, 121, 330, 119, 313, 316, 327, 322,
507 0, 319, 0, 303, 323, 319, 315, 317, 0, 321,
508 318, 319, 315, 306, 323, 297, 307, 306, 296, 309,
509 297, 129, 292, 297, 299, 302, 321, 302, 292, 286,
510 287, 298, 281, 298, 283, 296, 276, 287, 275, 308,
511 277, 282, 285, 284, 268, 282, 267, 271, 275, 0,
512 278, 264, 275, 262, 268, 273, 276, 262, 263, 265,
513 253, 258, 251, 258, 264, 259, 264, 263, 250, 261,
514 278, 244, 243, 242, 241, 253, 235, 495, 238, 236,
515 269, 248, 237, 239, 232, 237, 229, 229, 225, 221,
516
517 233, 229, 223, 235, 221, 221, 495, 233, 220, 227,
518 495, 226, 228, 215, 218, 212, 0, 211, 211, 0,
519 223, 224, 495, 241, 216, 223, 206, 217, 203, 215,
520 200, 203, 216, 231, 197, 196, 195, 495, 227, 199,
521 210, 194, 188, 187, 188, 495, 191, 201, 189, 182,
522 138, 0, 495, 495, 129, 196, 202, 185, 186, 194,
523 495, 193, 187, 176, 181, 191, 174, 175, 184, 170,
524 193, 167, 166, 179, 178, 495, 163, 178, 165, 178,
525 177, 192, 158, 166, 156, 155, 154, 160, 156, 165,
526 164, 141, 495, 152, 495, 495, 495, 161, 146, 495,
527
528 163, 146, 148, 147, 155, 156, 143, 139, 152, 141,
529 143, 139, 495, 495, 148, 146, 131, 495, 131, 126,
530 125, 81, 85, 495, 165, 68
531 } ;
532
533static yyconst flex_int16_t yy_def[427] =
534 { 0,
535 424, 1, 424, 424, 425, 424, 424, 424, 424, 424,
536 424, 424, 425, 425, 425, 425, 425, 425, 425, 425,
537 425, 425, 425, 425, 425, 425, 425, 425, 425, 425,
538 425, 425, 425, 425, 425, 424, 426, 425, 425, 425,
539 425, 425, 425, 425, 425, 425, 425, 425, 425, 425,
540 425, 425, 425, 425, 424, 425, 425, 425, 425, 424,
541 425, 425, 425, 425, 425, 425, 425, 425, 425, 425,
542 425, 425, 30, 30, 425, 425, 425, 425, 426, 425,
543 425, 424, 425, 425, 425, 425, 425, 425, 425, 425,
544 425, 425, 424, 425, 425, 425, 425, 424, 425, 425,
545
546 425, 424, 425, 425, 425, 425, 425, 425, 425, 425,
547 425, 425, 425, 425, 30, 30, 425, 425, 425, 425,
548 425, 425, 425, 424, 424, 425, 425, 425, 425, 424,
549 425, 425, 424, 425, 424, 425, 425, 425, 425, 424,
550 425, 425, 425, 424, 424, 425, 425, 424, 425, 425,
551 425, 425, 425, 425, 30, 425, 425, 425, 425, 425,
552 424, 425, 424, 424, 424, 424, 425, 425, 425, 425,
553 424, 425, 425, 424, 424, 425, 424, 425, 425, 425,
554 424, 424, 425, 425, 425, 425, 425, 425, 424, 425,
555 425, 425, 425, 424, 425, 424, 425, 424, 424, 424,
556
557 424, 425, 425, 425, 424, 424, 425, 424, 424, 424,
558 425, 425, 425, 424, 425, 424, 425, 424, 425, 424,
559 425, 425, 425, 424, 424, 425, 424, 424, 424, 425,
560 425, 424, 425, 424, 424, 424, 425, 424, 424, 424,
561 425, 424, 425, 424, 425, 424, 424, 425, 425, 425,
562 424, 425, 424, 424, 424, 425, 425, 424, 424, 425,
563 424, 424, 424, 424, 424, 424, 424, 425, 424, 425,
564 424, 425, 424, 424, 425, 425, 424, 424, 425, 424,
565 425, 424, 424, 424, 424, 424, 424, 424, 424, 424,
566 425, 424, 425, 424, 425, 424, 424, 425, 425, 424,
567
568 424, 425, 424, 424, 424, 424, 424, 424, 424, 424,
569 424, 424, 424, 424, 425, 424, 425, 424, 424, 425,
570 425, 424, 424, 425, 424, 424, 424, 424, 424, 424,
571 424, 424, 424, 424, 425, 424, 424, 424, 425, 424,
572 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
573 424, 425, 424, 424, 424, 424, 424, 424, 424, 424,
574 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
575 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
576 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
577 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
578
579 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
580 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
581 424, 424, 424, 0, 424, 424
582 } ;
583
584static yyconst flex_int16_t yy_nxt[539] =
585 { 0,
586 4, 5, 6, 7, 8, 9, 10, 10, 10, 11,
587 12, 5, 5, 5, 13, 14, 15, 16, 5, 17,
588 18, 19, 20, 21, 22, 5, 23, 24, 5, 23,
589 25, 26, 27, 28, 29, 30, 31, 32, 23, 5,
590 33, 34, 5, 36, 36, 36, 36, 36, 36, 36,
591 36, 40, 41, 44, 46, 47, 55, 48, 49, 50,
592 59, 42, 45, 59, 64, 60, 75, 165, 59, 76,
593 79, 56, 59, 51, 52, 86, 53, 66, 166, 37,
594 61, 67, 54, 71, 62, 68, 36, 36, 36, 36,
595 59, 65, 86, 59, 63, 163, 115, 164, 59, 72,
596
597 73, 116, 59, 73, 73, 73, 73, 418, 102, 73,
598 73, 73, 73, 423, 118, 155, 73, 73, 73, 73,
599 73, 74, 73, 97, 232, 124, 97, 103, 119, 108,
600 125, 97, 104, 144, 139, 97, 109, 139, 145, 73,
601 110, 174, 139, 208, 233, 180, 139, 414, 180, 422,
602 235, 175, 112, 180, 236, 209, 258, 180, 366, 368,
603 259, 401, 367, 421, 369, 402, 35, 35, 420, 419,
604 418, 417, 416, 415, 414, 413, 412, 411, 410, 409,
605 408, 407, 406, 405, 404, 403, 400, 400, 399, 398,
606 397, 396, 395, 394, 393, 392, 391, 390, 389, 388,
607
608 387, 386, 385, 384, 383, 181, 382, 381, 380, 379,
609 378, 377, 376, 375, 374, 373, 372, 145, 371, 370,
610 365, 364, 363, 362, 361, 360, 359, 358, 357, 356,
611 355, 354, 353, 352, 351, 350, 349, 348, 347, 346,
612 345, 344, 343, 342, 341, 340, 339, 338, 337, 336,
613 335, 334, 333, 332, 331, 330, 329, 328, 327, 326,
614 325, 324, 323, 322, 321, 320, 319, 318, 317, 316,
615 315, 314, 313, 312, 311, 310, 309, 308, 307, 306,
616 305, 304, 303, 302, 301, 300, 299, 298, 297, 296,
617 295, 294, 293, 292, 291, 290, 289, 288, 287, 286,
618
619 285, 284, 283, 282, 281, 112, 280, 145, 144, 279,
620 278, 277, 276, 275, 274, 273, 272, 271, 270, 269,
621 268, 267, 266, 265, 264, 263, 262, 261, 260, 257,
622 256, 255, 254, 253, 252, 177, 251, 250, 249, 248,
623 247, 246, 245, 244, 243, 242, 241, 240, 239, 238,
624 237, 234, 231, 230, 229, 228, 227, 144, 226, 225,
625 224, 195, 223, 222, 221, 220, 219, 218, 217, 216,
626 215, 214, 213, 212, 211, 210, 207, 206, 205, 204,
627 203, 112, 202, 201, 200, 199, 198, 197, 196, 195,
628 194, 193, 192, 191, 73, 190, 189, 188, 187, 186,
629
630 185, 184, 183, 182, 181, 179, 178, 177, 176, 173,
631 172, 171, 170, 169, 168, 167, 162, 161, 160, 159,
632 158, 157, 156, 154, 153, 152, 151, 150, 149, 148,
633 147, 146, 143, 142, 141, 140, 138, 137, 136, 135,
634 134, 133, 132, 131, 130, 129, 128, 127, 126, 123,
635 122, 121, 120, 117, 73, 114, 113, 112, 111, 107,
636 106, 105, 101, 100, 99, 98, 96, 95, 94, 93,
637 92, 91, 90, 89, 88, 86, 87, 85, 84, 83,
638 41, 82, 81, 80, 78, 77, 70, 69, 58, 57,
639 43, 39, 38, 424, 3, 424, 424, 424, 424, 424,
640
641 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
642 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
643 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
644 424, 424, 424, 424, 424, 424, 424, 424
645 } ;
646
647static yyconst flex_int16_t yy_chk[539] =
648 { 0,
649 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
650 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
651 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
652 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
653 1, 1, 1, 9, 9, 9, 9, 10, 10, 10,
654 10, 15, 15, 17, 18, 18, 20, 18, 18, 19,
655 23, 15, 17, 23, 25, 24, 31, 125, 23, 31,
656 426, 20, 23, 19, 19, 46, 19, 26, 125, 9,
657 24, 26, 19, 29, 24, 26, 36, 36, 36, 36,
658 29, 25, 46, 29, 24, 124, 74, 124, 29, 29,
659
660 74, 74, 29, 30, 30, 30, 30, 423, 64, 30,
661 30, 30, 30, 422, 76, 115, 115, 30, 30, 30,
662 30, 30, 30, 59, 204, 82, 59, 64, 76, 68,
663 82, 59, 64, 102, 97, 59, 68, 97, 102, 116,
664 68, 133, 97, 174, 204, 139, 97, 421, 139, 420,
665 206, 133, 116, 139, 206, 174, 232, 139, 351, 355,
666 232, 392, 351, 419, 355, 392, 425, 425, 417, 416,
667 415, 412, 411, 410, 409, 408, 407, 406, 405, 404,
668 403, 402, 401, 399, 398, 394, 391, 390, 389, 388,
669 387, 386, 385, 384, 383, 382, 381, 380, 379, 378,
670
671 377, 375, 374, 373, 372, 371, 370, 369, 368, 367,
672 366, 365, 364, 363, 362, 360, 359, 358, 357, 356,
673 350, 349, 348, 347, 345, 344, 343, 342, 341, 340,
674 339, 337, 336, 335, 334, 333, 332, 331, 330, 329,
675 328, 327, 326, 325, 324, 322, 321, 319, 318, 316,
676 315, 314, 313, 312, 310, 309, 308, 306, 305, 304,
677 303, 302, 301, 300, 299, 298, 297, 296, 295, 294,
678 293, 292, 291, 290, 289, 287, 286, 285, 284, 283,
679 282, 281, 280, 279, 278, 277, 276, 275, 274, 273,
680 272, 271, 270, 269, 268, 267, 266, 265, 264, 263,
681
682 262, 261, 259, 258, 257, 256, 255, 254, 253, 252,
683 251, 250, 249, 248, 247, 246, 245, 244, 243, 242,
684 241, 240, 239, 238, 237, 236, 235, 234, 233, 231,
685 230, 229, 228, 227, 226, 225, 224, 223, 222, 221,
686 220, 218, 217, 216, 215, 214, 212, 210, 209, 208,
687 207, 205, 203, 202, 201, 200, 199, 198, 197, 196,
688 194, 193, 192, 191, 190, 189, 188, 187, 186, 185,
689 183, 182, 179, 178, 176, 175, 173, 172, 171, 170,
690 169, 168, 167, 166, 165, 164, 163, 162, 161, 160,
691 159, 158, 157, 156, 155, 154, 153, 151, 150, 149,
692
693 147, 146, 143, 142, 140, 138, 137, 135, 134, 132,
694 131, 130, 129, 128, 127, 126, 123, 122, 121, 120,
695 119, 118, 117, 114, 113, 111, 110, 109, 108, 107,
696 106, 105, 101, 100, 99, 98, 96, 95, 94, 93,
697 92, 91, 90, 89, 88, 87, 85, 84, 83, 81,
698 80, 78, 77, 75, 73, 72, 71, 70, 69, 67,
699 66, 65, 63, 62, 61, 60, 58, 57, 56, 55,
700 54, 52, 51, 50, 49, 48, 47, 45, 44, 43,
701 42, 40, 39, 38, 33, 32, 28, 27, 22, 21,
702 16, 14, 13, 3, 424, 424, 424, 424, 424, 424,
703
704 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
705 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
706 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
707 424, 424, 424, 424, 424, 424, 424, 424
708 } ;
709
710static yy_state_type yy_last_accepting_state;
711static char *yy_last_accepting_cpos;
712
713extern int parse_events__flex_debug;
714int parse_events__flex_debug = 0;
715
716/* The intent behind this definition is that it'll catch
717 * any uses of REJECT which flex missed.
718 */
719#define REJECT reject_used_but_not_detected
720#define yymore() yymore_used_but_not_detected
721#define YY_MORE_ADJ 0
722#define YY_RESTORE_YY_MORE_OFFSET
723char *parse_events_text;
724#line 1 "util/parse-events.l"
725#line 5 "util/parse-events.l"
726#include <errno.h>
727#include "../perf.h"
728#include "parse-events-bison.h"
729
730static int __value(char *str, int base, int token)
731{
732 long num;
733
734 errno = 0;
735 num = strtoul(str, NULL, base);
736 if (errno)
737 return PE_ERROR;
738
739 parse_events_lval.num = num;
740 return token;
741}
742
743static int value(int base)
744{
745 return __value(parse_events_text, base, PE_VALUE);
746}
747
748static int raw(void)
749{
750 return __value(parse_events_text + 1, 16, PE_RAW);
751}
752
753static int str(int token)
754{
755 parse_events_lval.str = strdup(parse_events_text);
756 return token;
757}
758
759static int sym(int type, int config)
760{
761 parse_events_lval.num = (type << 16) + config;
762 return PE_VALUE_SYM;
763}
764
765#line 766 "<stdout>"
766
767#define INITIAL 0
768
769#ifndef YY_NO_UNISTD_H
770/* Special case for "unistd.h", since it is non-ANSI. We include it way
771 * down here because we want the user's section 1 to have been scanned first.
772 * The user has a chance to override it with an option.
773 */
774#include <unistd.h>
775#endif
776
777#ifndef YY_EXTRA_TYPE
778#define YY_EXTRA_TYPE void *
779#endif
780
781static int yy_init_globals (void );
782
783/* Accessor methods to globals.
784 These are made visible to non-reentrant scanners for convenience. */
785
786int parse_events_lex_destroy (void );
787
788int parse_events_get_debug (void );
789
790void parse_events_set_debug (int debug_flag );
791
792YY_EXTRA_TYPE parse_events_get_extra (void );
793
794void parse_events_set_extra (YY_EXTRA_TYPE user_defined );
795
796FILE *parse_events_get_in (void );
797
798void parse_events_set_in (FILE * in_str );
799
800FILE *parse_events_get_out (void );
801
802void parse_events_set_out (FILE * out_str );
803
804int parse_events_get_leng (void );
805
806char *parse_events_get_text (void );
807
808int parse_events_get_lineno (void );
809
810void parse_events_set_lineno (int line_number );
811
812/* Macros after this point can all be overridden by user definitions in
813 * section 1.
814 */
815
816#ifndef YY_SKIP_YYWRAP
817#ifdef __cplusplus
818extern "C" int parse_events_wrap (void );
819#else
820extern int parse_events_wrap (void );
821#endif
822#endif
823
824 static void yyunput (int c,char *buf_ptr );
825
826#ifndef yytext_ptr
827static void yy_flex_strncpy (char *,yyconst char *,int );
828#endif
829
830#ifdef YY_NEED_STRLEN
831static int yy_flex_strlen (yyconst char * );
832#endif
833
834#ifndef YY_NO_INPUT
835
836#ifdef __cplusplus
837static int yyinput (void );
838#else
839static int input (void );
840#endif
841
842#endif
843
844/* Amount of stuff to slurp up with each read. */
845#ifndef YY_READ_BUF_SIZE
846#define YY_READ_BUF_SIZE 8192
847#endif
848
849/* Copy whatever the last rule matched to the standard output. */
850#ifndef ECHO
851/* This used to be an fputs(), but since the string might contain NUL's,
852 * we now use fwrite().
853 */
854#define ECHO do { if (fwrite( parse_events_text, parse_events_leng, 1, parse_events_out )) {} } while (0)
855#endif
856
857/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
858 * is returned in "result".
859 */
860#ifndef YY_INPUT
861#define YY_INPUT(buf,result,max_size) \
862 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
863 { \
864 int c = '*'; \
865 unsigned n; \
866 for ( n = 0; n < max_size && \
867 (c = getc( parse_events_in )) != EOF && c != '\n'; ++n ) \
868 buf[n] = (char) c; \
869 if ( c == '\n' ) \
870 buf[n++] = (char) c; \
871 if ( c == EOF && ferror( parse_events_in ) ) \
872 YY_FATAL_ERROR( "input in flex scanner failed" ); \
873 result = n; \
874 } \
875 else \
876 { \
877 errno=0; \
878 while ( (result = fread(buf, 1, max_size, parse_events_in))==0 && ferror(parse_events_in)) \
879 { \
880 if( errno != EINTR) \
881 { \
882 YY_FATAL_ERROR( "input in flex scanner failed" ); \
883 break; \
884 } \
885 errno=0; \
886 clearerr(parse_events_in); \
887 } \
888 }\
889\
890
891#endif
892
893/* No semi-colon after return; correct usage is to write "yyterminate();" -
894 * we don't want an extra ';' after the "return" because that will cause
895 * some compilers to complain about unreachable statements.
896 */
897#ifndef yyterminate
898#define yyterminate() return YY_NULL
899#endif
900
901/* Number of entries by which start-condition stack grows. */
902#ifndef YY_START_STACK_INCR
903#define YY_START_STACK_INCR 25
904#endif
905
906/* Report a fatal error. */
907#ifndef YY_FATAL_ERROR
908#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
909#endif
910
911/* end tables serialization structures and prototypes */
912
913/* Default declaration of generated scanner - a define so the user can
914 * easily add parameters.
915 */
916#ifndef YY_DECL
917#define YY_DECL_IS_OURS 1
918
919extern int parse_events_lex (void);
920
921#define YY_DECL int parse_events_lex (void)
922#endif /* !YY_DECL */
923
924/* Code executed at the beginning of each rule, after parse_events_text and parse_events_leng
925 * have been set up.
926 */
927#ifndef YY_USER_ACTION
928#define YY_USER_ACTION
929#endif
930
931/* Code executed at the end of each rule. */
932#ifndef YY_BREAK
933#define YY_BREAK break;
934#endif
935
936#define YY_RULE_SETUP \
937 YY_USER_ACTION
938
939/** The main scanner function which does all the work.
940 */
941YY_DECL
942{
943 register yy_state_type yy_current_state;
944 register char *yy_cp, *yy_bp;
945 register int yy_act;
946
947#line 53 "util/parse-events.l"
948
949#line 950 "<stdout>"
950
951 if ( !(yy_init) )
952 {
953 (yy_init) = 1;
954
955#ifdef YY_USER_INIT
956 YY_USER_INIT;
957#endif
958
959 if ( ! (yy_start) )
960 (yy_start) = 1; /* first start state */
961
962 if ( ! parse_events_in )
963 parse_events_in = stdin;
964
965 if ( ! parse_events_out )
966 parse_events_out = stdout;
967
968 if ( ! YY_CURRENT_BUFFER ) {
969 parse_events_ensure_buffer_stack ();
970 YY_CURRENT_BUFFER_LVALUE =
971 parse_events__create_buffer(parse_events_in,YY_BUF_SIZE );
972 }
973
974 parse_events__load_buffer_state( );
975 }
976
977 while ( 1 ) /* loops until end-of-file is reached */
978 {
979 yy_cp = (yy_c_buf_p);
980
981 /* Support of parse_events_text. */
982 *yy_cp = (yy_hold_char);
983
984 /* yy_bp points to the position in yy_ch_buf of the start of
985 * the current run.
986 */
987 yy_bp = yy_cp;
988
989 yy_current_state = (yy_start);
990yy_match:
991 do
992 {
993 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
994 if ( yy_accept[yy_current_state] )
995 {
996 (yy_last_accepting_state) = yy_current_state;
997 (yy_last_accepting_cpos) = yy_cp;
998 }
999 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1000 {
1001 yy_current_state = (int) yy_def[yy_current_state];
1002 if ( yy_current_state >= 425 )
1003 yy_c = yy_meta[(unsigned int) yy_c];
1004 }
1005 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1006 ++yy_cp;
1007 }
1008 while ( yy_base[yy_current_state] != 495 );
1009
1010yy_find_action:
1011 yy_act = yy_accept[yy_current_state];
1012 if ( yy_act == 0 )
1013 { /* have to back up */
1014 yy_cp = (yy_last_accepting_cpos);
1015 yy_current_state = (yy_last_accepting_state);
1016 yy_act = yy_accept[yy_current_state];
1017 }
1018
1019 YY_DO_BEFORE_ACTION;
1020
1021do_action: /* This label is used only to access EOF actions. */
1022
1023 switch ( yy_act )
1024 { /* beginning of action switch */
1025 case 0: /* must back up */
1026 /* undo the effects of YY_DO_BEFORE_ACTION */
1027 *yy_cp = (yy_hold_char);
1028 yy_cp = (yy_last_accepting_cpos);
1029 yy_current_state = (yy_last_accepting_state);
1030 goto yy_find_action;
1031
1032case 1:
1033YY_RULE_SETUP
1034#line 54 "util/parse-events.l"
1035{ return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); }
1036 YY_BREAK
1037case 2:
1038YY_RULE_SETUP
1039#line 55 "util/parse-events.l"
1040{ return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); }
1041 YY_BREAK
1042case 3:
1043YY_RULE_SETUP
1044#line 56 "util/parse-events.l"
1045{ return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); }
1046 YY_BREAK
1047case 4:
1048YY_RULE_SETUP
1049#line 57 "util/parse-events.l"
1050{ return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS); }
1051 YY_BREAK
1052case 5:
1053YY_RULE_SETUP
1054#line 58 "util/parse-events.l"
1055{ return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES); }
1056 YY_BREAK
1057case 6:
1058YY_RULE_SETUP
1059#line 59 "util/parse-events.l"
1060{ return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); }
1061 YY_BREAK
1062case 7:
1063YY_RULE_SETUP
1064#line 60 "util/parse-events.l"
1065{ return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); }
1066 YY_BREAK
1067case 8:
1068YY_RULE_SETUP
1069#line 61 "util/parse-events.l"
1070{ return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); }
1071 YY_BREAK
1072case 9:
1073YY_RULE_SETUP
1074#line 62 "util/parse-events.l"
1075{ return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BUS_CYCLES); }
1076 YY_BREAK
1077case 10:
1078YY_RULE_SETUP
1079#line 63 "util/parse-events.l"
1080{ return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK); }
1081 YY_BREAK
1082case 11:
1083YY_RULE_SETUP
1084#line 64 "util/parse-events.l"
1085{ return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK); }
1086 YY_BREAK
1087case 12:
1088YY_RULE_SETUP
1089#line 65 "util/parse-events.l"
1090{ return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS); }
1091 YY_BREAK
1092case 13:
1093YY_RULE_SETUP
1094#line 66 "util/parse-events.l"
1095{ return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MIN); }
1096 YY_BREAK
1097case 14:
1098YY_RULE_SETUP
1099#line 67 "util/parse-events.l"
1100{ return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MAJ); }
1101 YY_BREAK
1102case 15:
1103YY_RULE_SETUP
1104#line 68 "util/parse-events.l"
1105{ return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CONTEXT_SWITCHES); }
1106 YY_BREAK
1107case 16:
1108YY_RULE_SETUP
1109#line 69 "util/parse-events.l"
1110{ return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS); }
1111 YY_BREAK
1112case 17:
1113YY_RULE_SETUP
1114#line 70 "util/parse-events.l"
1115{ return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_ALIGNMENT_FAULTS); }
1116 YY_BREAK
1117case 18:
1118YY_RULE_SETUP
1119#line 71 "util/parse-events.l"
1120{ return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_EMULATION_FAULTS); }
1121 YY_BREAK
1122case 19:
1123#line 74 "util/parse-events.l"
1124case 20:
1125#line 75 "util/parse-events.l"
1126case 21:
1127#line 76 "util/parse-events.l"
1128case 22:
1129#line 77 "util/parse-events.l"
1130case 23:
1131#line 78 "util/parse-events.l"
1132case 24:
1133#line 79 "util/parse-events.l"
1134case 25:
1135YY_RULE_SETUP
1136#line 79 "util/parse-events.l"
1137{ return str(PE_NAME_CACHE_TYPE); }
1138 YY_BREAK
1139case 26:
1140#line 82 "util/parse-events.l"
1141case 27:
1142#line 83 "util/parse-events.l"
1143case 28:
1144#line 84 "util/parse-events.l"
1145case 29:
1146#line 85 "util/parse-events.l"
1147case 30:
1148#line 86 "util/parse-events.l"
1149case 31:
1150YY_RULE_SETUP
1151#line 86 "util/parse-events.l"
1152{ return str(PE_NAME_CACHE_OP_RESULT); }
1153 YY_BREAK
1154case 32:
1155YY_RULE_SETUP
1156#line 88 "util/parse-events.l"
1157{ return PE_PREFIX_MEM; }
1158 YY_BREAK
1159case 33:
1160YY_RULE_SETUP
1161#line 89 "util/parse-events.l"
1162{ return raw(); }
1163 YY_BREAK
1164case 34:
1165YY_RULE_SETUP
1166#line 90 "util/parse-events.l"
1167{ return value(10); }
1168 YY_BREAK
1169case 35:
1170YY_RULE_SETUP
1171#line 91 "util/parse-events.l"
1172{ return value(16); }
1173 YY_BREAK
1174case 36:
1175YY_RULE_SETUP
1176#line 93 "util/parse-events.l"
1177{ return str(PE_MODIFIER_EVENT); }
1178 YY_BREAK
1179case 37:
1180YY_RULE_SETUP
1181#line 94 "util/parse-events.l"
1182{ return str(PE_MODIFIER_BP); }
1183 YY_BREAK
1184case 38:
1185YY_RULE_SETUP
1186#line 95 "util/parse-events.l"
1187{ return str(PE_NAME); }
1188 YY_BREAK
1189case 39:
1190YY_RULE_SETUP
1191#line 96 "util/parse-events.l"
1192{ return '/'; }
1193 YY_BREAK
1194case 40:
1195YY_RULE_SETUP
1196#line 97 "util/parse-events.l"
1197{ return '-'; }
1198 YY_BREAK
1199case 41:
1200YY_RULE_SETUP
1201#line 98 "util/parse-events.l"
1202{ return ','; }
1203 YY_BREAK
1204case 42:
1205YY_RULE_SETUP
1206#line 99 "util/parse-events.l"
1207{ return ':'; }
1208 YY_BREAK
1209case 43:
1210YY_RULE_SETUP
1211#line 100 "util/parse-events.l"
1212{ return '='; }
1213 YY_BREAK
1214case 44:
1215YY_RULE_SETUP
1216#line 102 "util/parse-events.l"
1217ECHO;
1218 YY_BREAK
1219#line 1220 "<stdout>"
1220case YY_STATE_EOF(INITIAL):
1221 yyterminate();
1222
1223 case YY_END_OF_BUFFER:
1224 {
1225 /* Amount of text matched not including the EOB char. */
1226 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1227
1228 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1229 *yy_cp = (yy_hold_char);
1230 YY_RESTORE_YY_MORE_OFFSET
1231
1232 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1233 {
1234 /* We're scanning a new file or input source. It's
1235 * possible that this happened because the user
1236 * just pointed parse_events_in at a new source and called
1237 * parse_events_lex(). If so, then we have to assure
1238 * consistency between YY_CURRENT_BUFFER and our
1239 * globals. Here is the right place to do so, because
1240 * this is the first action (other than possibly a
1241 * back-up) that will match for the new input source.
1242 */
1243 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1244 YY_CURRENT_BUFFER_LVALUE->yy_input_file = parse_events_in;
1245 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1246 }
1247
1248 /* Note that here we test for yy_c_buf_p "<=" to the position
1249 * of the first EOB in the buffer, since yy_c_buf_p will
1250 * already have been incremented past the NUL character
1251 * (since all states make transitions on EOB to the
1252 * end-of-buffer state). Contrast this with the test
1253 * in input().
1254 */
1255 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1256 { /* This was really a NUL. */
1257 yy_state_type yy_next_state;
1258
1259 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1260
1261 yy_current_state = yy_get_previous_state( );
1262
1263 /* Okay, we're now positioned to make the NUL
1264 * transition. We couldn't have
1265 * yy_get_previous_state() go ahead and do it
1266 * for us because it doesn't know how to deal
1267 * with the possibility of jamming (and we don't
1268 * want to build jamming into it because then it
1269 * will run more slowly).
1270 */
1271
1272 yy_next_state = yy_try_NUL_trans( yy_current_state );
1273
1274 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1275
1276 if ( yy_next_state )
1277 {
1278 /* Consume the NUL. */
1279 yy_cp = ++(yy_c_buf_p);
1280 yy_current_state = yy_next_state;
1281 goto yy_match;
1282 }
1283
1284 else
1285 {
1286 yy_cp = (yy_c_buf_p);
1287 goto yy_find_action;
1288 }
1289 }
1290
1291 else switch ( yy_get_next_buffer( ) )
1292 {
1293 case EOB_ACT_END_OF_FILE:
1294 {
1295 (yy_did_buffer_switch_on_eof) = 0;
1296
1297 if ( parse_events_wrap( ) )
1298 {
1299 /* Note: because we've taken care in
1300 * yy_get_next_buffer() to have set up
1301 * parse_events_text, we can now set up
1302 * yy_c_buf_p so that if some total
1303 * hoser (like flex itself) wants to
1304 * call the scanner after we return the
1305 * YY_NULL, it'll still work - another
1306 * YY_NULL will get returned.
1307 */
1308 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1309
1310 yy_act = YY_STATE_EOF(YY_START);
1311 goto do_action;
1312 }
1313
1314 else
1315 {
1316 if ( ! (yy_did_buffer_switch_on_eof) )
1317 YY_NEW_FILE;
1318 }
1319 break;
1320 }
1321
1322 case EOB_ACT_CONTINUE_SCAN:
1323 (yy_c_buf_p) =
1324 (yytext_ptr) + yy_amount_of_matched_text;
1325
1326 yy_current_state = yy_get_previous_state( );
1327
1328 yy_cp = (yy_c_buf_p);
1329 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1330 goto yy_match;
1331
1332 case EOB_ACT_LAST_MATCH:
1333 (yy_c_buf_p) =
1334 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1335
1336 yy_current_state = yy_get_previous_state( );
1337
1338 yy_cp = (yy_c_buf_p);
1339 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1340 goto yy_find_action;
1341 }
1342 break;
1343 }
1344
1345 default:
1346 YY_FATAL_ERROR(
1347 "fatal flex scanner internal error--no action found" );
1348 } /* end of action switch */
1349 } /* end of scanning one token */
1350} /* end of parse_events_lex */
1351
1352/* yy_get_next_buffer - try to read in a new buffer
1353 *
1354 * Returns a code representing an action:
1355 * EOB_ACT_LAST_MATCH -
1356 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1357 * EOB_ACT_END_OF_FILE - end of file
1358 */
1359static int yy_get_next_buffer (void)
1360{
1361 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1362 register char *source = (yytext_ptr);
1363 register int number_to_move, i;
1364 int ret_val;
1365
1366 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1367 YY_FATAL_ERROR(
1368 "fatal flex scanner internal error--end of buffer missed" );
1369
1370 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1371 { /* Don't try to fill the buffer, so this is an EOF. */
1372 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1373 {
1374 /* We matched a single character, the EOB, so
1375 * treat this as a final EOF.
1376 */
1377 return EOB_ACT_END_OF_FILE;
1378 }
1379
1380 else
1381 {
1382 /* We matched some text prior to the EOB, first
1383 * process it.
1384 */
1385 return EOB_ACT_LAST_MATCH;
1386 }
1387 }
1388
1389 /* Try to read more data. */
1390
1391 /* First move last chars to start of buffer. */
1392 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1393
1394 for ( i = 0; i < number_to_move; ++i )
1395 *(dest++) = *(source++);
1396
1397 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1398 /* don't do the read, it's not guaranteed to return an EOF,
1399 * just force an EOF
1400 */
1401 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1402
1403 else
1404 {
1405 int num_to_read =
1406 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1407
1408 while ( num_to_read <= 0 )
1409 { /* Not enough room in the buffer - grow it. */
1410
1411 /* just a shorter name for the current buffer */
1412 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1413
1414 int yy_c_buf_p_offset =
1415 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1416
1417 if ( b->yy_is_our_buffer )
1418 {
1419 int new_size = b->yy_buf_size * 2;
1420
1421 if ( new_size <= 0 )
1422 b->yy_buf_size += b->yy_buf_size / 8;
1423 else
1424 b->yy_buf_size *= 2;
1425
1426 b->yy_ch_buf = (char *)
1427 /* Include room in for 2 EOB chars. */
1428 parse_events_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1429 }
1430 else
1431 /* Can't grow it, we don't own it. */
1432 b->yy_ch_buf = 0;
1433
1434 if ( ! b->yy_ch_buf )
1435 YY_FATAL_ERROR(
1436 "fatal error - scanner input buffer overflow" );
1437
1438 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1439
1440 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1441 number_to_move - 1;
1442
1443 }
1444
1445 if ( num_to_read > YY_READ_BUF_SIZE )
1446 num_to_read = YY_READ_BUF_SIZE;
1447
1448 /* Read in more data. */
1449 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1450 (yy_n_chars), (size_t) num_to_read );
1451
1452 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1453 }
1454
1455 if ( (yy_n_chars) == 0 )
1456 {
1457 if ( number_to_move == YY_MORE_ADJ )
1458 {
1459 ret_val = EOB_ACT_END_OF_FILE;
1460 parse_events_restart(parse_events_in );
1461 }
1462
1463 else
1464 {
1465 ret_val = EOB_ACT_LAST_MATCH;
1466 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1467 YY_BUFFER_EOF_PENDING;
1468 }
1469 }
1470
1471 else
1472 ret_val = EOB_ACT_CONTINUE_SCAN;
1473
1474 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1475 /* Extend the array by 50%, plus the number we really need. */
1476 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1477 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) parse_events_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1478 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1479 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1480 }
1481
1482 (yy_n_chars) += number_to_move;
1483 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1484 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1485
1486 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1487
1488 return ret_val;
1489}
1490
1491/* yy_get_previous_state - get the state just before the EOB char was reached */
1492
1493 static yy_state_type yy_get_previous_state (void)
1494{
1495 register yy_state_type yy_current_state;
1496 register char *yy_cp;
1497
1498 yy_current_state = (yy_start);
1499
1500 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1501 {
1502 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1503 if ( yy_accept[yy_current_state] )
1504 {
1505 (yy_last_accepting_state) = yy_current_state;
1506 (yy_last_accepting_cpos) = yy_cp;
1507 }
1508 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1509 {
1510 yy_current_state = (int) yy_def[yy_current_state];
1511 if ( yy_current_state >= 425 )
1512 yy_c = yy_meta[(unsigned int) yy_c];
1513 }
1514 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1515 }
1516
1517 return yy_current_state;
1518}
1519
1520/* yy_try_NUL_trans - try to make a transition on the NUL character
1521 *
1522 * synopsis
1523 * next_state = yy_try_NUL_trans( current_state );
1524 */
1525 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1526{
1527 register int yy_is_jam;
1528 register char *yy_cp = (yy_c_buf_p);
1529
1530 register YY_CHAR yy_c = 1;
1531 if ( yy_accept[yy_current_state] )
1532 {
1533 (yy_last_accepting_state) = yy_current_state;
1534 (yy_last_accepting_cpos) = yy_cp;
1535 }
1536 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1537 {
1538 yy_current_state = (int) yy_def[yy_current_state];
1539 if ( yy_current_state >= 425 )
1540 yy_c = yy_meta[(unsigned int) yy_c];
1541 }
1542 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1543 yy_is_jam = (yy_current_state == 424);
1544
1545 return yy_is_jam ? 0 : yy_current_state;
1546}
1547
1548 static void yyunput (int c, register char * yy_bp )
1549{
1550 register char *yy_cp;
1551
1552 yy_cp = (yy_c_buf_p);
1553
1554 /* undo effects of setting up parse_events_text */
1555 *yy_cp = (yy_hold_char);
1556
1557 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1558 { /* need to shift things up to make room */
1559 /* +2 for EOB chars. */
1560 register int number_to_move = (yy_n_chars) + 2;
1561 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1562 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1563 register char *source =
1564 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1565
1566 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1567 *--dest = *--source;
1568
1569 yy_cp += (int) (dest - source);
1570 yy_bp += (int) (dest - source);
1571 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1572 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1573
1574 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1575 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1576 }
1577
1578 *--yy_cp = (char) c;
1579
1580 (yytext_ptr) = yy_bp;
1581 (yy_hold_char) = *yy_cp;
1582 (yy_c_buf_p) = yy_cp;
1583}
1584
1585#ifndef YY_NO_INPUT
1586#ifdef __cplusplus
1587 static int yyinput (void)
1588#else
1589 static int input (void)
1590#endif
1591
1592{
1593 int c;
1594
1595 *(yy_c_buf_p) = (yy_hold_char);
1596
1597 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1598 {
1599 /* yy_c_buf_p now points to the character we want to return.
1600 * If this occurs *before* the EOB characters, then it's a
1601 * valid NUL; if not, then we've hit the end of the buffer.
1602 */
1603 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1604 /* This was really a NUL. */
1605 *(yy_c_buf_p) = '\0';
1606
1607 else
1608 { /* need more input */
1609 int offset = (yy_c_buf_p) - (yytext_ptr);
1610 ++(yy_c_buf_p);
1611
1612 switch ( yy_get_next_buffer( ) )
1613 {
1614 case EOB_ACT_LAST_MATCH:
1615 /* This happens because yy_g_n_b()
1616 * sees that we've accumulated a
1617 * token and flags that we need to
1618 * try matching the token before
1619 * proceeding. But for input(),
1620 * there's no matching to consider.
1621 * So convert the EOB_ACT_LAST_MATCH
1622 * to EOB_ACT_END_OF_FILE.
1623 */
1624
1625 /* Reset buffer status. */
1626 parse_events_restart(parse_events_in );
1627
1628 /*FALLTHROUGH*/
1629
1630 case EOB_ACT_END_OF_FILE:
1631 {
1632 if ( parse_events_wrap( ) )
1633 return EOF;
1634
1635 if ( ! (yy_did_buffer_switch_on_eof) )
1636 YY_NEW_FILE;
1637#ifdef __cplusplus
1638 return yyinput();
1639#else
1640 return input();
1641#endif
1642 }
1643
1644 case EOB_ACT_CONTINUE_SCAN:
1645 (yy_c_buf_p) = (yytext_ptr) + offset;
1646 break;
1647 }
1648 }
1649 }
1650
1651 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1652 *(yy_c_buf_p) = '\0'; /* preserve parse_events_text */
1653 (yy_hold_char) = *++(yy_c_buf_p);
1654
1655 return c;
1656}
1657#endif /* ifndef YY_NO_INPUT */
1658
1659/** Immediately switch to a different input stream.
1660 * @param input_file A readable stream.
1661 *
1662 * @note This function does not reset the start condition to @c INITIAL .
1663 */
1664 void parse_events_restart (FILE * input_file )
1665{
1666
1667 if ( ! YY_CURRENT_BUFFER ){
1668 parse_events_ensure_buffer_stack ();
1669 YY_CURRENT_BUFFER_LVALUE =
1670 parse_events__create_buffer(parse_events_in,YY_BUF_SIZE );
1671 }
1672
1673 parse_events__init_buffer(YY_CURRENT_BUFFER,input_file );
1674 parse_events__load_buffer_state( );
1675}
1676
1677/** Switch to a different input buffer.
1678 * @param new_buffer The new input buffer.
1679 *
1680 */
1681 void parse_events__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1682{
1683
1684 /* TODO. We should be able to replace this entire function body
1685 * with
1686 * parse_events_pop_buffer_state();
1687 * parse_events_push_buffer_state(new_buffer);
1688 */
1689 parse_events_ensure_buffer_stack ();
1690 if ( YY_CURRENT_BUFFER == new_buffer )
1691 return;
1692
1693 if ( YY_CURRENT_BUFFER )
1694 {
1695 /* Flush out information for old buffer. */
1696 *(yy_c_buf_p) = (yy_hold_char);
1697 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1698 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1699 }
1700
1701 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1702 parse_events__load_buffer_state( );
1703
1704 /* We don't actually know whether we did this switch during
1705 * EOF (parse_events_wrap()) processing, but the only time this flag
1706 * is looked at is after parse_events_wrap() is called, so it's safe
1707 * to go ahead and always set it.
1708 */
1709 (yy_did_buffer_switch_on_eof) = 1;
1710}
1711
1712static void parse_events__load_buffer_state (void)
1713{
1714 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1715 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1716 parse_events_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1717 (yy_hold_char) = *(yy_c_buf_p);
1718}
1719
1720/** Allocate and initialize an input buffer state.
1721 * @param file A readable stream.
1722 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1723 *
1724 * @return the allocated buffer state.
1725 */
1726 YY_BUFFER_STATE parse_events__create_buffer (FILE * file, int size )
1727{
1728 YY_BUFFER_STATE b;
1729
1730 b = (YY_BUFFER_STATE) parse_events_alloc(sizeof( struct yy_buffer_state ) );
1731 if ( ! b )
1732 YY_FATAL_ERROR( "out of dynamic memory in parse_events__create_buffer()" );
1733
1734 b->yy_buf_size = size;
1735
1736 /* yy_ch_buf has to be 2 characters longer than the size given because
1737 * we need to put in 2 end-of-buffer characters.
1738 */
1739 b->yy_ch_buf = (char *) parse_events_alloc(b->yy_buf_size + 2 );
1740 if ( ! b->yy_ch_buf )
1741 YY_FATAL_ERROR( "out of dynamic memory in parse_events__create_buffer()" );
1742
1743 b->yy_is_our_buffer = 1;
1744
1745 parse_events__init_buffer(b,file );
1746
1747 return b;
1748}
1749
1750/** Destroy the buffer.
1751 * @param b a buffer created with parse_events__create_buffer()
1752 *
1753 */
1754 void parse_events__delete_buffer (YY_BUFFER_STATE b )
1755{
1756
1757 if ( ! b )
1758 return;
1759
1760 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1761 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1762
1763 if ( b->yy_is_our_buffer )
1764 parse_events_free((void *) b->yy_ch_buf );
1765
1766 parse_events_free((void *) b );
1767}
1768
1769#ifndef __cplusplus
1770extern int isatty (int );
1771#endif /* __cplusplus */
1772
1773/* Initializes or reinitializes a buffer.
1774 * This function is sometimes called more than once on the same buffer,
1775 * such as during a parse_events_restart() or at EOF.
1776 */
1777 static void parse_events__init_buffer (YY_BUFFER_STATE b, FILE * file )
1778
1779{
1780 int oerrno = errno;
1781
1782 parse_events__flush_buffer(b );
1783
1784 b->yy_input_file = file;
1785 b->yy_fill_buffer = 1;
1786
1787 /* If b is the current buffer, then parse_events__init_buffer was _probably_
1788 * called from parse_events_restart() or through yy_get_next_buffer.
1789 * In that case, we don't want to reset the lineno or column.
1790 */
1791 if (b != YY_CURRENT_BUFFER){
1792 b->yy_bs_lineno = 1;
1793 b->yy_bs_column = 0;
1794 }
1795
1796 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1797
1798 errno = oerrno;
1799}
1800
1801/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1802 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1803 *
1804 */
1805 void parse_events__flush_buffer (YY_BUFFER_STATE b )
1806{
1807 if ( ! b )
1808 return;
1809
1810 b->yy_n_chars = 0;
1811
1812 /* We always need two end-of-buffer characters. The first causes
1813 * a transition to the end-of-buffer state. The second causes
1814 * a jam in that state.
1815 */
1816 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1817 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1818
1819 b->yy_buf_pos = &b->yy_ch_buf[0];
1820
1821 b->yy_at_bol = 1;
1822 b->yy_buffer_status = YY_BUFFER_NEW;
1823
1824 if ( b == YY_CURRENT_BUFFER )
1825 parse_events__load_buffer_state( );
1826}
1827
1828/** Pushes the new state onto the stack. The new state becomes
1829 * the current state. This function will allocate the stack
1830 * if necessary.
1831 * @param new_buffer The new state.
1832 *
1833 */
1834void parse_events_push_buffer_state (YY_BUFFER_STATE new_buffer )
1835{
1836 if (new_buffer == NULL)
1837 return;
1838
1839 parse_events_ensure_buffer_stack();
1840
1841 /* This block is copied from parse_events__switch_to_buffer. */
1842 if ( YY_CURRENT_BUFFER )
1843 {
1844 /* Flush out information for old buffer. */
1845 *(yy_c_buf_p) = (yy_hold_char);
1846 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1847 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1848 }
1849
1850 /* Only push if top exists. Otherwise, replace top. */
1851 if (YY_CURRENT_BUFFER)
1852 (yy_buffer_stack_top)++;
1853 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1854
1855 /* copied from parse_events__switch_to_buffer. */
1856 parse_events__load_buffer_state( );
1857 (yy_did_buffer_switch_on_eof) = 1;
1858}
1859
1860/** Removes and deletes the top of the stack, if present.
1861 * The next element becomes the new top.
1862 *
1863 */
1864void parse_events_pop_buffer_state (void)
1865{
1866 if (!YY_CURRENT_BUFFER)
1867 return;
1868
1869 parse_events__delete_buffer(YY_CURRENT_BUFFER );
1870 YY_CURRENT_BUFFER_LVALUE = NULL;
1871 if ((yy_buffer_stack_top) > 0)
1872 --(yy_buffer_stack_top);
1873
1874 if (YY_CURRENT_BUFFER) {
1875 parse_events__load_buffer_state( );
1876 (yy_did_buffer_switch_on_eof) = 1;
1877 }
1878}
1879
1880/* Allocates the stack if it does not exist.
1881 * Guarantees space for at least one push.
1882 */
1883static void parse_events_ensure_buffer_stack (void)
1884{
1885 int num_to_alloc;
1886
1887 if (!(yy_buffer_stack)) {
1888
1889 /* First allocation is just for 2 elements, since we don't know if this
1890 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1891 * immediate realloc on the next call.
1892 */
1893 num_to_alloc = 1;
1894 (yy_buffer_stack) = (struct yy_buffer_state**)parse_events_alloc
1895 (num_to_alloc * sizeof(struct yy_buffer_state*)
1896 );
1897 if ( ! (yy_buffer_stack) )
1898 YY_FATAL_ERROR( "out of dynamic memory in parse_events_ensure_buffer_stack()" );
1899
1900 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1901
1902 (yy_buffer_stack_max) = num_to_alloc;
1903 (yy_buffer_stack_top) = 0;
1904 return;
1905 }
1906
1907 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1908
1909 /* Increase the buffer to prepare for a possible push. */
1910 int grow_size = 8 /* arbitrary grow size */;
1911
1912 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1913 (yy_buffer_stack) = (struct yy_buffer_state**)parse_events_realloc
1914 ((yy_buffer_stack),
1915 num_to_alloc * sizeof(struct yy_buffer_state*)
1916 );
1917 if ( ! (yy_buffer_stack) )
1918 YY_FATAL_ERROR( "out of dynamic memory in parse_events_ensure_buffer_stack()" );
1919
1920 /* zero only the new slots.*/
1921 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1922 (yy_buffer_stack_max) = num_to_alloc;
1923 }
1924}
1925
1926/** Setup the input buffer state to scan directly from a user-specified character buffer.
1927 * @param base the character buffer
1928 * @param size the size in bytes of the character buffer
1929 *
1930 * @return the newly allocated buffer state object.
1931 */
1932YY_BUFFER_STATE parse_events__scan_buffer (char * base, yy_size_t size )
1933{
1934 YY_BUFFER_STATE b;
1935
1936 if ( size < 2 ||
1937 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1938 base[size-1] != YY_END_OF_BUFFER_CHAR )
1939 /* They forgot to leave room for the EOB's. */
1940 return 0;
1941
1942 b = (YY_BUFFER_STATE) parse_events_alloc(sizeof( struct yy_buffer_state ) );
1943 if ( ! b )
1944 YY_FATAL_ERROR( "out of dynamic memory in parse_events__scan_buffer()" );
1945
1946 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1947 b->yy_buf_pos = b->yy_ch_buf = base;
1948 b->yy_is_our_buffer = 0;
1949 b->yy_input_file = 0;
1950 b->yy_n_chars = b->yy_buf_size;
1951 b->yy_is_interactive = 0;
1952 b->yy_at_bol = 1;
1953 b->yy_fill_buffer = 0;
1954 b->yy_buffer_status = YY_BUFFER_NEW;
1955
1956 parse_events__switch_to_buffer(b );
1957
1958 return b;
1959}
1960
1961/** Setup the input buffer state to scan a string. The next call to parse_events_lex() will
1962 * scan from a @e copy of @a str.
1963 * @param yystr a NUL-terminated string to scan
1964 *
1965 * @return the newly allocated buffer state object.
1966 * @note If you want to scan bytes that may contain NUL values, then use
1967 * parse_events__scan_bytes() instead.
1968 */
1969YY_BUFFER_STATE parse_events__scan_string (yyconst char * yystr )
1970{
1971
1972 return parse_events__scan_bytes(yystr,strlen(yystr) );
1973}
1974
1975/** Setup the input buffer state to scan the given bytes. The next call to parse_events_lex() will
1976 * scan from a @e copy of @a bytes.
1977 * @param bytes the byte buffer to scan
1978 * @param len the number of bytes in the buffer pointed to by @a bytes.
1979 *
1980 * @return the newly allocated buffer state object.
1981 */
1982YY_BUFFER_STATE parse_events__scan_bytes (yyconst char * yybytes, int _yybytes_len )
1983{
1984 YY_BUFFER_STATE b;
1985 char *buf;
1986 yy_size_t n;
1987 int i;
1988
1989 /* Get memory for full buffer, including space for trailing EOB's. */
1990 n = _yybytes_len + 2;
1991 buf = (char *) parse_events_alloc(n );
1992 if ( ! buf )
1993 YY_FATAL_ERROR( "out of dynamic memory in parse_events__scan_bytes()" );
1994
1995 for ( i = 0; i < _yybytes_len; ++i )
1996 buf[i] = yybytes[i];
1997
1998 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1999
2000 b = parse_events__scan_buffer(buf,n );
2001 if ( ! b )
2002 YY_FATAL_ERROR( "bad buffer in parse_events__scan_bytes()" );
2003
2004 /* It's okay to grow etc. this buffer, and we should throw it
2005 * away when we're done.
2006 */
2007 b->yy_is_our_buffer = 1;
2008
2009 return b;
2010}
2011
2012#ifndef YY_EXIT_FAILURE
2013#define YY_EXIT_FAILURE 2
2014#endif
2015
2016static void yy_fatal_error (yyconst char* msg )
2017{
2018 (void) fprintf( stderr, "%s\n", msg );
2019 exit( YY_EXIT_FAILURE );
2020}
2021
2022/* Redefine yyless() so it works in section 3 code. */
2023
2024#undef yyless
2025#define yyless(n) \
2026 do \
2027 { \
2028 /* Undo effects of setting up parse_events_text. */ \
2029 int yyless_macro_arg = (n); \
2030 YY_LESS_LINENO(yyless_macro_arg);\
2031 parse_events_text[parse_events_leng] = (yy_hold_char); \
2032 (yy_c_buf_p) = parse_events_text + yyless_macro_arg; \
2033 (yy_hold_char) = *(yy_c_buf_p); \
2034 *(yy_c_buf_p) = '\0'; \
2035 parse_events_leng = yyless_macro_arg; \
2036 } \
2037 while ( 0 )
2038
2039/* Accessor methods (get/set functions) to struct members. */
2040
2041/** Get the current line number.
2042 *
2043 */
2044int parse_events_get_lineno (void)
2045{
2046
2047 return parse_events_lineno;
2048}
2049
2050/** Get the input stream.
2051 *
2052 */
2053FILE *parse_events_get_in (void)
2054{
2055 return parse_events_in;
2056}
2057
2058/** Get the output stream.
2059 *
2060 */
2061FILE *parse_events_get_out (void)
2062{
2063 return parse_events_out;
2064}
2065
2066/** Get the length of the current token.
2067 *
2068 */
2069int parse_events_get_leng (void)
2070{
2071 return parse_events_leng;
2072}
2073
2074/** Get the current token.
2075 *
2076 */
2077
2078char *parse_events_get_text (void)
2079{
2080 return parse_events_text;
2081}
2082
2083/** Set the current line number.
2084 * @param line_number
2085 *
2086 */
2087void parse_events_set_lineno (int line_number )
2088{
2089
2090 parse_events_lineno = line_number;
2091}
2092
2093/** Set the input stream. This does not discard the current
2094 * input buffer.
2095 * @param in_str A readable stream.
2096 *
2097 * @see parse_events__switch_to_buffer
2098 */
2099void parse_events_set_in (FILE * in_str )
2100{
2101 parse_events_in = in_str ;
2102}
2103
2104void parse_events_set_out (FILE * out_str )
2105{
2106 parse_events_out = out_str ;
2107}
2108
2109int parse_events_get_debug (void)
2110{
2111 return parse_events__flex_debug;
2112}
2113
2114void parse_events_set_debug (int bdebug )
2115{
2116 parse_events__flex_debug = bdebug ;
2117}
2118
2119static int yy_init_globals (void)
2120{
2121 /* Initialization is the same as for the non-reentrant scanner.
2122 * This function is called from parse_events_lex_destroy(), so don't allocate here.
2123 */
2124
2125 (yy_buffer_stack) = 0;
2126 (yy_buffer_stack_top) = 0;
2127 (yy_buffer_stack_max) = 0;
2128 (yy_c_buf_p) = (char *) 0;
2129 (yy_init) = 0;
2130 (yy_start) = 0;
2131
2132/* Defined in main.c */
2133#ifdef YY_STDINIT
2134 parse_events_in = stdin;
2135 parse_events_out = stdout;
2136#else
2137 parse_events_in = (FILE *) 0;
2138 parse_events_out = (FILE *) 0;
2139#endif
2140
2141 /* For future reference: Set errno on error, since we are called by
2142 * parse_events_lex_init()
2143 */
2144 return 0;
2145}
2146
2147/* parse_events_lex_destroy is for both reentrant and non-reentrant scanners. */
2148int parse_events_lex_destroy (void)
2149{
2150
2151 /* Pop the buffer stack, destroying each element. */
2152 while(YY_CURRENT_BUFFER){
2153 parse_events__delete_buffer(YY_CURRENT_BUFFER );
2154 YY_CURRENT_BUFFER_LVALUE = NULL;
2155 parse_events_pop_buffer_state();
2156 }
2157
2158 /* Destroy the stack itself. */
2159 parse_events_free((yy_buffer_stack) );
2160 (yy_buffer_stack) = NULL;
2161
2162 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2163 * parse_events_lex() is called, initialization will occur. */
2164 yy_init_globals( );
2165
2166 return 0;
2167}
2168
2169/*
2170 * Internal utility routines.
2171 */
2172
2173#ifndef yytext_ptr
2174static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2175{
2176 register int i;
2177 for ( i = 0; i < n; ++i )
2178 s1[i] = s2[i];
2179}
2180#endif
2181
2182#ifdef YY_NEED_STRLEN
2183static int yy_flex_strlen (yyconst char * s )
2184{
2185 register int n;
2186 for ( n = 0; s[n]; ++n )
2187 ;
2188
2189 return n;
2190}
2191#endif
2192
2193void *parse_events_alloc (yy_size_t size )
2194{
2195 return (void *) malloc( size );
2196}
2197
2198void *parse_events_realloc (void * ptr, yy_size_t size )
2199{
2200 /* The cast to (char *) in the following accommodates both
2201 * implementations that use char* generic pointers, and those
2202 * that use void* generic pointers. It works with the latter
2203 * because both ANSI C and C++ allow castless assignment from
2204 * any pointer type to void*, and deal with argument conversions
2205 * as though doing an assignment.
2206 */
2207 return (void *) realloc( (char *) ptr, size );
2208}
2209
2210void parse_events_free (void * ptr )
2211{
2212 free( (char *) ptr ); /* see parse_events_realloc() for (char *) cast */
2213}
2214
2215#define YYTABLES_NAME "yytables"
2216
2217#line 102 "util/parse-events.l"
2218
2219
2220
2221int parse_events_wrap(void)
2222{
2223 return 1;
2224}
2225
diff --git a/tools/perf/util/parse-events-flex.h b/tools/perf/util/parse-events-flex.h
new file mode 100644
index 00000000000..b927f9a12c3
--- /dev/null
+++ b/tools/perf/util/parse-events-flex.h
@@ -0,0 +1,316 @@
1#ifndef parse_events_HEADER_H
2#define parse_events_HEADER_H 1
3#define parse_events_IN_HEADER 1
4
5#line 6 "util/parse-events-flex.h"
6
7#define YY_INT_ALIGNED short int
8
9/* A lexical scanner generated by flex */
10
11#define FLEX_SCANNER
12#define YY_FLEX_MAJOR_VERSION 2
13#define YY_FLEX_MINOR_VERSION 5
14#define YY_FLEX_SUBMINOR_VERSION 35
15#if YY_FLEX_SUBMINOR_VERSION > 0
16#define FLEX_BETA
17#endif
18
19/* First, we deal with platform-specific or compiler-specific issues. */
20
21/* begin standard C headers. */
22#include <stdio.h>
23#include <string.h>
24#include <errno.h>
25#include <stdlib.h>
26
27/* end standard C headers. */
28
29/* flex integer type definitions */
30
31#ifndef FLEXINT_H
32#define FLEXINT_H
33
34/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
35
36#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
37
38/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
39 * if you want the limit (max/min) macros for int types.
40 */
41#ifndef __STDC_LIMIT_MACROS
42#define __STDC_LIMIT_MACROS 1
43#endif
44
45#include <inttypes.h>
46typedef int8_t flex_int8_t;
47typedef uint8_t flex_uint8_t;
48typedef int16_t flex_int16_t;
49typedef uint16_t flex_uint16_t;
50typedef int32_t flex_int32_t;
51typedef uint32_t flex_uint32_t;
52#else
53typedef signed char flex_int8_t;
54typedef short int flex_int16_t;
55typedef int flex_int32_t;
56typedef unsigned char flex_uint8_t;
57typedef unsigned short int flex_uint16_t;
58typedef unsigned int flex_uint32_t;
59#endif /* ! C99 */
60
61/* Limits of integral types. */
62#ifndef INT8_MIN
63#define INT8_MIN (-128)
64#endif
65#ifndef INT16_MIN
66#define INT16_MIN (-32767-1)
67#endif
68#ifndef INT32_MIN
69#define INT32_MIN (-2147483647-1)
70#endif
71#ifndef INT8_MAX
72#define INT8_MAX (127)
73#endif
74#ifndef INT16_MAX
75#define INT16_MAX (32767)
76#endif
77#ifndef INT32_MAX
78#define INT32_MAX (2147483647)
79#endif
80#ifndef UINT8_MAX
81#define UINT8_MAX (255U)
82#endif
83#ifndef UINT16_MAX
84#define UINT16_MAX (65535U)
85#endif
86#ifndef UINT32_MAX
87#define UINT32_MAX (4294967295U)
88#endif
89
90#endif /* ! FLEXINT_H */
91
92#ifdef __cplusplus
93
94/* The "const" storage-class-modifier is valid. */
95#define YY_USE_CONST
96
97#else /* ! __cplusplus */
98
99/* C99 requires __STDC__ to be defined as 1. */
100#if defined (__STDC__)
101
102#define YY_USE_CONST
103
104#endif /* defined (__STDC__) */
105#endif /* ! __cplusplus */
106
107#ifdef YY_USE_CONST
108#define yyconst const
109#else
110#define yyconst
111#endif
112
113/* Size of default input buffer. */
114#ifndef YY_BUF_SIZE
115#define YY_BUF_SIZE 16384
116#endif
117
118#ifndef YY_TYPEDEF_YY_BUFFER_STATE
119#define YY_TYPEDEF_YY_BUFFER_STATE
120typedef struct yy_buffer_state *YY_BUFFER_STATE;
121#endif
122
123extern int parse_events_leng;
124
125extern FILE *parse_events_in, *parse_events_out;
126
127#ifndef YY_TYPEDEF_YY_SIZE_T
128#define YY_TYPEDEF_YY_SIZE_T
129typedef size_t yy_size_t;
130#endif
131
132#ifndef YY_STRUCT_YY_BUFFER_STATE
133#define YY_STRUCT_YY_BUFFER_STATE
134struct yy_buffer_state
135 {
136 FILE *yy_input_file;
137
138 char *yy_ch_buf; /* input buffer */
139 char *yy_buf_pos; /* current position in input buffer */
140
141 /* Size of input buffer in bytes, not including room for EOB
142 * characters.
143 */
144 yy_size_t yy_buf_size;
145
146 /* Number of characters read into yy_ch_buf, not including EOB
147 * characters.
148 */
149 int yy_n_chars;
150
151 /* Whether we "own" the buffer - i.e., we know we created it,
152 * and can realloc() it to grow it, and should free() it to
153 * delete it.
154 */
155 int yy_is_our_buffer;
156
157 /* Whether this is an "interactive" input source; if so, and
158 * if we're using stdio for input, then we want to use getc()
159 * instead of fread(), to make sure we stop fetching input after
160 * each newline.
161 */
162 int yy_is_interactive;
163
164 /* Whether we're considered to be at the beginning of a line.
165 * If so, '^' rules will be active on the next match, otherwise
166 * not.
167 */
168 int yy_at_bol;
169
170 int yy_bs_lineno; /**< The line count. */
171 int yy_bs_column; /**< The column count. */
172
173 /* Whether to try to fill the input buffer when we reach the
174 * end of it.
175 */
176 int yy_fill_buffer;
177
178 int yy_buffer_status;
179
180 };
181#endif /* !YY_STRUCT_YY_BUFFER_STATE */
182
183void parse_events_restart (FILE *input_file );
184void parse_events__switch_to_buffer (YY_BUFFER_STATE new_buffer );
185YY_BUFFER_STATE parse_events__create_buffer (FILE *file,int size );
186void parse_events__delete_buffer (YY_BUFFER_STATE b );
187void parse_events__flush_buffer (YY_BUFFER_STATE b );
188void parse_events_push_buffer_state (YY_BUFFER_STATE new_buffer );
189void parse_events_pop_buffer_state (void );
190
191YY_BUFFER_STATE parse_events__scan_buffer (char *base,yy_size_t size );
192YY_BUFFER_STATE parse_events__scan_string (yyconst char *yy_str );
193YY_BUFFER_STATE parse_events__scan_bytes (yyconst char *bytes,int len );
194
195void *parse_events_alloc (yy_size_t );
196void *parse_events_realloc (void *,yy_size_t );
197void parse_events_free (void * );
198
199/* Begin user sect3 */
200
201extern int parse_events_lineno;
202
203extern char *parse_events_text;
204#define yytext_ptr parse_events_text
205
206#ifdef YY_HEADER_EXPORT_START_CONDITIONS
207#define INITIAL 0
208
209#endif
210
211#ifndef YY_NO_UNISTD_H
212/* Special case for "unistd.h", since it is non-ANSI. We include it way
213 * down here because we want the user's section 1 to have been scanned first.
214 * The user has a chance to override it with an option.
215 */
216#include <unistd.h>
217#endif
218
219#ifndef YY_EXTRA_TYPE
220#define YY_EXTRA_TYPE void *
221#endif
222
223/* Accessor methods to globals.
224 These are made visible to non-reentrant scanners for convenience. */
225
226int parse_events_lex_destroy (void );
227
228int parse_events_get_debug (void );
229
230void parse_events_set_debug (int debug_flag );
231
232YY_EXTRA_TYPE parse_events_get_extra (void );
233
234void parse_events_set_extra (YY_EXTRA_TYPE user_defined );
235
236FILE *parse_events_get_in (void );
237
238void parse_events_set_in (FILE * in_str );
239
240FILE *parse_events_get_out (void );
241
242void parse_events_set_out (FILE * out_str );
243
244int parse_events_get_leng (void );
245
246char *parse_events_get_text (void );
247
248int parse_events_get_lineno (void );
249
250void parse_events_set_lineno (int line_number );
251
252/* Macros after this point can all be overridden by user definitions in
253 * section 1.
254 */
255
256#ifndef YY_SKIP_YYWRAP
257#ifdef __cplusplus
258extern "C" int parse_events_wrap (void );
259#else
260extern int parse_events_wrap (void );
261#endif
262#endif
263
264#ifndef yytext_ptr
265static void yy_flex_strncpy (char *,yyconst char *,int );
266#endif
267
268#ifdef YY_NEED_STRLEN
269static int yy_flex_strlen (yyconst char * );
270#endif
271
272#ifndef YY_NO_INPUT
273
274#endif
275
276/* Amount of stuff to slurp up with each read. */
277#ifndef YY_READ_BUF_SIZE
278#define YY_READ_BUF_SIZE 8192
279#endif
280
281/* Number of entries by which start-condition stack grows. */
282#ifndef YY_START_STACK_INCR
283#define YY_START_STACK_INCR 25
284#endif
285
286/* Default declaration of generated scanner - a define so the user can
287 * easily add parameters.
288 */
289#ifndef YY_DECL
290#define YY_DECL_IS_OURS 1
291
292extern int parse_events_lex (void);
293
294#define YY_DECL int parse_events_lex (void)
295#endif /* !YY_DECL */
296
297/* yy_get_previous_state - get the state just before the EOB char was reached */
298
299#undef YY_NEW_FILE
300#undef YY_FLUSH_BUFFER
301#undef yy_set_bol
302#undef yy_new_buffer
303#undef yy_set_interactive
304#undef YY_DO_BEFORE_ACTION
305
306#ifdef YY_DECL_IS_OURS
307#undef YY_DECL_IS_OURS
308#undef YY_DECL
309#endif
310
311#line 102 "util/parse-events.l"
312
313
314#line 315 "util/parse-events-flex.h"
315#undef parse_events_IN_HEADER
316#endif /* parse_events_HEADER_H */
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index b029296d20d..6e50b914cad 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -11,6 +11,9 @@
11#include "cache.h" 11#include "cache.h"
12#include "header.h" 12#include "header.h"
13#include "debugfs.h" 13#include "debugfs.h"
14#include "parse-events-flex.h"
15
16#define MAX_NAME_LEN 100
14 17
15struct event_symbol { 18struct event_symbol {
16 u8 type; 19 u8 type;
@@ -19,11 +22,7 @@ struct event_symbol {
19 const char *alias; 22 const char *alias;
20}; 23};
21 24
22enum event_result { 25int parse_events_parse(struct list_head *list, int *idx);
23 EVT_FAILED,
24 EVT_HANDLED,
25 EVT_HANDLED_ALL
26};
27 26
28#define CHW(x) .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_##x 27#define CHW(x) .type = PERF_TYPE_HARDWARE, .config = PERF_COUNT_HW_##x
29#define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x 28#define CSW(x) .type = PERF_TYPE_SOFTWARE, .config = PERF_COUNT_SW_##x
@@ -354,7 +353,24 @@ const char *__event_name(int type, u64 config)
354 return "unknown"; 353 return "unknown";
355} 354}
356 355
357static int parse_aliases(const char **str, const char *names[][MAX_ALIASES], int size) 356static int add_event(struct list_head *list, int *idx,
357 struct perf_event_attr *attr, char *name)
358{
359 struct perf_evsel *evsel;
360
361 event_attr_init(attr);
362
363 evsel = perf_evsel__new(attr, (*idx)++);
364 if (!evsel)
365 return -ENOMEM;
366
367 list_add_tail(&evsel->node, list);
368
369 evsel->name = strdup(name);
370 return 0;
371}
372
373static int parse_aliases(char *str, const char *names[][MAX_ALIASES], int size)
358{ 374{
359 int i, j; 375 int i, j;
360 int n, longest = -1; 376 int n, longest = -1;
@@ -362,58 +378,57 @@ static int parse_aliases(const char **str, const char *names[][MAX_ALIASES], int
362 for (i = 0; i < size; i++) { 378 for (i = 0; i < size; i++) {
363 for (j = 0; j < MAX_ALIASES && names[i][j]; j++) { 379 for (j = 0; j < MAX_ALIASES && names[i][j]; j++) {
364 n = strlen(names[i][j]); 380 n = strlen(names[i][j]);
365 if (n > longest && !strncasecmp(*str, names[i][j], n)) 381 if (n > longest && !strncasecmp(str, names[i][j], n))
366 longest = n; 382 longest = n;
367 } 383 }
368 if (longest > 0) { 384 if (longest > 0)
369 *str += longest;
370 return i; 385 return i;
371 }
372 } 386 }
373 387
374 return -1; 388 return -1;
375} 389}
376 390
377static enum event_result 391int parse_events_add_cache(struct list_head *list, int *idx,
378parse_generic_hw_event(const char **str, struct perf_event_attr *attr) 392 char *type, char *op_result1, char *op_result2)
379{ 393{
380 const char *s = *str; 394 struct perf_event_attr attr;
395 char name[MAX_NAME_LEN];
381 int cache_type = -1, cache_op = -1, cache_result = -1; 396 int cache_type = -1, cache_op = -1, cache_result = -1;
397 char *op_result[2] = { op_result1, op_result2 };
398 int i, n;
382 399
383 cache_type = parse_aliases(&s, hw_cache, PERF_COUNT_HW_CACHE_MAX);
384 /* 400 /*
385 * No fallback - if we cannot get a clear cache type 401 * No fallback - if we cannot get a clear cache type
386 * then bail out: 402 * then bail out:
387 */ 403 */
404 cache_type = parse_aliases(type, hw_cache,
405 PERF_COUNT_HW_CACHE_MAX);
388 if (cache_type == -1) 406 if (cache_type == -1)
389 return EVT_FAILED; 407 return -EINVAL;
408
409 n = snprintf(name, MAX_NAME_LEN, "%s", type);
390 410
391 while ((cache_op == -1 || cache_result == -1) && *s == '-') { 411 for (i = 0; (i < 2) && (op_result[i]); i++) {
392 ++s; 412 char *str = op_result[i];
413
414 snprintf(name + n, MAX_NAME_LEN - n, "-%s\n", str);
393 415
394 if (cache_op == -1) { 416 if (cache_op == -1) {
395 cache_op = parse_aliases(&s, hw_cache_op, 417 cache_op = parse_aliases(str, hw_cache_op,
396 PERF_COUNT_HW_CACHE_OP_MAX); 418 PERF_COUNT_HW_CACHE_OP_MAX);
397 if (cache_op >= 0) { 419 if (cache_op >= 0) {
398 if (!is_cache_op_valid(cache_type, cache_op)) 420 if (!is_cache_op_valid(cache_type, cache_op))
399 return EVT_FAILED; 421 return -EINVAL;
400 continue; 422 continue;
401 } 423 }
402 } 424 }
403 425
404 if (cache_result == -1) { 426 if (cache_result == -1) {
405 cache_result = parse_aliases(&s, hw_cache_result, 427 cache_result = parse_aliases(str, hw_cache_result,
406 PERF_COUNT_HW_CACHE_RESULT_MAX); 428 PERF_COUNT_HW_CACHE_RESULT_MAX);
407 if (cache_result >= 0) 429 if (cache_result >= 0)
408 continue; 430 continue;
409 } 431 }
410
411 /*
412 * Can't parse this as a cache op or result, so back up
413 * to the '-'.
414 */
415 --s;
416 break;
417 } 432 }
418 433
419 /* 434 /*
@@ -428,20 +443,17 @@ parse_generic_hw_event(const char **str, struct perf_event_attr *attr)
428 if (cache_result == -1) 443 if (cache_result == -1)
429 cache_result = PERF_COUNT_HW_CACHE_RESULT_ACCESS; 444 cache_result = PERF_COUNT_HW_CACHE_RESULT_ACCESS;
430 445
431 attr->config = cache_type | (cache_op << 8) | (cache_result << 16); 446 memset(&attr, 0, sizeof(attr));
432 attr->type = PERF_TYPE_HW_CACHE; 447 attr.config = cache_type | (cache_op << 8) | (cache_result << 16);
433 448 attr.type = PERF_TYPE_HW_CACHE;
434 *str = s; 449 return add_event(list, idx, &attr, name);
435 return EVT_HANDLED;
436} 450}
437 451
438static enum event_result 452static int add_tracepoint(struct list_head *list, int *idx,
439parse_single_tracepoint_event(char *sys_name, 453 char *sys_name, char *evt_name)
440 const char *evt_name,
441 unsigned int evt_length,
442 struct perf_event_attr *attr,
443 const char **strp)
444{ 454{
455 struct perf_event_attr attr;
456 char name[MAX_NAME_LEN];
445 char evt_path[MAXPATHLEN]; 457 char evt_path[MAXPATHLEN];
446 char id_buf[4]; 458 char id_buf[4];
447 u64 id; 459 u64 id;
@@ -452,130 +464,80 @@ parse_single_tracepoint_event(char *sys_name,
452 464
453 fd = open(evt_path, O_RDONLY); 465 fd = open(evt_path, O_RDONLY);
454 if (fd < 0) 466 if (fd < 0)
455 return EVT_FAILED; 467 return -1;
456 468
457 if (read(fd, id_buf, sizeof(id_buf)) < 0) { 469 if (read(fd, id_buf, sizeof(id_buf)) < 0) {
458 close(fd); 470 close(fd);
459 return EVT_FAILED; 471 return -1;
460 } 472 }
461 473
462 close(fd); 474 close(fd);
463 id = atoll(id_buf); 475 id = atoll(id_buf);
464 attr->config = id;
465 attr->type = PERF_TYPE_TRACEPOINT;
466 *strp += strlen(sys_name) + evt_length + 1; /* + 1 for the ':' */
467 476
468 attr->sample_type |= PERF_SAMPLE_RAW; 477 memset(&attr, 0, sizeof(attr));
469 attr->sample_type |= PERF_SAMPLE_TIME; 478 attr.config = id;
470 attr->sample_type |= PERF_SAMPLE_CPU; 479 attr.type = PERF_TYPE_TRACEPOINT;
480 attr.sample_type |= PERF_SAMPLE_RAW;
481 attr.sample_type |= PERF_SAMPLE_TIME;
482 attr.sample_type |= PERF_SAMPLE_CPU;
483 attr.sample_period = 1;
471 484
472 attr->sample_period = 1; 485 snprintf(name, MAX_NAME_LEN, "%s:%s", sys_name, evt_name);
473 486 return add_event(list, idx, &attr, name);
474
475 return EVT_HANDLED;
476} 487}
477 488
478/* sys + ':' + event + ':' + flags*/ 489static int add_tracepoint_multi(struct list_head *list, int *idx,
479#define MAX_EVOPT_LEN (MAX_EVENT_LENGTH * 2 + 2 + 128) 490 char *sys_name, char *evt_name)
480static enum event_result
481parse_multiple_tracepoint_event(struct perf_evlist *evlist, char *sys_name,
482 const char *evt_exp, char *flags)
483{ 491{
484 char evt_path[MAXPATHLEN]; 492 char evt_path[MAXPATHLEN];
485 struct dirent *evt_ent; 493 struct dirent *evt_ent;
486 DIR *evt_dir; 494 DIR *evt_dir;
495 int ret = 0;
487 496
488 snprintf(evt_path, MAXPATHLEN, "%s/%s", tracing_events_path, sys_name); 497 snprintf(evt_path, MAXPATHLEN, "%s/%s", tracing_events_path, sys_name);
489 evt_dir = opendir(evt_path); 498 evt_dir = opendir(evt_path);
490
491 if (!evt_dir) { 499 if (!evt_dir) {
492 perror("Can't open event dir"); 500 perror("Can't open event dir");
493 return EVT_FAILED; 501 return -1;
494 } 502 }
495 503
496 while ((evt_ent = readdir(evt_dir))) { 504 while (!ret && (evt_ent = readdir(evt_dir))) {
497 char event_opt[MAX_EVOPT_LEN + 1];
498 int len;
499
500 if (!strcmp(evt_ent->d_name, ".") 505 if (!strcmp(evt_ent->d_name, ".")
501 || !strcmp(evt_ent->d_name, "..") 506 || !strcmp(evt_ent->d_name, "..")
502 || !strcmp(evt_ent->d_name, "enable") 507 || !strcmp(evt_ent->d_name, "enable")
503 || !strcmp(evt_ent->d_name, "filter")) 508 || !strcmp(evt_ent->d_name, "filter"))
504 continue; 509 continue;
505 510
506 if (!strglobmatch(evt_ent->d_name, evt_exp)) 511 if (!strglobmatch(evt_ent->d_name, evt_name))
507 continue; 512 continue;
508 513
509 len = snprintf(event_opt, MAX_EVOPT_LEN, "%s:%s%s%s", sys_name, 514 ret = add_tracepoint(list, idx, sys_name, evt_ent->d_name);
510 evt_ent->d_name, flags ? ":" : "",
511 flags ?: "");
512 if (len < 0)
513 return EVT_FAILED;
514
515 if (parse_events(evlist, event_opt, 0))
516 return EVT_FAILED;
517 } 515 }
518 516
519 return EVT_HANDLED_ALL; 517 return ret;
520} 518}
521 519
522static enum event_result 520int parse_events_add_tracepoint(struct list_head *list, int *idx,
523parse_tracepoint_event(struct perf_evlist *evlist, const char **strp, 521 char *sys, char *event)
524 struct perf_event_attr *attr)
525{ 522{
526 const char *evt_name; 523 int ret;
527 char *flags = NULL, *comma_loc;
528 char sys_name[MAX_EVENT_LENGTH];
529 unsigned int sys_length, evt_length;
530
531 if (debugfs_valid_mountpoint(tracing_events_path))
532 return 0;
533 524
534 evt_name = strchr(*strp, ':'); 525 ret = debugfs_valid_mountpoint(tracing_events_path);
535 if (!evt_name) 526 if (ret)
536 return EVT_FAILED; 527 return ret;
537 528
538 sys_length = evt_name - *strp; 529 return strpbrk(event, "*?") ?
539 if (sys_length >= MAX_EVENT_LENGTH) 530 add_tracepoint_multi(list, idx, sys, event) :
540 return 0; 531 add_tracepoint(list, idx, sys, event);
541
542 strncpy(sys_name, *strp, sys_length);
543 sys_name[sys_length] = '\0';
544 evt_name = evt_name + 1;
545
546 comma_loc = strchr(evt_name, ',');
547 if (comma_loc) {
548 /* take the event name up to the comma */
549 evt_name = strndup(evt_name, comma_loc - evt_name);
550 }
551 flags = strchr(evt_name, ':');
552 if (flags) {
553 /* split it out: */
554 evt_name = strndup(evt_name, flags - evt_name);
555 flags++;
556 }
557
558 evt_length = strlen(evt_name);
559 if (evt_length >= MAX_EVENT_LENGTH)
560 return EVT_FAILED;
561 if (strpbrk(evt_name, "*?")) {
562 *strp += strlen(sys_name) + evt_length + 1; /* 1 == the ':' */
563 return parse_multiple_tracepoint_event(evlist, sys_name,
564 evt_name, flags);
565 } else {
566 return parse_single_tracepoint_event(sys_name, evt_name,
567 evt_length, attr, strp);
568 }
569} 532}
570 533
571static enum event_result 534static int
572parse_breakpoint_type(const char *type, const char **strp, 535parse_breakpoint_type(const char *type, struct perf_event_attr *attr)
573 struct perf_event_attr *attr)
574{ 536{
575 int i; 537 int i;
576 538
577 for (i = 0; i < 3; i++) { 539 for (i = 0; i < 3; i++) {
578 if (!type[i]) 540 if (!type || !type[i])
579 break; 541 break;
580 542
581 switch (type[i]) { 543 switch (type[i]) {
@@ -589,164 +551,65 @@ parse_breakpoint_type(const char *type, const char **strp,
589 attr->bp_type |= HW_BREAKPOINT_X; 551 attr->bp_type |= HW_BREAKPOINT_X;
590 break; 552 break;
591 default: 553 default:
592 return EVT_FAILED; 554 return -EINVAL;
593 } 555 }
594 } 556 }
557
595 if (!attr->bp_type) /* Default */ 558 if (!attr->bp_type) /* Default */
596 attr->bp_type = HW_BREAKPOINT_R | HW_BREAKPOINT_W; 559 attr->bp_type = HW_BREAKPOINT_R | HW_BREAKPOINT_W;
597 560
598 *strp = type + i; 561 return 0;
599
600 return EVT_HANDLED;
601} 562}
602 563
603static enum event_result 564int parse_events_add_breakpoint(struct list_head *list, int *idx,
604parse_breakpoint_event(const char **strp, struct perf_event_attr *attr) 565 void *ptr, char *type)
605{ 566{
606 const char *target; 567 struct perf_event_attr attr;
607 const char *type; 568 char name[MAX_NAME_LEN];
608 char *endaddr;
609 u64 addr;
610 enum event_result err;
611
612 target = strchr(*strp, ':');
613 if (!target)
614 return EVT_FAILED;
615
616 if (strncmp(*strp, "mem", target - *strp) != 0)
617 return EVT_FAILED;
618
619 target++;
620
621 addr = strtoull(target, &endaddr, 0);
622 if (target == endaddr)
623 return EVT_FAILED;
624
625 attr->bp_addr = addr;
626 *strp = endaddr;
627 569
628 type = strchr(target, ':'); 570 memset(&attr, 0, sizeof(attr));
571 attr.bp_addr = (u64) ptr;
629 572
630 /* If no type is defined, just rw as default */ 573 if (parse_breakpoint_type(type, &attr))
631 if (!type) { 574 return -EINVAL;
632 attr->bp_type = HW_BREAKPOINT_R | HW_BREAKPOINT_W;
633 } else {
634 err = parse_breakpoint_type(++type, strp, attr);
635 if (err == EVT_FAILED)
636 return EVT_FAILED;
637 }
638 575
639 /* 576 /*
640 * We should find a nice way to override the access length 577 * We should find a nice way to override the access length
641 * Provide some defaults for now 578 * Provide some defaults for now
642 */ 579 */
643 if (attr->bp_type == HW_BREAKPOINT_X) 580 if (attr.bp_type == HW_BREAKPOINT_X)
644 attr->bp_len = sizeof(long); 581 attr.bp_len = sizeof(long);
645 else 582 else
646 attr->bp_len = HW_BREAKPOINT_LEN_4; 583 attr.bp_len = HW_BREAKPOINT_LEN_4;
647
648 attr->type = PERF_TYPE_BREAKPOINT;
649
650 return EVT_HANDLED;
651}
652
653static int check_events(const char *str, unsigned int i)
654{
655 int n;
656
657 n = strlen(event_symbols[i].symbol);
658 if (!strncasecmp(str, event_symbols[i].symbol, n))
659 return n;
660 584
661 n = strlen(event_symbols[i].alias); 585 attr.type = PERF_TYPE_BREAKPOINT;
662 if (n) {
663 if (!strncasecmp(str, event_symbols[i].alias, n))
664 return n;
665 }
666 586
667 return 0; 587 snprintf(name, MAX_NAME_LEN, "mem:%p:%s", ptr, type ? type : "rw");
588 return add_event(list, idx, &attr, name);
668} 589}
669 590
670static enum event_result 591int
671parse_symbolic_event(const char **strp, struct perf_event_attr *attr) 592parse_events_add_numeric(struct list_head *list, int *idx,
593 unsigned long type, unsigned long config)
672{ 594{
673 const char *str = *strp; 595 struct perf_event_attr attr;
674 unsigned int i;
675 int n;
676
677 for (i = 0; i < ARRAY_SIZE(event_symbols); i++) {
678 n = check_events(str, i);
679 if (n > 0) {
680 attr->type = event_symbols[i].type;
681 attr->config = event_symbols[i].config;
682 *strp = str + n;
683 return EVT_HANDLED;
684 }
685 }
686 return EVT_FAILED;
687}
688 596
689static enum event_result 597 memset(&attr, 0, sizeof(attr));
690parse_raw_event(const char **strp, struct perf_event_attr *attr) 598 attr.type = type;
691{ 599 attr.config = config;
692 const char *str = *strp; 600 return add_event(list, idx, &attr,
693 u64 config; 601 (char *) __event_name(type, config));
694 int n;
695
696 if (*str != 'r')
697 return EVT_FAILED;
698 n = hex2u64(str + 1, &config);
699 if (n > 0) {
700 const char *end = str + n + 1;
701 if (*end != '\0' && *end != ',' && *end != ':')
702 return EVT_FAILED;
703
704 *strp = end;
705 attr->type = PERF_TYPE_RAW;
706 attr->config = config;
707 return EVT_HANDLED;
708 }
709 return EVT_FAILED;
710} 602}
711 603
712static enum event_result 604int parse_events_modifier(struct list_head *list, char *str)
713parse_numeric_event(const char **strp, struct perf_event_attr *attr)
714{ 605{
715 const char *str = *strp; 606 struct perf_evsel *evsel;
716 char *endp;
717 unsigned long type;
718 u64 config;
719
720 type = strtoul(str, &endp, 0);
721 if (endp > str && type < PERF_TYPE_MAX && *endp == ':') {
722 str = endp + 1;
723 config = strtoul(str, &endp, 0);
724 if (endp > str) {
725 attr->type = type;
726 attr->config = config;
727 *strp = endp;
728 return EVT_HANDLED;
729 }
730 }
731 return EVT_FAILED;
732}
733
734static int
735parse_event_modifier(const char **strp, struct perf_event_attr *attr)
736{
737 const char *str = *strp;
738 int exclude = 0, exclude_GH = 0; 607 int exclude = 0, exclude_GH = 0;
739 int eu = 0, ek = 0, eh = 0, eH = 0, eG = 0, precise = 0; 608 int eu = 0, ek = 0, eh = 0, eH = 0, eG = 0, precise = 0;
740 609
741 if (!*str) 610 if (str == NULL)
742 return 0; 611 return 0;
743 612
744 if (*str == ',')
745 return 0;
746
747 if (*str++ != ':')
748 return -1;
749
750 while (*str) { 613 while (*str) {
751 if (*str == 'u') { 614 if (*str == 'u') {
752 if (!exclude) 615 if (!exclude)
@@ -775,111 +638,60 @@ parse_event_modifier(const char **strp, struct perf_event_attr *attr)
775 638
776 ++str; 639 ++str;
777 } 640 }
778 if (str < *strp + 2)
779 return -1;
780 641
781 *strp = str; 642 /*
643 * precise ip:
644 *
645 * 0 - SAMPLE_IP can have arbitrary skid
646 * 1 - SAMPLE_IP must have constant skid
647 * 2 - SAMPLE_IP requested to have 0 skid
648 * 3 - SAMPLE_IP must have 0 skid
649 *
650 * See also PERF_RECORD_MISC_EXACT_IP
651 */
652 if (precise > 3)
653 return -EINVAL;
782 654
783 attr->exclude_user = eu; 655 list_for_each_entry(evsel, list, node) {
784 attr->exclude_kernel = ek; 656 evsel->attr.exclude_user = eu;
785 attr->exclude_hv = eh; 657 evsel->attr.exclude_kernel = ek;
786 attr->precise_ip = precise; 658 evsel->attr.exclude_hv = eh;
787 attr->exclude_host = eH; 659 evsel->attr.precise_ip = precise;
788 attr->exclude_guest = eG; 660 evsel->attr.exclude_host = eH;
661 evsel->attr.exclude_guest = eG;
662 }
789 663
790 return 0; 664 return 0;
791} 665}
792 666
793/* 667int parse_events(struct perf_evlist *evlist, const char *str, int unset __used)
794 * Each event can have multiple symbolic names.
795 * Symbolic names are (almost) exactly matched.
796 */
797static enum event_result
798parse_event_symbols(struct perf_evlist *evlist, const char **str,
799 struct perf_event_attr *attr)
800{ 668{
801 enum event_result ret; 669 struct perf_evsel *evsel, *h;
802 670 LIST_HEAD(list);
803 ret = parse_tracepoint_event(evlist, str, attr); 671 YY_BUFFER_STATE buffer;
804 if (ret != EVT_FAILED) 672 int ret, idx = evlist->nr_entries;
805 goto modifier;
806 673
807 ret = parse_raw_event(str, attr); 674 buffer = parse_events__scan_string(str);
808 if (ret != EVT_FAILED)
809 goto modifier;
810 675
811 ret = parse_numeric_event(str, attr); 676 ret = parse_events_parse(&list, &idx);
812 if (ret != EVT_FAILED)
813 goto modifier;
814 677
815 ret = parse_symbolic_event(str, attr); 678 parse_events__flush_buffer(buffer);
816 if (ret != EVT_FAILED) 679 parse_events__delete_buffer(buffer);
817 goto modifier;
818 680
819 ret = parse_generic_hw_event(str, attr); 681 if (!ret) {
820 if (ret != EVT_FAILED) 682 int entries = idx - evlist->nr_entries;
821 goto modifier; 683 perf_evlist__splice_list_tail(evlist, &list, entries);
684 return 0;
685 }
822 686
823 ret = parse_breakpoint_event(str, attr); 687 list_for_each_entry_safe(evsel, h, &list, node)
824 if (ret != EVT_FAILED) 688 perf_evsel__delete(evsel);
825 goto modifier;
826 689
827 fprintf(stderr, "invalid or unsupported event: '%s'\n", *str); 690 fprintf(stderr, "invalid or unsupported event: '%s'\n", str);
828 fprintf(stderr, "Run 'perf list' for a list of valid events\n"); 691 fprintf(stderr, "Run 'perf list' for a list of valid events\n");
829 return EVT_FAILED;
830
831modifier:
832 if (parse_event_modifier(str, attr) < 0) {
833 fprintf(stderr, "invalid event modifier: '%s'\n", *str);
834 fprintf(stderr, "Run 'perf list' for a list of valid events and modifiers\n");
835
836 return EVT_FAILED;
837 }
838
839 return ret; 692 return ret;
840} 693}
841 694
842int parse_events(struct perf_evlist *evlist , const char *str, int unset __used)
843{
844 struct perf_event_attr attr;
845 enum event_result ret;
846 const char *ostr;
847
848 for (;;) {
849 ostr = str;
850 memset(&attr, 0, sizeof(attr));
851 event_attr_init(&attr);
852 ret = parse_event_symbols(evlist, &str, &attr);
853 if (ret == EVT_FAILED)
854 return -1;
855
856 if (!(*str == 0 || *str == ',' || isspace(*str)))
857 return -1;
858
859 if (ret != EVT_HANDLED_ALL) {
860 struct perf_evsel *evsel;
861 evsel = perf_evsel__new(&attr, evlist->nr_entries);
862 if (evsel == NULL)
863 return -1;
864 perf_evlist__add(evlist, evsel);
865
866 evsel->name = calloc(str - ostr + 1, 1);
867 if (!evsel->name)
868 return -1;
869 strncpy(evsel->name, ostr, str - ostr);
870 }
871
872 if (*str == 0)
873 break;
874 if (*str == ',')
875 ++str;
876 while (isspace(*str))
877 ++str;
878 }
879
880 return 0;
881}
882
883int parse_events_option(const struct option *opt, const char *str, 695int parse_events_option(const struct option *opt, const char *str,
884 int unset __used) 696 int unset __used)
885{ 697{
@@ -1052,8 +864,6 @@ int print_hwcache_events(const char *event_glob)
1052 return printed; 864 return printed;
1053} 865}
1054 866
1055#define MAX_NAME_LEN 100
1056
1057/* 867/*
1058 * Print the help text for the event symbols: 868 * Print the help text for the event symbols:
1059 */ 869 */
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 7e0cbe75d5f..84d37714f3b 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -33,6 +33,21 @@ extern int parse_filter(const struct option *opt, const char *str, int unset);
33 33
34#define EVENTS_HELP_MAX (128*1024) 34#define EVENTS_HELP_MAX (128*1024)
35 35
36int parse_events_modifier(struct list_head *list __used, char *str __used);
37int parse_events_add_tracepoint(struct list_head *list, int *idx,
38 char *sys, char *event);
39int parse_events_add_raw(struct perf_evlist *evlist, unsigned long config,
40 unsigned long config1, unsigned long config2,
41 char *mod);
42int parse_events_add_numeric(struct list_head *list, int *idx,
43 unsigned long type, unsigned long config);
44int parse_events_add_cache(struct list_head *list, int *idx,
45 char *type, char *op_result1, char *op_result2);
46int parse_events_add_breakpoint(struct list_head *list, int *idx,
47 void *ptr, char *type);
48void parse_events_error(struct list_head *list, int *idx,
49 char const *msg);
50
36void print_events(const char *event_glob); 51void print_events(const char *event_glob);
37void print_events_type(u8 type); 52void print_events_type(u8 type);
38void print_tracepoint_events(const char *subsys_glob, const char *event_glob); 53void print_tracepoint_events(const char *subsys_glob, const char *event_glob);
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
new file mode 100644
index 00000000000..44dbc359f0a
--- /dev/null
+++ b/tools/perf/util/parse-events.l
@@ -0,0 +1,107 @@
1
2%option prefix="parse_events_"
3
4%{
5#include <errno.h>
6#include "../perf.h"
7#include "parse-events-bison.h"
8
9static int __value(char *str, int base, int token)
10{
11 long num;
12
13 errno = 0;
14 num = strtoul(str, NULL, base);
15 if (errno)
16 return PE_ERROR;
17
18 parse_events_lval.num = num;
19 return token;
20}
21
22static int value(int base)
23{
24 return __value(parse_events_text, base, PE_VALUE);
25}
26
27static int raw(void)
28{
29 return __value(parse_events_text + 1, 16, PE_RAW);
30}
31
32static int str(int token)
33{
34 parse_events_lval.str = strdup(parse_events_text);
35 return token;
36}
37
38static int sym(int type, int config)
39{
40 parse_events_lval.num = (type << 16) + config;
41 return PE_VALUE_SYM;
42}
43
44%}
45
46num_dec [0-9]+
47num_hex 0x[a-fA-F0-9]+
48num_raw_hex [a-fA-F0-9]+
49name [a-zA-Z_*?][a-zA-Z0-9_*?]*
50modifier_event [ukhp]{1,5}
51modifier_bp [rwx]
52
53%%
54cpu-cycles|cycles { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES); }
55stalled-cycles-frontend|idle-cycles-frontend { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND); }
56stalled-cycles-backend|idle-cycles-backend { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND); }
57instructions { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS); }
58cache-references { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES); }
59cache-misses { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES); }
60branch-instructions|branches { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_INSTRUCTIONS); }
61branch-misses { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BRANCH_MISSES); }
62bus-cycles { return sym(PERF_TYPE_HARDWARE, PERF_COUNT_HW_BUS_CYCLES); }
63cpu-clock { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK); }
64task-clock { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK); }
65page-faults|faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS); }
66minor-faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MIN); }
67major-faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MAJ); }
68context-switches|cs { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CONTEXT_SWITCHES); }
69cpu-migrations|migrations { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS); }
70alignment-faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_ALIGNMENT_FAULTS); }
71emulation-faults { return sym(PERF_TYPE_SOFTWARE, PERF_COUNT_SW_EMULATION_FAULTS); }
72
73L1-dcache|l1-d|l1d|L1-data |
74L1-icache|l1-i|l1i|L1-instruction |
75LLC|L2 |
76dTLB|d-tlb|Data-TLB |
77iTLB|i-tlb|Instruction-TLB |
78branch|branches|bpu|btb|bpc |
79node { return str(PE_NAME_CACHE_TYPE); }
80
81load|loads|read |
82store|stores|write |
83prefetch|prefetches |
84speculative-read|speculative-load |
85refs|Reference|ops|access |
86misses|miss { return str(PE_NAME_CACHE_OP_RESULT); }
87
88mem: { return PE_PREFIX_MEM; }
89r{num_raw_hex} { return raw(); }
90{num_dec} { return value(10); }
91{num_hex} { return value(16); }
92
93{modifier_event} { return str(PE_MODIFIER_EVENT); }
94{modifier_bp} { return str(PE_MODIFIER_BP); }
95{name} { return str(PE_NAME); }
96"/" { return '/'; }
97- { return '-'; }
98, { return ','; }
99: { return ':'; }
100= { return '='; }
101
102%%
103
104int parse_events_wrap(void)
105{
106 return 1;
107}
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
new file mode 100644
index 00000000000..4b4459e67a0
--- /dev/null
+++ b/tools/perf/util/parse-events.y
@@ -0,0 +1,127 @@
1
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}