From a22b507a4c3914d5ea9492b7eb60cbf603fb3c33 Mon Sep 17 00:00:00 2001 From: York Jasper Niebuhr Date: Mon, 13 Oct 2025 11:43:49 +0200 Subject: [PATCH] Added approach description --- plan.txt | 9 +++++++++ plugin/main.cpp | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 plan.txt diff --git a/plan.txt b/plan.txt new file mode 100644 index 0000000..ac95985 --- /dev/null +++ b/plan.txt @@ -0,0 +1,9 @@ +General: +- Use custom __builtin_offsetof definition to preserve the call until lower gimple + +Approach: +- At the very last point of gimple (after gimple optimizations), recognize accesses + - Build a mapping of statement location (multiple statements share) to a semantic graph (or tree) +- 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) diff --git a/plugin/main.cpp b/plugin/main.cpp index 8fe440a..9e196c0 100644 --- a/plugin/main.cpp +++ b/plugin/main.cpp @@ -349,8 +349,8 @@ int plugin_init(plugin_name_args *plugin_info, plugin_gcc_version *version) struct register_pass_info ginfo; ginfo.pass = new gimplabels_pass(nullptr); - ginfo.reference_pass_name = "cfg"; ginfo.ref_pass_instance_number = 1; + ginfo.reference_pass_name = "optimized"; ginfo.pos_op = PASS_POS_INSERT_AFTER; register_callback(plugin_info->base_name, PLUGIN_PASS_MANAGER_SETUP, nullptr, &ginfo);