From patchwork Mon Oct 15 21:05:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary Funck X-Patchwork-Id: 191667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id BA2EB2C007A for ; Tue, 16 Oct 2012 08:06:33 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1350939994; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version: Content-Type:Content-Disposition:User-Agent:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=auCGO8DJLBUVfAJglN9wWeIS4oI=; b=d8hiNKMzhPdCDqrd+AiRfyLcn2sjO1O2Rw7In2fauXKoa+LFLw7ThQTaDBgnsG lu+Obj7UGbB4DuD0aW20m27PvXfyRKXbUQ3thVvT6bIcQfT4By5jXmZzZfKv6Min lnfvfESsYw3rUXMNeqh9tmL33LhKES82iIQDAoHPJ3VIQ= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=bw2KqbNtJ1CvFI5graJ6rULVMXGXMlQq63FJx/zj8KkzXfHn6X/sxmqogPQfRJ EbkBLa3si8u6IviSaAM6vlFt/qYXrTon1k9TKS8p4BzY8FSyxs7NAuduY8B7eM/H O0SVVDYSICgP7o6mWJ2CtxALn+X0DR5FGfQAWSHOhhAjg=; Received: (qmail 1658 invoked by alias); 15 Oct 2012 21:06:24 -0000 Received: (qmail 1636 invoked by uid 22791); 15 Oct 2012 21:06:22 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, TW_BJ, TW_JC X-Spam-Check-By: sourceware.org Received: from mail.intrepid.com (HELO mail.intrepid.com) (74.95.8.113) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Oct 2012 21:06:05 +0000 Received: from screamer.local (screamer.local [10.10.1.2]) by mail.intrepid.com (8.14.5/8.14.5) with ESMTP id q9FL5u1l010282 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 15 Oct 2012 14:05:56 -0700 Received: from screamer.local (screamer.local [127.0.0.1]) by screamer.local (8.14.4/8.14.4) with ESMTP id q9FL5whr021583; Mon, 15 Oct 2012 14:05:58 -0700 Received: (from gary@localhost) by screamer.local (8.14.4/8.14.4/Submit) id q9FL5vIi021582; Mon, 15 Oct 2012 14:05:57 -0700 Date: Mon, 15 Oct 2012 14:05:57 -0700 From: Gary Funck To: Gcc Patches Cc: "Joseph S. Myers" Subject: RFC: Merge the GUPC branch into the GCC 4.8 trunk (patch 01 of 16) Message-ID: <20121015210557.GF18153@intrepid.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Attached, patch 01 of 16. These are configure and 'make' related changes that introduce UPC support into GCC. As noted previously, these changes build the UPC front-end as a 'cc1upc' binary in a fashion similar to Objective C. There are also specific ABI adjustments made for passing UPC pointers-to-shared (PTS) values for reasons of both efficiency and because it simplifies the handling of PTS's if they are targeted to a scalar mode (such as DImode or TImode). Some UPC-specific configuration options are added to the top-level configure.ac and gcc/configure.ac scripts. - Gary Configure and Make (patch 01 of 16) ----------------------------------- configure.ac contrib/gcc_update gcc/c-family/stub-upc.c gcc/c/Make-lang.in gcc/config/darwin.c gcc/config/darwin.h gcc/config/i386/i386.c gcc/config.in gcc/config/rs6000/rs6000.c gcc/configure.ac gcc/cp/Make-lang.in gcc/fortran/Make-lang.in gcc/java/Make-lang.in gcc/lto/Make-lang.in gcc/Makefile.in gcc/objc/Make-lang.in gcc/upc/config-lang.in gcc/upc/Makefile.in gcc/upc/Make-lang.in Makefile.def Makefile.tpl Index: configure.ac =================================================================== --- configure.ac (.../trunk) (revision 192449) +++ configure.ac (.../branches/gupc) (revision 192459) @@ -166,6 +166,7 @@ target_libraries="target-libgcc \ target-boehm-gc \ ${libgcj} \ target-libobjc \ + target-libgupc \ target-libada \ target-libgo" @@ -478,10 +479,8 @@ if test x$enable_libmudflap = x ; then esac fi -# Disable libgomp on non POSIX hosted systems. -if test x$enable_libgomp = x ; then - # Enable libgomp by default on hosted POSIX systems. - case "${target}" in +posix_based_os="yes" +case "${target}" in *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu) ;; *-*-netbsd* | *-*-freebsd* | *-*-openbsd* | *-*-dragonfly*) @@ -491,9 +490,20 @@ if test x$enable_libgomp = x ; then *-*-darwin* | *-*-aix*) ;; *) - noconfigdirs="$noconfigdirs target-libgomp" - ;; - esac + posix_based_os="no" + ;; +esac + +# Enable libgomp by default on POSIX hosted systems. +if test x$enable_libgomp = x -a $posix_based_os = "no" ; then + # Disable libgomp on non POSIX hosted systems. + noconfigdirs="$noconfigdirs target-libgomp" +fi + +# Enable libgupc by default on POSIX hosted systems. +if test x$enable_libgupc = x -a $posix_based_os = "no" ; then + # Disable libgupc on non POSIX hosted systems. + noconfigdirs="$noconfigdirs target-libgupc" fi # Disable libatomic on unsupported systems. @@ -1138,6 +1148,7 @@ if test "${build}" != "${host}" ; then GCJ_FOR_BUILD=${GCJ_FOR_BUILD-gcj} GFORTRAN_FOR_BUILD=${GFORTRAN_FOR_BUILD-gfortran} GOC_FOR_BUILD=${GOC_FOR_BUILD-gccgo} + GUPC_FOR_BUILD=${GUPC_FOR_BUILD-gupc} DLLTOOL_FOR_BUILD=${DLLTOOL_FOR_BUILD-dlltool} LD_FOR_BUILD=${LD_FOR_BUILD-ld} NM_FOR_BUILD=${NM_FOR_BUILD-nm} @@ -1152,6 +1163,7 @@ else GCJ_FOR_BUILD="\$(GCJ)" GFORTRAN_FOR_BUILD="\$(GFORTRAN)" GOC_FOR_BUILD="\$(GOC)" + GUPC_FOR_BUILD="\$(GUPC)" DLLTOOL_FOR_BUILD="\$(DLLTOOL)" LD_FOR_BUILD="\$(LD)" NM_FOR_BUILD="\$(NM)" @@ -1957,6 +1969,28 @@ case ,${enable_languages},:${enable_objc ;; esac +AC_ARG_WITH([upc-pts], +AS_HELP_STRING( +[[--with-upc-pts=[{struct,packed}]]], + [choose the representation of a UPC pointer-to-shared]), +[ + case ,${enable_languages}, in + *,upc,) + case "$withval" in + struct|packed) + true + ;; + *) + AC_MSG_ERROR([$withval is an invalid option to --with-upc-pts]) + ;; + esac + ;; + *) + AC_MSG_ERROR([--with-upc-pts supplied, but UPC language not enabled]) + ;; + esac +],[]) + # Disable libitm if we're not building C++ case ,${enable_languages}, in *,c++,*) ;; @@ -2901,6 +2935,48 @@ case "${target}" in ;; esac +# UPC linker script check +AC_MSG_CHECKING([for UPC link script support]) +AC_ARG_ENABLE(upc-link-script, +AS_HELP_STRING( + [--enable-upc-link-script], + [enable UPC's use of a custom linker script; + this will define the UPC shared section as a no load section on + targets where this feature is supported (requires GNU LD)]), +[ + case $enableval in + yes | no) ;; + *) + AC_MSG_ERROR([--enable-upc-link-script accepts only yes or no.]) + ;; + esac +], +[ + if test x${use_gnu_ld} != xno ; then + case "$target" in + # disable linker script for Apple Mac OS X + *-*-darwin*) + enable_upc_link_script=no + ;; + *) + enable_upc_link_script=yes + ;; + esac + else + enable_upc_link_script=no + fi + if test "$enable_upc_link_script" = yes; then + target_configargs="${target_configargs} --enable-upc-link-script" + host_configargs="${host_configargs} --enable-upc-link-script" + fi +]) +if test "$enable_upc_link_script" = yes; then + AC_MSG_RESULT([yes]); +else + AC_MSG_RESULT([no]); +fi + + # Makefile fragments. for frag in host_makefile_frag target_makefile_frag alphaieee_frag ospace_frag; do @@ -2947,6 +3023,7 @@ AC_SUBST(DLLTOOL_FOR_BUILD) AC_SUBST(GCJ_FOR_BUILD) AC_SUBST(GFORTRAN_FOR_BUILD) AC_SUBST(GOC_FOR_BUILD) +AC_SUBST(GUPC_FOR_BUILD) AC_SUBST(LDFLAGS_FOR_BUILD) AC_SUBST(LD_FOR_BUILD) AC_SUBST(NM_FOR_BUILD) @@ -3057,6 +3134,7 @@ NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TA NCN_STRICT_CHECK_TARGET_TOOLS(GCJ_FOR_TARGET, gcj) NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran) NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo) +NCN_STRICT_CHECK_TARGET_TOOLS(GUPC_FOR_TARGET, gupc) ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar) ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as) @@ -3091,6 +3169,8 @@ GCC_TARGET_TOOL(gfortran, GFORTRAN_FOR_T [gcc/gfortran -B$$r/$(HOST_SUBDIR)/gcc/], fortran) GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC, [gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go) +GCC_TARGET_TOOL(gupc, GUPC_FOR_TARGET, GUPC, + [gcc/gupc -B$$r/$(HOST_SUBDIR)/gcc/], upc) GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new]) GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO) GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new]) Index: contrib/gcc_update =================================================================== --- contrib/gcc_update (.../trunk) (revision 192449) +++ contrib/gcc_update (.../branches/gupc) (revision 192459) @@ -139,6 +139,11 @@ libgomp/Makefile.in: libgomp/Makefile.am libgomp/testsuite/Makefile.in: libgomp/Makefile.am libgomp/aclocal.m4 libgomp/configure: libgomp/configure.ac libgomp/aclocal.m4 libgomp/config.h.in: libgomp/configure.ac libgomp/aclocal.m4 +libgupc/aclocal.m4: libgupc/configure.ac libgupc/acinclude.m4 +libgupc/config.h.in: libgupc/configure.ac +libgupc/configure: libgupc/configure.ac libgupc/aclocal.m4 libgupc/acinclude.m4 +libgupc/Makefile.in: libgupc/Makefile.am libgupc/aclocal.m4 +libgupc/testsuite/Makefile.in: libgupc/Makefile.am libgupc/aclocal.m4 libitm/aclocal.m4: libitm/configure.ac libitm/acinclude.m4 libitm/Makefile.in: libitm/Makefile.am libitm/aclocal.m4 libitm/testsuite/Makefile.in: libitm/testsuite/Makefile.am libitm/aclocal.m4 Property changes on: . ___________________________________________________________________ Added: svn:mergeinfo Merged /trunk:r157128-184995,184997-192449 Index: gcc/c-family/stub-upc.c =================================================================== --- gcc/c-family/stub-upc.c (.../trunk) (revision 0) +++ gcc/c-family/stub-upc.c (.../branches/gupc) (revision 192459) @@ -0,0 +1,211 @@ +/* Stub functions for UPC routines + that are called from within the C front end. + respectively. + Copyright (C) 1991, 1995, 1997, 1998, + 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to the Free +Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tree.h" +#include "c-common.h" +#include "c-upc.h" + +int compiling_upc; +int flag_upc; +int use_upc_dwarf2_extensions; + +int +count_upc_threads_refs (tree expr ATTRIBUTE_UNUSED) +{ + return 0; +} + +int +is_multiple_of_upc_threads (tree expr ATTRIBUTE_UNUSED) +{ + return 0; +} + +void +set_upc_threads_refs_to_one (tree *expr ATTRIBUTE_UNUSED) +{ + return; +} + +tree +upc_get_block_factor (tree type ATTRIBUTE_UNUSED) +{ + return 0; +} + +tree +upc_grok_layout_qualifier ( + location_t loc ATTRIBUTE_UNUSED, + const enum tree_code decl_kind ATTRIBUTE_UNUSED, + tree type ATTRIBUTE_UNUSED, + tree elem_block_factor ATTRIBUTE_UNUSED, + tree layout_specifier ATTRIBUTE_UNUSED) +{ + return 0; +} + +void +upc_check_decl (tree ARG_UNUSED (decl)) +{ +} + +int +upc_check_decl_init (tree ARG_UNUSED (decl), + tree ARG_UNUSED (init)) +{ + return 0; +} + +void +upc_decl_init (tree ARG_UNUSED (decl), + tree ARG_UNUSED (init)) +{ +} + + +void +upc_set_decl_section (tree decl ATTRIBUTE_UNUSED) +{ +} + +int +upc_is_null_pts_p (tree p ATTRIBUTE_UNUSED) +{ + return 0; +} + +tree +upc_pts_increment ( + location_t location ATTRIBUTE_UNUSED, + enum tree_code code ATTRIBUTE_UNUSED, + tree arg ATTRIBUTE_UNUSED) +{ + return 0; +} + +tree +upc_pts_int_sum ( + location_t location ATTRIBUTE_UNUSED, + enum tree_code resultcode ATTRIBUTE_UNUSED, + tree ptrop ATTRIBUTE_UNUSED, + tree intop ATTRIBUTE_UNUSED) +{ + return 0; +} + +tree +upc_pts_diff ( + tree op0 ATTRIBUTE_UNUSED, + tree op1 ATTRIBUTE_UNUSED) +{ + return 0; +} + + +tree +upc_affinity_test (location_t ARG_UNUSED(start_locus), + tree ARG_UNUSED(affinity)) +{ + return 0; +} + +tree +upc_rts_forall_depth_var (void) +{ + return 0; +} + +tree +upc_build_sync_stmt (location_t ARG_UNUSED(loc), + tree ARG_UNUSED (op), tree ARG_UNUSED (exp)) +{ + return NULL_TREE; +} + +void +upc_block_factor_insert (tree ARG_UNUSED(type), + tree ARG_UNUSED(block_factor)) +{ +} + +tree +upc_block_factor_lookup (tree ARG_UNUSED(type)) +{ + return NULL_TREE; +} + +tree +upc_blocksizeof (location_t ARG_UNUSED(loc), tree ARG_UNUSED (op)) +{ + return NULL_TREE; +} + +tree +upc_build_pointer_type (tree ARG_UNUSED (op)) +{ + return NULL_TREE; +} + +tree +upc_elemsizeof (location_t ARG_UNUSED(loc), tree ARG_UNUSED (op)) +{ + return NULL_TREE; +} + +tree +upc_localsizeof (location_t ARG_UNUSED(loc), tree ARG_UNUSED (op)) +{ + return NULL_TREE; +} + +tree +upc_num_threads(void) +{ + return NULL_TREE; +} + +int +upc_diagnose_deprecated_stmt (location_t ARG_UNUSED (loc), + tree ARG_UNUSED (id)) +{ + return 0; +} + +void +upc_cpp_builtins (cpp_reader * ARG_UNUSED(pfile)) +{ +} + +tree +upc_instrument_forall (location_t ARG_UNUSED(loc), int ARG_UNUSED(start)) +{ + return 0; +} + +void +upc_write_global_declarations (void) +{ +} Index: gcc/c/Make-lang.in =================================================================== --- gcc/c/Make-lang.in (.../trunk) (revision 192449) +++ gcc/c/Make-lang.in (.../branches/gupc) (revision 192459) @@ -60,8 +60,10 @@ C_AND_OBJC_OBJS = attribs.o c/c-errors.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o \ $(C_COMMON_OBJS) $(C_TARGET_OBJS) +C_STUB_OBJS = c-family/stub-objc.o c-family/stub-upc.o + # Language-specific object files for C. -C_OBJS = c/c-lang.o c-family/stub-objc.o $(C_AND_OBJC_OBJS) +C_OBJS = c/c-lang.o $(C_STUB_OBJS) $(C_AND_OBJC_OBJS) c_OBJS = $(C_OBJS) cc1-checksum.o c/gccspec.o # Use strict warnings for this front end. Index: gcc/config/darwin.c =================================================================== --- gcc/config/darwin.c (.../trunk) (revision 192449) +++ gcc/config/darwin.c (.../branches/gupc) (revision 192459) @@ -3039,6 +3039,7 @@ darwin_override_options (void) } if (flag_var_tracking + && optimize >= 1 && generating_for_darwin_version >= 9 && (flag_gtoggle ? (debug_info_level == DINFO_LEVEL_NONE) : (debug_info_level >= DINFO_LEVEL_NORMAL)) Index: gcc/config/darwin.h =================================================================== --- gcc/config/darwin.h (.../trunk) (revision 192449) +++ gcc/config/darwin.h (.../branches/gupc) (revision 192459) @@ -177,14 +177,17 @@ extern GTY(()) int darwin_ms_struct; %{e*} %{r} \ %{o*}%{!o:-o a.out} \ %{!nostdlib:%{!nostartfiles:%S}} \ + %{!nostdlib:%{!nostartfiles:%{fupc-link:%:include(upc-crtbegin.spec)%(upc_crtbegin)}}}\ %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \ %{fopenmp|ftree-parallelize-loops=*: \ %{static|static-libgcc|static-libstdc++|static-libgfortran: libgomp.a%s; : -lgomp } } \ %{fgnu-tm: \ %{static|static-libgcc|static-libstdc++|static-libgfortran: libitm.a%s; : -litm } } \ + %{fupc-link:%:include(libgupc.spec)%(link_upc)} \ %{!nostdlib:%{!nodefaultlibs:\ %(link_ssp) %(link_gcc_c_sequence)\ }}\ + %{!nostdlib:%{!nostartfiles:%{fupc-link:%:include(upc-crtend.spec)%(upc_crtend)}}}\ %{!nostdlib:%{!nostartfiles:%E}} %{T*} %{F*} }}}}}}}" #define DSYMUTIL "\ndsymutil" @@ -917,6 +920,17 @@ extern void darwin_driver_init (unsigned #undef SUPPORTS_INIT_PRIORITY #define SUPPORTS_INIT_PRIORITY 0 +/* UPC for darwin */ + +/* Define main program rename */ +#define UPC_MAIN_NAME "_upc_main" + +/* UPC section names */ +#define UPC_SHARED_SECTION_NAME "__DATA,upc_shared" +#define UPC_PGM_INFO_SECTION_NAME "__DATA,upc_pgm_info" +#define UPC_INIT_SECTION_NAME "__TEXT,upc_init" +#define UPC_INIT_ARRAY_SECTION_NAME "__DATA,upc_init_array" + /* When building cross-compilers (and native crosses) we shall default to providing an osx-version-min of this unless overridden by the User. */ #define DEF_MIN_OSX_VERSION "10.4" Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c (.../trunk) (revision 192449) +++ gcc/config/i386/i386.c (.../branches/gupc) (revision 192459) @@ -6135,6 +6135,15 @@ classify_argument (enum machine_mode mod && targetm.calls.must_pass_in_stack (mode, type)) return 0; + /* Special case check for pointer to shared, on 64-bit target. */ + if (TARGET_64BIT && mode == TImode + && type && TREE_CODE (type) == POINTER_TYPE + && upc_shared_type_p (TREE_TYPE (type))) + { + classes[0] = classes[1] = X86_64_INTEGER_CLASS; + return 2; + } + if (type && AGGREGATE_TYPE_P (type)) { int i; @@ -7533,7 +7542,8 @@ function_value_64 (enum machine_mode ori return gen_rtx_REG (mode, regno); } - else if (POINTER_TYPE_P (valtype)) + else if (POINTER_TYPE_P (valtype) + && !upc_shared_type_p (TREE_TYPE (valtype))) { /* Pointers are always returned in word_mode. */ mode = word_mode; @@ -7617,6 +7627,11 @@ ix86_promote_function_mode (const_tree t { if (type != NULL_TREE && POINTER_TYPE_P (type)) { + if (upc_shared_type_p (TREE_TYPE (type))) + { + *punsignedp = 1; + return TYPE_MODE (upc_pts_rep_type_node); + } *punsignedp = POINTERS_EXTEND_UNSIGNED; return word_mode; } Index: gcc/config.in =================================================================== --- gcc/config.in (.../trunk) (revision 192449) +++ gcc/config.in (.../branches/gupc) (revision 192459) @@ -1539,6 +1539,32 @@ #endif +/* Define to 1 if UPC link script is supported. */ +#ifndef USED_FOR_TARGET +#undef HAVE_UPC_LINK_SCRIPT +#endif + + +/* Define to 1 if UPC pointer-to-shared representation is a packed 64 bit + word. */ +#ifndef USED_FOR_TARGET +#undef HAVE_UPC_PTS_PACKED_REP +#endif + + +/* Define to 1 if UPC pointer-to-shared representation is a structure. */ +#ifndef USED_FOR_TARGET +#undef HAVE_UPC_PTS_STRUCT_REP +#endif + + +/* Define to 1 if the 'vaddr' field is the first field in the UPC + pointer-to-shared representation. */ +#ifndef USED_FOR_TARGET +#undef HAVE_UPC_PTS_VADDR_FIRST +#endif + + /* Define if valgrind's valgrind/memcheck.h header is installed. */ #ifndef USED_FOR_TARGET #undef HAVE_VALGRIND_MEMCHECK_H @@ -1792,6 +1818,27 @@ #endif +/* For packed UPC pointers-to-shared, the size of the phase field (in bits). + */ +#ifndef USED_FOR_TARGET +#undef UPC_PTS_PHASE_SIZE +#endif + + +/* For packed UPC pointers-to-shared, the size of the thread field (in bits). + */ +#ifndef USED_FOR_TARGET +#undef UPC_PTS_THREAD_SIZE +#endif + + +/* For packed UPC pointers-to-shared, the size of the address field (in bits). + */ +#ifndef USED_FOR_TARGET +#undef UPC_PTS_VADDR_SIZE +#endif + + /* Define if your assembler mis-optimizes .eh_frame data. */ #ifndef USED_FOR_TARGET #undef USE_AS_TRADITIONAL_FORMAT Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (.../trunk) (revision 192449) +++ gcc/config/rs6000/rs6000.c (.../branches/gupc) (revision 192459) @@ -7407,6 +7407,11 @@ rs6000_return_in_memory (const_tree type /* Otherwise fall through to more conventional ABI rules. */ } +#if HAVE_UPC_PTS_STRUCT_REP + if (POINTER_TYPE_P (type) && upc_shared_type_p (TREE_TYPE (type))) + return true; +#endif + if (AGGREGATE_TYPE_P (type) && (aix_struct_return || (unsigned HOST_WIDE_INT) int_size_in_bytes (type) > 8)) @@ -8800,6 +8805,17 @@ rs6000_pass_by_reference (cumulative_arg if (!type) return 0; +#if HAVE_UPC_PTS_STRUCT_REP + if (DEFAULT_ABI == ABI_V4 && POINTER_TYPE_P (type) + && upc_shared_type_p (TREE_TYPE (type))) + { + if (TARGET_DEBUG_ARG) + fprintf (stderr, + "function_arg_pass_by_reference: V4 UPC ptr to shared\n"); + return 1; + } +#endif + if (DEFAULT_ABI == ABI_V4 && AGGREGATE_TYPE_P (type)) { if (TARGET_DEBUG_ARG) @@ -21459,11 +21475,12 @@ rs6000_output_function_epilogue (FILE *f use language_string. C is 0. Fortran is 1. Pascal is 2. Ada is 3. C++ is 9. Java is 13. Objective-C is 14. Objective-C++ isn't assigned - a number, so for now use 9. LTO and Go aren't assigned numbers + a number, so for now use 9. LTO, Go, and UPC aren't assigned numbers either, so for now use 0. */ if (! strcmp (language_string, "GNU C") || ! strcmp (language_string, "GNU GIMPLE") - || ! strcmp (language_string, "GNU Go")) + || ! strcmp (language_string, "GNU Go") + || ! strcmp (language_string, "GNU UPC")) i = 0; else if (! strcmp (language_string, "GNU F77") || ! strcmp (language_string, "GNU Fortran")) @@ -27104,7 +27121,7 @@ rs6000_function_value (const_tree valtyp mode = TYPE_MODE (valtype); if ((INTEGRAL_TYPE_P (valtype) && GET_MODE_BITSIZE (mode) < BITS_PER_WORD) - || POINTER_TYPE_P (valtype)) + || (POINTER_TYPE_P (valtype) && !upc_shared_type_p (TREE_TYPE (valtype)))) mode = TARGET_32BIT ? SImode : DImode; if (DECIMAL_FLOAT_MODE_P (mode) && TARGET_HARD_FLOAT && TARGET_FPRS) Index: gcc/configure.ac =================================================================== --- gcc/configure.ac (.../trunk) (revision 192449) +++ gcc/configure.ac (.../branches/gupc) (revision 192459) @@ -691,6 +691,182 @@ else fi, objc_boehm_gc='') +case ,${enable_languages}, in + *,upc,) lang_upc_enabled="yes" ;; + *) ;; +esac + +AC_ARG_WITH([upc-pts], +AS_HELP_STRING( + [--with-upc-pts={struct,packed}], + [choose the representation of a UPC pointer-to-shared]), +[ +if test x"$lang_upc_enabled" = x"yes" ; then + case "$withval" in + packed|struct) upc_pts_rep="$withval" ;; + *) AC_MSG_ERROR([$withval is an invalid option to --with-upc-pts]) + ;; + esac +else + AC_MSG_WARN([--with-upc-pts is allowed only when UPC +support has been enabled]) +fi +], +[ +if test x"$lang_upc_enabled" = x"yes" ; then + upc_pts_rep="packed" +fi +]) + + +# Perl is required for checking pts representation +AC_CHECK_PROG(PERL, perl, perl) + +AC_ARG_WITH([upc-pts-vaddr-order], +AS_HELP_STRING( +[--with-upc-pts-vaddr-order={last,first}], +[choose position of the address field in UPC pointer-to-shared representation]), +[ +if test x"$lang_upc_enabled" = x"yes" ; then + upc_vaddr_order="$withval" + case "$upc_vaddr_order" in + first|last) ;; + *) AC_MSG_ERROR( + [$withval is an invalid option to --with-upc-pts-vaddr-order]) ;; + esac +else + AC_MSG_WARN([--upc-pts-vaddr-order is allowed only when UPC +support has been enabled]) +fi +], +[ +if test x"$lang_upc_enabled" = x"yes" ; then + # Default UPC PTS vaddr order to "first" + upc_vaddr_order="first" +fi +]) + +AC_ARG_WITH([upc-packed-bits],, +[ + AC_MSG_WARN([--with-upc-packed-bits is deprecated. +Use --with-upc-pts-packed-bits instead.]) + with_upc_pts_packed_bits="$withval"; +], +[]) + +AC_ARG_WITH([upc-pts-packed-bits], +AS_HELP_STRING( +[--with-upc-pts-packed-bits=phase,thread,vaddr], +[choose bit distribution in packed UPC pointer-to-shared representation]), +[ +if test x"$lang_upc_enabled" = x"yes" ; then + if test x"$upc_pts_rep" = x"packed"; then + UPC_PTS_PHASE_SIZE=`echo "$withval" | $PERL -ne 'm/^(\d+),(\d+),(\d+)$/; + print $1 if ($1+$2+$3 == 64) && $1>=1;'` + UPC_PTS_THREAD_SIZE=`echo "$withval" | $PERL -ne 'm/^(\d+),(\d+),(\d+)$/; + print $2 if ($1+$2+$3 == 64) && $2>=1;'` + UPC_PTS_VADDR_SIZE=`echo "$withval" | $PERL -ne 'm/^(\d+),(\d+),(\d+)$/; + print $3 if ($1+$2+$3 == 64) && $3>=20;'` + if test -z "$UPC_PTS_PHASE_SIZE" \ + || test -z "$UPC_PTS_THREAD_SIZE" \ + || test -z "$UPC_PTS_VADDR_SIZE" ; then + AC_MSG_ERROR([--with-upc-pts-packed-bits=phase,thread,vaddr requires + phase+thread+vaddr=64 and phase >= 1 and thread >= 1 and vaddr >= 20]) + fi + else + AC_MSG_ERROR([--with-upc-pts-packed-bits is only supported for +the packed UPC pointer-to-shared representation]) + fi +else + AC_MSG_WARN([--with-upc-pts-packed-bits is allowed only when UPC +support has been enabled]) +fi +], +[ +if test x"$lang_upc_enabled" = x"yes" ; then + # GNU UPC packed pointer representation defaults. + case "$target" in + i[356]86* ) + UPC_PTS_PHASE_SIZE=20 + UPC_PTS_THREAD_SIZE=12 + UPC_PTS_VADDR_SIZE=32 + ;; + * ) + UPC_PTS_PHASE_SIZE=20 + UPC_PTS_THREAD_SIZE=10 + UPC_PTS_VADDR_SIZE=34 + esac +fi +]) + +AC_ARG_ENABLE(upc-link-script, +AS_HELP_STRING( + [--enable-upc-link-script], + [enable UPC's use of a custom linker script; + this will define the UPC shared section as a no load section on + targets where this feature is supported (requires GNU LD)]), +[ +if test x"$lang_upc_enabled" = x"yes" ; then + case $enableval in + yes | no) ;; + *) + AC_MSG_ERROR([--enable-upc-link-script accepts only yes or no.]) + esac +else + AC_MSG_WARN([--enable-upc-link-script is allowed only when UPC +support has been enabled]) +fi +], +[ +if test x"$lang_upc_enabled" = x"yes" ; then + enable_upc_link_script=no +fi +]) + +if test x"$lang_upc_enabled" = x"yes" ; then + AC_MSG_CHECKING([for UPC pointer-to-shared representation]) + AC_MSG_RESULT([$upc_pts_rep]) + case "$upc_pts_rep" in + packed) + AC_DEFINE(HAVE_UPC_PTS_PACKED_REP,[1], + [Define to 1 if UPC pointer-to-shared representation + is a packed 64 bit word.]) + ;; + struct) + AC_DEFINE(HAVE_UPC_PTS_STRUCT_REP,[1], + [Define to 1 if UPC pointer-to-shared representation + is a structure.]) + ;; + esac + AC_MSG_CHECKING([for UPC pointer-to-shared address field position]) + AC_MSG_RESULT([$upc_vaddr_order]) + if test x"$upc_vaddr_order" = x"first"; then + AC_DEFINE(HAVE_UPC_PTS_VADDR_FIRST,[1], + [Define to 1 if the 'vaddr' field is the first field +in the UPC pointer-to-shared representation.]) + fi + if test x"$upc_pts_rep" = x"packed"; then + AC_DEFINE_UNQUOTED(UPC_PTS_PHASE_SIZE,$UPC_PTS_PHASE_SIZE, + [For packed UPC pointers-to-shared, + the size of the phase field (in bits).]) + AC_DEFINE_UNQUOTED(UPC_PTS_THREAD_SIZE,$UPC_PTS_THREAD_SIZE, + [For packed UPC pointers-to-shared, + the size of the thread field (in bits).]) + AC_DEFINE_UNQUOTED(UPC_PTS_VADDR_SIZE,$UPC_PTS_VADDR_SIZE, + [For packed UPC pointers-to-shared, + the size of the address field (in bits).]) + AC_MSG_CHECKING([for packed UPC pointer-to-shared layout]) + AC_MSG_RESULT( + ["phase=${UPC_PTS_PHASE_SIZE},thread=${UPC_PTS_THREAD_SIZE}, +vaddr=${UPC_PTS_VADDR_SIZE}"]) + fi + AC_MSG_CHECKING([for UPC link script support]) + AC_MSG_RESULT($enable_upc_link_script) + if test "$enable_upc_link_script" = yes; then + AC_DEFINE(HAVE_UPC_LINK_SCRIPT, 1, [Define to 1 if UPC link script is supported.]) + fi +fi + AC_ARG_WITH(dwarf2, [AS_HELP_STRING([--with-dwarf2], [force the default debug format to be DWARF 2])], dwarf2="$with_dwarf2", @@ -787,7 +963,7 @@ AC_ARG_WITH(specs, AC_SUBST(CONFIGURE_SPECS) ACX_PKGVERSION([GCC]) -ACX_BUGURL([http://gcc.gnu.org/bugs.html]) +ACX_BUGURL([http://gccupc.org/bugs]) # Sanity check enable_languages in case someone does not run the toplevel # configure # script. Index: gcc/cp/Make-lang.in =================================================================== --- gcc/cp/Make-lang.in (.../trunk) (revision 192449) +++ gcc/cp/Make-lang.in (.../branches/gupc) (revision 192459) @@ -85,7 +85,7 @@ CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl. cp/cp-gimplify.o $(CXX_C_OBJS) # Language-specific object files for C++. -CXX_OBJS = cp/cp-lang.o c-family/stub-objc.o $(CXX_AND_OBJCXX_OBJS) +CXX_OBJS = cp/cp-lang.o $(C_STUB_OBJS) $(CXX_AND_OBJCXX_OBJS) c++_OBJS = $(CXX_OBJS) cc1plus-checksum.o cp/g++spec.o Index: gcc/fortran/Make-lang.in =================================================================== --- gcc/fortran/Make-lang.in (.../trunk) (revision 192449) +++ gcc/fortran/Make-lang.in (.../branches/gupc) (revision 192459) @@ -99,9 +99,10 @@ gfortran-cross$(exeext): gfortran$(exeex # The compiler itself is called f951. f951$(exeext): $(F95_OBJS) \ - $(BACKEND) $(LIBDEPS) attribs.o + $(C_STUB_OBJS) $(BACKEND) $(LIBDEPS) attribs.o +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ - $(F95_OBJS) $(BACKEND) $(LIBS) attribs.o $(BACKENDLIBS) + $(F95_OBJS) $(C_STUB_OBJS) \ + $(BACKEND) $(LIBS) attribs.o $(BACKENDLIBS) gt-fortran-trans.h : s-gtype; @true # Index: gcc/java/Make-lang.in =================================================================== --- gcc/java/Make-lang.in (.../trunk) (revision 192449) +++ gcc/java/Make-lang.in (.../branches/gupc) (revision 192459) @@ -98,10 +98,12 @@ java-warn = $(STRICT_WARN) # String length warnings jvspec.o-warn = -Wno-error -jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS) attribs.o +jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(C_STUB_OBJS) \ + $(LIBDEPS) attribs.o rm -f $@ +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ - $(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS) attribs.o $(BACKENDLIBS) + $(JAVA_OBJS) $(C_STUB_OBJS) \ + $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS) attribs.o $(BACKENDLIBS) jcf-dump$(exeext): $(JCFDUMP_OBJS) $(LIBDEPS) rm -f $@ Index: gcc/lto/Make-lang.in =================================================================== --- gcc/lto/Make-lang.in (.../trunk) (revision 192449) +++ gcc/lto/Make-lang.in (.../branches/gupc) (revision 192459) @@ -73,7 +73,7 @@ lto-warn = $(STRICT_WARN) $(LTO_EXE): $(LTO_OBJS) $(BACKEND) $(LIBDEPS) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ - $(LTO_OBJS) $(BACKEND) $(BACKENDLIBS) $(LIBS) + $(LTO_OBJS) $(C_STUB_OBJS) $(BACKEND) $(BACKENDLIBS) $(LIBS) # Dependencies lto/lto-lang.o: lto/lto-lang.c $(CONFIG_H) coretypes.h debug.h \ Index: gcc/Makefile.in =================================================================== --- gcc/Makefile.in (.../trunk) (revision 192449) +++ gcc/Makefile.in (.../branches/gupc) (revision 192459) @@ -1975,6 +1975,9 @@ c-family/c-ada-spec.o : c-family/c-ada-s c-family/stub-objc.o : c-family/stub-objc.c $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_H) $(C_COMMON_H) c-family/c-objc.h +c-family/stub-upc.o : c-family/stub-upc.c $(CONFIG_H) $(SYSTEM_H) \ + coretypes.h $(TREE_H) $(C_COMMON_H) c-family/c-upc.h + default-c.o: config/default-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(C_TARGET_H) $(C_TARGET_DEF_H) $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \ Index: gcc/objc/Make-lang.in =================================================================== --- gcc/objc/Make-lang.in (.../trunk) (revision 192449) +++ gcc/objc/Make-lang.in (.../branches/gupc) (revision 192459) @@ -68,9 +68,12 @@ cc1obj-checksum.c : build/genchecksum$(b cc1obj-checksum.o : cc1obj-checksum.c $(CONFIG_H) $(SYSTEM_H) -cc1obj$(exeext): $(OBJC_OBJS) $(C_AND_OBJC_OBJS) cc1obj-checksum.o $(BACKEND) $(LIBDEPS) +cc1obj$(exeext): $(OBJC_OBJS) $(C_AND_OBJC_OBJS) \ + c-family/stub-upc.o cc1obj-checksum.o \ + $(BACKEND) $(LIBDEPS) +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ - $(OBJC_OBJS) $(C_AND_OBJC_OBJS) cc1obj-checksum.o \ + $(OBJC_OBJS) $(C_AND_OBJC_OBJS) \ + c-family/stub-upc.o cc1obj-checksum.o \ $(BACKEND) $(LIBS) $(BACKENDLIBS) # Objective C language specific files. Index: gcc/upc/config-lang.in =================================================================== --- gcc/upc/config-lang.in (.../trunk) (revision 0) +++ gcc/upc/config-lang.in (.../branches/gupc) (revision 192459) @@ -0,0 +1,48 @@ +# upc/config-lang.in: GNU UPC runtime library top-level configure fragment + +# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, +# 2009, 2010, 2011 +# Free Software Foundation, Inc. +# Contributed by Gary Funck +# and Nenad Vukicevic . +# Based on original implementation +# by Jesse M. Draper +# and William W. Carlson . +# Derived from objc/config-lang.in + +# This file is part of GCC. + +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. + +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# Configure looks for the existence of this file to auto-config each language. +# We define several parameters used by configure: +# +# language - name of language as it would appear in $(LANGUAGES) +# compilers - value to add to $(COMPILERS) +# stagestuff - files to add to $(STAGESTUFF) + +language="upc" + +build_by_default="no" + +compilers="cc1upc\$(exeext)" + +stagestuff="cc1upc\$(exeext)" + +target_libs="target-libgupc" + +gtfiles="\$(srcdir)/c/c-lang.h \$(srcdir)/c/c-tree.h \$(srcdir)/c-family/c-common.h \$(srcdir)/c-family/c-pragma.h \$(srcdir)/c-family/c-upc.h \$(srcdir)/upc/upc-act.h \$(srcdir)/upc/upc-genericize.h \$(srcdir)/c/c-decl.c \$(srcdir)/c-family/c-common.c \$(srcdir)/c-family/c-cppbuiltin.c \$(srcdir)/c-family/c-pragma.c \$(srcdir)/c/c-objc-common.c \$(srcdir)/c/c-parser.c \$(srcdir)/upc/upc-act.c \$(srcdir)/upc/upc-genericize.c" + +extra_parts="${extra_parts} ${upc_extra_parts}" Index: gcc/upc/Makefile.in =================================================================== --- gcc/upc/Makefile.in (.../trunk) (revision 0) +++ gcc/upc/Makefile.in (.../branches/gupc) (revision 192459) @@ -0,0 +1,82 @@ +# Makefile.in: GNU UPC front-end Makefile + +# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, +# 2010, 2011 +# Free Software Foundation, Inc. +# Contributed by Gary Funck +# and Nenad Vukicevic . +# Based on original implementation +# by Jesse M. Draper +# and William W. Carlson . +# Derived from objc/Makefile.in + +# This file is part of GCC. + +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. + +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# The Makefile built from this file lives in the upc language subdirectory. +# Its purpose is to provide support for: +# +# 1. recursion where necessary, and only then (building .o's), and +# 2. building and debugging cc1upcc from the language subdirectory. +# +# The parent Makefile handles all other chores, with help from the language +# Makefile fragment. +# +# The targets for external use are `all' and `mostlyclean'. + +SHELL=/bin/sh + +OPTIMIZE= -O + +srcdir = . +VPATH = $(srcdir) + +AR = ar +AR_FLAGS = rc + +# Define this as & to perform parallel make on a Sequent. +# Note that this has some bugs, and it seems currently necessary +# to compile all the gen* files first by hand to avoid erroneous results. +P = + +# Definition of `all' is here so that new rules inserted by sed +# do not specify the default target. +all: all.indirect + +# sed inserts variable overrides after the following line. +####target overrides +####host overrides +####cross overrides +####build overrides +# + +# Now figure out from those variables how to compile and link. +all.indirect: Makefile frontend + +frontend: + cd ..; $(MAKE) cc1upc$(exeext) + +Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure + cd ..; $(SHELL) config.status + +mostlyclean: + -rm -f *.o xforward fflags +clean: mostlyclean +distclean: mostlyclean +extraclean: mostlyclean + +# For Sun VPATH. + Index: gcc/upc/Make-lang.in =================================================================== --- gcc/upc/Make-lang.in (.../trunk) (revision 0) +++ gcc/upc/Make-lang.in (.../branches/gupc) (revision 192459) @@ -0,0 +1,298 @@ +# Top level -*- makefile -*- fragment for GNU UPC + +# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, +# 2010, 2011, 2012 +# Free Software Foundation, Inc. +# Contributed by Gary Funck +# and Nenad Vukicevic . +# Based on original implementation +# by Jesse M. Draper +# and William W. Carlson . +# Derived from objc/Make-lang.in + +# This file is part of GCC. + +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. + +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# This file provides the language dependent support in the main Makefile. +# Each language makefile fragment must provide the following targets: +# +# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap, +# foo.install-normal, foo.install-common, foo.install-man, +# foo.uninstall, +# foo.mostlyclean, foo.clean, foo.distclean, +# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4 +# +# where `foo' is the name of the language. +# +# It should also provide rules for: +# +# - making any compiler driver (eg: upc) +# - the compiler proper (eg: cc1upc) +# - define the names for selecting the language in LANGUAGES. + +UPC_EXE = cc1upc$(exeext) gupc$(exeext) + +# Installation name. + +GUPC_INSTALL_NAME := $(shell echo gupc|sed '$(program_transform_name)') +UPC_INSTALL_NAME := $(shell echo upc|sed '$(program_transform_name)') +GUPC_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gupc|sed '$(program_transform_name)') + +# Define the names for selecting UPC in LANGUAGES. +UPC Upc upc: $(UPC_EXE) + +# Tell GNU make to ignore these if they exist. +.PHONY: UPC Upc upc + +# Use maximal warnings for this front end. +upc-warn = $(STRICT_WARN) + +# UPC PTS representation-dependent support. +# (Set by the --with-upc-pts={struct,packed} configure switch.) +UPC_PTS_C = upc-pts-packed.c upc-pts-struct.c +UPC_PTS_OBJ = upc/upc-pts-packed.o upc/upc-pts-struct.o + +# Language-specific object files for UPC. +UPC_OBJS = c-family/stub-objc.o upc/upc-act.o \ + upc/upc-genericize.o upc/upc-lang.o \ + upc/upc-gasp.o $(UPC_PTS_OBJ) + +cc1upc-checksum.c : build/genchecksum$(build_exeext) checksum-options \ + $(UPC_OBJS) $(C_AND_OBJC_OBJS) $(BACKEND) $(LIBDEPS) + build/genchecksum$(build_exeext) $(UPC_OBJS) $(C_AND_OBJC_OBJS) \ + $(BACKEND) $(LIBDEPS) checksum-options > cc1upc-checksum.c.tmp && \ + $(srcdir)/../move-if-change cc1upc-checksum.c.tmp cc1upc-checksum.c + +cc1upc-checksum.o : cc1upc-checksum.c $(CONFIG_H) $(SYSTEM_H) + +cc1upc$(exeext): $(UPC_OBJS) $(C_AND_OBJC_OBJS) cc1upc-checksum.o \ + $(BACKEND) $(LIBDEPS) + $(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ + $(UPC_OBJS) $(C_AND_OBJC_OBJS) cc1upc-checksum.o \ + $(BACKEND) $(LIBS) $(BACKENDLIBS) + +# Create the compiler driver gupc. +gupcspec.o: $(srcdir)/upc/gupcspec.c $(SYSTEM_H) $(TM_H) $(GCC_H) \ + $(CONFIG_H) coretypes.h intl.h $(OPTS_H) + (SHLIB='$(SHLIB)'; \ + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \ + $(INCLUDES) $(srcdir)/upc/gupcspec.c) + +GUPC_D_OBJS = $(GCC_OBJS) gupcspec.o +gupc$(exeext): $(GUPC_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a $(LIBDEPS) + $(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ + $(GUPC_D_OBJS) $(EXTRA_GCC_OBJS) libcommon-target.a \ + $(EXTRA_GCC_LIBS) $(LIBS) + +# +# UPC language specific files. +# +upc/upc-lang.o : upc/upc-lang.c \ + $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ + $(C_TREE_H) upc/upc-tree.h toplev.h \ + $(C_PRETTY_PRINT_H) $(DIAGNOSTIC_H) \ + $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) \ + gtype-upc.h gt-upc-upc-act.h upc/upc-act.h upc/upc-pts.h + +upc/upc-act.o : upc/upc-act.c \ + $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \ + $(TM_P_H) $(EXPR_H) $(TARGET_H) $(C_TREE_H) diagnostic.h toplev.h \ + flags.h input.h function.h output.h debug.h langhooks.h \ + $(LANGHOOKS_DEF_H) $(HASHTAB_H) c-family/c-pragma.h \ + gtype-upc.h gt-upc-upc-act.h upc/upc-act.h upc/upc-pts.h \ + upc/upc-rts-names.h + +upc/upc-genericize.o : upc/upc-genericize.c \ + $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \ + $(TM_P_H) $(EXPR_H) $(TARGET_H) $(C_TREE_H) diagnostic.h \ + toplev.h flags.h input.h function.h output.h debug.h langhooks.h \ + $(LANGHOOKS_DEF_H) $(HASHTAB_H) c-family/c-pragma.h \ + upc/upc-genericize.h upc/upc-tree.h upc/upc-act.h upc/upc-pts.h \ + gtype-upc.h gt-upc-upc-genericize.h upc/upc-act.h upc/upc-pts.h \ + upc/upc-rts-names.h + +upc/upc-pts-packed.o: upc/upc-pts-packed.c \ + $(CONFIG_H) $(SYSTEM_H) $(TARGET_H) $(TM_H) $(TM_P_H) \ + $(TREE_H) coretypes.h $(LANGHOOKS_DEF_H) langhooks.h \ + c-family/c-pragma.h $(C_TREE_H) debug.h \ + diagnostic.h $(EXPR_H) flags.h function.h input.h \ + output.h $(RTL_H) toplev.h \ + upc/upc-act.h upc/upc-pts.h upc/upc-rts-names.h + +upc/upc-pts-struct.o: upc/upc-pts-struct.c \ + $(CONFIG_H) $(SYSTEM_H) $(TARGET_H) $(TM_H) $(TM_P_H) \ + $(TREE_H) coretypes.h $(LANGHOOKS_DEF_H) langhooks.h \ + c-family/c-pragma.h $(C_TREE_H) debug.h \ + diagnostic.h $(EXPR_H) flags.h function.h input.h \ + output.h $(RTL_H) toplev.h \ + upc/upc-act.h upc/upc-pts.h upc/upc-rts-names.h + +upc/upc-gasp.o : upc/upc-gasp.c \ + $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \ + $(TM_P_H) $(EXPR_H) $(TARGET_H) $(C_TREE_H) diagnostic.h \ + toplev.h flags.h input.h function.h output.h debug.h langhooks.h \ + $(LANGHOOKS_DEF_H) $(HASHTAB_H) c-family/c-pragma.h \ + upc/upc-gasp.h upc/upc-tree.h upc/upc-act.h upc/upc-pts.h \ + upc/upc-rts-names.h + +# +# Documentation + +UPC_TEXI_FILES = \ + upc/gupc.texi \ + $(gcc_docdir)/include/fdl.texi \ + $(gcc_docdir)/include/gpl_v3.texi \ + $(gcc_docdir)/include/gcc-common.texi \ + gcc-vers.texi + +doc/gupc.info: $(UPC_TEXI_FILES) + if test "x$(BUILD_INFO)" = xinfo; then \ + rm -f doc/gupc.info*; \ + $(MAKEINFO) $(MAKEINFOFLAGS) -I. -I $(gcc_docdir) \ + -I $(gcc_docdir)/include -o $@ $<; \ + else true; fi + +doc/gupc.dvi: $(UPC_TEXI_FILES) + $(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $< + +doc/gupc.pdf: $(UPC_TEXI_FILES) + $(TEXI2PDF) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $< + +$(build_htmldir)/upc/index.html: $(UPC_TEXI_FILES) + $(mkinstalldirs) $(@D) + rm -f $(@D)/* + $(TEXI2HTML) -I $(gcc_docdir) -I $(gcc_docdir)/include \ + -I $(srcdir)/upc -o $(@D) $< + +.INTERMEDIATE: gupc.pod + +gupc.pod: upc/gupc.texi + -$(TEXI2POD) -D gupc < $< > $@ + +# +# Build hooks: + +upc.all.build: +upc.all.cross: +upc.start.encap: +upc.rest.encap: +upc.info: doc/gupc.info +upc.dvi: doc/gupc.dvi +upc.pdf: doc/gupc.pdf +upc.html: $(build_htmldir)/upc/index.html +upc.srcinfo: + -cp -p $^ $(srcdir)/doc +upc.man: doc/gupc.1 +upc.srcman: doc/gupc.1 + -cp -p $^ $(srcdir)/doc +upc.srcextra: +upc.install-pdf: +upc.install-plugin: + +upc.tags: force + cd $(srcdir)/upc; etags -o TAGS.sub *.y *.c *.h; \ + etags --include TAGS.sub --include ../TAGS.sub + +lang_checks += check-upc + +# +# Install hooks: +# cc1upc is installed elsewhere as part of $(COMPILERS). + +upc.install-common: cc1upc$(exeext) gupc$(exeext) installdirs + -rm -f $(DESTDIR)$(bindir)/$(GUPC_INSTALL_NAME)$(exeext) + $(INSTALL_PROGRAM) -m 755 gupc$(exeext) $(DESTDIR)$(bindir)/$(GUPC_INSTALL_NAME)$(exeext) + -rm -f $(DESTDIR)$(bindir)/$(GUPC_TARGET_INSTALL_NAME)$(exeext) + cd $(DESTDIR)$(bindir) && \ + $(LN) $(GUPC_INSTALL_NAME)$(exeext) $(GUPC_TARGET_INSTALL_NAME)$(exeext) + -rm -f $(DESTDIR)$(bindir)/$(UPC_INSTALL_NAME)$(exeext) + cd $(DESTDIR)$(bindir) && $(LN_S) $(GUPC_INSTALL_NAME)$(exeext) $(UPC_INSTALL_NAME)$(exeext) + +upc.install-plugin: + +upc.install-info: $(DESTDIR)$(infodir)/gupc.info + +upc.install-pdf: doc/gupc.pdf + @$(NORMAL_INSTALL) + test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc" + @for p in doc/gupc.pdf; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(pdf__strip_dir) \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \ + done + +upc.install-html: $(build_htmldir)/upc + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)" + @for p in $(build_htmldir)/upc; do \ + if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ + f=$(html__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ + else \ + echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ + fi; \ + done + +upc.install-man: $(DESTDIR)$(man1dir)/$(GUPC_INSTALL_NAME)$(man1ext) + +$(DESTDIR)$(man1dir)/$(GUPC_INSTALL_NAME)$(man1ext): doc/gupc.1 installdirs + -rm -f $@ + -$(INSTALL_DATA) $< $@ + -chmod a-x $@ + +upc.uninstall: + rm -rf $(DESTDIR)$(bindir)/$(GUPC_INSTALL_NAME)$(exeext) + rm -rf $(DESTDIR)$(bindir)/$(UPC_INSTALL_NAME)$(exeext) + rm -rf $(DESTDIR)$(man1dir)/$(GUPC_INSTALL_NAME)$(man1ext) + rm -rf $(DESTDIR)$(bindir)/$(GUPC_TARGET_INSTALL_NAME)$(exeext) + rm -rf $(DESTDIR)$(infodir)/gupc.info* + +# +# Clean hooks: +# A lot of the ancillary files are deleted by the main makefile. +# We just have to delete files specific to us. +upc.mostlyclean: + -rm -f tmp-upc-prs.y + -rm -f upc/*$(objext) upc/xforward upc/fflags + -rm -f upc/*$(coverageexts) +upc.clean: upc.mostlyclean + -rm -rf upc-headers +upc.distclean: + -rm -f upc/Makefile upc/Make-host upc/Make-target + -rm -f upc/config.status upc/config.cache +upc.maintainer-clean: + +# +# Stage hooks: + +upc.stage1: stage1-start + -mv upc/*$(objext) stage1/upc +upc.stage2: stage2-start + -mv upc/*$(objext) stage2/upc +upc.stage3: stage3-start + -mv upc/*$(objext) stage3/upc +upc.stage4: stage4-start + -mv upc/*$(objext) stage4/upc +upc.stageprofile: stageprofile-start + -mv upc/*$(objext) stageprofile/upc +upc.stagefeedback: stagefeedback-start + -mv upc/*$(objext) stagefeedback/upc Index: Makefile.def =================================================================== --- Makefile.def (.../trunk) (revision 192449) +++ Makefile.def (.../branches/gupc) (revision 192459) @@ -126,6 +126,7 @@ target_modules = { module= libbacktrace; target_modules = { module= libquadmath; }; target_modules = { module= libgfortran; }; target_modules = { module= libobjc; }; +target_modules = { module= libgupc; }; target_modules = { module= libgo; }; target_modules = { module= libtermcap; no_check=true; missing=mostlyclean; @@ -256,6 +257,8 @@ flags_to_pass = { flag= GCJ_FOR_TARGET ; flags_to_pass = { flag= GFORTRAN_FOR_TARGET ; }; flags_to_pass = { flag= GOC_FOR_TARGET ; }; flags_to_pass = { flag= GOCFLAGS_FOR_TARGET ; }; +flags_to_pass = { flag= GUPC_FOR_TARGET ; }; +flags_to_pass = { flag= GUPCFLAGS_FOR_TARGET ; }; flags_to_pass = { flag= LD_FOR_TARGET ; }; flags_to_pass = { flag= LIPO_FOR_TARGET ; }; flags_to_pass = { flag= LDFLAGS_FOR_TARGET ; }; @@ -507,6 +510,9 @@ dependencies = { module=configure-target // generated by the libgomp configure. Unfortunately, due to the use of // recursive make, we can't be that specific. dependencies = { module=all-target-libstdc++-v3; on=configure-target-libgomp; }; +// Installing UPC headers must follow gcc install because +// gcc removes and then recreates the include directory. +dependencies = { module=install-target-libgupc; on=install-gcc; }; // Target modules in the 'src' repository. lang_env_dependencies = { module=libtermcap; }; @@ -534,6 +540,8 @@ languages = { language=ada; gcc-check-ta lib-check-target=check-target-libada; }; languages = { language=objc; gcc-check-target=check-objc; lib-check-target=check-target-libobjc; }; +languages = { language=upc; gcc-check-target=check-upc; + lib-check-target=check-target-libgupc; }; languages = { language=obj-c++; gcc-check-target=check-obj-c++; }; languages = { language=go; gcc-check-target=check-go; lib-check-target=check-target-libgo; }; Index: Makefile.tpl =================================================================== --- Makefile.tpl (.../trunk) (revision 192449) +++ Makefile.tpl (.../branches/gupc) (revision 192459) @@ -160,6 +160,8 @@ BUILD_EXPORTS = \ GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \ GOC="$(GOC_FOR_BUILD)"; export GOC; \ GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \ + GUPC="$(GUPC_FOR_BUILD)"; export GUPC; \ + GUPCFLAGS="$(GUPCFLAGS_FOR_BUILD)"; export GUPCFLAGS; \ DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \ LD="$(LD_FOR_BUILD)"; export LD; \ LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \ @@ -197,6 +199,7 @@ HOST_EXPORTS = \ GCJ="$(GCJ)"; export GCJ; \ GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \ GOC="$(GOC)"; export GOC; \ + GUPC="$(GUPC)"; export GUPC; \ AR="$(AR)"; export AR; \ AS="$(AS)"; export AS; \ CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \ @@ -282,6 +285,7 @@ BASE_TARGET_EXPORTS = \ GCJ="$(GCJ_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GCJ; \ GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \ GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \ + GUPC="$(GUPC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GUPC; \ DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \ LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \ LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \ @@ -351,6 +355,7 @@ DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@ GCJ_FOR_BUILD = @GCJ_FOR_BUILD@ GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@ GOC_FOR_BUILD = @GOC_FOR_BUILD@ +GUPC_FOR_BUILD = @GUPC_FOR_BUILD@ LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ LD_FOR_BUILD = @LD_FOR_BUILD@ NM_FOR_BUILD = @NM_FOR_BUILD@ @@ -415,6 +420,7 @@ LIBCFLAGS = $(CFLAGS) CXXFLAGS = @CXXFLAGS@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates GOCFLAGS = $(CFLAGS) +GUPCFLAGS = $(CFLAGS) TFLAGS = @@ -481,6 +487,7 @@ RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @ GCJ_FOR_TARGET=$(STAGE_CC_WRAPPER) @GCJ_FOR_TARGET@ GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@ GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@ +GUPC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GUPC_FOR_TARGET@ DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@ LD_FOR_TARGET=@LD_FOR_TARGET@ @@ -504,6 +511,7 @@ LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARG LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@ GOCFLAGS_FOR_TARGET = -O2 -g +GUPCFLAGS_FOR_TARGET = -O2 -g FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@ SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@ @@ -603,6 +611,7 @@ EXTRA_HOST_FLAGS = \ 'GCJ=$(GCJ)' \ 'GFORTRAN=$(GFORTRAN)' \ 'GOC=$(GOC)' \ + 'GUPC=$(GUPC)' \ 'LD=$(LD)' \ 'LIPO=$(LIPO)' \ 'NM=$(NM)' \ @@ -642,6 +651,8 @@ EXTRA_TARGET_FLAGS = \ 'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ 'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \ + 'GUPC=$$(GUPC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \ + 'GUPCFLAGS=$$(GUPCFLAGS_FOR_TARGET)' \ 'LD=$(COMPILER_LD_FOR_TARGET)' \ 'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \ 'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \