| 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.hpp -- A collection of tuple operations. | 
|---|
| 8 | // | 
|---|
| 9 | // Author           : Rodolfo G. Esteves | 
|---|
| 10 | // Created On       : Mon May 18 07:44:20 2015 | 
|---|
| 11 | // Last Modified By : Henry Xue | 
|---|
| 12 | // Last Modified On : Mon Aug 23 15:36:09 2021 | 
|---|
| 13 | // Update Count     : 19 | 
|---|
| 14 | // | 
|---|
| 15 |  | 
|---|
| 16 | #pragma once | 
|---|
| 17 |  | 
|---|
| 18 | #include <string> | 
|---|
| 19 | #include <vector> | 
|---|
| 20 |  | 
|---|
| 21 | #include "AST/Fwd.hpp" | 
|---|
| 22 | #include "AST/Node.hpp" | 
|---|
| 23 | namespace ResolvExpr { | 
|---|
| 24 | struct CandidateFinder; | 
|---|
| 25 | } | 
|---|
| 26 |  | 
|---|
| 27 | namespace Tuples { | 
|---|
| 28 |  | 
|---|
| 29 | // TupleAssignment.cpp | 
|---|
| 30 | void handleTupleAssignment( | 
|---|
| 31 | ResolvExpr::CandidateFinder & finder, const ast::UntypedExpr * assign, | 
|---|
| 32 | std::vector< ResolvExpr::CandidateFinder > & args ); | 
|---|
| 33 |  | 
|---|
| 34 | // TupleExpansion.cpp | 
|---|
| 35 | /// Expands z.[a, b.[x, y], c] into [z.a, z.b.x, z.b.y, z.c], inserting UniqueExprs as appropriate. | 
|---|
| 36 | void expandMemberTuples( ast::TranslationUnit & translationUnit ); | 
|---|
| 37 |  | 
|---|
| 38 | /// Replaces tuple-related elements, such as TupleType, TupleExpr, TupleAssignExpr, etc. | 
|---|
| 39 | void expandTuples( ast::TranslationUnit & translaionUnit ); | 
|---|
| 40 |  | 
|---|
| 41 | /// Replaces UniqueExprs with a temporary variable and one call. | 
|---|
| 42 | void expandUniqueExpr( ast::TranslationUnit & translationUnit ); | 
|---|
| 43 |  | 
|---|
| 44 | /// Returns VoidType if any of the expressions have Voidtype, otherwise TupleType of the Expression result types. | 
|---|
| 45 | const ast::Type * makeTupleType( const std::vector<ast::ptr<ast::Expr>> & exprs ); | 
|---|
| 46 |  | 
|---|
| 47 | /// Returns a TypeInstType if `type` is a ttype, nullptr otherwise | 
|---|
| 48 | const ast::TypeInstType * isTtype( const ast::Type * type ); | 
|---|
| 49 |  | 
|---|
| 50 | /// Returns true if the expression may contain side-effects. | 
|---|
| 51 | bool maybeImpure( const ast::Expr * expr ); | 
|---|
| 52 |  | 
|---|
| 53 | /// Returns true if the expression may contain side-effect, | 
|---|
| 54 | /// ignoring the presence of unique expressions. | 
|---|
| 55 | bool maybeImpureIgnoreUnique( const ast::Expr * expr ); | 
|---|
| 56 |  | 
|---|
| 57 | } // namespace Tuples | 
|---|
| 58 |  | 
|---|
| 59 | // Local Variables: // | 
|---|
| 60 | // tab-width: 4 // | 
|---|
| 61 | // mode: c++ // | 
|---|
| 62 | // compile-command: "make install" // | 
|---|
| 63 | // End: // | 
|---|