tools/perf/util/pmu.y

Source file repositories/reference/linux-study-clean/tools/perf/util/pmu.y

File Facts

System
Linux kernel
Corpus path
tools/perf/util/pmu.y
Extension
.y
Size
1515 bytes
Lines
102
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

%define api.pure full
%parse-param {void *format}
%parse-param {void *scanner}
%lex-param {void* scanner}

%{

#ifndef NDEBUG
#define YYDEBUG 1
#endif

#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/bitmap.h>
#include <string.h>
#include "pmu.h"
#include "pmu-bison.h"

int perf_pmu_lex(YYSTYPE * yylval_param , void *yyscanner);

#define ABORT_ON(val) \
do { \
        if (val) \
                YYABORT; \
} while (0)

static void perf_pmu_error(void *format, void *scanner, const char *msg);

static void perf_pmu__set_format(unsigned long *bits, long from, long to)
{
	long b;

	if (!to)
		to = from;

	memset(bits, 0, BITS_TO_BYTES(PERF_PMU_FORMAT_BITS));
	for (b = from; b <= to; b++)
		__set_bit(b, bits);
}

%}

%token PP_CONFIG
%token PP_VALUE PP_ERROR
%type <num> PP_VALUE
%type <bits> bit_term
%type <bits> bits

%union
{
	unsigned long num;
	DECLARE_BITMAP(bits, PERF_PMU_FORMAT_BITS);
}

%%

format:
format format_term
|
format_term

format_term:
PP_CONFIG ':' bits
{
	perf_pmu_format__set_value(format, PERF_PMU_FORMAT_VALUE_CONFIG, $3);
}
|
PP_CONFIG PP_VALUE ':' bits
{
	perf_pmu_format__set_value(format, $2, $4);

Annotation

Implementation Notes