Deleted Added
sdiff udiff text old ( 198953 ) new ( 201360 )
full compact
1//===- BitcodeReader.cpp - Internal BitcodeReader implementation ----------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This header defines the BitcodeReader class.
11//
12//===----------------------------------------------------------------------===//
13
14#include "llvm/Bitcode/ReaderWriter.h"
15#include "BitcodeReader.h"
16#include "llvm/Constants.h"
17#include "llvm/DerivedTypes.h"
18#include "llvm/InlineAsm.h"
19#include "llvm/IntrinsicInst.h"
20#include "llvm/LLVMContext.h"
21#include "llvm/Metadata.h"
22#include "llvm/Module.h"
23#include "llvm/Operator.h"
24#include "llvm/AutoUpgrade.h"
25#include "llvm/ADT/SmallString.h"
26#include "llvm/ADT/SmallVector.h"
27#include "llvm/Support/MathExtras.h"
28#include "llvm/Support/MemoryBuffer.h"
29#include "llvm/OperandTraits.h"

--- 805 unchanged lines hidden (view full) ---

835 if (Record.empty() || RecordLength < 2)
836 return Error("Invalid METADATA_KIND record");
837 SmallString<8> Name;
838 Name.resize(RecordLength-1);
839 unsigned Kind = Record[0];
840 (void) Kind;
841 for (unsigned i = 1; i != RecordLength; ++i)
842 Name[i-1] = Record[i];
843 MetadataContext &TheMetadata = Context.getMetadata();
844 unsigned ExistingKind = TheMetadata.getMDKind(Name.str());
845 if (ExistingKind == 0) {
846 unsigned NewKind = TheMetadata.registerMDKind(Name.str());
847 (void) NewKind;
848 assert (Kind == NewKind
849 && "Unable to handle custom metadata mismatch!");
850 } else {
851 assert (ExistingKind == Kind
852 && "Unable to handle custom metadata mismatch!");
853 }
854 break;
855 }
856 }
857 }
858}
859
860/// DecodeSignRotatedValue - Decode a signed value stored with the sign bit in
861/// the LSB for dense VBR encoding.

--- 713 unchanged lines hidden (view full) ---

1575 return false;
1576}
1577
1578/// ParseMetadataAttachment - Parse metadata attachments.
1579bool BitcodeReader::ParseMetadataAttachment() {
1580 if (Stream.EnterSubBlock(bitc::METADATA_ATTACHMENT_ID))
1581 return Error("Malformed block record");
1582
1583 MetadataContext &TheMetadata = Context.getMetadata();
1584 SmallVector<uint64_t, 64> Record;
1585 while(1) {
1586 unsigned Code = Stream.ReadCode();
1587 if (Code == bitc::END_BLOCK) {
1588 if (Stream.ReadBlockEnd())
1589 return Error("Error at end of PARAMATTR block");
1590 break;
1591 }

--- 9 unchanged lines hidden (view full) ---

1601 case bitc::METADATA_ATTACHMENT: {
1602 unsigned RecordLength = Record.size();
1603 if (Record.empty() || (RecordLength - 1) % 2 == 1)
1604 return Error ("Invalid METADATA_ATTACHMENT reader!");
1605 Instruction *Inst = InstructionList[Record[0]];
1606 for (unsigned i = 1; i != RecordLength; i = i+2) {
1607 unsigned Kind = Record[i];
1608 Value *Node = MDValueList.getValueFwdRef(Record[i+1]);
1609 TheMetadata.addMD(Kind, cast<MDNode>(Node), Inst);
1610 }
1611 break;
1612 }
1613 }
1614 }
1615 return false;
1616}
1617

--- 823 unchanged lines hidden ---