From 58f03a4028987eef6b222b41d49e1f5781510b7c Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 12 Apr 2010 16:57:24 +0000 Subject: [PATCH] sim: add helper macros for branch profiling The profile code has a lot of helper macros already, but none yet for the branch profiling code. So add ones for the basic functions -- taken and untaken branches. Signed-off-by: Mike Frysinger --- sim/common/ChangeLog | 5 +++++ sim/common/sim-profile.h | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 4e0aaf0b7b8..71f4613ce94 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,8 @@ +2010-04-12 Mike Frysinger + + * sim-profile.h (PROFILE_BRANCH_TAKEN, PROFILE_BRANCH_UNTAKEN): New + defines. + 2010-04-12 Mike Frysinger * dv-core.c (dv_core_descriptor): Add NULL initializer. diff --git a/sim/common/sim-profile.h b/sim/common/sim-profile.h index 315a79f140a..c35fe0c4f3c 100644 --- a/sim/common/sim-profile.h +++ b/sim/common/sim-profile.h @@ -290,6 +290,22 @@ do { \ #define PROFILE_COUNT_CORE(cpu, addr, size, map) #endif /* ! core */ +#if WITH_PROFILE_MODEL_P +#define PROFILE_BRANCH_TAKEN(cpu) \ +do { \ + if (PROFILE_MODEL_P (cpu)) \ + ++ PROFILE_MODEL_TAKEN_COUNT (CPU_PROFILE_DATA (cpu)); \ +} while (0) +#define PROFILE_BRANCH_UNTAKEN(cpu) \ +do { \ + if (PROFILE_MODEL_P (cpu)) \ + ++ PROFILE_MODEL_UNTAKEN_COUNT (CPU_PROFILE_DATA (cpu)); \ +} while (0) +#else +#define PROFILE_BRANCH_TAKEN(cpu) +#define PROFILE_BRANCH_UNTAKEN(cpu) +#endif /* ! model */ + /* Misc. utilities. */ extern void sim_profile_print_bar (SIM_DESC, unsigned int, unsigned int, unsigned int); -- 2.30.2