[llvm-commits] [PATCH] Move the LowerMEMCPY and LowerMEMCPYCall to a common place

Bill Wendling isanbard at gmail.com
Mon Nov 5 13:12:51 PST 2007


On 11/5/07, Rafael Espindola <espindola at google.com> wrote:
> > If you're going to do this, why not just get rid of Subtarget
> > altogether and just use BaseSubtarget? It can be set to 0 for targets
> > that don't use it. Then again, it might not be a bad idea to use
> > virtual getter/setters here. It already has virtual functions, and
> > you're calling virtual functions through this pointer. So... :-)
>
> The problem with using only BaseSubtarget is that X86Subtarget adds a
> lot of methods to the base implementation. Because of this the X86
> code really expects to see a  pointer to the X86Subtarget and not
> TargetSubtarget. I.E., a downcast is needed.
>
I was thinking the opposite way, but wrote down the other way. :-)

If you use just Subtarget in each target that implements it and then
expose it through the getter, then you don't need the down-cast, only
an upcast. So no RTTI, etc. That way there's no extra info for targets
which don't have a subtarget, etc.

What do you think?

-bw



More information about the llvm-commits mailing list