Ignore:
Timestamp:
May 17, 2015, 1:19:35 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
0dd3a2f
Parents:
b87a5ed
Message:

licencing: second groups of files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/ResolvExpr/AlternativeFinder.h

    rb87a5ed ra32b204  
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// AlternativeFinder.h --
     8//
     9// Author           : Richard C. Bilson
     10// Created On       : Sat May 16 23:56:12 2015
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat May 16 23:58:43 2015
     13// Update Count     : 2
     14//
     15
    116#ifndef ALTERNATIVEFINDER_H
    217#define ALTERNATIVEFINDER_H
     
    1126
    1227namespace ResolvExpr {
    13     class AlternativeFinder : public Visitor {
    14       public:
    15         AlternativeFinder( const SymTab::Indexer &indexer, const TypeEnvironment &env );
    16         void find( Expression *expr, bool adjust = false );
    17         void findWithAdjustment( Expression *expr );
    18         AltList &get_alternatives() { return alternatives; }
    19  
    20         // make this look like an STL container so that we can apply generic algorithms
    21         typedef Alternative value_type;
    22         typedef AltList::iterator iterator;
    23         typedef AltList::const_iterator const_iterator;
    24         AltList::iterator begin() { return alternatives.begin(); }
    25         AltList::iterator end() { return alternatives.end(); }
    26         AltList::const_iterator begin() const { return alternatives.begin(); }
    27         AltList::const_iterator end() const { return alternatives.end(); }
    28  
    29         const SymTab::Indexer &get_indexer() const { return indexer; }
    30         const TypeEnvironment &get_environ() const { return env; }
    31       private:
    32         virtual void visit( ApplicationExpr *applicationExpr );
    33         virtual void visit( UntypedExpr *untypedExpr );
    34         virtual void visit( AddressExpr *addressExpr );
    35         virtual void visit( CastExpr *castExpr );
    36         virtual void visit( UntypedMemberExpr *memberExpr );
    37         virtual void visit( MemberExpr *memberExpr );
    38         virtual void visit( NameExpr *variableExpr );
    39         virtual void visit( VariableExpr *variableExpr );
    40         virtual void visit( ConstantExpr *constantExpr );
    41         virtual void visit( SizeofExpr *sizeofExpr );
    42         virtual void visit( AttrExpr *attrExpr );
    43         virtual void visit( LogicalExpr *logicalExpr );
    44         virtual void visit( ConditionalExpr *conditionalExpr );
    45         virtual void visit( CommaExpr *commaExpr );
    46         virtual void visit( TupleExpr *tupleExpr );
    47       public:  // xxx - temporary hack - should make Tuples::TupleAssignment a friend
    48         template< typename InputIterator, typename OutputIterator >
    49             void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );
     28        class AlternativeFinder : public Visitor {
     29          public:
     30                AlternativeFinder( const SymTab::Indexer &indexer, const TypeEnvironment &env );
     31                void find( Expression *expr, bool adjust = false );
     32                void findWithAdjustment( Expression *expr );
     33                AltList &get_alternatives() { return alternatives; }
    5034
    51       private:
    52         template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const std::string &name );
    53         bool instantiateFunction( std::list< DeclarationWithType* >& formals, /*const*/ AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave );
    54         template< typename OutputIterator >
    55             void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, AltList &actualAlt, OutputIterator out );
    56         template< typename OutputIterator >
    57             void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out );
    58         void resolveAttr( DeclarationWithType *funcDecl, FunctionType *function, Type *argType, const TypeEnvironment &env );
     35                // make this look like an STL container so that we can apply generic algorithms
     36                typedef Alternative value_type;
     37                typedef AltList::iterator iterator;
     38                typedef AltList::const_iterator const_iterator;
     39                AltList::iterator begin() { return alternatives.begin(); }
     40                AltList::iterator end() { return alternatives.end(); }
     41                AltList::const_iterator begin() const { return alternatives.begin(); }
     42                AltList::const_iterator end() const { return alternatives.end(); }
    5943
    60         const SymTab::Indexer &indexer;
    61         AltList alternatives;
    62         const TypeEnvironment &env;
    63     }; // AlternativeFinder
     44                const SymTab::Indexer &get_indexer() const { return indexer; }
     45                const TypeEnvironment &get_environ() const { return env; }
     46          private:
     47                virtual void visit( ApplicationExpr *applicationExpr );
     48                virtual void visit( UntypedExpr *untypedExpr );
     49                virtual void visit( AddressExpr *addressExpr );
     50                virtual void visit( CastExpr *castExpr );
     51                virtual void visit( UntypedMemberExpr *memberExpr );
     52                virtual void visit( MemberExpr *memberExpr );
     53                virtual void visit( NameExpr *variableExpr );
     54                virtual void visit( VariableExpr *variableExpr );
     55                virtual void visit( ConstantExpr *constantExpr );
     56                virtual void visit( SizeofExpr *sizeofExpr );
     57                virtual void visit( AttrExpr *attrExpr );
     58                virtual void visit( LogicalExpr *logicalExpr );
     59                virtual void visit( ConditionalExpr *conditionalExpr );
     60                virtual void visit( CommaExpr *commaExpr );
     61                virtual void visit( TupleExpr *tupleExpr );
     62          public:  // xxx - temporary hack - should make Tuples::TupleAssignment a friend
     63                template< typename InputIterator, typename OutputIterator >
     64                void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );
    6465
    65     Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env );
     66          private:
     67                template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const std::string &name );
     68                bool instantiateFunction( std::list< DeclarationWithType* >& formals, /*const*/ AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave );
     69                template< typename OutputIterator >
     70                void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, AltList &actualAlt, OutputIterator out );
     71                template< typename OutputIterator >
     72                void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out );
     73                void resolveAttr( DeclarationWithType *funcDecl, FunctionType *function, Type *argType, const TypeEnvironment &env );
     74
     75                const SymTab::Indexer &indexer;
     76                AltList alternatives;
     77                const TypeEnvironment &env;
     78        }; // AlternativeFinder
     79
     80        Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env );
    6681} // namespace ResolvExpr
    6782
    6883#endif // ALTERNATIVEFINDER_H
     84
     85// Local Variables: //
     86// tab-width: 4 //
     87// mode: c++ //
     88// compile-command: "make install" //
     89// End: //
Note: See TracChangeset for help on using the changeset viewer.