support inlining of non-outermost call expressions
[pet.git] / inlined_calls.h
blob171bf5c2d0f1d682317373c51bc523a6a758d6eb
1 #ifndef PET_INLINED_CALLS_H
2 #define PET_INLINED_CALLS_H
4 #include <vector>
5 #include <map>
7 #include <clang/AST/Decl.h>
8 #include <clang/AST/Expr.h>
9 #include <clang/AST/Stmt.h>
10 #include <clang/AST/RecursiveASTVisitor.h>
12 struct PetScan;
14 /* Structure for keeping track of inlined calls in an expression statement.
16 * "calls" collects the calls that appear in the expression statement and
17 * that need to be inlined from outermost to innermost.
18 * "inlined" collects the inlined pet_tree objects corresponding to elements
19 * in "calls" in reverse order.
20 * "call2id" maps inlined call expressions that return a value to
21 * the corresponding variable.
22 * "scan" is used to extract the inlined calls.
24 struct pet_inlined_calls : clang::RecursiveASTVisitor<pet_inlined_calls> {
25 std::vector<clang::Stmt *> calls;
26 std::vector<pet_tree *> inlined;
27 std::map<clang::Stmt *, isl_id *> call2id;
28 PetScan *scan;
30 pet_inlined_calls(PetScan *scan) : scan(scan) {}
31 ~pet_inlined_calls();
33 bool VisitCallExpr(clang::CallExpr *call);
35 void add(clang::CallExpr *call);
36 void collect(clang::Stmt *stmt);
37 __isl_give pet_tree *add_inlined(__isl_take pet_tree *tree);
40 #endif