For relative addressing on ARM, integers can be addressed over a much longer range than doubles. By putting doubles on the stack, before ints we increase the number of registers we can address in a single instruction. Should be optional do to this, rather than the current first come first served spilling.
I am not sure to understand what you mean precisely, are you suggesting to spill Values first, as they occupy 2 registers instead of one? Doubles are stored in other registers, and I don't see how spilling doubles might help unless you are referring to spilling int registers to double registers.
(In reply to Nicolas B. Pierron [:nbp] from comment #1) > I am not sure to understand what you mean precisely, are you suggesting to > spill Values first, as they occupy 2 registers instead of one? > No, I am suggesting spilling the double registers before the int regsiters. Before in terms of the stack frame ordering. > Doubles are stored in other registers, and I don't see how spilling doubles > might help unless you are referring to spilling int registers to double > registers. It helps because the ARM instruction to read a double from memory has less bits available to use as an offset than the int equivalent. So, by storing doubles closer to the stack pointer, we increase the chances of being able to identify them using the offset and thus loading them in a single instruction instead of two or more.
Sorry I've been a bit quiet on this - I did a bunch of work, then dropped the ball when other work got too busy. I attached the patches I did, they are rought WIP and pretty old so I bet they are well bit-rotted. Not sure if there is anything worth salvaging or how difficult it would be to make this approach work. The approach is to use an LStackSlot rather than an int to represent a slot on the stack. Then when we have done generating code (and know how many doubles we need to make space for) we go back and reify the abstract slots into concrete offsets (like they were before this work). One problem with this is we don't keep a list of all uses of stack slots, so we have to add a loop which iterates over every operand in every instruction, which is a large overhead. I did some work so we could avoid this work for x86 builds and only do it for ARM, but it would still some extra time to code generation. However, the big problem I had is that it didn't work and I couldn't work out why. Because the slots were ints before, it is impossible to do a search or to get any compiler help so I am not sure I changed everywhere I needed to change. There might be other bugs too - I was failing tests, but couldn't work out why for the life of me. Maybe someone who knows the register allocator better might be able to make more headway with this, but I think it is too difficult for me to do in a sane amount of time.
Assignee: ncameron → general
You need to log in before you can comment on or make changes to this bug.