This commit is contained in:
York Jasper Niebuhr 2025-10-13 16:16:28 +02:00
parent 75b7db5a35
commit ba026b5f59
2 changed files with 26 additions and 3 deletions

View File

@ -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

View File

@ -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;
}
}
}