[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 | //
|
---|
[6eb8948] | 7 | // Tuples.h --
|
---|
[51587aa] | 8 | //
|
---|
[843054c2] | 9 | // Author : Rodolfo G. Esteves
|
---|
[51587aa] | 10 | // Created On : Mon May 18 07:44:20 2015
|
---|
[6b0b624] | 11 | // Last Modified By : Peter A. Buhr
|
---|
| 12 | // Last Modified On : Sat Jul 22 09:55:00 2017
|
---|
| 13 | // Update Count : 16
|
---|
[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"
|
---|
[51b73452] | 23 | #include "SynTree/Expression.h"
|
---|
| 24 | #include "SynTree/Declaration.h"
|
---|
| 25 | #include "SynTree/Type.h"
|
---|
| 26 |
|
---|
[141b786] | 27 | #include "ResolvExpr/AlternativeFinder.h"
|
---|
| 28 |
|
---|
[51b73452] | 29 | namespace Tuples {
|
---|
[6eb8948] | 30 | // TupleAssignment.cc
|
---|
[77bfc80] | 31 | void handleTupleAssignment( ResolvExpr::AlternativeFinder & currentFinder, UntypedExpr * assign,
|
---|
[c43c171] | 32 | std::vector< ResolvExpr::AlternativeFinder >& args );
|
---|
[77bfc80] | 33 |
|
---|
[6eb8948] | 34 | // TupleExpansion.cc
|
---|
[bf32bb8] | 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( std::list< Declaration * > & translationUnit );
|
---|
| 37 |
|
---|
| 38 | /// replaces tuple-related elements, such as TupleType, TupleExpr, TupleAssignExpr, etc.
|
---|
[6eb8948] | 39 | void expandTuples( std::list< Declaration * > & translationUnit );
|
---|
[3c13c03] | 40 |
|
---|
[bf32bb8] | 41 | /// replaces UniqueExprs with a temporary variable and one call
|
---|
| 42 | void expandUniqueExpr( std::list< Declaration * > & translationUnit );
|
---|
[aefcc3b] | 43 |
|
---|
[bf32bb8] | 44 | /// returns VoidType if any of the expressions have Voidtype, otherwise TupleType of the Expression result types
|
---|
| 45 | Type * makeTupleType( const std::list< Expression * > & exprs );
|
---|
[9b4f329] | 46 | const ast::Type * makeTupleType( const std::vector<ast::ptr<ast::Expr>> & exprs );
|
---|
[65660bd] | 47 |
|
---|
[8bf784a] | 48 | /// returns a TypeInstType if `type` is a ttype, nullptr otherwise
|
---|
| 49 | TypeInstType * isTtype( Type * type );
|
---|
[77bfc80] | 50 | const ast::TypeInstType * isTtype( const ast::Type * type );
|
---|
[8bf784a] | 51 |
|
---|
[bf32bb8] | 52 | /// returns true if the expression may contain side-effects.
|
---|
| 53 | bool maybeImpure( Expression * expr );
|
---|
[9f10c4b8] | 54 |
|
---|
| 55 | /// returns true if the expression may contain side-effect, ignoring the presence of unique expressions.
|
---|
| 56 | bool maybeImpureIgnoreUnique( Expression * expr );
|
---|
[51b73452] | 57 | } // namespace Tuples
|
---|
| 58 |
|
---|
[51587aa] | 59 | // Local Variables: //
|
---|
| 60 | // tab-width: 4 //
|
---|
| 61 | // mode: c++ //
|
---|
| 62 | // compile-command: "make install" //
|
---|
| 63 | // End: //
|
---|