diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-07-13 17:19:57 +0000 | 
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-07-13 17:19:57 +0000 | 
| commit | 66e41e3c6e8b8fbc48d5d3b4d2bd9ce0be4ecb75 (patch) | |
| tree | 9de1c5f67a98cd0e73c60838396486c984f63ac2 /lib/Bitcode/Reader/BitcodeReader.cpp | |
| parent | abdf259d487163e72081a8cf4991b1617206b41e (diff) | |
Notes
Diffstat (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp')
| -rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 21 | 
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 69adead4ba8ed..527ae49b7143d 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -75,6 +75,7 @@ static GlobalValue::LinkageTypes GetDecodedLinkage(unsigned Val) {    case 11: return GlobalValue::LinkOnceODRLinkage;    case 12: return GlobalValue::AvailableExternallyLinkage;    case 13: return GlobalValue::LinkerPrivateLinkage; +  case 14: return GlobalValue::LinkerPrivateWeakLinkage;    }  } @@ -252,17 +253,18 @@ void BitcodeReaderValueList::ResolveConstantForwardRefs() {      // at once.      while (!Placeholder->use_empty()) {        Value::use_iterator UI = Placeholder->use_begin(); +      User *U = *UI;        // If the using object isn't uniqued, just update the operands.  This        // handles instructions and initializers for global variables. -      if (!isa<Constant>(*UI) || isa<GlobalValue>(*UI)) { +      if (!isa<Constant>(U) || isa<GlobalValue>(U)) {          UI.getUse().set(RealVal);          continue;        }        // Otherwise, we have a constant that uses the placeholder.  Replace that        // constant with a new constant that has *all* placeholder uses updated. -      Constant *UserC = cast<Constant>(*UI); +      Constant *UserC = cast<Constant>(U);        for (User::op_iterator I = UserC->op_begin(), E = UserC->op_end();             I != E; ++I) {          Value *NewOp; @@ -2178,13 +2180,18 @@ bool BitcodeReader::ParseFunctionBody(Function *F) {        InstructionList.push_back(I);        break;      } -    case bitc::FUNC_CODE_INST_ALLOCA: { // ALLOCA: [instty, op, align] -      if (Record.size() < 3) +    case bitc::FUNC_CODE_INST_ALLOCA: { // ALLOCA: [instty, opty, op, align] +      // For backward compatibility, tolerate a lack of an opty, and use i32. +      // LLVM 3.0: Remove this. +      if (Record.size() < 3 || Record.size() > 4)          return Error("Invalid ALLOCA record"); +      unsigned OpNum = 0;        const PointerType *Ty = -        dyn_cast_or_null<PointerType>(getTypeByID(Record[0])); -      Value *Size = getFnValueByID(Record[1], Type::getInt32Ty(Context)); -      unsigned Align = Record[2]; +        dyn_cast_or_null<PointerType>(getTypeByID(Record[OpNum++])); +      const Type *OpTy = Record.size() == 4 ? getTypeByID(Record[OpNum++]) : +                                              Type::getInt32Ty(Context); +      Value *Size = getFnValueByID(Record[OpNum++], OpTy); +      unsigned Align = Record[OpNum++];        if (!Ty || !Size) return Error("Invalid ALLOCA record");        I = new AllocaInst(Ty->getElementType(), Size, (1 << Align) >> 1);        InstructionList.push_back(I);  | 
