Path: blob/master/tools/perf/arch/csky/annotate/instructions.c
26299 views
// SPDX-License-Identifier: GPL-2.01// Copyright (C) 2019 Hangzhou C-SKY Microsystems co.,ltd.23#include <linux/compiler.h>45static struct ins_ops *csky__associate_ins_ops(struct arch *arch,6const char *name)7{8struct ins_ops *ops = NULL;910/* catch all kind of jumps */11if (!strcmp(name, "bt") ||12!strcmp(name, "bf") ||13!strcmp(name, "bez") ||14!strcmp(name, "bnez") ||15!strcmp(name, "bnezad") ||16!strcmp(name, "bhsz") ||17!strcmp(name, "bhz") ||18!strcmp(name, "blsz") ||19!strcmp(name, "blz") ||20!strcmp(name, "br") ||21!strcmp(name, "jmpi") ||22!strcmp(name, "jmp"))23ops = &jump_ops;2425/* catch function call */26if (!strcmp(name, "bsr") ||27!strcmp(name, "jsri") ||28!strcmp(name, "jsr"))29ops = &call_ops;3031/* catch function return */32if (!strcmp(name, "rts"))33ops = &ret_ops;3435if (ops)36arch__associate_ins_ops(arch, name, ops);37return ops;38}3940static int csky__annotate_init(struct arch *arch, char *cpuid __maybe_unused)41{42arch->initialized = true;43arch->objdump.comment_char = '/';44arch->associate_instruction_ops = csky__associate_ins_ops;45arch->e_machine = EM_CSKY;46#if defined(__CSKYABIV2__)47arch->e_flags = EF_CSKY_ABIV2;48#else49arch->e_flags = EF_CSKY_ABIV1;50#endif51return 0;52}535455