Make User track whether a class has 'hung off uses' and delete them in its destructor.
authorPete Cooper <peter_cooper@apple.com>
Wed, 10 Jun 2015 22:38:34 +0000 (22:38 +0000)
committerPete Cooper <peter_cooper@apple.com>
Wed, 10 Jun 2015 22:38:34 +0000 (22:38 +0000)
commit0aae8ce09fd6c337b5c4398eadcad75e7bb3eda2
tree03e990054aa8d54f966678c7309f5896d82f6166
parente0e42bb51fe60a9663833576b216a5a0b4048fff
Make User track whether a class has 'hung off uses' and delete them in its destructor.

Currently all of the logic for deleting hung off uses, which PHI/switch/etc use,
is in their classes.

This adds a bit to Value which tracks whether that user had hung off uses,
then User can be responsible for clearing them instead of the sub classes.

Note, the bit used here was taken from NumOperands which was 30-bits.
Given the reduction to 29 bits, and the average User being just over 100 bytes,
a single User with 29-bits of num operands would need 50GB of RAM for itself
so its reasonable to assume that 29-bits is enough for now.

This is a step towards hiding all the hung off uses logic in the User.

Reviewed by Duncan Exon Smith.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239490 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Instructions.h
include/llvm/IR/User.h
include/llvm/IR/Value.h
lib/IR/User.cpp