|
From: Florian K. <br...@ac...> - 2012-11-08 04:03:11
|
On 11/07/2012 07:14 AM, Julian Seward wrote: > > On Wednesday, November 07, 2012, Florian Krohm wrote: >> You could do the zero extension after the load, couldn't you? In which >> case you wouldn't need the IRLoadGOp. >> But representing it the way you propose gives you an advantage in insn >> selection. Is that right? Or is there another reason? Just curious. > ...snip ... > > In the end it seemed simplest to simply combine the load and conversion. > I could have used an IROp to indicate the conversion instead of using a > new enum, but that seems unclean -- obviously almost all of the IROps > one could put it are nonsensical -- and it would also require extending > IROp with a 32-bit identity operation. > > So I did a new enum. Oh yes, that's definitely better. > One other thing I have been thinking about for a while, although haven't done > anything about, is to relax the type rules for condition expressions (guards) > in IRLoadG, IRStoreG, IRMux0X, IRDirty, IRExit. Currently they are > require, respectively, I1, I1, I8, I1, I1. This is inconsistent, Yes, I had wondered about the I8 for the Mux0X condition also.. > and worse, > it leads to chains of pointless IR conversions, like > > 32to1(1Sto32(32to1(1Uto32(CmpNE32(x, 0)))) > > which are surprisingly common, especially in arm-derived IR. > > What I am contemplating is to change all of them to require a value of an > integral type (I1, I8, I16, I32 or I64), and test zero/nonzero, a la C > style conditionals. Then all the chains of conversions would disappear. Seconded. In particular as ir_opt probably does not eliminate all of those chains (not sure, just guessing). So if we can get away with it by construction then that is a good thing. > In an ideal world we could also swap the order of '0' and 'X' clauses in > Mux0X, so it reads more like C's ?-: operator. But that's probably too > big a change given that the reason is only one of aesthetics. It's not just aesthetics. I could not deal with that operator being somehow backwards when I did the IR generation for s390. Always had to think about it. So I wrote a wrapper function mkite (make if-then-else) for my sanity. Changing it may not be that much work. Florian |