AsmParser/Bitcode: Add support for MDLocation

This adds assembly and bitcode support for `MDLocation`.  The assembly
side is rather big, since this is the first `MDNode` subclass (that
isn't `MDTuple`).  Part of PR21433.

(If you're wondering where the mountains of testcase updates are, we
don't need them until I update `DILocation` and `DebugLoc` to actually
use this class.)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225830 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-01-13 21:10:44 +00:00
parent 7c06364dc0
commit 3b0fe4ec0a
15 changed files with 284 additions and 5 deletions

View File

@ -282,7 +282,8 @@ static bool isIntOrIntVectorValue(const std::pair<const Value*, unsigned> &V) {
return V.first->getType()->isIntOrIntVectorTy();
}
ValueEnumerator::ValueEnumerator(const Module &M) : HasMDString(false) {
ValueEnumerator::ValueEnumerator(const Module &M)
: HasMDString(false), HasMDLocation(false) {
if (shouldPreserveBitcodeUseListOrder())
UseListOrders = predictUseListOrder(M);
@ -547,6 +548,7 @@ void ValueEnumerator::EnumerateMetadata(const Metadata *MD) {
EnumerateValue(C->getValue());
HasMDString |= isa<MDString>(MD);
HasMDLocation |= isa<MDLocation>(MD);
// Replace the dummy ID inserted above with the correct one. MDValueMap may
// have changed by inserting operands, so we need a fresh lookup here.