llvm.org GIT mirror llvm / 573ca05
Transforms: Stop using DIDescriptor::is*() and auto-casting Same as r234255, but for lib/Analysis and lib/Transforms. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234257 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan P. N. Exon Smith 5 years ago
6 changed file(s) with 23 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
102102 if (!T.getName().empty())
103103 O << ' ' << T.getName();
104104 printFile(O, T.getFilename(), T.getDirectory(), T.getLineNumber());
105 if (T.isBasicType()) {
106 DIBasicType BT(T.get());
105 if (DIBasicType BT = dyn_cast(T)) {
107106 O << " ";
108107 if (const char *Encoding =
109108 dwarf::AttributeEncodingString(BT.getEncoding()))
117116 else
118117 O << "unknown-tag(" << T.getTag() << ")";
119118 }
120 if (T.isCompositeType()) {
121 DICompositeType CT(T.get());
119 if (DICompositeType CT = dyn_cast(T)) {
122120 if (auto *S = CT.getIdentifier())
123121 O << " (identifier: '" << S->getString() << "')";
124122 }
306306
307307 for (DICompileUnit DIC : F.compile_units()) {
308308 // Create our live subprogram list.
309 DIArray SPs = DIC.getSubprograms();
309 MDSubprogramArray SPs = DIC->getSubprograms();
310310 bool SubprogramChange = false;
311 for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) {
312 DISubprogram DISP(SPs.getElement(i));
311 for (unsigned i = 0, e = SPs.size(); i != e; ++i) {
312 DISubprogram DISP = SPs[i];
313313
314314 // Make sure we visit each subprogram only once.
315315 if (!VisitedSet.insert(DISP).second)
323323 }
324324
325325 // Create our live global variable list.
326 DIArray GVs = DIC.getGlobalVariables();
326 MDGlobalVariableArray GVs = DIC->getGlobalVariables();
327327 bool GlobalVariableChange = false;
328 for (unsigned i = 0, e = GVs.getNumElements(); i != e; ++i) {
329 DIGlobalVariable DIG(GVs.getElement(i));
328 for (unsigned i = 0, e = GVs.size(); i != e; ++i) {
329 DIGlobalVariable DIG = GVs[i];
330330
331331 // Make sure we only visit each global variable only once.
332332 if (!VisitedSet.insert(DIG).second)
486486 // this pass over the original .o's as they're produced, or run it after
487487 // LTO, we'll generate the same .gcno files.
488488
489 DICompileUnit CU(CU_Nodes->getOperand(i));
489 DICompileUnit CU = cast(CU_Nodes->getOperand(i));
490490 std::error_code EC;
491491 raw_fd_ostream out(mangleName(CU, "gcno"), EC, sys::fs::F_None);
492492 std::string EdgeDestinations;
494494 DIArray SPs = CU.getSubprograms();
495495 unsigned FunctionIdent = 0;
496496 for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) {
497 DISubprogram SP(SPs.getElement(i));
498 assert((!SP || SP.isSubprogram()) &&
499 "A MDNode in subprograms of a CU should be null or a DISubprogram.");
497 DISubprogram SP = cast_or_null(SPs.getElement(i));
500498 if (!SP)
501499 continue;
502500
576574 bool Result = false;
577575 bool InsertIndCounterIncrCode = false;
578576 for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
579 DICompileUnit CU(CU_Nodes->getOperand(i));
577 DICompileUnit CU = cast(CU_Nodes->getOperand(i));
580578 DIArray SPs = CU.getSubprograms();
581579 SmallVector, 8> CountersBySP;
582580 for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) {
583 DISubprogram SP(SPs.getElement(i));
584 assert((!SP || SP.isSubprogram()) &&
585 "A MDNode in subprograms of a CU should be null or a DISubprogram.");
581 DISubprogram SP = cast_or_null(SPs.getElement(i));
586582 if (!SP)
587583 continue;
588584 Function *F = SP.getFunction();
858854 NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu");
859855 if (CU_Nodes) {
860856 for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i) {
861 DICompileUnit CU(CU_Nodes->getOperand(i));
857 DICompileUnit CU = cast(CU_Nodes->getOperand(i));
862858 std::string FilenameGcda = mangleName(CU, "gcda");
863859 uint32_t CfgChecksum = FileChecksums.empty() ? 0 : FileChecksums[i];
864860 Builder.CreateCall3(StartFile,
866862 Builder.CreateGlobalStringPtr(ReversedVersion),
867863 Builder.getInt32(CfgChecksum));
868864 for (unsigned j = 0, e = CountersBySP.size(); j != e; ++j) {
869 DISubprogram SP(CountersBySP[j].second);
865 DISubprogram SP = cast_or_null(CountersBySP[j].second);
870866 uint32_t FuncChecksum = Funcs.empty() ? 0 : Funcs[j]->getFuncChecksum();
871867 Builder.CreateCall5(
872868 EmitFunction, Builder.getInt32(j),
641641 /// \returns the line number where \p F is defined. If it returns 0,
642642 /// it means that there is no debug information available for \p F.
643643 unsigned SampleProfileLoader::getFunctionLoc(Function &F) {
644 DISubprogram S = getDISubprogram(&F);
645 if (S.isSubprogram())
644 if (DISubprogram S = getDISubprogram(&F))
646645 return S.getLineNumber();
647646
648647 // If could not find the start of \p F, emit a diagnostic to inform the user
185185 // Ensure that OldFunc appears in the map.
186186 // (if it's already there it must point to NewFunc anyway)
187187 VMap[OldFunc] = NewFunc;
188 DISubprogram NewSubprogram(MapMetadata(OldSubprogramMDNode, VMap));
188 DISubprogram NewSubprogram =
189 cast(MapMetadata(OldSubprogramMDNode, VMap));
189190
190191 for (DICompileUnit CU : Finder.compile_units()) {
191192 DIArray Subprograms(CU.getSubprograms());
997997 /// that has an associated llvm.dbg.decl intrinsic.
998998 bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
999999 StoreInst *SI, DIBuilder &Builder) {
1000 DIVariable DIVar(DDI->getVariable());
1001 DIExpression DIExpr(DDI->getExpression());
1002 assert((!DIVar || DIVar.isVariable()) &&
1003 "Variable in DbgDeclareInst should be either null or a DIVariable.");
1000 DIVariable DIVar = DDI->getVariable();
1001 DIExpression DIExpr = DDI->getExpression();
10041002 if (!DIVar)
10051003 return false;
10061004
10281026 /// that has an associated llvm.dbg.decl intrinsic.
10291027 bool llvm::ConvertDebugDeclareToDebugValue(DbgDeclareInst *DDI,
10301028 LoadInst *LI, DIBuilder &Builder) {
1031 DIVariable DIVar(DDI->getVariable());
1032 DIExpression DIExpr(DDI->getExpression());
1033 assert((!DIVar || DIVar.isVariable()) &&
1034 "Variable in DbgDeclareInst should be either null or a DIVariable.");
1029 DIVariable DIVar = DDI->getVariable();
1030 DIExpression DIExpr = DDI->getExpression();
10351031 if (!DIVar)
10361032 return false;
10371033
11111107 if (!DDI)
11121108 return false;
11131109 DebugLoc Loc = DDI->getDebugLoc();
1114 DIVariable DIVar(DDI->getVariable());
1115 DIExpression DIExpr(DDI->getExpression());
1116 assert((!DIVar || DIVar.isVariable()) &&
1117 "Variable in DbgDeclareInst should be either null or a DIVariable.");
1110 DIVariable DIVar = DDI->getVariable();
1111 DIExpression DIExpr = DDI->getExpression();
11181112 if (!DIVar)
11191113 return false;
11201114