Skip to content

code gen: Improve efficiency of findPrefRealReg

Matthew Pickering requested to merge wip/linear-reg-alloc into master

Old strategy: For each variable linearly scan through all the blocks and check to see if the variable is any of the block register mappings. This is very slow when you have a lot of blocks.

New strategy: Maintain a map from virtual registers to the first real register the virtual register was assigned to. Consult this map in findPrefRealReg.

The map is updated when the register mapping is updated and is hidden behind the BlockAssigment abstraction.

On the mmark package this reduces compilation time from about 44s to 32s.

Ticket: #19471 (closed)

cc @AndreasK

Merge request reports