Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(377)

Side by Side Diff: lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Issue 183273009: Prep for merging 3.4: Undo changes from 3.3 branch (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Retry Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/Analysis/ScalarEvolution.cpp ('k') | lib/CodeGen/IntrinsicLowering.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===-- llvm/CodeGen/DwarfDebug.cpp - Dwarf Debug Framework ---------------===// 1 //===-- llvm/CodeGen/DwarfDebug.cpp - Dwarf Debug Framework ---------------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This file contains support for writing dwarf debug info into asm files. 10 // This file contains support for writing dwarf debug info into asm files.
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 AbstractSPDies.insert(std::make_pair(DS, ScopeDIE)); 599 AbstractSPDies.insert(std::make_pair(DS, ScopeDIE));
600 } 600 }
601 else 601 else
602 ScopeDIE = updateSubprogramScopeDIE(TheCU, DS); 602 ScopeDIE = updateSubprogramScopeDIE(TheCU, DS);
603 } 603 }
604 else { 604 else {
605 // There is no need to emit empty lexical block DIE. 605 // There is no need to emit empty lexical block DIE.
606 std::pair<ImportedEntityMap::const_iterator, 606 std::pair<ImportedEntityMap::const_iterator,
607 ImportedEntityMap::const_iterator> Range = std::equal_range( 607 ImportedEntityMap::const_iterator> Range = std::equal_range(
608 ScopesWithImportedEntities.begin(), ScopesWithImportedEntities.end(), 608 ScopesWithImportedEntities.begin(), ScopesWithImportedEntities.end(),
609 std::pair<const MDNode *, const MDNode *>(DS, (const MDNode*)0), 609 std::pair<const MDNode *, const MDNode *>(DS, 0), CompareFirst());
610 CompareFirst());
611 if (Children.empty() && Range.first == Range.second) 610 if (Children.empty() && Range.first == Range.second)
612 return NULL; 611 return NULL;
613 ScopeDIE = constructLexicalScopeDIE(TheCU, Scope); 612 ScopeDIE = constructLexicalScopeDIE(TheCU, Scope);
614 for (ImportedEntityMap::const_iterator i = Range.first; i != Range.second; + +i) 613 for (ImportedEntityMap::const_iterator i = Range.first; i != Range.second; + +i)
615 constructImportedModuleDIE(TheCU, i->second, ScopeDIE); 614 constructImportedModuleDIE(TheCU, i->second, ScopeDIE);
616 } 615 }
617 616
618 if (!ScopeDIE) return NULL; 617 if (!ScopeDIE) return NULL;
619 618
620 // Add children 619 // Add children
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 // split dwarf it's in the skeleton CU so omit it here. 700 // split dwarf it's in the skeleton CU so omit it here.
702 if (!useSplitDwarf()) 701 if (!useSplitDwarf())
703 NewCU->addLabelAddress(Die, dwarf::DW_AT_low_pc, NULL); 702 NewCU->addLabelAddress(Die, dwarf::DW_AT_low_pc, NULL);
704 703
705 // Define start line table label for each Compile Unit. 704 // Define start line table label for each Compile Unit.
706 MCSymbol *LineTableStartSym = Asm->GetTempSymbol("line_table_start", 705 MCSymbol *LineTableStartSym = Asm->GetTempSymbol("line_table_start",
707 NewCU->getUniqueID()); 706 NewCU->getUniqueID());
708 Asm->OutStreamer.getContext().setMCLineTableSymbol(LineTableStartSym, 707 Asm->OutStreamer.getContext().setMCLineTableSymbol(LineTableStartSym,
709 NewCU->getUniqueID()); 708 NewCU->getUniqueID());
710 709
711 // Use a single line table if we are using .loc and generating assembly.
712 bool UseTheFirstCU =
713 (Asm->TM.hasMCUseLoc() &&
714 Asm->OutStreamer.getKind() == MCStreamer::SK_AsmStreamer) ||
715 (NewCU->getUniqueID() == 0);
716
717 // DW_AT_stmt_list is a offset of line number information for this 710 // DW_AT_stmt_list is a offset of line number information for this
718 // compile unit in debug_line section. For split dwarf this is 711 // compile unit in debug_line section. For split dwarf this is
719 // left in the skeleton CU and so not included. 712 // left in the skeleton CU and so not included.
720 // The line table entries are not always emitted in assembly, so it 713 // The line table entries are not always emitted in assembly, so it
721 // is not okay to use line_table_start here. 714 // is not okay to use line_table_start here.
722 if (!useSplitDwarf()) { 715 if (!useSplitDwarf()) {
723 if (Asm->MAI->doesDwarfUseRelocationsAcrossSections()) 716 if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
724 NewCU->addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 717 NewCU->addLabel(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4,
725 UseTheFirstCU ? 718 NewCU->getUniqueID() == 0 ?
726 Asm->GetTempSymbol("section_line") : LineTableStartSym); 719 Asm->GetTempSymbol("section_line") : LineTableStartSym);
727 else if (UseTheFirstCU) 720 else if (NewCU->getUniqueID() == 0)
728 NewCU->addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0); 721 NewCU->addUInt(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 0);
729 else 722 else
730 NewCU->addDelta(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4, 723 NewCU->addDelta(Die, dwarf::DW_AT_stmt_list, dwarf::DW_FORM_data4,
731 LineTableStartSym, DwarfLineSectionSym); 724 LineTableStartSym, DwarfLineSectionSym);
732 } 725 }
733 726
734 // If we're using split dwarf the compilation dir is going to be in the 727 // If we're using split dwarf the compilation dir is going to be in the
735 // skeleton CU and so we don't need to duplicate it here. 728 // skeleton CU and so we don't need to duplicate it here.
736 if (!useSplitDwarf() && !CompilationDir.empty()) 729 if (!useSplitDwarf() && !CompilationDir.empty())
737 NewCU->addString(Die, dwarf::DW_AT_comp_dir, CompilationDir); 730 NewCU->addString(Die, dwarf::DW_AT_comp_dir, CompilationDir);
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 if (!MMI->hasDebugInfo()) return; 1433 if (!MMI->hasDebugInfo()) return;
1441 LScopes.initialize(*MF); 1434 LScopes.initialize(*MF);
1442 if (LScopes.empty()) return; 1435 if (LScopes.empty()) return;
1443 identifyScopeMarkers(); 1436 identifyScopeMarkers();
1444 1437
1445 // Set DwarfCompileUnitID in MCContext to the Compile Unit this function 1438 // Set DwarfCompileUnitID in MCContext to the Compile Unit this function
1446 // belongs to. 1439 // belongs to.
1447 LexicalScope *FnScope = LScopes.getCurrentFunctionScope(); 1440 LexicalScope *FnScope = LScopes.getCurrentFunctionScope();
1448 CompileUnit *TheCU = SPMap.lookup(FnScope->getScopeNode()); 1441 CompileUnit *TheCU = SPMap.lookup(FnScope->getScopeNode());
1449 assert(TheCU && "Unable to find compile unit!"); 1442 assert(TheCU && "Unable to find compile unit!");
1450 if (Asm->TM.hasMCUseLoc() && 1443 Asm->OutStreamer.getContext().setDwarfCompileUnitID(TheCU->getUniqueID());
1451 Asm->OutStreamer.getKind() == MCStreamer::SK_AsmStreamer)
1452 // Use a single line table if we are using .loc and generating assembly.
1453 Asm->OutStreamer.getContext().setDwarfCompileUnitID(0);
1454 else
1455 Asm->OutStreamer.getContext().setDwarfCompileUnitID(TheCU->getUniqueID());
1456 1444
1457 FunctionBeginSym = Asm->GetTempSymbol("func_begin", 1445 FunctionBeginSym = Asm->GetTempSymbol("func_begin",
1458 Asm->getFunctionNumber()); 1446 Asm->getFunctionNumber());
1459 // Assumes in correct section after the entry point. 1447 // Assumes in correct section after the entry point.
1460 Asm->OutStreamer.EmitLabel(FunctionBeginSym); 1448 Asm->OutStreamer.EmitLabel(FunctionBeginSym);
1461 1449
1462 assert(UserVariables.empty() && DbgValues.empty() && "Maps weren't cleaned"); 1450 assert(UserVariables.empty() && DbgValues.empty() && "Maps weren't cleaned");
1463 1451
1464 const TargetRegisterInfo *TRI = Asm->TM.getRegisterInfo(); 1452 const TargetRegisterInfo *TRI = Asm->TM.getRegisterInfo();
1465 // LiveUserVar - Map physreg numbers to the MDNode they contain. 1453 // LiveUserVar - Map physreg numbers to the MDNode they contain.
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2656 // string section and is identical in format to traditional .debug_str 2644 // string section and is identical in format to traditional .debug_str
2657 // sections. 2645 // sections.
2658 void DwarfDebug::emitDebugStrDWO() { 2646 void DwarfDebug::emitDebugStrDWO() {
2659 assert(useSplitDwarf() && "No split dwarf?"); 2647 assert(useSplitDwarf() && "No split dwarf?");
2660 const MCSection *OffSec = Asm->getObjFileLowering() 2648 const MCSection *OffSec = Asm->getObjFileLowering()
2661 .getDwarfStrOffDWOSection(); 2649 .getDwarfStrOffDWOSection();
2662 const MCSymbol *StrSym = DwarfStrSectionSym; 2650 const MCSymbol *StrSym = DwarfStrSectionSym;
2663 InfoHolder.emitStrings(Asm->getObjFileLowering().getDwarfStrDWOSection(), 2651 InfoHolder.emitStrings(Asm->getObjFileLowering().getDwarfStrDWOSection(),
2664 OffSec, StrSym); 2652 OffSec, StrSym);
2665 } 2653 }
OLDNEW
« no previous file with comments | « lib/Analysis/ScalarEvolution.cpp ('k') | lib/CodeGen/IntrinsicLowering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698