tools/perf/util/annotate-arch/annotate-powerpc.c

Source file repositories/reference/linux-study-clean/tools/perf/util/annotate-arch/annotate-powerpc.c

File Facts

System
Linux kernel
Corpus path
tools/perf/util/annotate-arch/annotate-powerpc.c
Extension
.c
Size
13030 bytes
Lines
411
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

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

struct insn_offset {
	const char	*name;
	int		value;
};

/*
 * There are memory instructions with opcode 31 which are
 * of X Form, Example:
 * ldx RT,RA,RB
 * ______________________________________
 * | 31 |  RT  |  RA |  RB |   21     |/|
 * --------------------------------------
 * 0    6     11    16    21         30 31
 *
 * But all instructions with opcode 31 are not memory.
 * Example: add RT,RA,RB
 *
 * Use bits 21 to 30 to check memory insns with 31 as opcode.
 * In ins_array below, for ldx instruction:
 * name => OP_31_XOP_LDX
 * value => 21
 */

static struct insn_offset ins_array[] = {
	{ .name = "OP_31_XOP_LXSIWZX",  .value = 12, },
	{ .name = "OP_31_XOP_LWARX",	.value = 20, },
	{ .name = "OP_31_XOP_LDX",	.value = 21, },
	{ .name = "OP_31_XOP_LWZX",	.value = 23, },
	{ .name = "OP_31_XOP_LDUX",	.value = 53, },
	{ .name = "OP_31_XOP_LWZUX",	.value = 55, },
	{ .name = "OP_31_XOP_LXSIWAX",  .value = 76, },
	{ .name = "OP_31_XOP_LDARX",    .value = 84, },
	{ .name = "OP_31_XOP_LBZX",	.value = 87, },
	{ .name = "OP_31_XOP_LVX",      .value = 103, },
	{ .name = "OP_31_XOP_LBZUX",    .value = 119, },
	{ .name = "OP_31_XOP_STXSIWX",  .value = 140, },
	{ .name = "OP_31_XOP_STDX",	.value = 149, },
	{ .name = "OP_31_XOP_STWX",	.value = 151, },
	{ .name = "OP_31_XOP_STDUX",	.value = 181, },
	{ .name = "OP_31_XOP_STWUX",	.value = 183, },
	{ .name = "OP_31_XOP_STBX",	.value = 215, },
	{ .name = "OP_31_XOP_STVX",     .value = 231, },
	{ .name = "OP_31_XOP_STBUX",	.value = 247, },
	{ .name = "OP_31_XOP_LHZX",	.value = 279, },
	{ .name = "OP_31_XOP_LHZUX",	.value = 311, },
	{ .name = "OP_31_XOP_LXVDSX",   .value = 332, },
	{ .name = "OP_31_XOP_LWAX",	.value = 341, },
	{ .name = "OP_31_XOP_LHAX",	.value = 343, },
	{ .name = "OP_31_XOP_LWAUX",	.value = 373, },
	{ .name = "OP_31_XOP_LHAUX",	.value = 375, },
	{ .name = "OP_31_XOP_STHX",	.value = 407, },
	{ .name = "OP_31_XOP_STHUX",	.value = 439, },
	{ .name = "OP_31_XOP_LXSSPX",   .value = 524, },
	{ .name = "OP_31_XOP_LDBRX",	.value = 532, },
	{ .name = "OP_31_XOP_LSWX",	.value = 533, },
	{ .name = "OP_31_XOP_LWBRX",	.value = 534, },
	{ .name = "OP_31_XOP_LFSUX",    .value = 567, },
	{ .name = "OP_31_XOP_LXSDX",    .value = 588, },
	{ .name = "OP_31_XOP_LSWI",	.value = 597, },
	{ .name = "OP_31_XOP_LFDX",     .value = 599, },
	{ .name = "OP_31_XOP_LFDUX",    .value = 631, },
	{ .name = "OP_31_XOP_STXSSPX",  .value = 652, },
	{ .name = "OP_31_XOP_STDBRX",	.value = 660, },
	{ .name = "OP_31_XOP_STXWX",	.value = 661, },
	{ .name = "OP_31_XOP_STWBRX",	.value = 662, },
	{ .name = "OP_31_XOP_STFSX",	.value = 663, },
	{ .name = "OP_31_XOP_STFSUX",	.value = 695, },
	{ .name = "OP_31_XOP_STXSDX",   .value = 716, },
	{ .name = "OP_31_XOP_STSWI",	.value = 725, },
	{ .name = "OP_31_XOP_STFDX",	.value = 727, },
	{ .name = "OP_31_XOP_STFDUX",	.value = 759, },
	{ .name = "OP_31_XOP_LXVW4X",   .value = 780, },
	{ .name = "OP_31_XOP_LHBRX",	.value = 790, },
	{ .name = "OP_31_XOP_LXVD2X",   .value = 844, },
	{ .name = "OP_31_XOP_LFIWAX",	.value = 855, },
	{ .name = "OP_31_XOP_LFIWZX",	.value = 887, },
	{ .name = "OP_31_XOP_STXVW4X",  .value = 908, },
	{ .name = "OP_31_XOP_STHBRX",	.value = 918, },
	{ .name = "OP_31_XOP_STXVD2X",  .value = 972, },
	{ .name = "OP_31_XOP_STFIWX",	.value = 983, },
};

/*
 * Arithmetic instructions which are having opcode as 31.
 * These instructions are tracked to save the register state
 * changes. Example:
 *
 * lwz	r10,264(r3)
 * add	r31, r3, r3
 * lwz	r9, 0(r31)

Annotation

Implementation Notes