cpu: single core: Give the compiler some hints to save memory.

Save memory when only a single core is enabled. Compiler can now see
always false/true conditions and optimise out unused TEXT.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This commit is contained in:
Liam Girdwood 2022-06-03 12:03:03 +01:00 committed by Liam Girdwood
parent d4af413687
commit b77149cff3
1 changed files with 21 additions and 0 deletions

View File

@ -21,6 +21,26 @@
#include <arch/lib/cpu.h>
#include <stdbool.h>
/* let the compiler optimise when in single core mode */
#if CONFIG_CORE_COUNT == 1
static inline int cpu_get_id(void)
{
return 0;
}
static inline bool cpu_is_primary(int id)
{
return 1;
}
static inline bool cpu_is_me(int id)
{
return 1;
}
#else
static inline int cpu_get_id(void)
{
return arch_cpu_get_id();
@ -35,6 +55,7 @@ static inline bool cpu_is_me(int id)
{
return id == cpu_get_id();
}
#endif
static inline int cpu_enable_core(int id)
{