llvm.org GIT mirror llvm / 18ee3bb
Adjust debug range offsets for isWeakForLinker() functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102127 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 10 years ago
3 changed file(s) with 67 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
13831383 if (Ranges.empty())
13841384 return 0;
13851385
1386 bool MarkFunctionBegin = false;
1387 if (FunctionBeginSym &&
1388 Asm->MF->getFunction()->isWeakForLinker())
1389 MarkFunctionBegin = true;
1390
13861391 SmallVector::const_iterator RI = Ranges.begin();
13871392 if (Ranges.size() > 1) {
13881393 // .debug_range section has not been laid out yet. Emit offset in
13921397 DebugRangeSymbols.size() * Asm->getTargetData().getPointerSize());
13931398 for (SmallVector::const_iterator RI = Ranges.begin(),
13941399 RE = Ranges.end(); RI != RE; ++RI) {
1395 DebugRangeSymbols.push_back(LabelsBeforeInsn.lookup(RI->first));
1396 DebugRangeSymbols.push_back(LabelsAfterInsn.lookup(RI->second));
1400 MCSymbol *Sym = LabelsBeforeInsn.lookup(RI->first);
1401 if (MarkFunctionBegin)
1402 WeakDebugRangeSymbols.insert(std::make_pair(Sym, FunctionBeginSym));
1403 DebugRangeSymbols.push_back(Sym);
1404
1405 Sym = LabelsAfterInsn.lookup(RI->second);
1406 if (MarkFunctionBegin)
1407 WeakDebugRangeSymbols.insert(std::make_pair(Sym, FunctionBeginSym));
1408 DebugRangeSymbols.push_back(Sym);
13971409 }
13981410 DebugRangeSymbols.push_back(NULL);
13991411 DebugRangeSymbols.push_back(NULL);
32273239 // Start the dwarf ranges section.
32283240 Asm->OutStreamer.SwitchSection(
32293241 Asm->getObjFileLowering().getDwarfRangesSection());
3230 for (SmallVector::const_iterator I = DebugRangeSymbols.begin(),
3231 E = DebugRangeSymbols.end(); I != E; ++I) {
3232 if (*I)
3233 Asm->EmitLabelDifference(*I, TextSectionSym,
3242 for (SmallVector::const_iterator
3243 I = DebugRangeSymbols.begin(), E = DebugRangeSymbols.end();
3244 I != E; ++I) {
3245 if (*I) {
3246 const MCSymbol *Begin = TextSectionSym;
3247 // If this symbol is inside linkonce section then use appropriate begin
3248 // marker;
3249 DenseMap::iterator WI
3250 = WeakDebugRangeSymbols.find(*I);
3251 if (WI != WeakDebugRangeSymbols.end())
3252 Begin = WI->second;
3253
3254 Asm->EmitLabelDifference(*I, Begin,
32343255 Asm->getTargetData().getPointerSize());
3256 }
32353257 else
32363258 Asm->OutStreamer.EmitIntValue(0, Asm->getTargetData().getPointerSize(),
32373259 /*addrspace*/0);
196196 DenseMap LabelsAfterInsn;
197197
198198 SmallVector DebugRangeSymbols;
199 DenseMap WeakDebugRangeSymbols;
199200
200201 /// Previous instruction's location information. This is used to determine
201202 /// label location to indicate scope boundries in dwarf debug info.
0 ; RUN: llc < %s | grep "Ltmp3-Lfunc_begin"
1 ; PR 6894
2
3 declare void @_Z7examplev() ssp
4
5 define linkonce_odr void @_bar(i64, i64, i64 %__depth_limit) ssp {
6 entry:
7 br i1 undef, label %while.body, label %while.end, !dbg !0
8
9 while.body: ; preds = %entry
10 br i1 undef, label %if.then, label %if.end, !dbg !8
11
12 if.then: ; preds = %while.body
13 call void @_Z7examplev(), !dbg !10
14 ret void, !dbg !12
15
16 if.end: ; preds = %while.body
17 call void @_Z7examplev(), !dbg !13
18 unreachable
19
20 while.end: ; preds = %entry
21 ret void, !dbg !12
22 }
23
24 !0 = metadata !{i32 2742, i32 7, metadata !1, null}
25 !1 = metadata !{i32 524299, metadata !2, i32 2738, i32 5} ; [ DW_TAG_lexical_block ]
26 !2 = metadata !{i32 524334, i32 0, metadata !3, metadata !"__introsort_loop", metadata !"__introsort_loop", metadata !"_bar", metadata !3, i32 2738, metadata !5, i1 false, i1 true, i32 0, i32 0, null, i1 false} ; [ DW_TAG_subprogram ]
27 !3 = metadata !{i32 524329, metadata !"stl_algo.h", metadata !"/usr/include/c++/4.2.1/bits", metadata !4} ; [ DW_TAG_file_type ]
28 !4 = metadata !{i32 524305, i32 0, i32 4, metadata !"example.cc", metadata !"/tmp", metadata !"clang 1.5", i1 true, i1 false, metadata !"", i32 0} ; [ DW_TAG_compile_unit ]
29 !5 = metadata !{i32 524309, metadata !6, metadata !"", metadata !6, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !7, i32 0, null} ; [ DW_TAG_subroutine_type ]
30 !6 = metadata !{i32 524329, metadata !"example.cc", metadata !"/tmp", metadata !4} ; [ DW_TAG_file_type ]
31 !7 = metadata !{null}
32 !8 = metadata !{i32 2744, i32 4, metadata !9, null}
33 !9 = metadata !{i32 524299, metadata !1, i32 2743, i32 2} ; [ DW_TAG_lexical_block ]
34 !10 = metadata !{i32 2746, i32 8, metadata !11, null}
35 !11 = metadata !{i32 524299, metadata !9, i32 2745, i32 6} ; [ DW_TAG_lexical_block ]
36 !12 = metadata !{i32 2762, i32 5, metadata !1, null}
37 !13 = metadata !{i32 2750, i32 4, metadata !9, null}