Changeset 67a67af


Ignore:
Timestamp:
Aug 11, 2017, 10:55:14 AM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
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, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
03321e4, f196351
Parents:
3b4571b (diff), 54cd58b (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 plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
1 added
5 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • Makefile.in

    r3b4571b r67a67af  
    198198        $(top_srcdir)/automake/install-sh \
    199199        $(top_srcdir)/automake/missing INSTALL README automake/compile \
    200         automake/config.guess automake/config.sub automake/install-sh \
    201         automake/missing
     200        automake/config.guess automake/config.sub automake/depcomp \
     201        automake/install-sh automake/missing automake/ylwrap
    202202DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    203203distdir = $(PACKAGE)-$(VERSION)
  • doc/working/resolver_design.md

    r3b4571b r67a67af  
    9191## Conversion Costs ##
    9292Each possible resolution of an expression has a _cost_ tuple consisting of
    93 the following components: _unsafe_ conversion cost, _polymorphic_
    94 specialization cost, _safe_ conversion cost, a count of _explicit_
    95 conversions, and _qualifier_ conversion cost.
     93the following components:
     941. _unsafe_ conversion cost: summed degree of unsafe conversions; unlike CFA03, this is not a simple count of conversions (for symmetry with the safe conversions)
     952. _polymorphic unifications_: count of parameters and return values bound to some polymorphic type for boxing
     963. _type variables_: number of polymorphic type variables bound
     974. negated _type specializations_: Each type assertion specializes the polymorphism, thus decreasing the cost; nested polymorphic types (e.g. `T*`) are also counted as specializations
     985. _safe_ conversions: summed degree of safe conversions
     996. _qualifier_ conversions: summed degree of qualifier and reference conversions
    96100These components are lexically-ordered and can be summed element-wise;
    97101summation starts at `(0, 0, 0, 0, 0)`.
     102
     103**TODO** update below for consistency with this
    98104
    99105### Lvalue and Qualifier Conversions ###
  • src/CodeGen/CodeGenerator.cc

    r3b4571b r67a67af  
    6464        } // extension
    6565
    66         ostream & CodeGenerator::Indenter::operator()( ostream & output ) const {
    67           return output << string( cg.cur_indent, ' ' );
    68         }
    69 
    70         ostream & operator<<( ostream & output, const CodeGenerator::Indenter &indent ) {
    71                 return indent( output );
    72         }
    73 
    7466        CodeGenerator::LabelPrinter & CodeGenerator::LabelPrinter::operator()( std::list< Label > & l ) {
    7567                labels = &l;
     
    109101        }
    110102
    111         CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ) {}
     103        CodeGenerator::CodeGenerator( std::ostream & os, bool pretty, bool genC, bool lineMarks ) : indent( CodeGenerator::tabsize ), insideFunction( false ), output( os ), printLabels( *this ), pretty( pretty ), genC( genC ), lineMarks( lineMarks ) {}
    112104
    113105        string CodeGenerator::mangleName( DeclarationWithType * decl ) {
     
    200192                        output << " {" << endl;
    201193
    202                         cur_indent += CodeGenerator::tabsize;
     194                        ++indent;
    203195                        for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end(); i++ ) {
    204196                                output << lineDirective( *i ) << indent;
     
    207199                        } // for
    208200
    209                         cur_indent -= CodeGenerator::tabsize;
     201                        --indent;
    210202
    211203                        output << indent << "}";
     
    237229                        output << " {" << endl;
    238230
    239                         cur_indent += CodeGenerator::tabsize;
     231                        ++indent;
    240232                        for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end();  i++) {
    241233                                ObjectDecl * obj = dynamic_cast< ObjectDecl* >( *i );
     
    249241                        } // for
    250242
    251                         cur_indent -= CodeGenerator::tabsize;
     243                        --indent;
    252244
    253245                        output << indent << "}";
     
    761753                std::list< Statement * > & stmts = stmtExpr->get_statements()->get_kids();
    762754                output << lineDirective( stmtExpr) << "({" << std::endl;
    763                 cur_indent += CodeGenerator::tabsize;
     755                ++indent;
    764756                unsigned int numStmts = stmts.size();
    765757                unsigned int i = 0;
     
    784776                        ++i;
    785777                }
    786                 cur_indent -= CodeGenerator::tabsize;
     778                --indent;
    787779                output << indent << "})";
    788780        }
     
    793785                output << "{" << endl;
    794786
    795                 cur_indent += CodeGenerator::tabsize;
     787                ++indent;
    796788
    797789                for ( std::list<Statement *>::iterator i = ks.begin(); i != ks.end();  i++ ) {
     
    804796                        } // if
    805797                } // for
    806                 cur_indent -= CodeGenerator::tabsize;
     798                --indent;
    807799
    808800                output << indent << "}";
     
    872864
    873865                output << "{" << std::endl;
    874                 cur_indent += CodeGenerator::tabsize;
     866                ++indent;
    875867                acceptAll( switchStmt->get_statements(), *this );
    876                 cur_indent -= CodeGenerator::tabsize;
     868                --indent;
    877869                output << indent << "}";
    878870        }
     
    891883                std::list<Statement *> sts = caseStmt->get_statements();
    892884
    893                 cur_indent += CodeGenerator::tabsize;
     885                ++indent;
    894886                for ( std::list<Statement *>::iterator i = sts.begin(); i != sts.end();  i++) {
    895887                        output << indent << printLabels( (*i)->get_labels() )  ;
     
    897889                        output << endl;
    898890                } // for
    899                 cur_indent -= CodeGenerator::tabsize;
     891                --indent;
    900892        }
    901893
  • src/CodeGen/CodeGenerator.h

    r3b4571b r67a67af  
    2323#include "SynTree/Visitor.h"      // for Visitor
    2424#include "SynTree/SynTree.h"      // for Visitor Nodes
     25
     26#include "Common/Indenter.h"      // for Indenter
    2527
    2628namespace CodeGen {
     
    100102                template< class Iterator > void genCommaList( Iterator begin, Iterator end );
    101103
    102                 struct Indenter {
    103                         Indenter(CodeGenerator &cg) : cg(cg) {}
    104                         CodeGenerator & cg;
    105                         std::ostream& operator()(std::ostream & os) const;
    106                 };
    107 
    108104                struct LabelPrinter {
    109105                        LabelPrinter(CodeGenerator &cg) : cg(cg), labels( 0 ) {}
     
    128124          private:
    129125                Indenter indent;
    130                 int cur_indent;
    131126                bool insideFunction;
    132127                std::ostream &output;
  • src/Common/utility.h

    r3b4571b r67a67af  
    2424#include <sstream>
    2525#include <string>
     26#include <type_traits>
    2627
    2728#include <cassert>
     
    304305// for ( val : group_iterate( container1, container2, ... ) ) {}
    305306// syntax to have a for each that iterates multiple containers of the same length
    306 // TODO: update to use variadic arguments, perfect forwarding
     307// TODO: update to use variadic arguments
    307308
    308309template< typename T1, typename T2 >
     
    313314
    314315        struct iterator {
    315                 typedef std::tuple<typename T1::value_type, typename T2::value_type> value_type;
    316                 typedef typename T1::iterator T1Iter;
    317                 typedef typename T2::iterator T2Iter;
     316                typedef typename std::remove_reference<T1>::type T1val;
     317                typedef typename std::remove_reference<T2>::type T2val;
     318                typedef std::tuple<typename T1val::value_type &, typename T2val::value_type &> value_type;
     319                typedef typename T1val::iterator T1Iter;
     320                typedef typename T2val::iterator T2Iter;
    318321                typedef std::tuple<T1Iter, T2Iter> IterTuple;
    319322                IterTuple it;
     
    323326                }
    324327                bool operator!=( const iterator &other ) const { return it != other.it; }
    325                 value_type operator*() const { return std::make_tuple( *std::get<0>(it), *std::get<1>(it) ); }
     328                value_type operator*() const { return std::tie( *std::get<0>(it), *std::get<1>(it) ); }
    326329        };
    327330        iterator begin() { return iterator( std::get<0>(args).begin(), std::get<1>(args).begin() ); }
     
    333336
    334337template< typename... Args >
    335 group_iterate_t<Args...> group_iterate( const Args &... args ) {
    336         return group_iterate_t<Args...>(args...);
     338group_iterate_t<Args...> group_iterate( Args &&... args ) {
     339        return group_iterate_t<Args...>(std::forward<Args>( args )...);
    337340}
    338341
  • src/Makefile.in

    r3b4571b r67a67af  
    219219        SymTab/driver_cfa_cpp-TypeEquality.$(OBJEXT) \
    220220        SymTab/driver_cfa_cpp-Autogen.$(OBJEXT) \
    221         SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT) \
    222221        SynTree/driver_cfa_cpp-Type.$(OBJEXT) \
    223222        SynTree/driver_cfa_cpp-VoidType.$(OBJEXT) \
     
    518517        SymTab/Indexer.cc SymTab/Mangler.cc SymTab/Validate.cc \
    519518        SymTab/FixFunction.cc SymTab/ImplementationType.cc \
    520         SymTab/TypeEquality.cc SymTab/Autogen.cc SymTab/TreeStruct.cc \
    521         SynTree/Type.cc SynTree/VoidType.cc SynTree/BasicType.cc \
     519        SymTab/TypeEquality.cc SymTab/Autogen.cc SynTree/Type.cc \
     520        SynTree/VoidType.cc SynTree/BasicType.cc \
    522521        SynTree/PointerType.cc SynTree/ArrayType.cc \
    523522        SynTree/FunctionType.cc SynTree/ReferenceToType.cc \
     
    852851SymTab/driver_cfa_cpp-Autogen.$(OBJEXT): SymTab/$(am__dirstamp) \
    853852        SymTab/$(DEPDIR)/$(am__dirstamp)
    854 SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT): SymTab/$(am__dirstamp) \
    855         SymTab/$(DEPDIR)/$(am__dirstamp)
    856853SynTree/$(am__dirstamp):
    857854        @$(MKDIR_P) SynTree
     
    10481045@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Po@am__quote@
    10491046@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Mangler.Po@am__quote@
    1050 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po@am__quote@
    10511047@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TypeEquality.Po@am__quote@
    10521048@AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Po@am__quote@
     
    21012097@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    21022098@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Autogen.obj `if test -f 'SymTab/Autogen.cc'; then $(CYGPATH_W) 'SymTab/Autogen.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Autogen.cc'; fi`
    2103 
    2104 SymTab/driver_cfa_cpp-TreeStruct.o: SymTab/TreeStruct.cc
    2105 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-TreeStruct.o -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo -c -o SymTab/driver_cfa_cpp-TreeStruct.o `test -f 'SymTab/TreeStruct.cc' || echo '$(srcdir)/'`SymTab/TreeStruct.cc
    2106 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po
    2107 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/TreeStruct.cc' object='SymTab/driver_cfa_cpp-TreeStruct.o' libtool=no @AMDEPBACKSLASH@
    2108 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2109 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-TreeStruct.o `test -f 'SymTab/TreeStruct.cc' || echo '$(srcdir)/'`SymTab/TreeStruct.cc
    2110 
    2111 SymTab/driver_cfa_cpp-TreeStruct.obj: SymTab/TreeStruct.cc
    2112 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-TreeStruct.obj -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo -c -o SymTab/driver_cfa_cpp-TreeStruct.obj `if test -f 'SymTab/TreeStruct.cc'; then $(CYGPATH_W) 'SymTab/TreeStruct.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TreeStruct.cc'; fi`
    2113 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po
    2114 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='SymTab/TreeStruct.cc' object='SymTab/driver_cfa_cpp-TreeStruct.obj' libtool=no @AMDEPBACKSLASH@
    2115 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2116 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-TreeStruct.obj `if test -f 'SymTab/TreeStruct.cc'; then $(CYGPATH_W) 'SymTab/TreeStruct.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TreeStruct.cc'; fi`
    21172099
    21182100SynTree/driver_cfa_cpp-Type.o: SynTree/Type.cc
  • src/ResolvExpr/CurrentObject.cc

    r3b4571b r67a67af  
    1919#include "CurrentObject.h"
    2020
     21#include "Common/Indenter.h"
     22
    2123#include "SynTree/Declaration.h"
    2224#include "SynTree/Initializer.h"
     
    4547                        assertf( false, "unhandled type on getConstValue %s", toString( constExpr->get_result() ).c_str() ); // xxx - might be semantic error
    4648                }
    47         }
    48 
    49         struct Indenter {
    50                 static const int amt = 2;
    51                 unsigned int indent = 0;
    52 
    53                 Indenter & operator+=(int nlevels) { indent += amt*nlevels; return *this; }
    54                 Indenter & operator-=(int nlevels) { indent -= amt*nlevels; return *this; }
    55                 Indenter operator+(int nlevels) { Indenter indenter = *this; return indenter += nlevels; }
    56                 Indenter operator-(int nlevels) { Indenter indenter = *this; return indenter -= nlevels; }
    57                 Indenter & operator++() { return *this += 1; }
    58                 Indenter & operator--() { return *this -= 1; }
    59         };
    60         std::ostream & operator<<( std::ostream & out, Indenter & indent ) {
    61                 return out << std::string(indent.indent, ' ');
    6249        }
    6350
  • src/ResolvExpr/CurrentObject.h

    r3b4571b r67a67af  
    2424        class MemberIterator;
    2525
     26        // TODO: memory management of MemberIterators
    2627        class CurrentObject {
    2728        public:
  • src/SymTab/module.mk

    r3b4571b r67a67af  
    1111## Created On       : Mon Jun  1 17:49:17 2015
    1212## Last Modified By : Andrew Beach
    13 ## Last Modified On : Wed Jul 12 13:06:00 2017
    14 ## Update Count     : 3
     13## Last Modified On : Thr Aug 10 16:08:00 2017
     14## Update Count     : 4
    1515###############################################################################
    1616
     
    2121       SymTab/ImplementationType.cc \
    2222       SymTab/TypeEquality.cc \
    23        SymTab/Autogen.cc \
    24        SymTab/TreeStruct.cc
     23       SymTab/Autogen.cc
Note: See TracChangeset for help on using the changeset viewer.