[llvm-commits] metadata.h/cpp review stuff

Devang Patel devang.patel at gmail.com
Tue Oct 20 07:08:42 PDT 2009


On Mon, Oct 19, 2009 at 12:06 AM, Chris Lattner <clattner at apple.com> wrote:
> Hi Devang,
>
> I'm just now getting caught up on your work.  Here are some thoughts/
> questions on Metadata.h/cpp:
>
>
> The metadata hierarchy is:
>
> User
>   -> MetadataBase
>      -> MDString
>      -> MDNode
>      -> NamedMDNode
>
> Why not:
>
> Value
>   -> MetadataBase
>      -> MDString
>      -> MDNode
>      -> NamedMDNode
>
> This would shrink them significantly and reduce the games you have to
> play with hiding getNumOperands, overloading operator new, etc.  Also,
> MetadataBase doesn't have much common state, it isn't clear it needs
> to exist at all.
>
> There is some seriously confused code circling around
> MetadataBase::resizeOperands.  It looks like half the code thinks that
> operands can happen, but half doesn't.  Please remove all this stuff.

It is trying to maintain following use counts

!1 = { i32 1} ; [uses 1]
!2 = {  !1 }   ; [uses 0]

...
call @llvm.dbg.blah(!1, !2)
...

Metadata used by another metadata is counted as regular uses. Metadata
used by non-metadata values is not a normal use (it is invisible to
the non-metadata value). This is why the hierarchy is based on User
and operand list is only counting metadata uses.

-
Devang




More information about the llvm-commits mailing list