101 if (
I->empty() || !
I->back().isTerminator()) {
102 dbgs() <<
"Basic Block in function '" << F.
getName()
103 <<
"' does not have terminator!\n";
119 INITIALIZE_PASS(PreVerifier,
"preverify",
"Preliminary module verification",
121 static
char &PreVerifyID = PreVerifier::
ID;
134 std::string Messages;
150 const Value *PersonalityFn;
158 MessagesStr(Messages), PersonalityFn(0) {
163 Context(0), DT(0), DL(0), MessagesStr(Messages), PersonalityFn(0) {
167 bool doInitialization(
Module &M) {
171 DL = getAnalysisIfAvailable<DataLayout>();
175 return abortIfBroken();
180 DT = &getAnalysis<DominatorTree>();
187 InstsInThisBlock.clear();
196 return abortIfBroken();
199 bool doFinalization(
Module &M) {
202 visitGlobalValue(*
I);
205 if (
I->isDeclaration()) visitFunction(*
I);
210 visitGlobalVariable(*
I);
214 visitGlobalAlias(*
I);
218 visitNamedMDNode(*
I);
221 visitModuleIdents(M);
225 Finder.processModule(M);
231 return abortIfBroken();
243 bool abortIfBroken() {
244 if (!Broken)
return false;
245 MessagesStr <<
"Broken module found, ";
248 MessagesStr <<
"compilation aborted!\n";
249 dbgs() << MessagesStr.str();
253 MessagesStr <<
"verification continues.\n";
254 dbgs() << MessagesStr.str();
257 MessagesStr <<
"compilation terminated.\n";
270 void visitModuleIdents(
Module &M);
271 void visitModuleFlags(
Module &M);
293 void visitPHINode(
PHINode &PN);
300 void visitVAArgInst(
VAArgInst &VAA) { visitInstruction(VAA); }
327 int VT,
unsigned ArgNo, std::string &Suffix);
328 bool VerifyIntrinsicType(
Type *Ty,
331 bool VerifyIntrinsicIsVarArg(
bool isVarArg,
333 bool VerifyAttributeCount(
AttributeSet Attrs,
unsigned Params);
334 void VerifyAttributeTypes(
AttributeSet Attrs,
unsigned Idx,
335 bool isFunction,
const Value *V);
337 bool isReturnValue,
const Value *V);
341 void VerifyBitcastType(
const Value *V,
Type *DestTy,
Type *SrcTy);
342 void VerifyConstantExprBitcastType(
const ConstantExpr *CE);
344 void verifyDebugInfo();
346 void WriteValue(
const Value *V) {
348 if (isa<Instruction>(V)) {
349 MessagesStr << *V <<
'\n';
356 void WriteType(
Type *
T) {
358 MessagesStr <<
' ' << *
T;
365 void CheckFailed(
const Twine &Message,
368 MessagesStr << Message.
str() <<
"\n";
376 void CheckFailed(
const Twine &Message,
const Value *V1,
378 MessagesStr << Message.
str() <<
"\n";
387 MessagesStr << Message.
str() <<
"\n";
403 #define Assert(C, M) \
404 do { if (!(C)) { CheckFailed(M); return; } } while (0)
405 #define Assert1(C, M, V1) \
406 do { if (!(C)) { CheckFailed(M, V1); return; } } while (0)
407 #define Assert2(C, M, V1, V2) \
408 do { if (!(C)) { CheckFailed(M, V1, V2); return; } } while (0)
409 #define Assert3(C, M, V1, V2, V3) \
410 do { if (!(C)) { CheckFailed(M, V1, V2, V3); return; } } while (0)
411 #define Assert4(C, M, V1, V2, V3, V4) \
412 do { if (!(C)) { CheckFailed(M, V1, V2, V3, V4); return; } } while (0)
427 (isa<GlobalAlias>(GV) &&
429 "Global is external, but doesn't have external or dllimport or weak linkage!",
433 "Global is marked as dllimport, but not external", &GV);
436 "Only global variables can have appending linkage!", &GV);
441 "Only global arrays can have appending linkage!", GVar);
448 "Global variable initializer type does not match global "
449 "variable type!", &GV);
455 "'common' global must have a zero initializer!", &GV);
462 "invalid linkage type for global declaration", &GV);
466 GV.
getName() ==
"llvm.global_dtors")) {
468 "invalid linkage for intrinsic global variable", &GV);
478 "wrong type for intrinsic global variable", &GV);
483 GV.
getName() ==
"llvm.compiler.used")) {
485 "invalid linkage for intrinsic global variable", &GV);
487 if (
ArrayType *ATy = dyn_cast<ArrayType>(GVType)) {
489 Assert1(PTy,
"wrong type for intrinsic global variable", &GV);
493 Assert1(InitArray,
"wrong initalizer for intrinsic global variable",
495 for (
unsigned i = 0, e = InitArray->
getNumOperands(); i != e; ++i) {
498 isa<GlobalVariable>(V) || isa<Function>(V) || isa<GlobalAlias>(V),
499 "invalid llvm.used member", V);
507 visitGlobalValue(GV);
516 while (!WorkStack.
empty()) {
521 if (
const User *U = dyn_cast<User>(V)) {
522 for (
unsigned I = 0,
N = U->getNumOperands();
I !=
N; ++
I)
526 if (
const ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) {
527 VerifyConstantExprBitcastType(CE);
533 visitGlobalValue(GV);
538 "Alias name cannot be empty!", &GA);
540 "Alias should have external or external weak linkage!", &GA);
542 "Aliasee cannot be NULL!", &GA);
544 "Alias and aliasee types should match!", &GA);
549 if (!isa<GlobalValue>(Aliasee)) {
552 (CE->
getOpcode() == Instruction::BitCast ||
553 CE->
getOpcode() == Instruction::GetElementPtr) &&
555 "Aliasee should be either GlobalValue or bitcast of GlobalValue",
558 if (CE->
getOpcode() == Instruction::BitCast) {
563 "Alias bitcasts cannot be between different address spaces",
570 "Aliasing chain should end with function or global variable", &GA);
572 visitGlobalValue(GA);
575 void Verifier::visitNamedMDNode(
NamedMDNode &NMD) {
582 "Named metadata operand cannot be function local!", MD);
590 if (!MDNodes.insert(&MD))
597 if (isa<Constant>(Op) || isa<MDString>(Op))
599 if (
MDNode *
N = dyn_cast<MDNode>(Op)) {
601 "Global metadata operand cannot be function local!", &MD,
N);
611 ActualF =
I->getParent()->getParent();
612 else if (
BasicBlock *BB = dyn_cast<BasicBlock>(Op))
613 ActualF = BB->getParent();
614 else if (
Argument *
A = dyn_cast<Argument>(Op))
615 ActualF =
A->getParent();
616 assert(ActualF &&
"Unimplemented function local metadata case!");
618 Assert2(ActualF == F,
"function-local metadata used in wrong function",
623 void Verifier::visitModuleIdents(
Module &M) {
633 "incorrect number of operands in llvm.ident metadata",
N);
635 (
"invalid value for llvm.ident metadata entry operand"
636 "(the operand should be a string)"),
641 void Verifier::visitModuleFlags(
Module &M) {
649 visitModuleFlag(Flags->
getOperand(
I), SeenIDs, Requirements);
653 for (
unsigned I = 0, E = Requirements.
size();
I != E; ++
I) {
654 MDNode *Requirement = Requirements[
I];
660 CheckFailed(
"invalid requirement on flag, flag is not present in module",
666 CheckFailed((
"invalid requirement on flag, "
667 "flag does not have the required value"),
679 "incorrect number of operands in module flag", Op);
683 "invalid behavior operand in module flag (expected constant integer)",
685 unsigned BehaviorValue = Behavior->getZExtValue();
687 "invalid ID operand in module flag (expected metadata string)",
691 switch (BehaviorValue) {
694 "invalid behavior operand in module flag (unexpected constant)",
709 "invalid value for 'require' module flag (expected metadata pair)",
712 (
"invalid value for 'require' module flag "
713 "(first value operand should be a string)"),
726 "invalid value for 'append'-type module flag "
727 "(expected a metadata node)", Op->
getOperand(2));
734 bool Inserted = SeenIDs.
insert(std::make_pair(ID, Op)).second;
736 "module flag identifiers must be unique (or of 'require' type)",
741 void Verifier::VerifyAttributeTypes(
AttributeSet Attrs,
unsigned Idx,
742 bool isFunction,
const Value *V) {
750 assert(Slot != ~0U &&
"Attribute set inconsistency!");
754 if (
I->isStringAttribute())
783 CheckFailed(
"Attribute '" +
I->getAsString() +
784 "' only applies to functions!", V);
790 CheckFailed(
"Attribute '" +
I->getAsString() +
791 "' does not apply to function returns");
794 }
else if (isFunction) {
795 CheckFailed(
"Attribute '" +
I->getAsString() +
796 "' does not apply to functions!", V);
804 void Verifier::VerifyParameterAttrs(
AttributeSet Attrs,
unsigned Idx,
Type *Ty,
805 bool isReturnValue,
const Value *V) {
809 VerifyAttributeTypes(Attrs, Idx,
false, V);
817 "Attribute 'byval', 'nest', 'sret', 'nocapture', and 'returned' "
818 "do not apply to return values!", V);
827 "'byval, nest, and sret' are incompatible!", V);
835 "'byval, nest, and inreg' are incompatible!", V);
839 "'sret and returned' are incompatible!", V);
843 "'zeroext and signext' are incompatible!", V);
847 "'readnone and readonly' are incompatible!", V);
851 "'noinline and alwaysinline' are incompatible!", V);
855 "Wrong types for attribute: " +
861 "Attribute 'byval' does not support unsized types!", V);
864 "Attribute 'byval' only applies to parameters with pointer type!",
875 bool SawNest =
false;
876 bool SawReturned =
false;
878 for (
unsigned i = 0, e = Attrs.
getNumSlots(); i != e; ++i) {
889 VerifyParameterAttrs(Attrs, Idx, Ty, Idx == 0, V);
895 Assert1(!SawNest,
"More than one parameter has attribute nest!", V);
900 Assert1(!SawReturned,
"More than one parameter has attribute returned!",
903 "argument and return types for 'returned' attribute", V);
908 Assert1(Idx == 1,
"Attribute sret is not on first parameter!", V);
914 VerifyAttributeTypes(Attrs, AttributeSet::FunctionIndex,
true, V);
920 "Attributes 'readnone and readonly' are incompatible!", V);
926 "Attributes 'noinline and alwaysinline' are incompatible!", V);
932 "Attribute 'optnone' requires 'noinline'!", V);
936 "Attributes 'optsize and optnone' are incompatible!", V);
940 "Attributes 'minsize and optnone' are incompatible!", V);
944 void Verifier::VerifyBitcastType(
const Value *V,
Type *DestTy,
Type *SrcTy) {
952 "Bitcast requires both operands to be pointer or neither", V);
953 Assert1(SrcBitSize == DestBitSize,
954 "Bitcast requires types of same width", V);
958 "Bitcast operand must not be aggregate", V);
960 "Bitcast type must not be aggregate", V);
976 "Bitcasts between pointers of different address spaces is not legal."
977 "Use AddrSpaceCast instead.", V);
980 void Verifier::VerifyConstantExprBitcastType(
const ConstantExpr *CE) {
981 if (CE->
getOpcode() == Instruction::BitCast) {
984 VerifyBitcastType(CE, DstTy, SrcTy);
988 bool Verifier::VerifyAttributeCount(
AttributeSet Attrs,
unsigned Params) {
994 if (LastIndex <= Params
995 || (LastIndex == AttributeSet::FunctionIndex
996 && (LastSlot == 0 || Attrs.
getSlotIndex(LastSlot - 1) <= Params)))
1004 void Verifier::visitFunction(
Function &F) {
1010 "Function context does not match Module context!", &
F);
1014 "# formal arguments must match # of arguments for function type!",
1016 Assert1(F.getReturnType()->isFirstClassType() ||
1017 F.getReturnType()->isVoidTy() ||
1018 F.getReturnType()->isStructTy(),
1019 "Functions cannot return aggregate values!", &
F);
1021 Assert1(!F.hasStructRetAttr() || F.getReturnType()->isVoidTy(),
1022 "Invalid struct return type!", &
F);
1027 "Attribute after last parameter!", &F);
1030 VerifyFunctionAttrs(FT, Attrs, &F);
1035 Assert1(!Attrs.hasAttribute(AttributeSet::FunctionIndex,
1037 "Attribute 'builtin' can only be applied to a callsite.", &
F);
1040 switch (F.getCallingConv()) {
1053 "Varargs functions must have C calling conventions!", &
F);
1057 bool isLLVMdotName = F.getName().size() >= 5 &&
1058 F.getName().substr(0, 5) ==
"llvm.";
1065 "Argument value does not match function argument type!",
1067 Assert1(
I->getType()->isFirstClassType(),
1068 "Function arguments must have first-class types!",
I);
1070 Assert2(!
I->getType()->isMetadataTy(),
1071 "Function takes metadata but isn't an intrinsic",
I, &
F);
1074 if (F.isMaterializable()) {
1076 }
else if (F.isDeclaration()) {
1077 Assert1(F.hasExternalLinkage() || F.hasDLLImportLinkage() ||
1078 F.hasExternalWeakLinkage(),
1079 "invalid linkage type for function declaration", &
F);
1083 Assert1(!isLLVMdotName,
"llvm intrinsics cannot be defined!", &F);
1088 "Entry block to function must not have predecessors!", Entry);
1093 "blockaddress may not be used with the entry block!", Entry);
1099 if (F.getIntrinsicID()) {
1101 if (F.hasAddressTaken(&U))
1102 Assert1(0,
"Invalid user of intrinsic instruction!", U);
1108 void Verifier::visitBasicBlock(
BasicBlock &BB) {
1109 InstsInThisBlock.clear();
1116 if (isa<PHINode>(BB.
front())) {
1119 std::sort(Preds.begin(), Preds.end());
1123 Assert1(PN->getNumIncomingValues() != 0,
1124 "PHI nodes must have at least one entry. If the block is dead, "
1125 "the PHI should be removed!", PN);
1126 Assert1(PN->getNumIncomingValues() == Preds.size(),
1127 "PHINode should have one entry for each predecessor of its "
1128 "parent basic block!", PN);
1132 Values.
reserve(PN->getNumIncomingValues());
1133 for (
unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
1134 Values.
push_back(std::make_pair(PN->getIncomingBlock(i),
1135 PN->getIncomingValue(i)));
1136 std::sort(Values.
begin(), Values.
end());
1138 for (
unsigned i = 0, e = Values.
size(); i != e; ++i) {
1143 Assert4(i == 0 || Values[i].first != Values[i-1].first ||
1144 Values[i].second == Values[i-1].second,
1145 "PHI node has multiple entries for the same basic block with "
1146 "different incoming values!", PN, Values[i].first,
1147 Values[i].second, Values[i-1].second);
1151 Assert3(Values[i].first == Preds[i],
1152 "PHI node entries do not match predecessors!", PN,
1153 Values[i].first, Preds[i]);
1162 "Terminator found in the middle of a basic block!", I.
getParent());
1163 visitInstruction(I);
1166 void Verifier::visitBranchInst(
BranchInst &BI) {
1169 "Branch condition is not 'i1' type!", &BI, BI.
getCondition());
1171 visitTerminatorInst(BI);
1174 void Verifier::visitReturnInst(
ReturnInst &RI) {
1179 "Found return instr that returns non-void in Function of void "
1183 "Function return type does not match operand "
1188 visitTerminatorInst(RI);
1191 void Verifier::visitSwitchInst(
SwitchInst &SI) {
1197 Assert1(i.getCaseValue()->getType() == SwitchTy,
1198 "Switch constants must all be same type as switch value!", &SI);
1200 "Duplicate integer as switch case", &SI, i.getCaseValue());
1203 visitTerminatorInst(SI);
1208 "Indirectbr operand must have pointer type!", &BI);
1211 "Indirectbr destinations must all have pointer type!", &BI);
1213 visitTerminatorInst(BI);
1216 void Verifier::visitSelectInst(
SelectInst &SI) {
1219 "Invalid operands for select instruction!", &SI);
1222 "Select values must have same type as select instruction!", &SI);
1223 visitInstruction(SI);
1230 Assert1(0,
"User-defined operators should not live outside of a pass!", &I);
1233 void Verifier::visitTruncInst(
TruncInst &I) {
1245 "trunc source and destination must both be a vector or neither", &
I);
1246 Assert1(SrcBitSize > DestBitSize,
"DestTy too big for Trunc", &I);
1248 visitInstruction(I);
1251 void Verifier::visitZExtInst(
ZExtInst &I) {
1260 "zext source and destination must both be a vector or neither", &
I);
1264 Assert1(SrcBitSize < DestBitSize,
"Type too small for ZExt", &I);
1266 visitInstruction(I);
1269 void Verifier::visitSExtInst(
SExtInst &I) {
1281 "sext source and destination must both be a vector or neither", &
I);
1282 Assert1(SrcBitSize < DestBitSize,
"Type too small for SExt", &I);
1284 visitInstruction(I);
1298 "fptrunc source and destination must both be a vector or neither",&
I);
1299 Assert1(SrcBitSize > DestBitSize,
"DestTy too big for FPTrunc", &I);
1301 visitInstruction(I);
1304 void Verifier::visitFPExtInst(
FPExtInst &I) {
1316 "fpext source and destination must both be a vector or neither", &
I);
1317 Assert1(SrcBitSize < DestBitSize,
"DestTy too small for FPExt", &I);
1319 visitInstruction(I);
1322 void Verifier::visitUIToFPInst(
UIToFPInst &I) {
1331 "UIToFP source and dest must both be vector or scalar", &I);
1333 "UIToFP source must be integer or integer vector", &
I);
1335 "UIToFP result must be FP or FP vector", &
I);
1337 if (SrcVec && DstVec)
1338 Assert1(cast<VectorType>(SrcTy)->getNumElements() ==
1339 cast<VectorType>(DestTy)->getNumElements(),
1340 "UIToFP source and dest vector length mismatch", &I);
1342 visitInstruction(I);
1345 void Verifier::visitSIToFPInst(
SIToFPInst &I) {
1354 "SIToFP source and dest must both be vector or scalar", &I);
1356 "SIToFP source must be integer or integer vector", &
I);
1358 "SIToFP result must be FP or FP vector", &
I);
1360 if (SrcVec && DstVec)
1361 Assert1(cast<VectorType>(SrcTy)->getNumElements() ==
1362 cast<VectorType>(DestTy)->getNumElements(),
1363 "SIToFP source and dest vector length mismatch", &I);
1365 visitInstruction(I);
1368 void Verifier::visitFPToUIInst(
FPToUIInst &I) {
1377 "FPToUI source and dest must both be vector or scalar", &I);
1381 "FPToUI result must be integer or integer vector", &
I);
1383 if (SrcVec && DstVec)
1384 Assert1(cast<VectorType>(SrcTy)->getNumElements() ==
1385 cast<VectorType>(DestTy)->getNumElements(),
1386 "FPToUI source and dest vector length mismatch", &I);
1388 visitInstruction(I);
1391 void Verifier::visitFPToSIInst(
FPToSIInst &I) {
1400 "FPToSI source and dest must both be vector or scalar", &I);
1402 "FPToSI source must be FP or FP vector", &
I);
1404 "FPToSI result must be integer or integer vector", &
I);
1406 if (SrcVec && DstVec)
1407 Assert1(cast<VectorType>(SrcTy)->getNumElements() ==
1408 cast<VectorType>(DestTy)->getNumElements(),
1409 "FPToSI source and dest vector length mismatch", &I);
1411 visitInstruction(I);
1420 "PtrToInt source must be pointer", &
I);
1422 "PtrToInt result must be integral", &
I);
1424 "PtrToInt type mismatch", &
I);
1430 "PtrToInt Vector width mismatch", &
I);
1433 visitInstruction(I);
1442 "IntToPtr source must be an integral", &
I);
1444 "IntToPtr result must be a pointer",&
I);
1446 "IntToPtr type mismatch", &
I);
1451 "IntToPtr Vector width mismatch", &
I);
1453 visitInstruction(I);
1459 VerifyBitcastType(&I, DestTy, SrcTy);
1460 visitInstruction(I);
1468 "AddrSpaceCast source must be a pointer", &
I);
1470 "AddrSpaceCast result must be a pointer", &
I);
1472 "AddrSpaceCast must be between different address spaces", &
I);
1475 "AddrSpaceCast vector pointer number of elements mismatch", &
I);
1476 visitInstruction(I);
1481 void Verifier::visitPHINode(
PHINode &PN) {
1488 "PHI nodes not grouped at top of basic block!",
1495 "PHI node operands are not the same type as the result!", &PN);
1500 visitInstruction(PN);
1503 void Verifier::VerifyCallSite(
CallSite CS) {
1507 "Called function must be a pointer!",
I);
1510 Assert1(FPTy->getElementType()->isFunctionTy(),
1511 "Called function is not pointer to function type!",
I);
1512 FunctionType *FTy = cast<FunctionType>(FPTy->getElementType());
1515 if (FTy->isVarArg())
1517 "Called function requires more parameters than were provided!",
I);
1520 "Incorrect number of arguments passed to called function!",
I);
1523 for (
unsigned i = 0, e = FTy->getNumParams(); i != e; ++i)
1525 "Call parameter type does not match function signature!",
1531 "Attribute after last parameter!", I);
1534 VerifyFunctionAttrs(FTy, Attrs, I);
1536 if (FTy->isVarArg()) {
1538 bool SawNest =
false;
1539 bool SawReturned =
false;
1541 for (
unsigned Idx = 1; Idx < 1 + FTy->getNumParams(); ++Idx) {
1549 for (
unsigned Idx = 1 + FTy->getNumParams(); Idx <= CS.
arg_size(); ++Idx) {
1551 VerifyParameterAttrs(Attrs, Idx, Ty,
false, I);
1554 Assert1(!SawNest,
"More than one parameter has attribute nest!", I);
1559 Assert1(!SawReturned,
"More than one parameter has attribute returned!",
1562 "Incompatible argument and return types for 'returned' "
1568 "Attribute 'sret' cannot be used for vararg call arguments!",
I);
1576 PE = FTy->param_end(); PI != PE; ++PI)
1577 Assert1(!(*PI)->isMetadataTy(),
1578 "Function has metadata parameter but isn't an intrinsic",
I);
1581 visitInstruction(*I);
1584 void Verifier::visitCallInst(
CallInst &CI) {
1585 VerifyCallSite(&CI);
1589 visitIntrinsicFunctionCall(ID, CI);
1592 void Verifier::visitInvokeInst(
InvokeInst &II) {
1593 VerifyCallSite(&II);
1598 "The unwind destination does not have a landingpad instruction!",&II);
1600 visitTerminatorInst(II);
1608 "Both operands to a binary operator are not of the same type!", &B);
1613 case Instruction::Add:
1614 case Instruction::Sub:
1615 case Instruction::Mul:
1616 case Instruction::SDiv:
1617 case Instruction::UDiv:
1618 case Instruction::SRem:
1619 case Instruction::URem:
1621 "Integer arithmetic operators only work with integral types!", &B);
1623 "Integer arithmetic operators must have same type "
1624 "for operands and result!", &B);
1628 case Instruction::FAdd:
1629 case Instruction::FSub:
1630 case Instruction::FMul:
1631 case Instruction::FDiv:
1632 case Instruction::FRem:
1634 "Floating-point arithmetic operators only work with "
1635 "floating-point types!", &B);
1637 "Floating-point arithmetic operators must have same type "
1638 "for operands and result!", &B);
1645 "Logical operators only work with integral types!", &B);
1647 "Logical operators must have same type for operands and result!",
1650 case Instruction::Shl:
1651 case Instruction::LShr:
1652 case Instruction::AShr:
1654 "Shifts only work with integral types!", &B);
1656 "Shift return type must be same as operands!", &B);
1662 visitInstruction(B);
1665 void Verifier::visitICmpInst(
ICmpInst &IC) {
1670 "Both operands to ICmp instruction are not of the same type!", &IC);
1673 "Invalid operand types for ICmp instruction", &IC);
1677 "Invalid predicate in ICmp instruction!", &IC);
1679 visitInstruction(IC);
1687 "Both operands to FCmp instruction are not of the same type!", &FC);
1690 "Invalid operand types for FCmp instruction", &
FC);
1694 "Invalid predicate in FCmp instruction!", &
FC);
1696 visitInstruction(FC);
1702 "Invalid extractelement operands!", &EI);
1703 visitInstruction(EI);
1710 "Invalid insertelement operands!", &IE);
1711 visitInstruction(IE);
1717 "Invalid shufflevector operands!", &SV);
1718 visitInstruction(SV);
1724 Assert1(isa<PointerType>(TargetTy),
1725 "GEP base pointer is not a vector or a vector of pointers", &GEP);
1726 Assert1(cast<PointerType>(TargetTy)->getElementType()->isSized(),
1727 "GEP into unsized type!", &GEP);
1735 Assert1(ElTy,
"Invalid indices for GEP pointer type!", &GEP);
1739 == ElTy,
"GEP is not of right type for indices!", &GEP, ElTy);
1741 if (GEP.getPointerOperandType()->isVectorTy()) {
1743 unsigned GepWidth = GEP.getPointerOperandType()->getVectorNumElements();
1744 Assert1(GepWidth == GEP.getType()->getVectorNumElements(),
1745 "Vector GEP result width doesn't match operand's", &GEP);
1746 for (
unsigned i = 0, e = Idxs.size(); i != e; ++i) {
1747 Type *IndexTy = Idxs[i]->getType();
1749 "Vector GEP must have vector indices!", &GEP);
1751 Assert1(IndexWidth == GepWidth,
"Invalid GEP index vector width", &GEP);
1754 visitInstruction(GEP);
1763 Assert1(PTy,
"Load operand must be a pointer.", &LI);
1766 "Load result type does not match pointer operand type!", &
LI, ElTy);
1769 "Load cannot have Release ordering", &
LI);
1771 "Atomic load must specify explicit alignment", &
LI);
1774 "atomic store operand must have integer type!",
1777 Assert2(Size >= 8 && !(Size & (Size - 1)),
1778 "atomic store operand must be power-of-two byte-sized integer",
1783 "Non-atomic load cannot have SynchronizationScope specified", &
LI);
1787 unsigned NumOperands = Range->getNumOperands();
1788 Assert1(NumOperands % 2 == 0,
"Unfinished range!", Range);
1789 unsigned NumRanges = NumOperands / 2;
1790 Assert1(NumRanges >= 1,
"It should have at least one range!", Range);
1793 for (
unsigned i = 0; i < NumRanges; ++i) {
1795 Assert1(Low,
"The lower limit must be an integer!", Low);
1797 Assert1(High,
"The upper limit must be an integer!", High);
1799 High->
getType() == ElTy,
"Range types must match load type!",
1805 Assert1(!CurRange.isEmptySet() && !CurRange.isFullSet(),
1806 "Range must not be empty!", Range);
1808 Assert1(CurRange.intersectWith(LastRange).isEmptySet(),
1809 "Intervals are overlapping", Range);
1810 Assert1(LowV.
sgt(LastRange.getLower()),
"Intervals are not in order",
1817 if (NumRanges > 2) {
1823 Assert1(FirstRange.intersectWith(LastRange).isEmptySet(),
1824 "Intervals are overlapping", Range);
1832 visitInstruction(LI);
1835 void Verifier::visitStoreInst(
StoreInst &SI) {
1837 Assert1(PTy,
"Store operand must be a pointer.", &SI);
1840 "Stored value type does not match pointer operand type!",
1844 "Store cannot have Acquire ordering", &SI);
1846 "Atomic store must specify explicit alignment", &SI);
1849 "atomic store operand must have integer type!",
1852 Assert2(Size >= 8 && !(Size & (Size - 1)),
1853 "atomic store operand must be power-of-two byte-sized integer",
1858 "Non-atomic store cannot have SynchronizationScope specified", &SI);
1860 visitInstruction(SI);
1863 void Verifier::visitAllocaInst(
AllocaInst &AI) {
1866 "Allocation instruction pointer not in the generic address space!",
1871 "Alloca array size must have integer type", &AI);
1872 visitInstruction(AI);
1877 "cmpxchg instructions must be atomic.", &CXI);
1879 "cmpxchg instructions cannot be unordered.", &CXI);
1881 Assert1(PTy,
"First cmpxchg operand must be a pointer.", &CXI);
1882 Type *ElTy = PTy->getElementType();
1884 "cmpxchg operand must have integer type!",
1887 Assert2(Size >= 8 && !(Size & (Size - 1)),
1888 "cmpxchg operand must be power-of-two byte-sized integer",
1891 "Expected value type does not match pointer operand type!",
1894 "Stored value type does not match pointer operand type!",
1896 visitInstruction(CXI);
1901 "atomicrmw instructions must be atomic.", &RMWI);
1903 "atomicrmw instructions cannot be unordered.", &RMWI);
1905 Assert1(PTy,
"First atomicrmw operand must be a pointer.", &RMWI);
1906 Type *ElTy = PTy->getElementType();
1908 "atomicrmw operand must have integer type!",
1911 Assert2(Size >= 8 && !(Size & (Size - 1)),
1912 "atomicrmw operand must be power-of-two byte-sized integer",
1915 "Argument value type does not match pointer operand type!",
1919 "Invalid binary operation!", &RMWI);
1920 visitInstruction(RMWI);
1923 void Verifier::visitFenceInst(
FenceInst &FI) {
1927 "fence instructions may only have "
1928 "acquire, release, acq_rel, or seq_cst ordering.", &FI);
1929 visitInstruction(FI);
1936 "Invalid ExtractValueInst operands!", &EVI);
1938 visitInstruction(EVI);
1945 "Invalid InsertValueInst operands!", &IVI);
1947 visitInstruction(IVI);
1956 "LandingPadInst needs at least one clause or to be a cleanup.", &LPI);
1963 "Block containing LandingPadInst must be jumped to "
1964 "only by the unwind edge of an invoke.", &LPI);
1970 "LandingPadInst not the first non-PHI instruction in the block.",
1977 "Personality function doesn't match others in function", &LPI);
1981 Assert1(isa<Constant>(PersonalityFn),
"Personality function is not constant!",
1985 Assert1(isa<Constant>(Clause),
"Clause is not constant!", &LPI);
1988 "Catch operand does not have pointer type!", &LPI);
1990 Assert1(LPI.
isFilter(i),
"Clause is neither catch nor filter!", &LPI);
1991 Assert1(isa<ConstantArray>(Clause) || isa<ConstantAggregateZero>(Clause),
1992 "Filter operand is not an array of constants!", &LPI);
1996 visitInstruction(LPI);
1999 void Verifier::verifyDominatesUse(
Instruction &I,
unsigned i) {
2004 if (
InvokeInst *II = dyn_cast<InvokeInst>(Op)) {
2010 Assert2(InstsInThisBlock.count(Op) || DT->dominates(Op, U),
2011 "Instruction does not dominate all uses!", Op, &
I);
2018 Assert1(BB,
"Instruction not embedded in basic block!", &I);
2020 if (!isa<PHINode>(I)) {
2023 Assert1(*UI != (
User*)&I || !DT->isReachableFromEntry(BB),
2024 "Only PHI nodes may reference their own value!", &
I);
2029 "Instruction has a name, but provides a void value!", &
I);
2035 "Instruction returns a non-scalar type!", &
I);
2040 isa<CallInst>(
I) || isa<InvokeInst>(I),
2041 "Invalid use of metadata!", &
I);
2048 if (
Instruction *Used = dyn_cast<Instruction>(*UI))
2049 Assert2(Used->getParent() != 0,
"Instruction referencing instruction not"
2050 " embedded in a basic block!", &
I, Used);
2052 CheckFailed(
"Use of instruction is not an instruction!", *UI);
2063 Assert1(0,
"Instruction operands must be first-class values!", &I);
2070 "Cannot take the address of an intrinsic!", &
I);
2073 "Cannot invoke an intrinsinc other than donothing", &
I);
2078 "Referring to a basic block in another function!", &
I);
2081 "Referring to an argument in another function!", &
I);
2085 }
else if (isa<Instruction>(I.
getOperand(i))) {
2086 verifyDominatesUse(I, i);
2087 }
else if (isa<InlineAsm>(I.
getOperand(i))) {
2088 Assert1((i + 1 == e && isa<CallInst>(I)) ||
2089 (i + 3 == e && isa<InvokeInst>(I)),
2090 "Cannot take the address of an inline asm!", &I);
2099 while (!Stack.
empty()) {
2104 VerifyConstantExprBitcastType(V);
2117 "fpmath requires a floating point result!", &
I);
2120 if (
ConstantFP *CFP0 = dyn_cast_or_null<ConstantFP>(Op0)) {
2121 APFloat Accuracy = CFP0->getValueAPF();
2123 "fpmath accuracy not a positive number!", &
I);
2125 Assert1(
false,
"invalid fpmath accuracy!", &I);
2130 Assert1(!MD || isa<LoadInst>(I),
"Ranges are only for loads!", &I);
2134 Finder.processLocation(*Mod,
DILocation(MD));
2137 InstsInThisBlock.insert(&I);
2145 bool Verifier::VerifyIntrinsicType(
Type *Ty,
2148 using namespace Intrinsic;
2151 if (Infos.
empty())
return true;
2152 IITDescriptor D = Infos.
front();
2153 Infos = Infos.
slice(1);
2167 VerifyIntrinsicType(VT->getElementType(), Infos, ArgTys);
2172 VerifyIntrinsicType(PT->getElementType(), Infos, ArgTys);
2180 for (
unsigned i = 0, e = D.Struct_NumElements; i != e; ++i)
2189 if (D.getArgumentNumber() < ArgTys.
size())
2190 return Ty != ArgTys[D.getArgumentNumber()];
2194 assert(D.getArgumentNumber() == ArgTys.
size() &&
"Table consistency error");
2197 switch (D.getArgumentKind()) {
2207 return D.getArgumentNumber() >= ArgTys.
size() ||
2208 !isa<VectorType>(ArgTys[D.getArgumentNumber()]) ||
2210 cast<VectorType>(ArgTys[D.getArgumentNumber()])) != Ty;
2214 return D.getArgumentNumber() >= ArgTys.
size() ||
2215 !isa<VectorType>(ArgTys[D.getArgumentNumber()]) ||
2217 cast<VectorType>(ArgTys[D.getArgumentNumber()])) != Ty;
2228 Verifier::VerifyIntrinsicIsVarArg(
bool isVarArg,
2230 using namespace Intrinsic;
2234 return isVarArg ?
true :
false;
2237 if (Infos.
size() != 1)
2241 IITDescriptor D = Infos.
front();
2242 Infos = Infos.
slice(1);
2244 return isVarArg ?
false :
true;
2266 Assert1(!VerifyIntrinsicType(IFTy->getReturnType(), TableRef, ArgTys),
2267 "Intrinsic has incorrect return type!", IF);
2268 for (
unsigned i = 0, e = IFTy->getNumParams(); i != e; ++i)
2269 Assert1(!VerifyIntrinsicType(IFTy->getParamType(i), TableRef, ArgTys),
2270 "Intrinsic has incorrect argument type!", IF);
2274 Assert1(!VerifyIntrinsicIsVarArg(IsVarArg, TableRef),
2275 "Intrinsic was not defined with variable arguments!", IF);
2277 Assert1(!VerifyIntrinsicIsVarArg(IsVarArg, TableRef),
2278 "Callsite was not defined with variable arguments!", IF);
2281 Assert1(TableRef.
empty(),
"Intrinsic has too few arguments!", IF);
2288 "Intrinsic name not mangled correctly for type arguments!", IF);
2302 "is_zero_undef argument of bit counting intrinsics must be a "
2303 "constant int", &CI);
2307 "invalid llvm.dbg.declare intrinsic call 1", &CI);
2310 "invalid llvm.dbg.declare intrinsic call 2", &CI);
2312 Finder.processDeclare(*Mod, cast<DbgDeclareInst>(&CI));
2317 "invalid llvm.dbg.value intrinsic call 1", &CI);
2318 Finder.processValue(*Mod, cast<DbgValueInst>(&CI));
2326 "alignment argument of memory intrinsics must be a constant int",
2329 "isvolatile argument of memory intrinsics must be a constant int",
2338 Assert1(AI,
"llvm.gcroot parameter #1 must be an alloca.", &CI);
2340 "llvm.gcroot parameter #2 must be a constant.", &CI);
2343 "llvm.gcroot parameter #1 must either be a pointer alloca, "
2344 "or argument #2 must be a non-null constant.", &CI);
2349 "Enclosing function does not use GC.", &CI);
2353 "llvm.init_trampoline parameter #2 must resolve to a function.",
2359 cast<ConstantInt>(CI.
getArgOperand(1))->getZExtValue() < 2 &&
2361 "invalid arguments to llvm.prefetch",
2366 "llvm.stackprotector parameter #2 must resolve to an alloca.",
2373 "size argument of memory use markers must be a constant integer",
2378 "llvm.invariant.end parameter #2 must be a constant integer", &CI);
2383 void Verifier::verifyDebugInfo() {
2387 E = Finder.compile_unit_end(); I != E; ++
I)
2390 E = Finder.subprogram_end(); I != E; ++
I)
2393 E = Finder.global_variable_end(); I != E; ++
I)
2395 "DIGlobalVariable does not Verify!", *
I);
2397 E = Finder.type_end(); I != E; ++
I)
2400 E = Finder.scope_end(); I != E; ++
I)
2410 return new Verifier(action);
2419 assert(!F.
isDeclaration() &&
"Cannot verify external functions");
2422 Verifier *V =
new Verifier(action);
2424 FPM.doInitialization();
2433 std::string *ErrorInfo) {
2435 Verifier *V =
new Verifier(action);
2437 PM.run(const_cast<Module&>(M));
2439 if (ErrorInfo && V->Broken)
2440 *ErrorInfo = V->MessagesStr.str();
bool verifyModule(const Module &M, VerifierFailureAction action=AbortProcessAction, std::string *ErrorInfo=0)
Check a module for errors.
const Use & getOperandUse(unsigned i) const
void push_back(const T &Elt)
LinkageTypes getLinkage() const
IntegerType * getType() const
AtomicOrdering getOrdering() const
Returns the ordering constraint on this cmpxchg.
static PassRegistry * getPassRegistry()
LLVMContext & getContext() const
const AttributeSet & getAttributes() const
LLVM Argument representation.
#define Assert4(C, M, V1, V2, V3, V4)
Base class for instruction visitors.
Value * getAggregateOperand()
void initializeVerifierPass(PassRegistry &)
SynchronizationScope getSynchScope() const
ArrayRef< unsigned > getIndices() const
Sign extended before/after call.
unsigned getScalarSizeInBits()
static bool isValidOperands(const Value *Vec, const Value *NewElt, const Value *Idx)
VerifierFailureAction
An enumeration to specify the action to be taken if errors found.
Force argument to be passed in register.
The main container class for the LLVM Intermediate Representation.
unsigned getNumParams() const
const T & front() const
front - Get the first element.
static cl::opt< bool > DisableDebugInfoVerifier("disable-debug-info-verifier", cl::init(true))
unsigned arg_size() const
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
This class represents zero extension of integer types.
unsigned getNumOperands() const
Nested function static chain.
unsigned getNumOperands() const
getNumOperands - Return number of MDNode operands.
Type::subtype_iterator param_iterator
named_metadata_iterator named_metadata_end()
bool hasAppendingLinkage() const
Source said inlining was desirable.
bool isDoubleTy() const
isDoubleTy - Return true if this is 'double', a 64-bit IEEE fp type.
iterator begin(unsigned Slot) const
bool isPtrOrPtrVectorTy() const
Type * getReturnType() const
const Function * getParent() const
Return the enclosing method, or null if none.
const Instruction & front() const
MDNode - a tuple of other values.
This class represents a sign extension of integer types.
unsigned getAddressSpace() const
Return the address space of the Pointer type.
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
static VectorType * getTruncatedElementVectorType(VectorType *VTy)
const Constant * getInitializer() const
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
Value * getPersonalityFn() const
const Constant * getAliasee() const
unsigned getOpcode() const
getOpcode - Return the opcode at the root of this constant expression
bool isFiniteNonZero() const
LoopInfoBase< BlockT, LoopT > * LI
ValTy * getArgument(unsigned ArgNo) const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
StringRef getName() const
Value * getOperand(unsigned i) const LLVM_READONLY
getOperand - Return specified operand.
bool Verify() const
Verify - Verify that a compile unit is well formed.
void WriteAsOperand(raw_ostream &, const Value *, bool PrintTy=true, const Module *Context=0)
Appends the two values, which are required to be metadata nodes.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
This class represents a conversion between pointers from one address space to another.
std::string str() const
str - Return the twine contents as a std::string.
bool hasCommonLinkage() const
const APInt & getValue() const
Return the constant's value.
T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val()
#define llvm_unreachable(msg)
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
unsigned getNumArgOperands() const
bool canLosslesslyBitCastTo(Type *Ty) const
Determine if this type could be losslessly bitcast to Ty.
bool hasAddressTaken() const
Returns true if there are any uses of this basic block other than direct branches, switches, etc. to it.
bool Verify() const
Verify - Verify that a global variable descriptor is well formed.
Function must be in a unwind table.
#define Assert2(C, M, V1, V2)
ID
LLVM Calling Convention Representation.
AttributeSet typeIncompatible(Type *Ty, uint64_t Index)
Which attributes cannot be applied to a type.
Type * getPointerOperandType() const
Function does not access memory.
BasicBlock * getDestination(unsigned i)
getDestination - Return the specified destination.
Hidden pointer to structure to return.
Function creates no aliases of pointer.
SynchronizationScope getSynchScope() const
This class represents a cast from a pointer to an integer.
global_iterator global_begin()
static bool isValidOperands(const Value *V1, const Value *V2, const Value *Mask)
void visit(Iterator Start, Iterator End)
DISubprogram - This is a wrapper for a subprogram (e.g. a function).
AtomicOrdering getOrdering() const
Returns the ordering constraint on this RMW.
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
bool isHalfTy() const
isHalfTy - Return true if this is 'half', a 16-bit IEEE fp type.
ArrayRef< T > slice(unsigned N) const
slice(n) - Chop off the first N elements of the array.
Represents a floating point comparison operator.
bool sgt(const APInt &RHS) const
Signed greather than comparison.
bool isMaterializable() const
bool isFirstClassType() const
This class represents a no-op cast from one type to another.
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
GlobalValue * resolveAliasedGlobal(bool stopOnWeak=true)
unsigned getNumClauses() const
getNumClauses - Get the number of clauses for this landing pad.
ValTy * getCalledValue() const
This class represents a cast from floating point to signed integer.
unsigned getNumElements() const
Return the number of elements in the Vector type.
Type * getElementType() const
This class represents a truncation of integer types.
size_t size() const
size - Get the array size.
BasicBlock * getNormalDest() const
unsigned getNumIncomingValues() const
Value * getClause(unsigned Idx) const
#define Assert3(C, M, V1, V2, V3)
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
Value * stripPointerCastsNoFollowAliases()
Strips off any unneeded pointer casts and all-zero GEPs from the specified value, returning the origi...
verifyModule will print to stderr and return true
bool isFilter(unsigned Idx) const
isFilter - Return 'true' if the clause and index Idx is a filter clause.
bool isX86_MMXTy() const
isX86_MMXTy - Return true if this is X86 MMX.
bool isIntOrIntVectorTy() const
unsigned getNumSlots() const
Return the number of slots used in this attribute list. This is the number of arguments that have an ...
Type * getParamType(unsigned i) const
Parameter type accessors.
initializer< Ty > init(const Ty &Val)
unsigned getAlignment() const
alias_iterator alias_end()
value_use_iterator< User > use_iterator
LLVM Basic Block Representation.
InstrTy * getInstruction() const
void initializePreVerifierPass(PassRegistry &)
static BlockAddress * get(Function *F, BasicBlock *BB)
get - Return a BlockAddress for the specified function and basic block.
unsigned getIntrinsicID() const LLVM_READONLY
Type * getElementType(unsigned N) const
LLVM Constant Representation.
void getModuleFlagsMetadata(SmallVectorImpl< ModuleFlagEntry > &Flags) const
getModuleFlagsMetadata - Returns the module flags in the provided vector.
PointerType * getType() const
bool isFloatTy() const
isFloatTy - Return true if this is 'float', a 32-bit IEEE fp type.
APInt Or(const APInt &LHS, const APInt &RHS)
Bitwise OR function for APInt.
LandingPadInst * getLandingPadInst()
Return the landingpad instruction associated with the landing pad.
APInt Xor(const APInt &LHS, const APInt &RHS)
Bitwise XOR function for APInt.
Interval::pred_iterator pred_begin(Interval *I)
Return value is always equal to this argument.
static bool isValidLinkage(LinkageTypes L)
bool verifyFunction(const Function &F, VerifierFailureAction action=AbortProcessAction)
static Type * getVoidTy(LLVMContext &C)
DIGlobalVariable - This is a wrapper for a global variable.
INITIALIZE_PASS(PreVerifier,"preverify","Preliminary module verification", false, false) static char &PreVerifyID
Type * getTypeAtIndex(const Value *V)
verifyModule will print to stderr and abort()
Represent an integer comparison operator.
MDNode * getOperand(unsigned i) const
getOperand - Return specified operand.
Value * getOperand(unsigned i) const
Zero extended before/after call.
Interval::pred_iterator pred_end(Interval *I)
Function doesn't unwind stack.
Predicate getPredicate() const
Return the predicate for this instruction.
bool empty() const
empty - Check if the array is empty.
Marks function as being in a cold path.
This class represents a cast from an integer to a pointer.
Mark the function as not returning.
bool hasWeakLinkage() const
bool isFPOrFPVectorTy() const
PointerType * getPointerTo(unsigned AddrSpace=0)
const Value * getTrueValue() const
Call cannot be duplicated.
DIScope - A base class for various scopes.
bool isConditional() const
global_iterator global_end()
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &KV)
bool hasExternalWeakLinkage() const
BinaryOps getOpcode() const
bool hasExternalLinkage() const
BasicBlock * getUnwindDest() const
AtomicOrdering getOrdering() const
Returns the ordering effect of this store.
bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Class for constant integers.
Value * getIncomingValue(unsigned i) const
unsigned getVectorNumElements() const
AnalysisUsage & addRequiredID(const void *ID)
void getIntrinsicInfoTableEntries(ID id, SmallVectorImpl< IITDescriptor > &T)
MDNode * getMetadata(unsigned KindID) const
iterator end(unsigned Slot) const
const APInt & getLower() const
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
This class represents a cast from floating point to unsigned integer.
alias_iterator alias_begin()
SequentialType * getType() const
Value * stripPointerCasts()
Strips off any unneeded pointer casts, all-zero GEPs and aliases from the specified value...
Function * getCalledFunction() const
AtomicOrdering getOrdering() const
Returns the ordering effect of this fence.
BinOp getOperation() const
static VectorType * getExtendedElementVectorType(VectorType *VTy)
raw_ostream & dbgs()
dbgs - Return a circular-buffered debug stream.
Value * getArgOperand(unsigned i) const
Class for arbitrary precision integers.
bool hasInitializer() const
Function must not be optimized.
Function only reads from memory.
Value * getCondition() const
APInt And(const APInt &LHS, const APInt &RHS)
Bitwise AND function for APInt.
PointerType * getType() const
getType - Global values are always pointers.
bool isFunctionLocal() const
isFunctionLocal - Return whether MDNode is local to a function.
NamedMDNode * getNamedMetadata(const Twine &Name) const
Value * getCondition() const
std::string getName(ID id, ArrayRef< Type * > Tys=None)
bool isAggregateType() const
bool Verify() const
Verify - Verify that a type descriptor is well formed.
verifyModule will just return true
AtomicOrdering getOrdering() const
Returns the ordering effect of this fence.
bool isDeclaration() const
unsigned getSlotIndex(unsigned Slot) const
Return the index for the given slot.
bool hasAttributes(unsigned Index) const
Return true if attribute exists at the given index.
unsigned getAlignment() const
Callee isn't recognized as a builtin.
bool isCatch(unsigned Idx) const
isCatch - Return 'true' if the clause and index Idx is a catch clause.
TerminatorInst * getTerminator()
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
bool Verify() const
Verify - Verify that a subprogram descriptor is well formed.
bool isLandingPad() const
Return true if this basic block is a landing pad.
FunctionType * getFunctionType() const
This class represents a cast unsigned integer to floating point.
const Type * getScalarType() const
unsigned getPrimitiveSizeInBits() const
bool hasLocalLinkage() const
NamedMDListType::iterator named_metadata_iterator
The named metadata iterators.
This class represents a cast from signed integer to floating point.
const APInt & getUpper() const
Type * getReturnType() const
Function can return twice.
static Type * getIndexedType(Type *Ptr, ArrayRef< Value * > IdxList)
This class represents a truncation of floating point types.
bool isLabelTy() const
isLabelTy - Return true if this is 'label'.
LLVM Value Representation.
bool hasUnnamedAddr() const
ValueT lookup(const KeyT &Val) const
Disable implicit floating point insts.
const Value * getArraySize() const
bool hasDLLImportLinkage() const
unsigned getNumOperands() const
getNumOperands - Return the number of NamedMDNode operands.
#define Assert1(C, M, V1)
static bool isContiguous(const ConstantRange &A, const ConstantRange &B)
unsigned getNumElements() const
Random access to the elements.
This class represents an extension of floating point types.
DICompileUnit - A wrapper for a compile unit.
Intel_OCL_BI - Calling conventions for Intel OpenCL built-ins.
Stack protection required.
unsigned getNumDestinations() const
bool isEmpty() const
Return true if there are no attributes.
const BasicBlock * getParent() const
InstListType::iterator iterator
Instruction iterators...
named_metadata_iterator named_metadata_begin()
LLVMContext & getContext() const
bool isVoidTy() const
isVoidTy - Return true if this is 'void'.
FunTy * getCalledFunction() const
bool empty() const
empty - Check if the string is empty.
FunctionPass * createVerifierPass(VerifierFailureAction action=AbortProcessAction)
Create a verifier pass.
bool isMetadataTy() const
isMetadataTy - Return true if this is 'metadata'.
static const char * areInvalidOperands(Value *Cond, Value *True, Value *False)
Function must be optimized for size first.