diff --git a/docs/plan.txt b/docs/plan.txt index ac95985..11cf659 100644 --- a/docs/plan.txt +++ b/docs/plan.txt @@ -7,3 +7,4 @@ Approach: - Right after expansion to RTL, pattern match set of RTL instructions with same location to graph - Add notes (persistent over RTL transformations) to any RTL instruction that is relevant - After all RTL optimizations, add assembly labels before relevant RTL instructions (identified by notes) +- Might need an additional early pass to prevent COMPONENT_REFs to constant/static stuff from being folded early diff --git a/plugin/access_discover.cpp b/plugin/access_discover.cpp index 1ab3d7b..7d0d011 100644 --- a/plugin/access_discover.cpp +++ b/plugin/access_discover.cpp @@ -44,8 +44,29 @@ static int scan_gimple_statement(const char* funcname, gimple_stmt_iterator* gsi } Build map: location->LocationPattern + Build GimpleStatementPattern tree from individual gimple statement + Add GimpleStatementPattern to LocationPattern (attached at matching variable names (potentially unnamed ssa)) + Patterns include markers for member offsets (type, member, value) + Later load a set of RTLInstructionPattern to match the patterns */ + print_gimple_statement(gsi_stmt(*gsi)); + + gimple* stmt = gsi_stmt(*gsi); + enum gimple_code stmt_code = gimple_code(stmt); + + switch (stmt_code) { + case GIMPLE_CALL: + // check for offsetof, then fall through to operand scanning + case GIMPLE_ASSIGN: + case GIMPLE_COND: + case GIMPLE_LABEL: + case GIMPLE_RETURN: + return 0; + default: + return 1; + } + return 0; } @@ -72,9 +93,10 @@ unsigned int access_discover_pass::execute(function* fun) { basic_block bb; FOR_EACH_BB_FN(bb, fun) { for (gimple_stmt_iterator gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) { - int stmt_scan_success; - if ((stmt_scan_success = scan_gimple_statement(funcname, &gsi)) != 0) - return stmt_scan_success; + if (scan_gimple_statement(funcname, &gsi) != 0) { + internal_error("fatal error in spslr plugin: %s", "failed to scan gimple statement"); + return 0; + } } }