Commit 992b0aa1 by Janne Blomqvist

Let the compiler decide whether to inline.

2011-11-10  Janne Blomqvist  <jb@gcc.gnu.org>

	* intrinsics/cpu_time.c (__cpu_time_1): Don't force inlining.
	* intrinsics/random.c (rnumber_4): Remove inline attribute.
	(rnumber_8, rnumber_10, rnumber_16): Likewise.
	* intrinsics/system_clock.c (gf_gettime_mono): Likewise.
	* intrinsics/time_1.h (ATTRIBUTE_ALWAYS_INLINE): Remove macro.
	(gf_cputime): Add inline attribute for MingW version.
	* io/format.c (format_hash): Remove inline attribute.
	* io/io.h (memset4): Inline function from transfer.c and write.c
	moved here.
	* io/transfer.c (min_off): Remove inline attribute.
	(memset4): Move to io.h.
	* io/write.c (memset4): Likewise.
	(memcpy4): Remove inline attribute.
	* io/write_float.def (calculate_exp): Likewise.

From-SVN: r181260
parent 154b68db
2011-11-10 Janne Blomqvist <jb@gcc.gnu.org>
* intrinsics/cpu_time.c (__cpu_time_1): Don't force inlining.
* intrinsics/random.c (rnumber_4): Remove inline attribute.
(rnumber_8, rnumber_10, rnumber_16): Likewise.
* intrinsics/system_clock.c (gf_gettime_mono): Likewise.
* intrinsics/time_1.h (ATTRIBUTE_ALWAYS_INLINE): Remove macro.
(gf_cputime): Add inline attribute for MingW version.
* io/format.c (format_hash): Remove inline attribute.
* io/io.h (memset4): Inline function from transfer.c and write.c
moved here.
* io/transfer.c (min_off): Remove inline attribute.
(memset4): Move to io.h.
* io/write.c (memset4): Likewise.
(memcpy4): Remove inline attribute.
* io/write_float.def (calculate_exp): Likewise.
2011-11-09 Janne Blomqvist <jb@gcc.gnu.org> 2011-11-09 Janne Blomqvist <jb@gcc.gnu.org>
* intrinsics/time_1.h (gf_gettime): Simplify time() usage. * intrinsics/time_1.h (gf_gettime): Simplify time() usage.
......
...@@ -26,9 +26,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see ...@@ -26,9 +26,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#include "time_1.h" #include "time_1.h"
static inline void __cpu_time_1 (long *, long *) ATTRIBUTE_ALWAYS_INLINE; static void
static inline void
__cpu_time_1 (long *sec, long *usec) __cpu_time_1 (long *sec, long *usec)
{ {
long user_sec, user_usec, system_sec, system_usec; long user_sec, user_usec, system_sec, system_usec;
......
...@@ -74,7 +74,7 @@ static __gthread_mutex_t random_lock; ...@@ -74,7 +74,7 @@ static __gthread_mutex_t random_lock;
correct offset. */ correct offset. */
static inline void static void
rnumber_4 (GFC_REAL_4 *f, GFC_UINTEGER_4 v) rnumber_4 (GFC_REAL_4 *f, GFC_UINTEGER_4 v)
{ {
GFC_UINTEGER_4 mask; GFC_UINTEGER_4 mask;
...@@ -89,7 +89,7 @@ rnumber_4 (GFC_REAL_4 *f, GFC_UINTEGER_4 v) ...@@ -89,7 +89,7 @@ rnumber_4 (GFC_REAL_4 *f, GFC_UINTEGER_4 v)
*f = (GFC_REAL_4) v * GFC_REAL_4_LITERAL(0x1.p-32); *f = (GFC_REAL_4) v * GFC_REAL_4_LITERAL(0x1.p-32);
} }
static inline void static void
rnumber_8 (GFC_REAL_8 *f, GFC_UINTEGER_8 v) rnumber_8 (GFC_REAL_8 *f, GFC_UINTEGER_8 v)
{ {
GFC_UINTEGER_8 mask; GFC_UINTEGER_8 mask;
...@@ -106,7 +106,7 @@ rnumber_8 (GFC_REAL_8 *f, GFC_UINTEGER_8 v) ...@@ -106,7 +106,7 @@ rnumber_8 (GFC_REAL_8 *f, GFC_UINTEGER_8 v)
#ifdef HAVE_GFC_REAL_10 #ifdef HAVE_GFC_REAL_10
static inline void static void
rnumber_10 (GFC_REAL_10 *f, GFC_UINTEGER_8 v) rnumber_10 (GFC_REAL_10 *f, GFC_UINTEGER_8 v)
{ {
GFC_UINTEGER_8 mask; GFC_UINTEGER_8 mask;
...@@ -126,7 +126,7 @@ rnumber_10 (GFC_REAL_10 *f, GFC_UINTEGER_8 v) ...@@ -126,7 +126,7 @@ rnumber_10 (GFC_REAL_10 *f, GFC_UINTEGER_8 v)
/* For REAL(KIND=16), we only need to mask off the lower bits. */ /* For REAL(KIND=16), we only need to mask off the lower bits. */
static inline void static void
rnumber_16 (GFC_REAL_16 *f, GFC_UINTEGER_8 v1, GFC_UINTEGER_8 v2) rnumber_16 (GFC_REAL_16 *f, GFC_UINTEGER_8 v1, GFC_UINTEGER_8 v2)
{ {
GFC_UINTEGER_8 mask; GFC_UINTEGER_8 mask;
......
...@@ -75,7 +75,7 @@ static int weak_gettime (clockid_t, struct timespec *) ...@@ -75,7 +75,7 @@ static int weak_gettime (clockid_t, struct timespec *)
Return value: 0 for success, -1 for error. In case of error, errno Return value: 0 for success, -1 for error. In case of error, errno
is set. is set.
*/ */
static inline int static int
gf_gettime_mono (time_t * secs, long * nanosecs) gf_gettime_mono (time_t * secs, long * nanosecs)
{ {
int err; int err;
......
...@@ -97,14 +97,6 @@ localtime_r (const time_t * timep, struct tm * result) ...@@ -97,14 +97,6 @@ localtime_r (const time_t * timep, struct tm * result)
#endif #endif
#if defined (__GNUC__) && (__GNUC__ >= 3)
# define ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__))
#else
# define ATTRIBUTE_ALWAYS_INLINE
#endif
static inline int gf_cputime (long *, long *, long *, long *) ATTRIBUTE_ALWAYS_INLINE;
/* Helper function for the actual implementation of the DTIME, ETIME and /* Helper function for the actual implementation of the DTIME, ETIME and
CPU_TIME intrinsics. Returns 0 for success or -1 if no CPU_TIME intrinsics. Returns 0 for success or -1 if no
CPU time could be computed. */ CPU time could be computed. */
...@@ -114,7 +106,7 @@ static inline int gf_cputime (long *, long *, long *, long *) ATTRIBUTE_ALWAYS_I ...@@ -114,7 +106,7 @@ static inline int gf_cputime (long *, long *, long *, long *) ATTRIBUTE_ALWAYS_I
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
static int static inline int
gf_cputime (long *user_sec, long *user_usec, long *system_sec, long *system_usec) gf_cputime (long *user_sec, long *user_usec, long *system_sec, long *system_usec)
{ {
union { union {
......
...@@ -116,8 +116,8 @@ reset_fnode_counters (st_parameter_dt *dtp) ...@@ -116,8 +116,8 @@ reset_fnode_counters (st_parameter_dt *dtp)
/* A simple hashing function to generate an index into the hash table. */ /* A simple hashing function to generate an index into the hash table. */
static inline static uint32_t
uint32_t format_hash (st_parameter_dt *dtp) format_hash (st_parameter_dt *dtp)
{ {
char *key; char *key;
gfc_charlen_type key_len; gfc_charlen_type key_len;
......
...@@ -801,5 +801,14 @@ dec_waiting_unlocked (gfc_unit *u) ...@@ -801,5 +801,14 @@ dec_waiting_unlocked (gfc_unit *u)
#endif #endif
} }
static inline void
memset4 (gfc_char4_t *p, gfc_char4_t c, int k)
{
int j;
for (j = 0; j < k; j++)
*p++ = c;
}
#endif #endif
...@@ -2877,7 +2877,7 @@ next_record_r_unf (st_parameter_dt *dtp, int complete_record) ...@@ -2877,7 +2877,7 @@ next_record_r_unf (st_parameter_dt *dtp, int complete_record)
} }
static inline gfc_offset static gfc_offset
min_off (gfc_offset a, gfc_offset b) min_off (gfc_offset a, gfc_offset b)
{ {
return (a < b ? a : b); return (a < b ? a : b);
...@@ -3136,13 +3136,6 @@ sset (stream * s, int c, ssize_t nbyte) ...@@ -3136,13 +3136,6 @@ sset (stream * s, int c, ssize_t nbyte)
return nbyte - bytes_left; return nbyte - bytes_left;
} }
static inline void
memset4 (gfc_char4_t *p, gfc_char4_t c, int k)
{
int j;
for (j = 0; j < k; j++)
*p++ = c;
}
/* Position to the next record in write mode. */ /* Position to the next record in write mode. */
......
...@@ -41,15 +41,7 @@ typedef unsigned char uchar; ...@@ -41,15 +41,7 @@ typedef unsigned char uchar;
/* Helper functions for character(kind=4) internal units. These are needed /* Helper functions for character(kind=4) internal units. These are needed
by write_float.def. */ by write_float.def. */
static inline void static void
memset4 (gfc_char4_t *p, gfc_char4_t c, int k)
{
int j;
for (j = 0; j < k; j++)
*p++ = c;
}
static inline void
memcpy4 (gfc_char4_t *dest, const char *source, int k) memcpy4 (gfc_char4_t *dest, const char *source, int k)
{ {
int j; int j;
......
...@@ -774,7 +774,7 @@ write_infnan (st_parameter_dt *dtp, const fnode *f, int isnan_flag, int sign_bit ...@@ -774,7 +774,7 @@ write_infnan (st_parameter_dt *dtp, const fnode *f, int isnan_flag, int sign_bit
/* Returns the value of 10**d. */ /* Returns the value of 10**d. */
#define CALCULATE_EXP(x) \ #define CALCULATE_EXP(x) \
inline static GFC_REAL_ ## x \ static GFC_REAL_ ## x \
calculate_exp_ ## x (int d)\ calculate_exp_ ## x (int d)\
{\ {\
int i;\ int i;\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment