Changeset 44b7088


Ignore:
Timestamp:
Feb 25, 2016, 5:03:36 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, ctor, deferred_resn, demangler, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, string, with_gc
Children:
ac1ed49, d09c421
Parents:
91b8a17
Message:

Added VarArgsType? for GCC builtin_va_list var args pack

Location:
src
Files:
1 added
26 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/GenType.cc

    r91b8a17 r44b7088  
    3939                virtual void visit( EnumInstType *enumInst );
    4040                virtual void visit( TypeInstType *typeInst );
     41                virtual void visit( VarArgsType *varArgsType );
    4142 
    4243          private:
     
    191192        }
    192193
     194        void GenType::visit( VarArgsType *varArgsType ) {
     195                typeString = "__builtin_va_list " + typeString;
     196                // don't handle qualifiers, var args pack shouldn't have any
     197        }
     198
    193199        void GenType::handleQualifiers( Type *type ) {
    194200                if ( type->get_isConst() ) {
  • src/Makefile.in

    r91b8a17 r44b7088  
    171171        SynTree/driver_cfa_cpp-TypeofType.$(OBJEXT) \
    172172        SynTree/driver_cfa_cpp-AttrType.$(OBJEXT) \
     173        SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT) \
    173174        SynTree/driver_cfa_cpp-Constant.$(OBJEXT) \
    174175        SynTree/driver_cfa_cpp-Expression.$(OBJEXT) \
     
    369370        SynTree/ArrayType.cc SynTree/FunctionType.cc \
    370371        SynTree/ReferenceToType.cc SynTree/TupleType.cc \
    371         SynTree/TypeofType.cc SynTree/AttrType.cc SynTree/Constant.cc \
     372        SynTree/TypeofType.cc SynTree/AttrType.cc \
     373        SynTree/VarArgsType.cc SynTree/Constant.cc \
    372374        SynTree/Expression.cc SynTree/TupleExpr.cc \
    373375        SynTree/CommaExpr.cc SynTree/TypeExpr.cc \
     
    703705SynTree/driver_cfa_cpp-AttrType.$(OBJEXT): SynTree/$(am__dirstamp) \
    704706        SynTree/$(DEPDIR)/$(am__dirstamp)
     707SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT): SynTree/$(am__dirstamp) \
     708        SynTree/$(DEPDIR)/$(am__dirstamp)
    705709SynTree/driver_cfa_cpp-Constant.$(OBJEXT): SynTree/$(am__dirstamp) \
    706710        SynTree/$(DEPDIR)/$(am__dirstamp)
     
    867871        -rm -f SynTree/driver_cfa_cpp-TypeSubstitution.$(OBJEXT)
    868872        -rm -f SynTree/driver_cfa_cpp-TypeofType.$(OBJEXT)
     873        -rm -f SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT)
    869874        -rm -f SynTree/driver_cfa_cpp-Visitor.$(OBJEXT)
    870875        -rm -f SynTree/driver_cfa_cpp-VoidType.$(OBJEXT)
     
    974979@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-TypeSubstitution.Po@am__quote@
    975980@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-TypeofType.Po@am__quote@
     981@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Po@am__quote@
    976982@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po@am__quote@
    977983@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Po@am__quote@
     
    20482054@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    20492055@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-AttrType.obj `if test -f 'SynTree/AttrType.cc'; then $(CYGPATH_W) 'SynTree/AttrType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/AttrType.cc'; fi`
     2056
     2057SynTree/driver_cfa_cpp-VarArgsType.o: SynTree/VarArgsType.cc
     2058@am__fastdepCXX_TRUE@   $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-VarArgsType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Tpo -c -o SynTree/driver_cfa_cpp-VarArgsType.o `test -f 'SynTree/VarArgsType.cc' || echo '$(srcdir)/'`SynTree/VarArgsType.cc
     2059@am__fastdepCXX_TRUE@   $(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Po
     2060@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='SynTree/VarArgsType.cc' object='SynTree/driver_cfa_cpp-VarArgsType.o' libtool=no @AMDEPBACKSLASH@
     2061@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2062@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VarArgsType.o `test -f 'SynTree/VarArgsType.cc' || echo '$(srcdir)/'`SynTree/VarArgsType.cc
     2063
     2064SynTree/driver_cfa_cpp-VarArgsType.obj: SynTree/VarArgsType.cc
     2065@am__fastdepCXX_TRUE@   $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-VarArgsType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Tpo -c -o SynTree/driver_cfa_cpp-VarArgsType.obj `if test -f 'SynTree/VarArgsType.cc'; then $(CYGPATH_W) 'SynTree/VarArgsType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VarArgsType.cc'; fi`
     2066@am__fastdepCXX_TRUE@   $(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-VarArgsType.Po
     2067@AMDEP_TRUE@@am__fastdepCXX_FALSE@      source='SynTree/VarArgsType.cc' object='SynTree/driver_cfa_cpp-VarArgsType.obj' libtool=no @AMDEPBACKSLASH@
     2068@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2069@am__fastdepCXX_FALSE@  $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VarArgsType.obj `if test -f 'SynTree/VarArgsType.cc'; then $(CYGPATH_W) 'SynTree/VarArgsType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VarArgsType.cc'; fi`
    20502070
    20512071SynTree/driver_cfa_cpp-Constant.o: SynTree/Constant.cc
  • src/ResolvExpr/AdjustExprType.cc

    r91b8a17 r44b7088  
    3636                virtual Type* mutate( TypeInstType *aggregateUseType );
    3737                virtual Type* mutate( TupleType *tupleType );
     38                virtual Type* mutate( VarArgsType *varArgsType );
    3839
    3940                const TypeEnvironment &env;
     
    111112                return tupleType;
    112113        }
     114
     115        Type *AdjustExprType::mutate( VarArgsType *varArgsType ) {
     116                return varArgsType;
     117        }
    113118} // namespace ResolvExpr
    114119
  • src/ResolvExpr/CommonType.cc

    r91b8a17 r44b7088  
    3838                virtual void visit( TypeInstType *aggregateUseType );
    3939                virtual void visit( TupleType *tupleType );
     40                virtual void visit( VarArgsType *varArgsType );
    4041
    4142                template< typename RefType > void handleRefType( RefType *inst, Type *other );
     
    213214        void CommonType::visit( TupleType *tupleType ) {
    214215        }
     216
     217        void CommonType::visit( VarArgsType *varArgsType ) {
     218        }
    215219} // namespace ResolvExpr
    216220
  • src/ResolvExpr/ConversionCost.cc

    r91b8a17 r44b7088  
    247247                } // if
    248248        }
     249
     250        void ConversionCost::visit(VarArgsType *varArgsType) {
     251                if ( VarArgsType *destAsVarArgs = dynamic_cast< VarArgsType* >( dest ) ) {
     252                        cost = Cost::zero;
     253                }
     254        }
    249255} // namespace ResolvExpr
    250256
  • src/ResolvExpr/ConversionCost.h

    r91b8a17 r44b7088  
    4040                virtual void visit(TypeInstType *aggregateUseType);
    4141                virtual void visit(TupleType *tupleType);
     42                virtual void visit(VarArgsType *varArgsType);
    4243          protected:
    4344                Type *dest;
  • src/ResolvExpr/PtrsAssignable.cc

    r91b8a17 r44b7088  
    3838                virtual void visit( TypeInstType *inst );
    3939                virtual void visit( TupleType *tupleType );
     40                virtual void visit( VarArgsType *varArgsType );
    4041          private:
    4142                Type *dest;
     
    137138///   }
    138139        }
     140
     141        void PtrsAssignable::visit( VarArgsType *varArgsType ) {
     142        }
    139143} // namespace ResolvExpr
    140144
  • src/ResolvExpr/PtrsCastable.cc

    r91b8a17 r44b7088  
    3939                virtual void visit(TypeInstType *inst);
    4040                virtual void visit(TupleType *tupleType);
     41                virtual void visit(VarArgsType *varArgsType);
    4142          private:
    4243                Type *dest;
     
    139140                result = objectCast( dest, env, indexer );
    140141        }
     142
     143        void PtrsCastable::visit(VarArgsType *varArgsType) {
     144                result = objectCast( dest, env, indexer );
     145        }
    141146} // namespace ResolvExpr
    142147
  • src/ResolvExpr/RenameVars.cc

    r91b8a17 r44b7088  
    113113        }
    114114
     115        void RenameVars::visit( VarArgsType *varArgsType ) {
     116                typeBefore( varArgsType );
     117                typeAfter( varArgsType );
     118        }
     119
    115120        void RenameVars::typeBefore( Type *type ) {
    116121                if ( ! type->get_forall().empty() ) {
  • src/ResolvExpr/RenameVars.h

    r91b8a17 r44b7088  
    4343                virtual void visit( TypeInstType *aggregateUseType );
    4444                virtual void visit( TupleType *tupleType );
     45                virtual void visit( VarArgsType *varArgsType );
    4546
    4647                void typeBefore( Type *type );
  • src/ResolvExpr/Unify.cc

    r91b8a17 r44b7088  
    5959                virtual void visit(TypeInstType *aggregateUseType);
    6060                virtual void visit(TupleType *tupleType);
     61                virtual void visit(VarArgsType *varArgsType);
    6162
    6263                template< typename RefType > void handleRefType( RefType *inst, Type *other );
     
    582583        }
    583584
     585        void Unify::visit(VarArgsType *varArgsType) {
     586                result = dynamic_cast< VarArgsType* >( type2 );
     587        }
     588
    584589} // namespace ResolvExpr
    585590
  • src/SymTab/FixFunction.cc

    r91b8a17 r44b7088  
    7272                return tupleType;
    7373        }
     74
     75        Type * FixFunction::mutate(VarArgsType *varArgsType) {
     76                return varArgsType;
     77        }
    7478} // namespace SymTab
    7579
  • src/SymTab/FixFunction.h

    r91b8a17 r44b7088  
    4141                virtual Type* mutate(TypeInstType *aggregateUseType);
    4242                virtual Type* mutate(TupleType *tupleType);
     43                virtual Type* mutate(VarArgsType *varArgsType);
    4344 
    4445                bool isVoid;
  • src/SymTab/ImplementationType.cc

    r91b8a17 r44b7088  
    4040                virtual void visit(TypeInstType *aggregateUseType);
    4141                virtual void visit(TupleType *tupleType);
     42                virtual void visit(VarArgsType *varArgsType);
    4243
    4344                Type *result;                   // synthesized
     
    116117                result = newType;
    117118        }
     119
     120        void ImplementationType::visit(VarArgsType *varArgsType) {
     121        }
    118122} // namespace SymTab
    119123
  • src/SymTab/Mangler.cc

    r91b8a17 r44b7088  
    224224                acceptAll( tupleType->get_types(), *this );
    225225                mangleName << "_";
     226        }
     227
     228        void Mangler::visit( VarArgsType *varArgsType ) {
     229                mangleName << "VARGS";
    226230        }
    227231
  • src/SymTab/Mangler.h

    r91b8a17 r44b7088  
    4545                virtual void visit( TypeInstType *aggregateUseType );
    4646                virtual void visit( TupleType *tupleType );
     47                virtual void visit( VarArgsType *varArgsType );
    4748 
    4849                std::string get_mangleName() { return mangleName.str(); }
  • src/SymTab/TypeEquality.cc

    r91b8a17 r44b7088  
    4141                virtual void visit( EnumInstType *enumInst );
    4242                virtual void visit( TypeInstType *typeInst );
     43                virtual void visit( VarArgsType *varArgsType );
    4344
    4445                void handleQualifiers( Type * t );
     
    191192                }
    192193        }
     194
     195        void TypeEquality::visit( VarArgsType *varArgsType ) {
     196                // don't handle qualifiers; var args pack shouldn't have any
     197                if ( ! dynamic_cast< VarArgsType * >( other ) ) {
     198                        result = false;
     199                }
     200        }
    193201} // namespace SymTab
  • src/SynTree/Mutator.cc

    r91b8a17 r44b7088  
    421421}
    422422
     423Type *Mutator::mutate( VarArgsType *varArgsType ) {
     424        mutateAll( varArgsType->get_forall(), *this );
     425        return varArgsType;
     426}
     427
    423428Initializer *Mutator::mutate( SingleInit *singleInit ) {
    424429        singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) );
  • src/SynTree/Mutator.h

    r91b8a17 r44b7088  
    9090        virtual Type* mutate( TypeofType *typeofType );
    9191        virtual Type* mutate( AttrType *attrType );
     92        virtual Type* mutate( VarArgsType *varArgsType );
    9293
    9394        virtual Initializer* mutate( SingleInit *singleInit );
  • src/SynTree/SynTree.h

    r91b8a17 r44b7088  
    9797class TypeofType;
    9898class AttrType;
     99class VarArgsType;
    99100
    100101class Initializer;
  • src/SynTree/Type.h

    r91b8a17 r44b7088  
    400400};
    401401
     402/// Represents the GCC built-in varargs type
     403class VarArgsType : public Type {
     404        VarArgsType();
     405
     406        virtual VarArgsType *clone() const { return new VarArgsType( *this ); }
     407        virtual void accept( Visitor &v ) { v.visit( this ); }
     408        virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     409        virtual void print( std::ostream &os, int indent = 0 ) const;
     410};
     411
    402412inline Type::Qualifiers &Type::Qualifiers::operator+=( const Type::Qualifiers &other ) {
    403413        isConst |= other.isConst;
  • src/SynTree/TypeSubstitution.cc

    r91b8a17 r44b7088  
    198198}
    199199
     200Type * TypeSubstitution::mutate( VarArgsType *varArgsType ) {
     201        return handleType( varArgsType );
     202}
     203
    200204void TypeSubstitution::print( std::ostream &os, int indent ) const {
    201205        os << std::string( indent, ' ' ) << "Types:" << std::endl;
  • src/SynTree/TypeSubstitution.h

    r91b8a17 r44b7088  
    7474        virtual Type* mutate(ContextInstType *aggregateUseType);
    7575        virtual Type* mutate(TupleType *tupleType);
     76        virtual Type* mutate(VarArgsType *varArgsType);
    7677       
    7778        // TODO: worry about traversing into a forall-qualified function type or type decl with assertions
  • src/SynTree/Visitor.cc

    r91b8a17 r44b7088  
    355355}
    356356
     357void Visitor::visit( VarArgsType *varArgsType ) {
     358        acceptAll( varArgsType->get_forall(), *this );
     359}
     360
    357361void Visitor::visit( SingleInit *singleInit ) {
    358362        singleInit->get_value()->accept( *this );
  • src/SynTree/Visitor.h

    r91b8a17 r44b7088  
    9090        virtual void visit( TypeofType *typeofType );
    9191        virtual void visit( AttrType *attrType );
     92        virtual void visit( VarArgsType *varArgsType );
    9293
    9394        virtual void visit( SingleInit *singleInit );
  • src/SynTree/module.mk

    r91b8a17 r44b7088  
    2525       SynTree/TypeofType.cc \
    2626       SynTree/AttrType.cc \
     27       SynTree/VarArgsType.cc \
    2728       SynTree/Constant.cc \
    2829       SynTree/Expression.cc \
Note: See TracChangeset for help on using the changeset viewer.