llvm.org GIT mirror llvm / fdbf1c0
Merge from mainline git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_20@36932 91177308-0d34-0410-b5e6-96231b3b80d8 Tanya Lattner 12 years ago
1 changed file(s) with 28 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
984984 GlobalInits.push_back(std::make_pair(NewGV, InitID-1));
985985 break;
986986 }
987 // FUNCTION: [type, callingconv, isproto, linkage, alignment, section,
988 // visibility]
987 // FUNCTION: [type, callingconv, isproto, linkage, paramattr,
988 // alignment, section, visibility]
989989 case bitc::MODULE_CODE_FUNCTION: {
990 if (Record.size() < 7)
990 if (Record.size() < 8)
991991 return Error("Invalid MODULE_CODE_FUNCTION record");
992992 const Type *Ty = getTypeByID(Record[0]);
993993 if (!isa(Ty))
10031003 Func->setCallingConv(Record[1]);
10041004 bool isProto = Record[2];
10051005 Func->setLinkage(GetDecodedLinkage(Record[3]));
1006 Func->setAlignment((1 << Record[4]) >> 1);
1007 if (Record[5]) {
1008 if (Record[5]-1 >= SectionTable.size())
1006
1007 assert(Func->getFunctionType()->getParamAttrs() ==
1008 getParamAttrs(Record[4]));
1009
1010 Func->setAlignment((1 << Record[5]) >> 1);
1011 if (Record[6]) {
1012 if (Record[6]-1 >= SectionTable.size())
10091013 return Error("Invalid section ID");
1010 Func->setSection(SectionTable[Record[5]-1]);
1011 }
1012 Func->setVisibility(GetDecodedVisibility(Record[6]));
1014 Func->setSection(SectionTable[Record[6]-1]);
1015 }
1016 Func->setVisibility(GetDecodedVisibility(Record[7]));
10131017
10141018 ValueList.push_back(Func);
10151019
13631367 }
13641368
13651369 case bitc::FUNC_CODE_INST_INVOKE: { // INVOKE: [cc,fnty, op0,op1,op2, ...]
1366 if (Record.size() < 3) return Error("Invalid INVOKE record");
1367 unsigned CCInfo = Record[0];
1368 BasicBlock *NormalBB = getBasicBlock(Record[1]);
1369 BasicBlock *UnwindBB = getBasicBlock(Record[2]);
1370
1371 unsigned OpNum = 3;
1370 if (Record.size() < 4) return Error("Invalid INVOKE record");
1371 unsigned CCInfo = Record[1];
1372 BasicBlock *NormalBB = getBasicBlock(Record[2]);
1373 BasicBlock *UnwindBB = getBasicBlock(Record[3]);
1374
1375 unsigned OpNum = 4;
13721376 Value *Callee;
13731377 if (getValueTypePair(Record, OpNum, NextValueNo, Callee))
13741378 return Error("Invalid INVOKE record");
13821386 Record.size() < OpNum+FTy->getNumParams())
13831387 return Error("Invalid INVOKE record");
13841388
1389 assert(FTy->getParamAttrs() == getParamAttrs(Record[0]));
1390
13851391 SmallVector Ops;
13861392 for (unsigned i = 0, e = FTy->getNumParams(); i != e; ++i, ++OpNum) {
13871393 Ops.push_back(getFnValueByID(Record[OpNum], FTy->getParamType(i)));
14831489 break;
14841490 }
14851491 case bitc::FUNC_CODE_INST_CALL: { // CALL: [cc, fnty, fnid, arg0, arg1...]
1486 if (Record.size() < 1)
1492 if (Record.size() < 2)
14871493 return Error("Invalid CALL record");
1488 unsigned CCInfo = Record[0];
1489
1490 unsigned OpNum = 1;
1494
1495 unsigned CCInfo = Record[1];
1496
1497 unsigned OpNum = 2;
14911498 Value *Callee;
14921499 if (getValueTypePair(Record, OpNum, NextValueNo, Callee))
14931500 return Error("Invalid CALL record");
14971504 if (OpTy) FTy = dyn_cast(OpTy->getElementType());
14981505 if (!FTy || Record.size() < FTy->getNumParams()+OpNum)
14991506 return Error("Invalid CALL record");
1507
1508 assert(FTy->getParamAttrs() == getParamAttrs(Record[0]));
15001509
15011510 SmallVector Args;
15021511 // Read the fixed params.