diff --git a/docs/plan.txt b/docs/plan.txt index c9792ef..fd41b0a 100644 --- a/docs/plan.txt +++ b/docs/plan.txt @@ -1,7 +1,20 @@ General: - Use custom __builtin_offsetof definition to preserve the call until lower gimple -OLD Approach: +Approach: +- Use gcc 16 callback in build_component_ref to replace relevant offfsetofs with __spslr_offsetof(uid) calls + - Maintain mapping from uid to type and member information +- At early RTL, find calls and replace them with UNSPEC RTL mov instructions of constants + - Doing it late would most certainly litter rax (return of call) + - Doing it late would also cause surrounding code to deal with clobbering caused by call! +- At very late RTL, find UNSPECs, replace them with constants and add asm labels + - To begin with, this causes one move per offsetof + - Later, add DIY constant folding -> patcher executes byte code program produced by postprocessor + - Patcher program also handles instructions like SET_PERM(RWX, base, page count) + - Current operand values and arbitrary number of member offsets can be used in new operand value compuation + - Patcher is just a byte code interpreter + +OLD Approach 1: - 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 @@ -9,7 +22,7 @@ OLD Approach: - 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 -Approach: +OLD Approach 2: - At the very first point of gimple (before optimizations), replace COMPONENT_REFs of relevant structs - Turn them into calls of __spslr_component_ref(base (new ssa stmt), type uid, member uid) - Make sure the return type is matching that of the COMPONENT_REF (member type)