| 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 | // Tuples.h -- | 
|---|
| 8 | // | 
|---|
| 9 | // Author           : Rodolfo G. Esteves | 
|---|
| 10 | // Created On       : Mon May 18 07:44:20 2015 | 
|---|
| 11 | // Last Modified By : Peter A. Buhr | 
|---|
| 12 | // Last Modified On : Sat Jul 22 09:55:00 2017 | 
|---|
| 13 | // Update Count     : 16 | 
|---|
| 14 | // | 
|---|
| 15 |  | 
|---|
| 16 | #pragma once | 
|---|
| 17 |  | 
|---|
| 18 | #include <string> | 
|---|
| 19 |  | 
|---|
| 20 | #include "SynTree/Expression.h" | 
|---|
| 21 | #include "SynTree/Declaration.h" | 
|---|
| 22 | #include "SynTree/Type.h" | 
|---|
| 23 |  | 
|---|
| 24 | #include "ResolvExpr/AlternativeFinder.h" | 
|---|
| 25 |  | 
|---|
| 26 | namespace Tuples { | 
|---|
| 27 | // TupleAssignment.cc | 
|---|
| 28 | void handleTupleAssignment( ResolvExpr::AlternativeFinder & currentFinder, UntypedExpr * assign, const std::list<ResolvExpr::AltList> & possibilities ); | 
|---|
| 29 |  | 
|---|
| 30 | // TupleExpansion.cc | 
|---|
| 31 | /// expands z.[a, b.[x, y], c] into [z.a, z.b.x, z.b.y, z.c], inserting UniqueExprs as appropriate | 
|---|
| 32 | void expandMemberTuples( std::list< Declaration * > & translationUnit ); | 
|---|
| 33 |  | 
|---|
| 34 | /// replaces tuple-related elements, such as TupleType, TupleExpr, TupleAssignExpr, etc. | 
|---|
| 35 | void expandTuples( std::list< Declaration * > & translationUnit ); | 
|---|
| 36 |  | 
|---|
| 37 | /// replaces UniqueExprs with a temporary variable and one call | 
|---|
| 38 | void expandUniqueExpr( std::list< Declaration * > & translationUnit ); | 
|---|
| 39 |  | 
|---|
| 40 | /// returns VoidType if any of the expressions have Voidtype, otherwise TupleType of the Expression result types | 
|---|
| 41 | Type * makeTupleType( const std::list< Expression * > & exprs ); | 
|---|
| 42 |  | 
|---|
| 43 | /// returns a TypeInstType if `type` is a ttype, nullptr otherwise | 
|---|
| 44 | TypeInstType * isTtype( Type * type ); | 
|---|
| 45 |  | 
|---|
| 46 | /// returns true if the expression may contain side-effects. | 
|---|
| 47 | bool maybeImpure( Expression * expr ); | 
|---|
| 48 |  | 
|---|
| 49 | /// returns true if the expression may contain side-effect, ignoring the presence of unique expressions. | 
|---|
| 50 | bool maybeImpureIgnoreUnique( Expression * expr ); | 
|---|
| 51 | } // namespace Tuples | 
|---|
| 52 |  | 
|---|
| 53 | // Local Variables: // | 
|---|
| 54 | // tab-width: 4 // | 
|---|
| 55 | // mode: c++ // | 
|---|
| 56 | // compile-command: "make install" // | 
|---|
| 57 | // End: // | 
|---|