<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 24 February 2014 16:20, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
What is the underlying motivation for doing this?<br></blockquote><div><br></div><div>The proximate cause is that I'm trying to remove the vtable from llvm::Value, and in order to do that I'm going to write dispatch functions that switch on the ValueID and call the appropriate function from the most-derived-type. If I do that, then we have lib/IR placing calls to lib/CodeGen, which is a layering violation.</div>
<div><br></div><div>At a higher level, PSV does not belong there. It is not part of the IR. No IR passes use or understand it. It's not documented in the LangRef. Frankly, it's a hack -- and it's a great hack that and I understand its utility for lib/CodeGen -- but that doesn't change the fact that it's not part of llvm's IR. I've just never been motivated to do something about it until now.</div>
<div><br></div><div>Nick</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
----- Original Message -----<br>
> From: "Nick Lewycky" <<a href="mailto:nlewycky@google.com">nlewycky@google.com</a>><br>
> To: "Commit Messages and Patches for LLVM" <<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a>><br>
> Sent: Monday, February 24, 2014 6:13:30 PM<br>
> Subject: patch: remove PseudoSourceValue from Value.<br>
><br>
><br>
><br>
> The attached patch removes PseudoSourceValue from the Value<br>
> hierarchy. No functionality change intended, but I had to make a<br>
> number of assumptions in order to make that claim. I assume nobody<br>
> ever assigned names to PSV's. I assume nobody has an AliasAnalysis<br>
> that is smart about PSV's (it's not in tree). That sort of thing.<br>
><br>
><br>
> I'm going to say up front, this patch isn't entirely pretty. There's<br>
> some PointerUnions involved. Some code did get nicer, there were<br>
> users that had tests for Value* then if isa<PseudoSourceValue> do<br>
> something that would end in an unconditional return or continue,<br>
> then afterwards handle non-PSV Value's. These are now sensible<br>
> conditions for the two cases. Some code got worse. Target/Mips wins<br>
> the contest for actually having code that treated PSV's and Value's<br>
> through the same code paths, good job guys! Sorry that I'm doing<br>
> this to you.<br>
><br>
><br>
> At its core, this patch makes PseudoSourceValue the root of its own<br>
> hierarchy with just itself and FixedPseudoSourceValue in it, then<br>
> updated MachinePointerInfo to store a pointer-union of the PSV and<br>
> Value*. Various bits of code throughout lib/CodeGen and lib/Target<br>
> are updated to pass MPI's around instead of extracting the Value*<br>
> from an MPI, passing that, then rebuilding the MPI on the other end.<br>
> Such code was silly anyways.<br>
><br>
><br>
> Please review. Before we get a low-level code review, I'm expecting<br>
> to be told that I've violated some design criteria of the backend<br>
> that I wasn't aware of. I mean, I moved a method from private to<br>
> public, so that's a pretty big sign. Please feel free to tell me how<br>
> things ought to be layered.<br>
><br>
><br>
> Nick<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Hal Finkel<br>
Assistant Computational Scientist<br>
Leadership Computing Facility<br>
Argonne National Laboratory<br>
</font></span></blockquote></div></div></div>