From: Borja F. <bor...@gm...> - 2010-11-19 14:08:27
|
We need to figure out some important things that need to be introduced in the compiler before we advance with bigger things. The things i'm talking about are: 1) aligning data wider than 1 byte in even registers to favour movws and argument passing into functions. int16 a = b; // a = r21:r20, b = r13:r12 movw r20, r12 <--- good reg allocation int16 a = b; // a = r20:r21, b = r12:r13 mov r21, r13 mov r20, r12 <--- bad reg allocation 2) THE BIG ONE: working with register pairs. there are some instructions like sbiw/adiw, movw, ld/st that only work with register pairs. we need to figure out how to introduce them. For example, I wrote a pass that converts 2 moves in a row into a movw. This is very basic, but i find it bad, because if the compiler places an instruction between both moves this pass wont be able to replace it with the movw. Also i find it very hacky, because the compiler doesnt know that there is really a move instruction that work with 16bit data so it doesnt have a global view of the costs and probably worsening reg allocation. If we worked with pseudo regs of 16 bits this should be straight forward, but we would face the problem i mentioned some time ago, all data operations would need custom lowering, because LLVM isnt able to split a wider reg into subregs (say R1312 into R13:R12). An initial guess would be manually splitting the reg into its subregs, perform the operation and finally recombining the subregs again into the bigger one for next instruction, but im not sure yet if this is a good solution. We really need to think about it because it's a very important design decision. This was my first email into llvm's dev mailing list, but i really didnt got any real solution. If you can think of any other points related to this, add them. |