From: andreast Date: Mon, 18 Aug 2008 14:31:58 +0000 (+0000) Subject: 2008-08-18 Andreas Tobler X-Git-Url: http://git.sourceforge.jp/view?a=commitdiff_plain;h=30e9c25ce01f98d7c90f8be7d36e0e4f1f337b37;p=pf3gnuchains%2Fgcc-fork.git 2008-08-18 Andreas Tobler * config/rs6000/driver-rs6000.c (detect_caches_freebsd): New function. (detect_processor_freebsd): Likewise. (host_detect_local_cpu): Call newly added functions for FreeBSD. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139196 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 46a22ea32e3..2f49559479c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-08-18 Andreas Tobler + + * 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 * 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 37e2d7c95d6..3f5524ea08a 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 #endif -#ifdef __APPLE__ +#if defined (__APPLE__) || (__FreeBSD__) # include # include #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