Print this page
rollback tools/cw/cw.c
patch01 - 693 import Sun Devpro Math Library
rollback tools/cw/cw.c
patch01 - 693 import Sun Devpro Math Library


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*



  23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*
  28  * Wrapper for the GNU C compiler to make it accept the Sun C compiler
  29  * arguments where possible.
  30  *
  31  * Since the translation is inexact, this is something of a work-in-progress.
  32  *
  33  */
  34 
  35 /* If you modify this file, you must increment CW_VERSION */
  36 #define CW_VERSION      "1.29"
  37 
  38 /*
  39  * -#           Verbose mode
  40  * -###         Show compiler commands built by driver, no compilation
  41  * -A<name[(tokens)]>     Preprocessor predicate assertion
  42  * -B<[static|dynamic]>   Specify dynamic or static binding
  43  * -C           Prevent preprocessor from removing comments
  44  * -c           Compile only - produce .o files, suppress linking
  45  * -cg92        Alias for -xtarget=ss1000
  46  * -D<name[=token]>       Associate name with token as if by #define
  47  * -d[y|n]      dynamic [-dy] or static [-dn] option to linker
  48  * -E           Compile source through preprocessor only, output to stdout
  49  * -erroff=<t>    Suppress warnings specified by tags t(%none, %all, <tag list>)
  50  * -errtags=<a>   Display messages with tags a(no, yes)
  51  * -errwarn=<t>   Treats warnings specified by tags t(%none, %all, <tag list>)
  52  *              as errors
  53  * -fast        Optimize using a selection of options
  54  * -fd          Report old-style function definitions and declarations
  55  * -features=zla        Allow zero-length arrays
  56  * -flags       Show this summary of compiler options


 375  * to the values in x_trans[n]. The x_flags indicates what compiler
 376  * is being used and what flags have been set via the use of
 377  * "x_arg".
 378  */
 379 typedef struct xarch_table {
 380         char    *x_arg;
 381         int     x_flags;
 382         char    *x_trans[TRANS_ENTRY];
 383 } xarch_table_t;
 384 
 385 /*
 386  * The translation table for the -xarch= flag used in the Studio compilers.
 387  */
 388 static const xarch_table_t xtbl[] = {
 389 #if defined(__x86)
 390         { "generic",    SS11 },
 391         { "generic64",  (SS11|M64), { "-m64", "-mtune=opteron" } },
 392         { "amd64",      (SS11|M64), { "-m64", "-mtune=opteron" } },
 393         { "386",        SS11,   { "-march=i386" } },
 394         { "pentium_pro", SS11,  { "-march=pentiumpro" } },


 395 #elif defined(__sparc)
 396         { "generic",    (SS11|M32), { "-m32", "-mcpu=v8" } },
 397         { "generic64",  (SS11|M64), { "-m64", "-mcpu=v9" } },
 398         { "v8",         (SS11|M32), { "-m32", "-mcpu=v8", "-mno-v8plus" } },
 399         { "v8plus",     (SS11|M32), { "-m32", "-mcpu=v9", "-mv8plus" } },
 400         { "v8plusa",    (SS11|M32), { "-m32", "-mcpu=ultrasparc", "-mv8plus",
 401                         "-mvis" } },
 402         { "v8plusb",    (SS11|M32), { "-m32", "-mcpu=ultrasparc3", "-mv8plus",
 403                         "-mvis" } },
 404         { "v9",         (SS11|M64), { "-m64", "-mcpu=v9" } },
 405         { "v9a",        (SS11|M64), { "-m64", "-mcpu=ultrasparc", "-mvis" } },
 406         { "v9b",        (SS11|M64), { "-m64", "-mcpu=ultrasparc3", "-mvis" } },
 407         { "sparc",      SS12, { "-mcpu=v9", "-mv8plus" } },
 408         { "sparcvis",   SS12, { "-mcpu=ultrasparc", "-mvis" } },
 409         { "sparcvis2",  SS12, { "-mcpu=ultrasparc3", "-mvis" } }
 410 #endif
 411 };
 412 
 413 static int xtbl_size = sizeof (xtbl) / sizeof (xarch_table_t);
 414 




   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2011, Richard Lowe.
  24  */
  25 /*
  26  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  */
  29 
  30 /*
  31  * Wrapper for the GNU C compiler to make it accept the Sun C compiler
  32  * arguments where possible.
  33  *
  34  * Since the translation is inexact, this is something of a work-in-progress.
  35  *
  36  */
  37 
  38 /* If you modify this file, you must increment CW_VERSION */
  39 #define CW_VERSION      "1.30"
  40 
  41 /*
  42  * -#           Verbose mode
  43  * -###         Show compiler commands built by driver, no compilation
  44  * -A<name[(tokens)]>     Preprocessor predicate assertion
  45  * -B<[static|dynamic]>   Specify dynamic or static binding
  46  * -C           Prevent preprocessor from removing comments
  47  * -c           Compile only - produce .o files, suppress linking
  48  * -cg92        Alias for -xtarget=ss1000
  49  * -D<name[=token]>       Associate name with token as if by #define
  50  * -d[y|n]      dynamic [-dy] or static [-dn] option to linker
  51  * -E           Compile source through preprocessor only, output to stdout
  52  * -erroff=<t>    Suppress warnings specified by tags t(%none, %all, <tag list>)
  53  * -errtags=<a>   Display messages with tags a(no, yes)
  54  * -errwarn=<t>   Treats warnings specified by tags t(%none, %all, <tag list>)
  55  *              as errors
  56  * -fast        Optimize using a selection of options
  57  * -fd          Report old-style function definitions and declarations
  58  * -features=zla        Allow zero-length arrays
  59  * -flags       Show this summary of compiler options


 378  * to the values in x_trans[n]. The x_flags indicates what compiler
 379  * is being used and what flags have been set via the use of
 380  * "x_arg".
 381  */
 382 typedef struct xarch_table {
 383         char    *x_arg;
 384         int     x_flags;
 385         char    *x_trans[TRANS_ENTRY];
 386 } xarch_table_t;
 387 
 388 /*
 389  * The translation table for the -xarch= flag used in the Studio compilers.
 390  */
 391 static const xarch_table_t xtbl[] = {
 392 #if defined(__x86)
 393         { "generic",    SS11 },
 394         { "generic64",  (SS11|M64), { "-m64", "-mtune=opteron" } },
 395         { "amd64",      (SS11|M64), { "-m64", "-mtune=opteron" } },
 396         { "386",        SS11,   { "-march=i386" } },
 397         { "pentium_pro", SS11,  { "-march=pentiumpro" } },
 398         { "sse",        SS11, { "-msse", "-mfpmath=sse" } },
 399         { "sse2",       SS11, { "-msse2", "-mfpmath=sse" } },
 400 #elif defined(__sparc)
 401         { "generic",    (SS11|M32), { "-m32", "-mcpu=v8" } },
 402         { "generic64",  (SS11|M64), { "-m64", "-mcpu=v9" } },
 403         { "v8",         (SS11|M32), { "-m32", "-mcpu=v8", "-mno-v8plus" } },
 404         { "v8plus",     (SS11|M32), { "-m32", "-mcpu=v9", "-mv8plus" } },
 405         { "v8plusa",    (SS11|M32), { "-m32", "-mcpu=ultrasparc", "-mv8plus",
 406                         "-mvis" } },
 407         { "v8plusb",    (SS11|M32), { "-m32", "-mcpu=ultrasparc3", "-mv8plus",
 408                         "-mvis" } },
 409         { "v9",         (SS11|M64), { "-m64", "-mcpu=v9" } },
 410         { "v9a",        (SS11|M64), { "-m64", "-mcpu=ultrasparc", "-mvis" } },
 411         { "v9b",        (SS11|M64), { "-m64", "-mcpu=ultrasparc3", "-mvis" } },
 412         { "sparc",      SS12, { "-mcpu=v9", "-mv8plus" } },
 413         { "sparcvis",   SS12, { "-mcpu=ultrasparc", "-mvis" } },
 414         { "sparcvis2",  SS12, { "-mcpu=ultrasparc3", "-mvis" } }
 415 #endif
 416 };
 417 
 418 static int xtbl_size = sizeof (xtbl) / sizeof (xarch_table_t);
 419