Commit 3b7abfda by Andreas Tobler Committed by Andreas Tobler

driver-rs6000.c (detect_caches_freebsd): New function.

2008-08-18  Andreas Tobler  <a.tobler@schweiz.org>

	* config/rs6000/driver-rs6000.c (detect_caches_freebsd): New function.
	(detect_processor_freebsd): Likewise.
	(host_detect_local_cpu): Call newly added functions for FreeBSD.

From-SVN: r139196
parent 2f9864e6
2008-08-18 Andreas Tobler <a.tobler@schweiz.org>
* config/rs6000/driver-rs6000.c (detect_caches_freebsd): New function.
(detect_processor_freebsd): Likewise.
(host_detect_local_cpu): Call newly added functions for FreeBSD.
2008-08-18 Richard Guenther <rguenther@suse.de> 2008-08-18 Richard Guenther <rguenther@suse.de>
* tree-cfg.c (verify_types_in_gimple_assign): Verify copies * tree-cfg.c (verify_types_in_gimple_assign): Verify copies
......
/* Subroutines for the gcc driver. /* Subroutines for the gcc driver.
Copyright (C) 2007 Free Software Foundation, Inc. Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -31,7 +31,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -31,7 +31,7 @@ along with GCC; see the file COPYING3. If not see
# include <link.h> # include <link.h>
#endif #endif
#ifdef __APPLE__ #if defined (__APPLE__) || (__FreeBSD__)
# include <sys/types.h> # include <sys/types.h>
# include <sys/sysctl.h> # include <sys/sysctl.h>
#endif #endif
...@@ -124,6 +124,36 @@ detect_processor_darwin (void) ...@@ -124,6 +124,36 @@ detect_processor_darwin (void)
#endif /* __APPLE__ */ #endif /* __APPLE__ */
#ifdef __FreeBSD__
/* Returns the description of caches on FreeBSD PPC. */
static char *
detect_caches_freebsd (void)
{
unsigned l1_sizekb, l1_line, l1_assoc, l2_sizekb;
size_t len = 4;
/* Currently, as of FreeBSD-7.0, there is only the cacheline_size
available via sysctl. */
sysctlbyname ("machdep.cacheline_size", &l1_line, &len, NULL, 0);
l1_sizekb = 32;
l1_assoc = 0;
l2_sizekb = 512;
return describe_cache (l1_sizekb, l1_line, l1_assoc, l2_sizekb);
}
/* Currently returns default powerpc. */
static const char *
detect_processor_freebsd (void)
{
return "powerpc";
}
#endif /* __FreeBSD__ */
#ifdef __linux__ #ifdef __linux__
/* Returns AT_PLATFORM if present, otherwise generic PowerPC. */ /* Returns AT_PLATFORM if present, otherwise generic PowerPC. */
...@@ -343,6 +373,10 @@ const char ...@@ -343,6 +373,10 @@ const char
cache = detect_caches_aix (); cache = detect_caches_aix ();
#elif defined (__APPLE__) #elif defined (__APPLE__)
cache = detect_caches_darwin (); cache = detect_caches_darwin ();
#elif defined (__FreeBSD__)
cache = detect_caches_freebsd ();
/* FreeBSD PPC does not provide any cache information yet. */
cache = "";
#elif defined (__linux__) #elif defined (__linux__)
cache = detect_caches_linux (); cache = detect_caches_linux ();
/* PPC Linux does not provide any cache information yet. */ /* PPC Linux does not provide any cache information yet. */
...@@ -355,6 +389,8 @@ const char ...@@ -355,6 +389,8 @@ const char
cpu = detect_processor_aix (); cpu = detect_processor_aix ();
#elif defined (__APPLE__) #elif defined (__APPLE__)
cpu = detect_processor_darwin (); cpu = detect_processor_darwin ();
#elif defined (__FreeBSD__)
cpu = detect_processor_freebsd ();
#elif defined (__linux__) #elif defined (__linux__)
cpu = detect_processor_linux (); cpu = detect_processor_linux ();
#else #else
......
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