From 253cd82652ef9d79f0a3ec24ca7f06615e60db93 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 11 Aug 2015 14:10:38 +0200 Subject: [PATCH] support inlining of outermost call expressions In particular, any expression statement of which the outer expression is a call to a function, the definition of which is marked "inline", is replaced by an inlined copy of the called function. Calls that appear as subexpressions are not inlined because that would require support for return statements. The inlining is performed at the level of (unevaluated) pet_trees to ensure a consistent view of what variables are considered parameters. The inlining is performed by assigning the scalar arguments and the indices of the array arguments to temporary variables and replacing the corresponding formal arguments in the tree extracted from the function body by expression referring to or containing these temporary variables. The regular evaluation mechanism is then used to propagate the scalar values whenever feasible. Signed-off-by: Sven Verdoolaege --- scan.cc | 148 ++++++++++++++++++++++++++++++ scan.h | 11 ++- tests/inline1.c | 12 +++ tests/inline1.scop | 107 +++++++++++++++++++++ tests/inline2.c | 12 +++ tests/inline2.scop | 57 ++++++++++++ tests/inline3.c | 13 +++ tests/inline3.scop | 105 +++++++++++++++++++++ tests/inline4.c | 13 +++ tests/inline4.scop | 136 +++++++++++++++++++++++++++ tests/inline5.c | 13 +++ tests/inline5.scop | 190 ++++++++++++++++++++++++++++++++++++++ tests/inline6.c | 25 +++++ tests/inline6.scop | 265 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/inline7.c | 28 ++++++ tests/inline7.scop | 101 ++++++++++++++++++++ tests/inline8.c | 22 +++++ tests/inline8.scop | 98 ++++++++++++++++++++ tests/inline9.c | 30 ++++++ tests/inline9.scop | 186 +++++++++++++++++++++++++++++++++++++ 20 files changed, 1571 insertions(+), 1 deletion(-) create mode 100644 tests/inline1.c create mode 100644 tests/inline1.scop create mode 100644 tests/inline2.c create mode 100644 tests/inline2.scop create mode 100644 tests/inline3.c create mode 100644 tests/inline3.scop create mode 100644 tests/inline4.c create mode 100644 tests/inline4.scop create mode 100644 tests/inline5.c create mode 100644 tests/inline5.scop create mode 100644 tests/inline6.c create mode 100644 tests/inline6.scop create mode 100644 tests/inline7.c create mode 100644 tests/inline7.scop create mode 100644 tests/inline8.c create mode 100644 tests/inline8.scop create mode 100644 tests/inline9.c create mode 100644 tests/inline9.scop diff --git a/scan.cc b/scan.cc index dd4bbc6..2579f4c 100644 --- a/scan.cc +++ b/scan.cc @@ -58,6 +58,7 @@ #include "context.h" #include "expr.h" #include "id.h" +#include "inliner.h" #include "nest.h" #include "options.h" #include "scan.h" @@ -301,6 +302,17 @@ void PetScan::report_missing_summary_function_body(Stmt *stmt) report(stmt, id); } +/* Report an unsupported argument in a call to an inlined function, + * unless autodetect is set. + */ +void PetScan::report_unsupported_inline_function_argument(Stmt *stmt) +{ + DiagnosticsEngine &diag = PP.getDiagnostics(); + unsigned id = diag.getCustomDiagID(DiagnosticsEngine::Warning, + "unsupported inline function call argument"); + report(stmt, id); +} + /* Extract an integer from "val", which is assumed to be non-negative. */ static __isl_give isl_val *extract_unsigned(isl_ctx *ctx, @@ -1766,13 +1778,149 @@ __isl_give pet_tree *PetScan::update_loc(__isl_take pet_tree *tree, Stmt *stmt) return tree; } +/* Is "expr" of a type that can be converted to an access expression? + */ +static bool is_access_expr_type(Expr *expr) +{ + switch (expr->getStmtClass()) { + case Stmt::ArraySubscriptExprClass: + case Stmt::DeclRefExprClass: + case Stmt::MemberExprClass: + return true; + default: + return false; + } +} + +/* Tell the pet_inliner "inliner" about the formal arguments + * in "fd" and the corresponding actual arguments in "call". + * Return 0 if this was successful and -1 otherwise. + * + * Any pointer argument is treated as an array. + * The other arguments are treated as scalars. + * + * In case of scalars, there is no restriction on the actual argument. + * This actual argument is assigned to a variable with a name + * that is derived from the name of the corresponding formal argument, + * but made not to conflict with any variable names that are + * already in use. + * + * In case of arrays, the actual argument needs to be an expression + * of a type that can be converted to an access expression or the address + * of such an expression, ignoring implicit and redundant casts. + */ +int PetScan::set_inliner_arguments(pet_inliner &inliner, CallExpr *call, + FunctionDecl *fd) +{ + unsigned n; + + n = fd->getNumParams(); + for (int i = 0; i < n; ++i) { + ParmVarDecl *parm = fd->getParamDecl(i); + QualType type = parm->getType(); + Expr *arg, *sub; + pet_expr *expr; + int is_addr = 0; + + arg = call->getArg(i); + if (array_depth(type.getTypePtr()) == 0) { + string name = parm->getName().str(); + if (name_in_use(name, NULL)) + name = generate_new_name(name); + inliner.add_scalar_arg(parm, name, extract_expr(arg)); + continue; + } + arg = pet_clang_strip_casts(arg); + sub = extract_addr_of_arg(arg); + if (sub) { + is_addr = 1; + arg = pet_clang_strip_casts(sub); + } + if (!is_access_expr_type(arg)) { + report_unsupported_inline_function_argument(arg); + return -1; + } + expr = extract_access_expr(arg); + if (!expr) + return -1; + inliner.add_array_arg(parm, expr, is_addr); + } + + return 0; +} + +/* Try and construct a pet_tree from the body of "fd" using the actual + * arguments in "call" in place of the formal arguments. + * "fd" is assumed to point to the declaration with a function body. + * In particular, construct a block that consists of assignments + * of (parts of) the actual arguments to temporary variables + * followed by the inlined function body with the formal arguments + * replaced by (expressions containing) these temporary variables. + * + * The actual inlining is taken care of by the pet_inliner function. + * This function merely calls set_inliner_arguments to tell + * the pet_inliner about the actual arguments, extracts a pet_tree + * from the body of the called function and then passes this pet_tree + * to the pet_inliner. + * + * During the extraction of the function body, all variables names + * that are declared in the calling function as well all variable + * names that are known to be in use are considered to be in use + * in the called function to ensure that there is no naming conflict. + * Similarly, the additional names that are in use in the called function + * are considered to be in use in the calling function as well. + * + * The location of the pet_tree is reset to the call site to ensure + * that the extent of the scop does not include the body of the called + * function. + */ +__isl_give pet_tree *PetScan::extract_inlined_call(CallExpr *call, + FunctionDecl *fd) +{ + int save_autodetect; + pet_tree *tree; + pet_loc *tree_loc; + pet_inliner inliner(ctx, n_arg, ast_context); + + if (set_inliner_arguments(inliner, call, fd) < 0) + return NULL; + + save_autodetect = options->autodetect; + options->autodetect = 0; + PetScan body_scan(PP, ast_context, fd, loc, options, + isl_union_map_copy(value_bounds), independent); + collect_declared_names(); + body_scan.add_new_used_names(declared_names); + body_scan.add_new_used_names(used_names); + tree = body_scan.extract(fd->getBody(), false); + add_new_used_names(body_scan.used_names); + options->autodetect = save_autodetect; + + tree_loc = construct_pet_loc(call->getSourceRange(), true); + tree = pet_tree_set_loc(tree, tree_loc); + + return inliner.inline_tree(tree); +} + /* Try and construct a pet_tree corresponding * to the expression statement "stmt". + * + * If the outer expression is a function call and if the corresponding + * function body is marked "inline", then return a pet_tree + * corresponding to the inlined function. */ __isl_give pet_tree *PetScan::extract_expr_stmt(Stmt *stmt) { pet_expr *expr; + if (stmt->getStmtClass() == Stmt::CallExprClass) { + CallExpr *call = cast(stmt); + FunctionDecl *fd = call->getDirectCallee(); + fd = pet_clang_find_function_decl_with_body(fd); + if (fd && fd->isInlineSpecified()) + return extract_inlined_call(call, fd); + } + expr = extract_expr(cast(stmt)); return extract(expr, stmt->getSourceRange(), true); } diff --git a/scan.h b/scan.h index 054a674..90ba3c7 100644 --- a/scan.h +++ b/scan.h @@ -10,6 +10,7 @@ #include #include "context.h" +#include "inliner.h" #include "loc.h" #include "scop.h" #include "summary.h" @@ -117,6 +118,9 @@ struct PetScan { /* A set of names known to be in use. */ std::set used_names; + /* Sequence number of the next temporary inlined argument variable. */ + int n_arg; + PetScan(clang::Preprocessor &PP, clang::ASTContext &ast_context, clang::DeclContext *decl_context, ScopLoc &loc, pet_options *options, __isl_take isl_union_map *value_bounds, @@ -126,7 +130,7 @@ struct PetScan { options(options), value_bounds(value_bounds), partial(false), last_line(0), current_line(0), independent(independent), n_rename(0), - declared_names_collected(false) { } + declared_names_collected(false), n_arg(0) { } ~PetScan(); @@ -201,6 +205,10 @@ private: clang::ValueDecl *iv); __isl_give pet_tree *extract_for(clang::ForStmt *stmt); __isl_give pet_tree *extract_expr_stmt(clang::Stmt *stmt); + __isl_give pet_tree *extract_inlined_call(clang::CallExpr *call, + clang::FunctionDecl *fd); + int set_inliner_arguments(pet_inliner &inliner, clang::CallExpr *call, + clang::FunctionDecl *fd); __isl_give pet_expr *extract_assume(clang::Expr *expr); __isl_give pet_function_summary *get_summary(clang::FunctionDecl *fd); @@ -249,4 +257,5 @@ private: void report_missing_increment(clang::Stmt *stmt); void report_missing_summary_function(clang::Stmt *stmt); void report_missing_summary_function_body(clang::Stmt *stmt); + void report_unsupported_inline_function_argument(clang::Stmt *stmt); }; diff --git a/tests/inline1.c b/tests/inline1.c new file mode 100644 index 0000000..cb950ac --- /dev/null +++ b/tests/inline1.c @@ -0,0 +1,12 @@ +inline void g(int a) +{ + a += 1; +} + +void f() +{ +#pragma scop + int a = 1; + g(a); +#pragma endscop +} diff --git a/tests/inline1.scop b/tests/inline1.scop new file mode 100644 index 0000000..6f8c931 --- /dev/null +++ b/tests/inline1.scop @@ -0,0 +1,107 @@ +start: 46 +end: 94 +indent: "\t" +context: '{ : }' +schedule: '{ domain: "{ S_3[]; S_0[]; S_5[]; S_4[]; S_1[]; S_2[] }", child: { sequence: + [ { filter: "{ S_0[] }" }, { filter: "{ S_1[] }" }, { filter: "{ S_2[] }" }, { filter: + "{ S_3[] }" }, { filter: "{ S_5[] }" }, { filter: "{ S_4[] }" } ] } }' +arrays: +- context: '{ : }' + extent: '{ a[] }' + element_type: int + element_size: 4 + declared: 1 + exposed: 1 +- context: '{ : }' + extent: '{ a_0[] }' + element_type: int + element_size: 4 + declared: 1 +statements: +- line: 9 + domain: '{ S_0[] }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_0[] -> a[] }' + index: '{ S_0[] -> a[] }' + reference: __pet_ref_0 + kill: 1 +- line: 9 + domain: '{ S_1[] }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_1[] -> a[] }' + reference: __pet_ref_1 + read: 0 + write: 1 + - type: int + value: 1 +- line: -1 + domain: '{ S_2[] }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_2[] -> a_0[] }' + index: '{ S_2[] -> a_0[] }' + reference: __pet_ref_2 + kill: 1 +- line: -1 + domain: '{ S_3[] }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_3[] -> a_0[] }' + reference: __pet_ref_3 + read: 0 + write: 1 + - type: access + index: '{ S_3[] -> [(1)] }' + reference: __pet_ref_4 + read: 1 + write: 0 +- line: 3 + domain: '{ S_5[] }' + body: + type: expression + expr: + type: op + operation: += + arguments: + - type: access + index: '{ S_5[] -> a_0[] }' + reference: __pet_ref_5 + read: 1 + write: 1 + - type: int + value: 1 +- line: -1 + domain: '{ S_4[] }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_4[] -> a_0[] }' + index: '{ S_4[] -> a_0[] }' + reference: __pet_ref_6 + kill: 1 diff --git a/tests/inline2.c b/tests/inline2.c new file mode 100644 index 0000000..eb4e2e8 --- /dev/null +++ b/tests/inline2.c @@ -0,0 +1,12 @@ +inline void g(int *a) +{ + a[0] += 1; +} + +void f() +{ +#pragma scop + int a = 1; + g(&a); +#pragma endscop +} diff --git a/tests/inline2.scop b/tests/inline2.scop new file mode 100644 index 0000000..aa5e533 --- /dev/null +++ b/tests/inline2.scop @@ -0,0 +1,57 @@ +start: 50 +end: 99 +indent: "\t" +context: '{ : }' +schedule: '{ domain: "{ S_0[]; S_2[]; S_1[] }", child: { sequence: [ { filter: "{ + S_0[] }" }, { filter: "{ S_1[] }" }, { filter: "{ S_2[] }" } ] } }' +arrays: +- context: '{ : }' + extent: '{ a[] }' + element_type: int + element_size: 4 + declared: 1 + exposed: 1 +statements: +- line: 9 + domain: '{ S_0[] }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_0[] -> a[] }' + index: '{ S_0[] -> a[] }' + reference: __pet_ref_0 + kill: 1 +- line: 9 + domain: '{ S_1[] }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_1[] -> a[] }' + reference: __pet_ref_1 + read: 0 + write: 1 + - type: int + value: 1 +- line: 3 + domain: '{ S_2[] }' + body: + type: expression + expr: + type: op + operation: += + arguments: + - type: access + index: '{ S_2[] -> a[] }' + reference: __pet_ref_2 + read: 1 + write: 1 + - type: int + value: 1 diff --git a/tests/inline3.c b/tests/inline3.c new file mode 100644 index 0000000..dbb1f91 --- /dev/null +++ b/tests/inline3.c @@ -0,0 +1,13 @@ +inline void g(int *a) +{ + a[0] += 1; +} + +void f() +{ +#pragma scop + int a[10]; + a[5] = 1; + g(&a[5]); +#pragma endscop +} diff --git a/tests/inline3.scop b/tests/inline3.scop new file mode 100644 index 0000000..8ba3469 --- /dev/null +++ b/tests/inline3.scop @@ -0,0 +1,105 @@ +start: 50 +end: 113 +indent: "\t" +context: '{ : }' +schedule: '{ domain: "{ S_3[]; S_0[]; S_5[]; S_4[]; S_1[]; S_2[] }", child: { sequence: + [ { filter: "{ S_0[] }" }, { filter: "{ S_1[] }" }, { filter: "{ S_2[] }" }, { filter: + "{ S_3[] }" }, { filter: "{ S_5[] }" }, { filter: "{ S_4[] }" } ] } }' +arrays: +- context: '{ : }' + extent: '{ a[i0] : i0 >= 0 and i0 <= 9 }' + element_type: int + element_size: 4 + declared: 1 + exposed: 1 +- context: '{ : }' + extent: '{ __pet_arg_0[] }' + element_type: int + element_size: 4 + declared: 1 +statements: +- line: 9 + domain: '{ S_0[] }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_0[] -> a[o0] : o0 >= 0 and o0 <= 9 }' + index: '{ S_0[] -> a[] }' + depth: 1 + reference: __pet_ref_0 + kill: 1 +- line: 10 + domain: '{ S_1[] }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_1[] -> a[(5)] }' + reference: __pet_ref_1 + read: 0 + write: 1 + - type: int + value: 1 +- line: -1 + domain: '{ S_2[] }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_2[] -> __pet_arg_0[] }' + index: '{ S_2[] -> __pet_arg_0[] }' + reference: __pet_ref_2 + kill: 1 +- line: -1 + domain: '{ S_3[] }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_3[] -> __pet_arg_0[] }' + reference: __pet_ref_3 + read: 0 + write: 1 + - type: int + value: 5 +- line: 3 + domain: '{ S_5[] }' + body: + type: expression + expr: + type: op + operation: += + arguments: + - type: access + index: '{ S_5[] -> a[(5)] }' + reference: __pet_ref_4 + read: 1 + write: 1 + - type: int + value: 1 +- line: -1 + domain: '{ S_4[] }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_4[] -> __pet_arg_0[] }' + index: '{ S_4[] -> __pet_arg_0[] }' + reference: __pet_ref_5 + kill: 1 diff --git a/tests/inline4.c b/tests/inline4.c new file mode 100644 index 0000000..31e5b3d --- /dev/null +++ b/tests/inline4.c @@ -0,0 +1,13 @@ +inline void g(int n, int a[n]) +{ + for (int i = 0; i < n; ++i) + a[i] = 0; +} + +void f(int n, int m, int a[n][m]) +{ +#pragma scop + for (int i = 0; i < n; ++i) + g(m, a[i]); +#pragma endscop +} diff --git a/tests/inline4.scop b/tests/inline4.scop new file mode 100644 index 0000000..21a3ebb --- /dev/null +++ b/tests/inline4.scop @@ -0,0 +1,136 @@ +start: 113 +end: 185 +indent: "\t" +context: '[m, n] -> { : m >= 0 and m <= 2147483647 and n <= 2147483647 and n >= -2147483648 + }' +schedule: '{ domain: "[m, n] -> { S_4[i] : i >= 0 and i <= -1 + n; S_2[i] : i >= 0 + and i <= -1 + n; S_6[i, i''] : i >= 0 and i <= -1 + n and i'' >= 0 and i'' <= -1 + + m; S_0[i] : i >= 0 and i <= -1 + n; S_3[i] : i >= 0 and i <= -1 + n; S_1[i] : + i >= 0 and i <= -1 + n; S_5[i] : i >= 0 and i <= -1 + n }", child: { schedule: "[n, + m] -> L_0[{ S_3[i] -> [(i)]; S_6[i, i''] -> [(i)]; S_1[i] -> [(i)]; S_5[i] -> [(i)]; + S_4[i] -> [(i)]; S_2[i] -> [(i)]; S_0[i] -> [(i)] }]", child: { sequence: [ { filter: + "[n, m] -> { S_0[i] }" }, { filter: "[n, m] -> { S_1[i] }" }, { filter: "[n, m] + -> { S_3[i] }" }, { filter: "[n, m] -> { S_4[i] }" }, { filter: "[n, m] -> { S_6[i, + i''] }", child: { schedule: "[n, m] -> L_1[{ S_6[i, i''] -> [(i'')] }]" } }, { filter: + "[n, m] -> { S_5[i]; S_2[i] }", child: { set: [ { filter: "[n] -> { S_2[i] }" }, + { filter: "[n] -> { S_5[i] }" } ] } } ] } } }' +arrays: +- context: '{ : }' + extent: '[m, n] -> { n_0[] }' + element_type: int + element_size: 4 + declared: 1 +- context: '{ : }' + extent: '[m, n] -> { __pet_arg_0[] }' + element_type: int + element_size: 4 + declared: 1 +- context: '[m] -> { : m >= 0 }' + extent: '[m, n] -> { a[i0, i1] : i0 >= 0 and i1 >= 0 and i1 <= -1 + m }' + element_type: int + element_size: 4 +statements: +- line: -1 + domain: '[m, n] -> { S_0[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '[m, n] -> { S_0[i] -> n_0[] }' + index: '[m, n] -> { S_0[i] -> n_0[] }' + reference: __pet_ref_0 + kill: 1 +- line: -1 + domain: '[m, n] -> { S_1[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '[m, n] -> { S_1[i] -> n_0[] }' + reference: __pet_ref_1 + read: 0 + write: 1 + - type: access + index: '[m, n] -> { S_1[i] -> [(m)] }' + reference: __pet_ref_2 + read: 1 + write: 0 +- line: -1 + domain: '[m, n] -> { S_3[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '[m, n] -> { S_3[i] -> __pet_arg_0[] }' + index: '[m, n] -> { S_3[i] -> __pet_arg_0[] }' + reference: __pet_ref_3 + kill: 1 +- line: -1 + domain: '[m, n] -> { S_4[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '[m, n] -> { S_4[i] -> __pet_arg_0[] }' + reference: __pet_ref_4 + read: 0 + write: 1 + - type: access + index: '[m, n] -> { S_4[i] -> [(i)] }' + reference: __pet_ref_5 + read: 1 + write: 0 +- line: 4 + domain: '[m, n] -> { S_6[i, i''] : i >= 0 and i <= -1 + n and i'' >= 0 and i'' <= + -1 + m }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '[m, n] -> { S_6[i, i''] -> a[(i), (i'')] }' + reference: __pet_ref_6 + read: 0 + write: 1 + - type: int + value: 0 +- line: -1 + domain: '[m, n] -> { S_2[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '[m, n] -> { S_2[i] -> n_0[] }' + index: '[m, n] -> { S_2[i] -> n_0[] }' + reference: __pet_ref_7 + kill: 1 +- line: -1 + domain: '[m, n] -> { S_5[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '[m, n] -> { S_5[i] -> __pet_arg_0[] }' + index: '[m, n] -> { S_5[i] -> __pet_arg_0[] }' + reference: __pet_ref_8 + kill: 1 diff --git a/tests/inline5.c b/tests/inline5.c new file mode 100644 index 0000000..dc02314 --- /dev/null +++ b/tests/inline5.c @@ -0,0 +1,13 @@ +inline void g(int n, int a[n]) +{ + for (int i = 0; i < n; ++i) + a[i] = 0; +} + +void f(int n, int m, int a[n][m]) +{ +#pragma scop + for (int i = 0; i < n; ++i) + g(m - 2, &a[i][1]); +#pragma endscop +} diff --git a/tests/inline5.scop b/tests/inline5.scop new file mode 100644 index 0000000..641792b --- /dev/null +++ b/tests/inline5.scop @@ -0,0 +1,190 @@ +start: 113 +end: 193 +indent: "\t" +context: '[m, n] -> { : m >= 0 and n <= 2147483647 and n >= -2147483648 and m <= + 2147483647 }' +schedule: '{ domain: "[m, n] -> { S_4[i] : i >= 0 and i <= -1 + n; S_2[i] : i >= 0 + and i <= -1 + n; S_9[i, i''] : i'' <= -3 + m and i >= 0 and i <= -1 + n and i'' + >= 0; S_7[i] : i >= 0 and i <= -1 + n; S_6[i] : i >= 0 and i <= -1 + n; S_0[i] : + i >= 0 and i <= -1 + n; S_3[i] : i >= 0 and i <= -1 + n; S_1[i] : i >= 0 and i <= + -1 + n; S_8[i] : i >= 0 and i <= -1 + n; S_5[i] : i >= 0 and i <= -1 + n }", child: + { schedule: "[n, m] -> L_0[{ S_3[i] -> [(i)]; S_9[i, i''] -> [(i)]; S_1[i] -> [(i)]; + S_5[i] -> [(i)]; S_4[i] -> [(i)]; S_2[i] -> [(i)]; S_8[i] -> [(i)]; S_6[i] -> [(i)]; + S_7[i] -> [(i)]; S_0[i] -> [(i)] }]", child: { sequence: [ { filter: "[n, m] -> + { S_0[i] }" }, { filter: "[n, m] -> { S_1[i] }" }, { filter: "[n, m] -> { S_3[i] + }" }, { filter: "[n, m] -> { S_4[i] }" }, { filter: "[n, m] -> { S_6[i] }" }, { + filter: "[n, m] -> { S_7[i] }" }, { filter: "[n, m] -> { S_9[i, i''] }", child: + { schedule: "[n, m] -> L_1[{ S_9[i, i''] -> [(i'')] }]" } }, { filter: "[n, m] -> + { S_5[i]; S_2[i]; S_8[i] }", child: { set: [ { filter: "[n] -> { S_2[i] }" }, { + filter: "[n] -> { S_5[i] }" }, { filter: "[n] -> { S_8[i] }" } ] } } ] } } }' +arrays: +- context: '{ : }' + extent: '[m, n] -> { n_0[] }' + element_type: int + element_size: 4 + declared: 1 +- context: '{ : }' + extent: '[m, n] -> { __pet_arg_0[] }' + element_type: int + element_size: 4 + declared: 1 +- context: '{ : }' + extent: '[m, n] -> { __pet_arg_1[] }' + element_type: int + element_size: 4 + declared: 1 +- context: '[m] -> { : m >= 0 }' + extent: '[m, n] -> { a[i0, i1] : i0 >= 0 and i1 >= 0 and i1 <= -1 + m }' + element_type: int + element_size: 4 +statements: +- line: -1 + domain: '[m, n] -> { S_0[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '[m, n] -> { S_0[i] -> n_0[] }' + index: '[m, n] -> { S_0[i] -> n_0[] }' + reference: __pet_ref_0 + kill: 1 +- line: -1 + domain: '[m, n] -> { S_1[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '[m, n] -> { S_1[i] -> n_0[] }' + reference: __pet_ref_1 + read: 0 + write: 1 + - type: op + operation: '-' + arguments: + - type: access + index: '[m, n] -> { S_1[i] -> [(m)] }' + reference: __pet_ref_2 + read: 1 + write: 0 + - type: int + value: 2 +- line: -1 + domain: '[m, n] -> { S_3[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '[m, n] -> { S_3[i] -> __pet_arg_0[] }' + index: '[m, n] -> { S_3[i] -> __pet_arg_0[] }' + reference: __pet_ref_3 + kill: 1 +- line: -1 + domain: '[m, n] -> { S_4[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '[m, n] -> { S_4[i] -> __pet_arg_0[] }' + reference: __pet_ref_4 + read: 0 + write: 1 + - type: access + index: '[m, n] -> { S_4[i] -> [(i)] }' + reference: __pet_ref_5 + read: 1 + write: 0 +- line: -1 + domain: '[m, n] -> { S_6[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '[m, n] -> { S_6[i] -> __pet_arg_1[] }' + index: '[m, n] -> { S_6[i] -> __pet_arg_1[] }' + reference: __pet_ref_6 + kill: 1 +- line: -1 + domain: '[m, n] -> { S_7[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '[m, n] -> { S_7[i] -> __pet_arg_1[] }' + reference: __pet_ref_7 + read: 0 + write: 1 + - type: int + value: 1 +- line: 4 + domain: '[m, n] -> { S_9[i, i''] : i'' <= -3 + m and i >= 0 and i <= -1 + n and + i'' >= 0 }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '[m, n] -> { S_9[i, i''] -> a[(i), (1 + i'')] }' + reference: __pet_ref_8 + read: 0 + write: 1 + - type: int + value: 0 +- line: -1 + domain: '[m, n] -> { S_2[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '[m, n] -> { S_2[i] -> n_0[] }' + index: '[m, n] -> { S_2[i] -> n_0[] }' + reference: __pet_ref_9 + kill: 1 +- line: -1 + domain: '[m, n] -> { S_5[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '[m, n] -> { S_5[i] -> __pet_arg_0[] }' + index: '[m, n] -> { S_5[i] -> __pet_arg_0[] }' + reference: __pet_ref_10 + kill: 1 +- line: -1 + domain: '[m, n] -> { S_8[i] : i >= 0 and i <= -1 + n }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '[m, n] -> { S_8[i] -> __pet_arg_1[] }' + index: '[m, n] -> { S_8[i] -> __pet_arg_1[] }' + reference: __pet_ref_11 + kill: 1 diff --git a/tests/inline6.c b/tests/inline6.c new file mode 100644 index 0000000..9cdfc51 --- /dev/null +++ b/tests/inline6.c @@ -0,0 +1,25 @@ +inline void add2(int *a) +{ + int t = 2; + a[0] += t; +} + +inline void add3(int *a) +{ + int t = 3; + a[0] += t; +} + +void foo() +{ + int i; + int a[10]; + +#pragma scop + for (i = 0; i < 10; ++i) { + a[i] = 0; + add2(&a[i]); + add3(&a[i]); + } +#pragma endscop +} diff --git a/tests/inline6.scop b/tests/inline6.scop new file mode 100644 index 0000000..f3343c9 --- /dev/null +++ b/tests/inline6.scop @@ -0,0 +1,265 @@ +start: 142 +end: 244 +indent: "\t" +context: '{ : }' +schedule: '{ domain: "{ S_3[i] : i >= 0 and i <= 9; S_5[i] : i >= 0 and i <= 9; S_6[i] + : i >= 0 and i <= 9; S_9[i] : i >= 0 and i <= 9; S_8[i] : i >= 0 and i <= 9; S_14[i] + : i >= 0 and i <= 9; S_13[i] : i >= 0 and i <= 9; S_2[i] : i >= 0 and i <= 9; S_7[i] + : i >= 0 and i <= 9; S_4[i] : i >= 0 and i <= 9; S_11[i] : i >= 0 and i <= 9; S_12[i] + : i >= 0 and i <= 9; S_10[i] : i >= 0 and i <= 9; S_0[i] : i >= 0 and i <= 9; S_1[i] + : i >= 0 and i <= 9 }", child: { schedule: "L_0[{ S_3[i] -> [(i)]; S_5[i] -> [(i)]; + S_6[i] -> [(i)]; S_9[i] -> [(i)]; S_8[i] -> [(i)]; S_14[i] -> [(i)]; S_13[i] -> + [(i)]; S_2[i] -> [(i)]; S_7[i] -> [(i)]; S_4[i] -> [(i)]; S_11[i] -> [(i)]; S_12[i] + -> [(i)]; S_10[i] -> [(i)]; S_0[i] -> [(i)]; S_1[i] -> [(i)] }]", child: { sequence: + [ { filter: "{ S_0[i] }" }, { filter: "{ S_1[i] }" }, { filter: "{ S_2[i] }" }, + { filter: "{ S_4[i] }" }, { filter: "{ S_5[i] }" }, { filter: "{ S_7[i] }" }, { + filter: "{ S_6[i] }" }, { filter: "{ S_3[i] }" }, { filter: "{ S_8[i] }" }, { filter: + "{ S_9[i] }" }, { filter: "{ S_11[i] }" }, { filter: "{ S_12[i] }" }, { filter: + "{ S_14[i] }" }, { filter: "{ S_13[i] }" }, { filter: "{ S_10[i] }" } ] } } }' +arrays: +- context: '{ : }' + extent: '{ __pet_arg_0[] }' + element_type: int + element_size: 4 + declared: 1 +- context: '{ : }' + extent: '{ t[] }' + element_type: int + element_size: 4 + declared: 1 +- context: '{ : }' + extent: '{ __pet_arg_1[] }' + element_type: int + element_size: 4 + declared: 1 +- context: '{ : }' + extent: '{ t_0[] }' + element_type: int + element_size: 4 + declared: 1 +- context: '{ : }' + extent: '{ a[i0] : i0 >= 0 and i0 <= 9 }' + element_type: int + element_size: 4 +statements: +- line: 20 + domain: '{ S_0[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_0[i] -> a[(i)] }' + reference: __pet_ref_0 + read: 0 + write: 1 + - type: int + value: 0 +- line: -1 + domain: '{ S_1[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_1[i] -> __pet_arg_0[] }' + index: '{ S_1[i] -> __pet_arg_0[] }' + reference: __pet_ref_1 + kill: 1 +- line: -1 + domain: '{ S_2[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_2[i] -> __pet_arg_0[] }' + reference: __pet_ref_2 + read: 0 + write: 1 + - type: access + index: '{ S_2[i] -> [(i)] }' + reference: __pet_ref_3 + read: 1 + write: 0 +- line: 3 + domain: '{ S_4[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_4[i] -> t[] }' + index: '{ S_4[i] -> t[] }' + reference: __pet_ref_4 + kill: 1 +- line: 3 + domain: '{ S_5[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_5[i] -> t[] }' + reference: __pet_ref_5 + read: 0 + write: 1 + - type: int + value: 2 +- line: 4 + domain: '{ S_7[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: += + arguments: + - type: access + index: '{ S_7[i] -> a[(i)] }' + reference: __pet_ref_6 + read: 1 + write: 1 + - type: access + index: '{ S_7[i] -> [(2)] }' + reference: __pet_ref_7 + read: 1 + write: 0 +- line: 3 + domain: '{ S_6[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_6[i] -> t[] }' + index: '{ S_6[i] -> t[] }' + reference: __pet_ref_8 + kill: 1 +- line: -1 + domain: '{ S_3[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_3[i] -> __pet_arg_0[] }' + index: '{ S_3[i] -> __pet_arg_0[] }' + reference: __pet_ref_9 + kill: 1 +- line: -1 + domain: '{ S_8[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_8[i] -> __pet_arg_1[] }' + index: '{ S_8[i] -> __pet_arg_1[] }' + reference: __pet_ref_10 + kill: 1 +- line: -1 + domain: '{ S_9[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_9[i] -> __pet_arg_1[] }' + reference: __pet_ref_11 + read: 0 + write: 1 + - type: access + index: '{ S_9[i] -> [(i)] }' + reference: __pet_ref_12 + read: 1 + write: 0 +- line: 9 + domain: '{ S_11[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_11[i] -> t_0[] }' + index: '{ S_11[i] -> t_0[] }' + reference: __pet_ref_13 + kill: 1 +- line: 9 + domain: '{ S_12[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_12[i] -> t_0[] }' + reference: __pet_ref_14 + read: 0 + write: 1 + - type: int + value: 3 +- line: 10 + domain: '{ S_14[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: += + arguments: + - type: access + index: '{ S_14[i] -> a[(i)] }' + reference: __pet_ref_15 + read: 1 + write: 1 + - type: access + index: '{ S_14[i] -> [(3)] }' + reference: __pet_ref_16 + read: 1 + write: 0 +- line: 9 + domain: '{ S_13[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_13[i] -> t_0[] }' + index: '{ S_13[i] -> t_0[] }' + reference: __pet_ref_17 + kill: 1 +- line: -1 + domain: '{ S_10[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_10[i] -> __pet_arg_1[] }' + index: '{ S_10[i] -> __pet_arg_1[] }' + reference: __pet_ref_18 + kill: 1 diff --git a/tests/inline7.c b/tests/inline7.c new file mode 100644 index 0000000..8683a64 --- /dev/null +++ b/tests/inline7.c @@ -0,0 +1,28 @@ +struct s { + int a[30][40]; + int b[50]; +}; + +void g(struct s *u) +{ + for (int i = 0; i < 10; ++i) + for (int j = 0; j < 10; ++j) + u->a[10 + i][20 + j] = i + j; + u->b[5] = 1; +} + +inline void h(struct s t[20]) +{ + for (int i = 0; i < 20; ++i) + g(&t[i]); +} + +void f() +{ + struct s s[10][20]; + +#pragma scop + for (int i = 0; i < 10; ++i) + h(s[i]); +#pragma endscop +} diff --git a/tests/inline7.scop b/tests/inline7.scop new file mode 100644 index 0000000..c2717bd --- /dev/null +++ b/tests/inline7.scop @@ -0,0 +1,101 @@ +start: 286 +end: 356 +indent: "\t" +context: '{ : }' +schedule: '{ domain: "{ S_3[i, i''] : i >= 0 and i <= 9 and i'' >= 0 and i'' <= 19; + S_2[i] : i >= 0 and i <= 9; S_0[i] : i >= 0 and i <= 9; S_1[i] : i >= 0 and i <= + 9 }", child: { schedule: "L_0[{ S_3[i, i''] -> [(i)]; S_2[i] -> [(i)]; S_1[i] -> + [(i)]; S_0[i] -> [(i)] }]", child: { sequence: [ { filter: "{ S_0[i] }" }, { filter: + "{ S_1[i] }" }, { filter: "{ S_3[i, i''] }", child: { schedule: "L_1[{ S_3[i, i''] + -> [(i'')] }]" } }, { filter: "{ S_2[i] }" } ] } } }' +types: +- name: s + definition: "struct s {\n int a[30][40];\n int b[50];\n}" +arrays: +- context: '{ : }' + extent: '{ __pet_arg_0[] }' + element_type: int + element_size: 4 + declared: 1 +- context: '{ : }' + extent: '{ s[i0, i1] : i0 >= 0 and i1 >= 0 and i0 <= 9 and i1 <= 19 }' + element_type: struct s + element_size: 5000 + element_is_record: 1 +- context: '{ : }' + extent: '{ s_a[s[i0, i1] -> a[i2, i3]] : i0 >= 0 and i1 >= 0 and i0 <= 9 and i1 + <= 19 and i2 >= 0 and i3 >= 0 and i2 <= 29 and i3 <= 39 }' + element_type: int + element_size: 4 +- context: '{ : }' + extent: '{ s_b[s[i0, i1] -> b[i2]] : i0 >= 0 and i1 >= 0 and i0 <= 9 and i1 <= 19 + and i2 >= 0 and i2 <= 49 }' + element_type: int + element_size: 4 +statements: +- line: -1 + domain: '{ S_0[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_0[i] -> __pet_arg_0[] }' + index: '{ S_0[i] -> __pet_arg_0[] }' + reference: __pet_ref_0 + kill: 1 +- line: -1 + domain: '{ S_1[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_1[i] -> __pet_arg_0[] }' + reference: __pet_ref_1 + read: 0 + write: 1 + - type: access + index: '{ S_1[i] -> [(i)] }' + reference: __pet_ref_2 + read: 1 + write: 0 +- line: 17 + domain: '{ S_3[i, i''] : i >= 0 and i <= 9 and i'' >= 0 and i'' <= 19 }' + body: + type: expression + expr: + type: call + name: g + arguments: + - type: op + operation: '&' + arguments: + - type: access + may_write: '{ S_3[i, i''] -> s_a[s[i, i''] -> a[o2, o3]] : o3 <= 29 and + o3 >= 20 and o2 <= 19 and o2 >= 10; S_3[i, i''] -> s_b[s[i, i''] -> b[5]] + }' + must_write: '{ S_3[i, i''] -> s_a[s[i, i''] -> a[o2, o3]] : o3 <= 29 and + o3 >= 20 and o2 <= 19 and o2 >= 10; S_3[i, i''] -> s_b[s[i, i''] -> b[5]] + }' + index: '{ S_3[i, i''] -> s[(i), (i'')] }' + reference: __pet_ref_3 + read: 0 + write: 1 +- line: -1 + domain: '{ S_2[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_2[i] -> __pet_arg_0[] }' + index: '{ S_2[i] -> __pet_arg_0[] }' + reference: __pet_ref_4 + kill: 1 diff --git a/tests/inline8.c b/tests/inline8.c new file mode 100644 index 0000000..10c8fa6 --- /dev/null +++ b/tests/inline8.c @@ -0,0 +1,22 @@ +struct s { + int a[30][40]; + int b[50]; +}; + +void g(struct s *u); + +inline void h(struct s t[20]) +{ + for (int i = 0; i < 20; ++i) + g(&t[i]); +} + +void f() +{ + struct s s[10][20]; + +#pragma scop + for (int i = 0; i < 10; ++i) + h(s[i]); +#pragma endscop +} diff --git a/tests/inline8.scop b/tests/inline8.scop new file mode 100644 index 0000000..927cf89 --- /dev/null +++ b/tests/inline8.scop @@ -0,0 +1,98 @@ +start: 175 +end: 245 +indent: "\t" +context: '{ : }' +schedule: '{ domain: "{ S_3[i, i''] : i >= 0 and i <= 9 and i'' >= 0 and i'' <= 19; + S_2[i] : i >= 0 and i <= 9; S_0[i] : i >= 0 and i <= 9; S_1[i] : i >= 0 and i <= + 9 }", child: { schedule: "L_0[{ S_3[i, i''] -> [(i)]; S_2[i] -> [(i)]; S_1[i] -> + [(i)]; S_0[i] -> [(i)] }]", child: { sequence: [ { filter: "{ S_0[i] }" }, { filter: + "{ S_1[i] }" }, { filter: "{ S_3[i, i''] }", child: { schedule: "L_1[{ S_3[i, i''] + -> [(i'')] }]" } }, { filter: "{ S_2[i] }" } ] } } }' +types: +- name: s + definition: "struct s {\n int a[30][40];\n int b[50];\n}" +arrays: +- context: '{ : }' + extent: '{ __pet_arg_0[] }' + element_type: int + element_size: 4 + declared: 1 +- context: '{ : }' + extent: '{ s[i0, i1] : i0 >= 0 and i1 >= 0 and i0 <= 9 and i1 <= 19 }' + element_type: struct s + element_size: 5000 + element_is_record: 1 +- context: '{ : }' + extent: '{ s_a[s[i0, i1] -> a[i2, i3]] : i0 >= 0 and i1 >= 0 and i0 <= 9 and i1 + <= 19 and i2 >= 0 and i3 >= 0 and i2 <= 29 and i3 <= 39 }' + element_type: int + element_size: 4 +- context: '{ : }' + extent: '{ s_b[s[i0, i1] -> b[i2]] : i0 >= 0 and i1 >= 0 and i0 <= 9 and i1 <= 19 + and i2 >= 0 and i2 <= 49 }' + element_type: int + element_size: 4 +statements: +- line: -1 + domain: '{ S_0[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_0[i] -> __pet_arg_0[] }' + index: '{ S_0[i] -> __pet_arg_0[] }' + reference: __pet_ref_0 + kill: 1 +- line: -1 + domain: '{ S_1[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_1[i] -> __pet_arg_0[] }' + reference: __pet_ref_1 + read: 0 + write: 1 + - type: access + index: '{ S_1[i] -> [(i)] }' + reference: __pet_ref_2 + read: 1 + write: 0 +- line: 11 + domain: '{ S_3[i, i''] : i >= 0 and i <= 9 and i'' >= 0 and i'' <= 19 }' + body: + type: expression + expr: + type: call + name: g + arguments: + - type: op + operation: '&' + arguments: + - type: access + may_read: '{ S_3[i, i''] -> s[i, i''] }' + may_write: '{ S_3[i, i''] -> s[i, i''] }' + must_write: '{ }' + index: '{ S_3[i, i''] -> s[(i), (i'')] }' + reference: __pet_ref_3 + read: 1 + write: 1 +- line: -1 + domain: '{ S_2[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_2[i] -> __pet_arg_0[] }' + index: '{ S_2[i] -> __pet_arg_0[] }' + reference: __pet_ref_4 + kill: 1 diff --git a/tests/inline9.c b/tests/inline9.c new file mode 100644 index 0000000..525b30b --- /dev/null +++ b/tests/inline9.c @@ -0,0 +1,30 @@ +struct s { + int a[30][40]; + int b[50]; +}; + +void g(struct s *u) +{ + for (int i = 0; i < 10; ++i) + for (int j = 0; j < 10; ++j) + u->a[10 + i][20 + j] = i + j; + u->b[5] = 1; +} + +inline void h(struct s t[20]) +{ + int a = 0; + for (int i = 0; i < 20; ++i) + g(&t[i]); +} + +void f() +{ + struct s s[10][20]; + +#pragma scop + int a = 1; + for (int i = 0; i < 10; ++i) + h(s[i]); +#pragma endscop +} diff --git a/tests/inline9.scop b/tests/inline9.scop new file mode 100644 index 0000000..e8c6aec --- /dev/null +++ b/tests/inline9.scop @@ -0,0 +1,186 @@ +start: 298 +end: 380 +indent: "\t" +context: '{ : }' +schedule: '{ domain: "{ S_3[i] : i >= 0 and i <= 9; S_5[i] : i >= 0 and i <= 9; S_0[]; + S_6[i] : i >= 0 and i <= 9; S_8[i, i''] : i >= 0 and i <= 9 and i'' >= 0 and i'' + <= 19; S_2[i] : i >= 0 and i <= 9; S_7[i] : i >= 0 and i <= 9; S_4[i] : i >= 0 and + i <= 9; S_1[] }", child: { sequence: [ { filter: "{ S_0[] }" }, { filter: "{ S_1[] + }" }, { filter: "{ S_3[i]; S_5[i]; S_6[i]; S_8[i, i'']; S_2[i]; S_7[i]; S_4[i] }", + child: { schedule: "L_0[{ S_8[i, i''] -> [(i)]; S_6[i] -> [(i)]; S_3[i] -> [(i)]; + S_4[i] -> [(i)]; S_5[i] -> [(i)]; S_2[i] -> [(i)]; S_7[i] -> [(i)] }]", child: { + sequence: [ { filter: "{ S_2[i] }" }, { filter: "{ S_3[i] }" }, { filter: "{ S_5[i] + }" }, { filter: "{ S_6[i] }" }, { filter: "{ S_8[i, i''] }", child: { schedule: + "L_1[{ S_8[i, i''] -> [(i'')] }]" } }, { filter: "{ S_7[i] }" }, { filter: "{ S_4[i] + }" } ] } } } ] } }' +types: +- name: s + definition: "struct s {\n int a[30][40];\n int b[50];\n}" +arrays: +- context: '{ : }' + extent: '{ a[] }' + element_type: int + element_size: 4 + declared: 1 + exposed: 1 +- context: '{ : }' + extent: '{ __pet_arg_0[] }' + element_type: int + element_size: 4 + declared: 1 +- context: '{ : }' + extent: '{ a_0[] }' + element_type: int + element_size: 4 + declared: 1 +- context: '{ : }' + extent: '{ s[i0, i1] : i0 >= 0 and i1 >= 0 and i0 <= 9 and i1 <= 19 }' + element_type: struct s + element_size: 5000 + element_is_record: 1 +- context: '{ : }' + extent: '{ s_a[s[i0, i1] -> a[i2, i3]] : i0 >= 0 and i1 >= 0 and i0 <= 9 and i1 + <= 19 and i2 >= 0 and i3 >= 0 and i2 <= 29 and i3 <= 39 }' + element_type: int + element_size: 4 +- context: '{ : }' + extent: '{ s_b[s[i0, i1] -> b[i2]] : i0 >= 0 and i1 >= 0 and i0 <= 9 and i1 <= 19 + and i2 >= 0 and i2 <= 49 }' + element_type: int + element_size: 4 +statements: +- line: 26 + domain: '{ S_0[] }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_0[] -> a[] }' + index: '{ S_0[] -> a[] }' + reference: __pet_ref_0 + kill: 1 +- line: 26 + domain: '{ S_1[] }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_1[] -> a[] }' + reference: __pet_ref_1 + read: 0 + write: 1 + - type: int + value: 1 +- line: -1 + domain: '{ S_2[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_2[i] -> __pet_arg_0[] }' + index: '{ S_2[i] -> __pet_arg_0[] }' + reference: __pet_ref_2 + kill: 1 +- line: -1 + domain: '{ S_3[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_3[i] -> __pet_arg_0[] }' + reference: __pet_ref_3 + read: 0 + write: 1 + - type: access + index: '{ S_3[i] -> [(i)] }' + reference: __pet_ref_4 + read: 1 + write: 0 +- line: 16 + domain: '{ S_5[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_5[i] -> a_0[] }' + index: '{ S_5[i] -> a_0[] }' + reference: __pet_ref_5 + kill: 1 +- line: 16 + domain: '{ S_6[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: = + arguments: + - type: access + index: '{ S_6[i] -> a_0[] }' + reference: __pet_ref_6 + read: 0 + write: 1 + - type: int + value: 0 +- line: 18 + domain: '{ S_8[i, i''] : i >= 0 and i <= 9 and i'' >= 0 and i'' <= 19 }' + body: + type: expression + expr: + type: call + name: g + arguments: + - type: op + operation: '&' + arguments: + - type: access + may_write: '{ S_8[i, i''] -> s_a[s[i, i''] -> a[o2, o3]] : o3 <= 29 and + o3 >= 20 and o2 <= 19 and o2 >= 10; S_8[i, i''] -> s_b[s[i, i''] -> b[5]] + }' + must_write: '{ S_8[i, i''] -> s_a[s[i, i''] -> a[o2, o3]] : o3 <= 29 and + o3 >= 20 and o2 <= 19 and o2 >= 10; S_8[i, i''] -> s_b[s[i, i''] -> b[5]] + }' + index: '{ S_8[i, i''] -> s[(i), (i'')] }' + reference: __pet_ref_7 + read: 0 + write: 1 +- line: 16 + domain: '{ S_7[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_7[i] -> a_0[] }' + index: '{ S_7[i] -> a_0[] }' + reference: __pet_ref_8 + kill: 1 +- line: -1 + domain: '{ S_4[i] : i >= 0 and i <= 9 }' + body: + type: expression + expr: + type: op + operation: kill + arguments: + - type: access + killed: '{ S_4[i] -> __pet_arg_0[] }' + index: '{ S_4[i] -> __pet_arg_0[] }' + reference: __pet_ref_9 + kill: 1 -- 2.11.4.GIT