Changeset 7cd8827 for driver


Ignore:
Timestamp:
Aug 14, 2018, 4:10:58 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
636e1b9
Parents:
c3a8ecd (diff), 5a5d31a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg2:software/cfa/cfa-cc

Location:
driver
Files:
5 moved

Legend:

Unmodified
Added
Removed
  • driver/Makefile.am

    rc3a8ecd r7cd8827  
    1515###############################################################################
    1616
     17AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
     18
    1719# applies to both programs
    18 AM_CXXFLAGS = -Wall -O2 -g -std=c++14 -I${abs_top_srcdir}/src
    19 if BUILD_NO_LIB
    20 else
    21 AM_CXXFLAGS += -DHAVE_LIBCFA
    22 endif
    23 if BUILD_DEBUG
    24 AM_CXXFLAGS += -DHAVE_LIBCFA_DEBUG
    25 endif
    26 if BUILD_RELEASE
    27 AM_CXXFLAGS += -DHAVE_LIBCFA_RELEASE
    28 endif
     20AM_CXXFLAGS = @HOST_FLAGS@ -Wall -O2 -g -std=c++14 -I${abs_top_srcdir}/src
    2921
    3022# don't install cfa directly
     
    4537# put into lib for now
    4638cc1libdir = ${CFA_LIBDIR}
    47 cc1lib_PROGRAMS = cc1
     39cc1lib_PROGRAMS = as cc1
     40as_SOURCES = as.cc
    4841cc1_SOURCES = cc1.cc
    4942
    50 aslibdir = ${CFA_LIBDIR}
    51 aslib_PROGRAMS = as
    52 as_SOURCES = as.cc
    53 
    5443MAINTAINERCLEANFILES = $(CFA_BINDIR)/$(CFA_NAME) @CFA_PREFIX@/lib/${cc1lib_PROGRAMS}
  • driver/Makefile.in

    rc3a8ecd r7cd8827  
    9292build_triplet = @build@
    9393host_triplet = @host@
    94 @BUILD_NO_LIB_FALSE@am__append_1 = -DHAVE_LIBCFA
    95 @BUILD_DEBUG_TRUE@am__append_2 = -DHAVE_LIBCFA_DEBUG
    96 @BUILD_RELEASE_TRUE@am__append_3 = -DHAVE_LIBCFA_RELEASE
    9794noinst_PROGRAMS = cfa$(EXEEXT)
    98 cc1lib_PROGRAMS = cc1$(EXEEXT)
    99 aslib_PROGRAMS = as$(EXEEXT)
    100 subdir = src/driver
     95cc1lib_PROGRAMS = as$(EXEEXT) cc1$(EXEEXT)
     96subdir = driver
    10197ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    102 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
     98am__aclocal_m4_deps = $(top_srcdir)/automake/cfa.m4 \
     99        $(top_srcdir)/configure.ac
    103100am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    104101        $(ACLOCAL_M4)
     
    108105CONFIG_CLEAN_FILES =
    109106CONFIG_CLEAN_VPATH_FILES =
    110 am__installdirs = "$(DESTDIR)$(aslibdir)" "$(DESTDIR)$(cc1libdir)"
    111 PROGRAMS = $(aslib_PROGRAMS) $(cc1lib_PROGRAMS) $(noinst_PROGRAMS)
     107am__installdirs = "$(DESTDIR)$(cc1libdir)"
     108PROGRAMS = $(cc1lib_PROGRAMS) $(noinst_PROGRAMS)
    112109am_as_OBJECTS = as.$(OBJEXT)
    113110as_OBJECTS = $(am_as_OBJECTS)
     
    186183BACKEND_CC = @BACKEND_CC@
    187184BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@
    188 BUILD_IN_TREE_FLAGS_NOLIB = @BUILD_IN_TREE_FLAGS_NOLIB@
    189185CC = @CC@
    190186CCAS = @CCAS@
     
    217213EXEEXT = @EXEEXT@
    218214GREP = @GREP@
     215HOST_FLAGS = @HOST_FLAGS@
    219216INSTALL = @INSTALL@
    220217INSTALL_DATA = @INSTALL_DATA@
     
    226223LEXLIB = @LEXLIB@
    227224LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
     225LIBCFA_TARGET_DIRS = @LIBCFA_TARGET_DIRS@
     226LIBCFA_TARGET_MAKEFILES = @LIBCFA_TARGET_MAKEFILES@
    228227LIBOBJS = @LIBOBJS@
    229228LIBS = @LIBS@
    230229LTLIBOBJS = @LTLIBOBJS@
    231 MACHINE_TYPE = @MACHINE_TYPE@
    232230MAKEINFO = @MAKEINFO@
    233231MKDIR_P = @MKDIR_P@
     
    245243SHELL = @SHELL@
    246244STRIP = @STRIP@
     245TARGET_HOSTS = @TARGET_HOSTS@
    247246VERSION = @VERSION@
    248247YACC = @YACC@
     
    300299top_builddir = @top_builddir@
    301300top_srcdir = @top_srcdir@
     301AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
    302302
    303303# applies to both programs
    304 AM_CXXFLAGS = -Wall -O2 -g -std=c++14 -I${abs_top_srcdir}/src \
    305         $(am__append_1) $(am__append_2) $(am__append_3)
     304AM_CXXFLAGS = @HOST_FLAGS@ -Wall -O2 -g -std=c++14 -I${abs_top_srcdir}/src
    306305cfa_SOURCES = cfa.cc
    307306
    308307# put into lib for now
    309308cc1libdir = ${CFA_LIBDIR}
     309as_SOURCES = as.cc
    310310cc1_SOURCES = cc1.cc
    311 aslibdir = ${CFA_LIBDIR}
    312 as_SOURCES = as.cc
    313311MAINTAINERCLEANFILES = $(CFA_BINDIR)/$(CFA_NAME) @CFA_PREFIX@/lib/${cc1lib_PROGRAMS}
    314312all: all-am
     
    325323          esac; \
    326324        done; \
    327         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/driver/Makefile'; \
     325        echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign driver/Makefile'; \
    328326        $(am__cd) $(top_srcdir) && \
    329           $(AUTOMAKE) --foreign src/driver/Makefile
     327          $(AUTOMAKE) --foreign driver/Makefile
    330328Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
    331329        @case '$?' in \
     
    345343        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    346344$(am__aclocal_m4_deps):
    347 install-aslibPROGRAMS: $(aslib_PROGRAMS)
    348         @$(NORMAL_INSTALL)
    349         @list='$(aslib_PROGRAMS)'; test -n "$(aslibdir)" || list=; \
    350         if test -n "$$list"; then \
    351           echo " $(MKDIR_P) '$(DESTDIR)$(aslibdir)'"; \
    352           $(MKDIR_P) "$(DESTDIR)$(aslibdir)" || exit 1; \
    353         fi; \
    354         for p in $$list; do echo "$$p $$p"; done | \
    355         sed 's/$(EXEEXT)$$//' | \
    356         while read p p1; do if test -f $$p \
    357           ; then echo "$$p"; echo "$$p"; else :; fi; \
    358         done | \
    359         sed -e 'p;s,.*/,,;n;h' \
    360             -e 's|.*|.|' \
    361             -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
    362         sed 'N;N;N;s,\n, ,g' | \
    363         $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
    364           { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
    365             if ($$2 == $$4) files[d] = files[d] " " $$1; \
    366             else { print "f", $$3 "/" $$4, $$1; } } \
    367           END { for (d in files) print "f", d, files[d] }' | \
    368         while read type dir files; do \
    369             if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
    370             test -z "$$files" || { \
    371               echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(aslibdir)$$dir'"; \
    372               $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(aslibdir)$$dir" || exit $$?; \
    373             } \
    374         ; done
    375 
    376 uninstall-aslibPROGRAMS:
    377         @$(NORMAL_UNINSTALL)
    378         @list='$(aslib_PROGRAMS)'; test -n "$(aslibdir)" || list=; \
    379         files=`for p in $$list; do echo "$$p"; done | \
    380           sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
    381               -e 's/$$/$(EXEEXT)/' \
    382         `; \
    383         test -n "$$list" || exit 0; \
    384         echo " ( cd '$(DESTDIR)$(aslibdir)' && rm -f" $$files ")"; \
    385         cd "$(DESTDIR)$(aslibdir)" && rm -f $$files
    386 
    387 clean-aslibPROGRAMS:
    388         -test -z "$(aslib_PROGRAMS)" || rm -f $(aslib_PROGRAMS)
    389345install-cc1libPROGRAMS: $(cc1lib_PROGRAMS)
    390346        @$(NORMAL_INSTALL)
     
    557513all-am: Makefile $(PROGRAMS)
    558514installdirs:
    559         for dir in "$(DESTDIR)$(aslibdir)" "$(DESTDIR)$(cc1libdir)"; do \
     515        for dir in "$(DESTDIR)$(cc1libdir)"; do \
    560516          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
    561517        done
     
    593549clean: clean-am
    594550
    595 clean-am: clean-aslibPROGRAMS clean-cc1libPROGRAMS clean-generic \
    596         clean-noinstPROGRAMS mostlyclean-am
     551clean-am: clean-cc1libPROGRAMS clean-generic clean-noinstPROGRAMS \
     552        mostlyclean-am
    597553
    598554distclean: distclean-am
     
    614570info-am:
    615571
    616 install-data-am: install-aslibPROGRAMS install-cc1libPROGRAMS
     572install-data-am: install-cc1libPROGRAMS
    617573
    618574install-dvi: install-dvi-am
     
    660616ps-am:
    661617
    662 uninstall-am: uninstall-aslibPROGRAMS uninstall-cc1libPROGRAMS
     618uninstall-am: uninstall-cc1libPROGRAMS
    663619        @$(NORMAL_INSTALL)
    664620        $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
     
    666622
    667623.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
    668         clean-aslibPROGRAMS clean-cc1libPROGRAMS clean-generic \
    669         clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
    670         distclean-compile distclean-generic distclean-tags distdir dvi \
    671         dvi-am html html-am info info-am install install-am \
    672         install-aslibPROGRAMS install-cc1libPROGRAMS install-data \
    673         install-data-am install-dvi install-dvi-am install-exec \
    674         install-exec-am install-exec-hook install-html install-html-am \
    675         install-info install-info-am install-man install-pdf \
    676         install-pdf-am install-ps install-ps-am install-strip \
    677         installcheck installcheck-am installdirs maintainer-clean \
    678         maintainer-clean-generic mostlyclean mostlyclean-compile \
    679         mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
    680         uninstall-am uninstall-aslibPROGRAMS uninstall-cc1libPROGRAMS \
     624        clean-cc1libPROGRAMS clean-generic clean-noinstPROGRAMS \
     625        cscopelist-am ctags ctags-am distclean distclean-compile \
     626        distclean-generic distclean-tags distdir dvi dvi-am html \
     627        html-am info info-am install install-am install-cc1libPROGRAMS \
     628        install-data install-data-am install-dvi install-dvi-am \
     629        install-exec install-exec-am install-exec-hook install-html \
     630        install-html-am install-info install-info-am install-man \
     631        install-pdf install-pdf-am install-ps install-ps-am \
     632        install-strip installcheck installcheck-am installdirs \
     633        maintainer-clean maintainer-clean-generic mostlyclean \
     634        mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
     635        tags tags-am uninstall uninstall-am uninstall-cc1libPROGRAMS \
    681636        uninstall-hook
    682637
  • driver/cfa.cc

    rc3a8ecd r7cd8827  
    2121#include <string.h>                                                                             // strcmp
    2222
     23#include <sys/types.h>
     24#include <sys/stat.h>
     25
    2326#include "Common/SemanticError.h"
    2427#include "config.h"                                                                             // configure info
     
    6669} // shuffle
    6770
     71static inline bool dirExists(const string & path) {
     72    struct stat info;
     73    if(stat( path.c_str(), &info ) != 0)
     74        return false;
     75    else if(info.st_mode & S_IFDIR)
     76        return true;
     77    else
     78        return false;
     79} //dirExists
     80
    6881
    6982#define str(s) #s
     
    7386        string Major( str( CFA_VERSION_MAJOR ) ), Minor( str( CFA_VERSION_MINOR ) ), Patch( str( CFA_VERSION_PATCH ) );
    7487
    75         string installincdir( CFA_INCDIR );                                     // fixed location of include files
    76         string installlibdir( CFA_LIBDIR );                                     // fixed location of cc1 and cfa-cpp commands
     88        string installincdir( CFA_INCDIR );                         // fixed location of include files
     89        string installlibdir( CFA_LIBDIR );                         // fixed location of cc1 and cfa-cpp commands when installed
     90        string srcdriverdir ( TOP_BUILDDIR "driver");                // fixed location of cc1 and cfa-cpp commands when in tree
    7791
    7892        string heading;                                                                         // banner printed at start of cfa compilation
     
    96110        bool xflag = false;                                                                     // user supplied -x flag
    97111        bool debugging __attribute(( unused )) = false;         // -g flag
     112        bool m32 = false;                                    // -m32 flag
     113        bool m64 = false;                                    // -m64 flag
     114        bool intree = false;
    98115
    99116        const char *args[argc + 100];                                           // cfa command line values, plus some space for additional flags
     
    154171                        } else if ( arg == "-no-include-stdhdr" ) {
    155172                                noincstd_flag = true;                                   // strip the no-include-stdhdr flag
     173                        } else if ( arg == "-in-tree" ) {
     174                                intree = true;
    156175                        } else if ( arg == "-compiler" ) {
    157176                                // use the user specified compiler
     
    258277                                libs[nlibs] = argv[i];
    259278                                nlibs += 1;
     279                        } else if ( arg == "-m32" ) {
     280                                m32 = true;
     281                                m64 = false;
     282                                args[nargs] = argv[i];
     283                                nargs += 1;
     284                        } else if ( arg == "-m64" ) {
     285                                m64 = true;
     286                                m32 = false;
     287                                args[nargs] = argv[i];
     288                                nargs += 1;
    260289                        } else {
    261290                                // concatenate any other arguments
     
    309338
    310339        // add the CFA include-library paths, which allow direct access to header files without directory qualification
    311         args[nargs] = "-I" CFA_INCDIR;
    312         nargs += 1;
    313         if ( ! noincstd_flag ) {                                                        // do not use during build
    314                 args[nargs] = "-I" CFA_INCDIR "/stdhdr";
    315                 nargs += 1;
    316         } // if
    317         args[nargs] = "-I" CFA_INCDIR "/concurrency";
    318         nargs += 1;
    319         args[nargs] = "-I" CFA_INCDIR "/containers";
    320         nargs += 1;
     340        if( !intree ) {
     341                args[nargs] = "-I" CFA_INCDIR;
     342                nargs += 1;
     343                if ( ! noincstd_flag ) {                                                        // do not use during build
     344                        args[nargs] = "-I" CFA_INCDIR "/stdhdr";
     345                        nargs += 1;
     346                } // if
     347                args[nargs] = "-I" CFA_INCDIR "/concurrency";
     348                nargs += 1;
     349                args[nargs] = "-I" CFA_INCDIR "/containers";
     350                nargs += 1;
     351        } else {
     352                args[nargs] = "-I" TOP_SRCDIR "libcfa/src";
     353                nargs += 1;
     354                if ( ! noincstd_flag ) {                                                        // do not use during build
     355                        args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/stdhdr";
     356                        nargs += 1;
     357                } // if
     358                args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/concurrency";
     359                nargs += 1;
     360                args[nargs] = "-I" TOP_SRCDIR "libcfa/src" "/containers";
     361                nargs += 1;
     362        }
    321363
    322364        // add stdbool to get defines for bool/true/false
     
    326368        nargs += 1;
    327369
    328         #ifdef HAVE_LIBCFA
     370        string libbase;
     371        if( !intree ) {
     372                libbase = CFA_LIBDIR;
     373        } else {
     374                libbase = TOP_BUILDDIR "libcfa/";
     375                args[nargs] = "-D__CFA_FLAG__=-t";
     376                nargs += 1;
     377        }
     378
     379        const char * const arch = m32 ? CFA_32_CPU : (m64 ? CFA_64_CPU : CFA_DEFAULT_CPU);
     380        const char * config = debug ? "debug": "nodebug";
     381        string libdir = libbase + arch + "-" + config;
     382        if( !dirExists(libdir) ) {
     383                cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
     384                cerr << "Was looking for " << libdir << endl;
     385                libdir = libbase + arch + "-" + "nolib";
     386        }
     387
     388        if( !dirExists(libdir) ) {
     389                cerr << argv[0] << " internal error, cannot find prelude directory." << endl;
     390                cerr << "Was looking for " << libdir << endl;
     391                exit( EXIT_FAILURE );
     392        }
     393
     394        args[nargs] = ( *new string( string("-D__CFA_FLAG__=--prelude-dir=" ) + libdir + (intree ? "/prelude" : "")) ).c_str();
     395        nargs += 1;
     396
    329397        if ( link ) {
    330                 #if ! defined(HAVE_LIBCFA_RELEASE)
    331                 if ( ! debug ) {
    332                         cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl;
    333                         exit( EXIT_FAILURE );
    334                 } // if
    335                 #endif
    336                 #if ! defined(HAVE_LIBCFA_DEBUG)
    337                 if ( debug ) {
    338                         cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl;
    339                         exit( EXIT_FAILURE );
    340                 } // if
    341                 #endif
    342 
    343398                args[nargs] = "-Xlinker";
    344399                nargs += 1;
     
    359414
    360415                // include the cfa library in case it's needed
    361                 args[nargs] = "-L" CFA_LIBDIR;
    362                 nargs += 1;
    363                 if ( debug ) {
    364                         args[nargs] = "-lcfa-d";
    365                 } else {
    366                         args[nargs] = "-lcfa";
    367                 } // if
     416                args[nargs] = ( *new string( string("-L" ) + libdir + (intree ? "/src" : "")) ).c_str();
     417                nargs += 1;
     418                args[nargs] = "-lcfa";
    368419                nargs += 1;
    369420                args[nargs] = "-lpthread";
     
    374425                nargs += 1;
    375426        } // if
    376         #endif // HAVE_LIBCFA
    377427
    378428        // Add exception flags (unconditionally)
     
    420470
    421471        if ( Bprefix.length() == 0 ) {
    422                 Bprefix = installlibdir;
     472                Bprefix = !intree ? installlibdir : srcdriverdir;
    423473                args[nargs] = ( *new string( string("-D__GCC_BPREFIX__=") + Bprefix ) ).c_str();
    424474                nargs += 1;
    425475        } // if
    426476
    427     args[nargs] = "-Xlinker";                                                   // used by backtrace
    428     nargs += 1;
    429     args[nargs] = "-export-dynamic";
    430     nargs += 1;
     477        args[nargs] = "-Xlinker";                                                       // used by backtrace
     478        nargs += 1;
     479        args[nargs] = "-export-dynamic";
     480        nargs += 1;
    431481
    432482        // execute the compilation command
Note: See TracChangeset for help on using the changeset viewer.