Mark x86_curlwp() with __attribute__ ((const)), so gcc can CSE it and know

that it does not clobber global data.
This commit is contained in:
ad 2008-05-22 13:55:51 +00:00
parent 050d9aaef4
commit d9b262b49d
3 changed files with 10 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.56 2008/05/11 16:57:43 ad Exp $ */
/* $NetBSD: cpu.h,v 1.57 2008/05/22 13:55:51 ad Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -57,7 +57,7 @@ x86_curcpu(void)
return ci;
}
__inline static lwp_t * __unused
__inline static lwp_t * __unused __attribute__ ((const))
x86_curlwp(void)
{
lwp_t *l;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.174 2008/05/11 16:57:43 ad Exp $ */
/* $NetBSD: cpu.h,v 1.175 2008/05/22 13:55:51 ad Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -57,7 +57,7 @@ x86_curcpu(void)
return ci;
}
__inline static lwp_t * __unused
__inline static lwp_t * __attribute__ ((const))
x86_curlwp(void)
{
lwp_t *l;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.4 2008/05/12 14:41:07 ad Exp $ */
/* $NetBSD: cpu.h,v 1.5 2008/05/22 13:55:51 ad Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -238,8 +238,12 @@ extern struct cpu_info *cpu_info_list;
#if !defined(__GNUC__) || defined(_LKM)
/* For non-GCC and modules */
struct cpu_info *x86_curcpu(void);
lwp_t *x86_curlwp(void);
void cpu_set_curpri(int);
# ifdef __GNUC__
lwp_t *x86_curlwp(void) __attribute__ ((const));
# else
lwp_t *x86_curlwp(void);
# endif
#endif
#define cpu_number() (cpu_index(curcpu()))