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