source: src/Tuples/Tuples.h @ 01d433e

new-ast-unique-expr
Last change on this file since 01d433e was 01d433e, checked in by Henry Xue <y58xue@…>, 4 months ago

Convert expandUniqueExpr pass to use new AST (NOT WORKING)

Currently not working due to unresolved issues with UniqueExpr?. See
page 5 of https://cforall.uwaterloo.ca/doc/Fangren_Yu_Report_S20.pdf
for more details.

  • Property mode set to 100644
File size: 2.5 KB
Line 
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 : Andrew Beach
12// Last Modified On : Tue Jun 18 09:36:00 2019
13// Update Count     : 18
14//
15
16#pragma once
17
18#include <string>
19#include <vector>
20
21#include "AST/Fwd.hpp"
22#include "AST/Node.hpp"
23#include "SynTree/Expression.h"
24#include "SynTree/Declaration.h"
25#include "SynTree/Type.h"
26
27#include "ResolvExpr/AlternativeFinder.h"
28#include "ResolvExpr/CandidateFinder.hpp"
29
30namespace Tuples {
31        // TupleAssignment.cc
32        void handleTupleAssignment( ResolvExpr::AlternativeFinder & currentFinder, UntypedExpr * assign,
33                std::vector< ResolvExpr::AlternativeFinder >& args );
34        void handleTupleAssignment( 
35                ResolvExpr::CandidateFinder & finder, const ast::UntypedExpr * assign, 
36                std::vector< ResolvExpr::CandidateFinder > & args );
37
38        // TupleExpansion.cc
39        /// expands z.[a, b.[x, y], c] into [z.a, z.b.x, z.b.y, z.c], inserting UniqueExprs as appropriate
40        void expandMemberTuples( std::list< Declaration * > & translationUnit );
41
42        /// replaces tuple-related elements, such as TupleType, TupleExpr, TupleAssignExpr, etc.
43        void expandTuples( std::list< Declaration * > & translationUnit );
44
45        /// replaces UniqueExprs with a temporary variable and one call
46        void expandUniqueExpr( std::list< Declaration * > & translationUnit );
47        void expandUniqueExpr( ast::TranslationUnit & translationUnit );
48
49        /// returns VoidType if any of the expressions have Voidtype, otherwise TupleType of the Expression result types
50        Type * makeTupleType( const std::list< Expression * > & exprs );
51        const ast::Type * makeTupleType( const std::vector<ast::ptr<ast::Expr>> & exprs );
52
53        /// returns a TypeInstType if `type` is a ttype, nullptr otherwise
54        TypeInstType * isTtype( Type * type );
55        const TypeInstType * isTtype( const Type * type );
56        const ast::TypeInstType * isTtype( const ast::Type * type );
57
58        /// returns true if the expression may contain side-effects.
59        bool maybeImpure( const Expression * expr );
60        bool maybeImpure( const ast::Expr * expr );
61
62        /// Returns true if the expression may contain side-effect,
63        /// ignoring the presence of unique expressions.
64        bool maybeImpureIgnoreUnique( const Expression * expr );
65        bool maybeImpureIgnoreUnique( const ast::Expr * expr );
66} // namespace Tuples
67
68// Local Variables: //
69// tab-width: 4 //
70// mode: c++ //
71// compile-command: "make install" //
72// End: //
Note: See TracBrowser for help on using the repository browser.