Iterating over the allocnos class, objects & their conflicts each twice to find it. It iterates over allocnos then by pseudoregs to extract the min & max reside ranges. 1. Iterates over codeblocks & their control flow edges to flag fallthru edges, and again to mark backedges. These array are lastly iterated over to use the alterations to the code being optimized. An preliminary iteration (with memory CSE records & alias analysis initialized) over the codeblocks & directions therein first conditionally (skipping non-directions & sideeffecting operate calls) tracks stackpointer updates, serial & parallelized SET ops. That recolouring includes iterating over those remaining allocnos, their conflicts, & their objects to assign legitimate colours to gather a full collection of what must be recoloured. If optimizing away indirect jumps yields any clearly dead directions to delete itll reanalyze the dataflow again. Itll optionally recompute register sets in case that freed anything up, recompute regsets, optionally iterate thrice over codeblocks, instructions therein, & twice over their makes use of to bitflag which pseudoregisters are movable using several temp bitmasks, determines which registers are clobbered the place, initialize price counters, & optionally reinitializes loop analysis. With some extra collections initialized it iterates over the instructions again in reverse taking a look at attached alignment logs to any labels to populate a sidetable through a lookup desk. For each loop, with further collections (together with a sidetable of color data & formulating thread linked lists) allocated, it first clears bitflags for any already assigned allocnos, iterates over various bitmasks to decide on preferable CPU regs earlier than dropping any which cant be satisfied.
Throughout that initialization it conditionally iterates over the code to gather regions utilizing a number of loops relying on the control flow. With alias & loop evaluation it iterates over codeblocks & directions therein to note perform calls, optionally iterates over caller-save regs to include in its register-alloc datamodel, optionally iterates over codeblocks & directions therein to note equivalent regs, iterates over pseudoregs to see if they will now be inlined, & optionally over instructions to file store equivilents. Or any equivalent problem. The Map Colouring Problem refers to the problem of shading a political map with as few colours as attainable so that no two bordering countries share the same color. In theory you possibly can color any political map with solely four colours. GCC consistantly has a pallete of more than four colours! Then itll try a extra thorough/complex https://gina-rodriguez.org positioning of operate prologues & epilogues.
If it discovered any were found itll type & iterate over these allocnos assigning obtainable registers in that order. If that indicates its applicable itll iterate over the codeblocks edges to search out all predecessors which could profit from this optimization & will be duplicated. Several further iterations over the registers & their makes use of, codeblocks, and so forth computes stats for register allocation to check with. 2. Determines whether the reg allocator indicates a MOVs needed. For every instruction it determines whether or not its resizing the callstack. A followup iteration over the codeblocks, incoming chains bitmask from the previous iteration, management stream edges, & the linked codeblocks open chains (again from previous iteration) determines where chains will be merged between codeblocks. With extra collections initialized it iterates over each loop.
For each (with some variation) it removes empty codeblocks, initializes runtime memfences, shcedules the instruction round them (by splitting linked lists whilst assigning & sorting per-instruction sequence numbers), & specifically bruteforces with reference to bitmasks an optimal order for CPU pipelining. After elective GCC debugging output it iterates over candidates, codeblocks, dataflow, & candidates in reverse to gather usage info into bitmasks. Bitmasks are cleared between iterations. Booleans are usually optimized away. Together with static annotations, & ones per instruction (twice) or codepath. Regardless of whether or not that occurs it considers adding the instruction to the memory CSE data or discarding invalidated ones. For PARALLELized Sets it discards any memory CSE information clobbered by literal asm code, iterates over every action within the PARALLEL to test whether it solely incorporates noops – if so deleting this instruction, iterates over all those Sets again to (as described above) simplify them earlier than committing modifications or simplifying the operands.