diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 20 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 13 |
2 files changed, 23 insertions, 10 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index d33bb6042b..8d5a3c7ed7 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -425,6 +425,13 @@ bool DISubprogram::describes(const Function *F) { return false; } +unsigned DISubprogram::isOptimized() const { + assert (DbgNode && "Invalid subprogram descriptor!"); + if (DbgNode->getNumOperands() == 16) + return getUnsignedField(15); + return 0; +} + StringRef DIScope::getFilename() const { if (!DbgNode) return StringRef(); @@ -912,7 +919,8 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context, bool isDefinition, unsigned VK, unsigned VIndex, DIType ContainingType, - bool isArtificial) { + bool isArtificial, + bool isOptimized) { Value *Elts[] = { GetTagConstant(dwarf::DW_TAG_subprogram), @@ -929,9 +937,10 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context, ConstantInt::get(Type::getInt32Ty(VMContext), (unsigned)VK), ConstantInt::get(Type::getInt32Ty(VMContext), VIndex), ContainingType.getNode(), - ConstantInt::get(Type::getInt1Ty(VMContext), isArtificial) + ConstantInt::get(Type::getInt1Ty(VMContext), isArtificial), + ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized) }; - return DISubprogram(MDNode::get(VMContext, &Elts[0], 15)); + return DISubprogram(MDNode::get(VMContext, &Elts[0], 16)); } /// CreateSubprogramDefinition - Create new subprogram descriptor for the @@ -956,9 +965,10 @@ DISubprogram DIFactory::CreateSubprogramDefinition(DISubprogram &SPDeclaration) DeclNode->getOperand(11), // Virtuality DeclNode->getOperand(12), // VIndex DeclNode->getOperand(13), // Containting Type - DeclNode->getOperand(14) // isArtificial + DeclNode->getOperand(14), // isArtificial + DeclNode->getOperand(15) // isOptimized }; - return DISubprogram(MDNode::get(VMContext, &Elts[0], 15)); + return DISubprogram(MDNode::get(VMContext, &Elts[0], 16)); } /// CreateGlobalVariable - Create a new descriptor for the specified global. diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 1a97ae77eb..e68a17d7af 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1328,12 +1328,18 @@ DIE *DwarfDebug::createSubprogramDIE(const DISubprogram &SP, bool MakeDecl) { if (SP.isArtificial()) addUInt(SPDie, dwarf::DW_AT_artificial, dwarf::DW_FORM_flag, 1); - // DW_TAG_inlined_subroutine may refer to this DIE. - ModuleCU->insertDIE(SP.getNode(), SPDie); + if (!SP.isLocalToUnit()) + addUInt(SPDie, dwarf::DW_AT_external, dwarf::DW_FORM_flag, 1); + if (SP.isOptimized()) + addUInt(SPDie, dwarf::DW_AT_APPLE_optimized, dwarf::DW_FORM_flag, 1); + if (!DisableFramePointerElim(*Asm->MF)) addUInt(SPDie, dwarf::DW_AT_APPLE_omit_frame_ptr, dwarf::DW_FORM_flag, 1); + // DW_TAG_inlined_subroutine may refer to this DIE. + ModuleCU->insertDIE(SP.getNode(), SPDie); + return SPDie; } @@ -1424,9 +1430,6 @@ DIE *DwarfDebug::updateSubprogramScopeDIE(MDNode *SPNode) { MachineLocation Location(RI->getFrameRegister(*Asm->MF)); addAddress(SPDie, dwarf::DW_AT_frame_base, Location); - if (!DISubprogram(SPNode).isLocalToUnit()) - addUInt(SPDie, dwarf::DW_AT_external, dwarf::DW_FORM_flag, 1); - return SPDie; } |