aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/rs6000/driver-rs6000.c40
2 files changed, 44 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 46a22ea..2f49559 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+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>
* tree-cfg.c (verify_types_in_gimple_assign): Verify copies
diff --git a/gcc/config/rs6000/driver-rs6000.c b/gcc/config/rs6000/driver-rs6000.c
index 37e2d7c..3f5524e 100644
--- a/gcc/config/rs6000/driver-rs6000.c
+++ b/gcc/config/rs6000/driver-rs6000.c
@@ -1,5 +1,5 @@
/* 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.
@@ -31,7 +31,7 @@ along with GCC; see the file COPYING3. If not see
# include <link.h>
#endif
-#ifdef __APPLE__
+#if defined (__APPLE__) || (__FreeBSD__)
# include <sys/types.h>
# include <sys/sysctl.h>
#endif
@@ -124,6 +124,36 @@ detect_processor_darwin (void)
#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__
/* Returns AT_PLATFORM if present, otherwise generic PowerPC. */
@@ -343,6 +373,10 @@ const char
cache = detect_caches_aix ();
#elif defined (__APPLE__)
cache = detect_caches_darwin ();
+#elif defined (__FreeBSD__)
+ cache = detect_caches_freebsd ();
+ /* FreeBSD PPC does not provide any cache information yet. */
+ cache = "";
#elif defined (__linux__)
cache = detect_caches_linux ();
/* PPC Linux does not provide any cache information yet. */
@@ -355,6 +389,8 @@ const char
cpu = detect_processor_aix ();
#elif defined (__APPLE__)
cpu = detect_processor_darwin ();
+#elif defined (__FreeBSD__)
+ cpu = detect_processor_freebsd ();
#elif defined (__linux__)
cpu = detect_processor_linux ();
#else