diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-23 14:19:52 +0000 | 
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-10-23 14:19:52 +0000 | 
| commit | 4a142eb28942073eb27a112b5ca1cca3f01beb9c (patch) | |
| tree | 22cc59e4b240d84c3a5a60531119c4eca914a256 /lib/Bitcode/Reader/BitcodeReader.cpp | |
| parent | 5cd822fa9bbb9622241e3bf4d7674ed49ccde5b9 (diff) | |
Notes
Diffstat (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp')
| -rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 22 | 
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 4eb12c69eb6ec..3a385cbe382de 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -840,7 +840,15 @@ bool BitcodeReader::ParseMetadata() {        for (unsigned i = 1; i != RecordLength; ++i)          Name[i-1] = Record[i];        MetadataContext &TheMetadata = Context.getMetadata(); -      TheMetadata.MDHandlerNames[Name.str()] = Kind; +      unsigned ExistingKind = TheMetadata.getMDKind(Name.str()); +      if (ExistingKind == 0) { +        unsigned NewKind = TheMetadata.registerMDKind(Name.str()); +        assert (Kind == NewKind  +                && "Unable to handle custom metadata mismatch!"); +      } else { +        assert (ExistingKind == Kind  +                && "Unable to handle custom metadata mismatch!"); +      }        break;      }      } @@ -1165,7 +1173,7 @@ bool BitcodeReader::ParseConstants() {        if (Record.size() < 2) return Error("Invalid INLINEASM record");        std::string AsmStr, ConstrStr;        bool HasSideEffects = Record[0] & 1; -      bool IsMsAsm = Record[0] >> 1; +      bool IsAlignStack = Record[0] >> 1;        unsigned AsmStrSize = Record[1];        if (2+AsmStrSize >= Record.size())          return Error("Invalid INLINEASM record"); @@ -1179,7 +1187,7 @@ bool BitcodeReader::ParseConstants() {          ConstrStr += (char)Record[3+AsmStrSize+i];        const PointerType *PTy = cast<PointerType>(CurTy);        V = InlineAsm::get(cast<FunctionType>(PTy->getElementType()), -                         AsmStr, ConstrStr, HasSideEffects, IsMsAsm); +                         AsmStr, ConstrStr, HasSideEffects, IsAlignStack);        break;      }      } @@ -2044,14 +2052,18 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {      }      case bitc::FUNC_CODE_INST_MALLOC: { // MALLOC: [instty, op, align] +      // Autoupgrade malloc instruction to malloc call. +      // FIXME: Remove in LLVM 3.0.        if (Record.size() < 3)          return Error("Invalid MALLOC record");        const PointerType *Ty =          dyn_cast_or_null<PointerType>(getTypeByID(Record[0]));        Value *Size = getFnValueByID(Record[1], Type::getInt32Ty(Context)); -      unsigned Align = Record[2];        if (!Ty || !Size) return Error("Invalid MALLOC record"); -      I = new MallocInst(Ty->getElementType(), Size, (1 << Align) >> 1); +      if (!CurBB) return Error("Invalid malloc instruction with no BB"); +      const Type *Int32Ty = IntegerType::getInt32Ty(CurBB->getContext()); +      I = CallInst::CreateMalloc(CurBB, Int32Ty, Ty->getElementType(), +                                 Size, NULL);        InstructionList.push_back(I);        break;      }  | 
