llvm.org GIT mirror llvm / 084751c
Remove MachineFunction's DefaultDebugLoc member, and make DwarfDebug.cpp responsible for figuring out what that's supposed to be on its own. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101844 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 10 years ago
3 changed file(s) with 16 addition(s) and 23 deletion(s). Raw diff Collapse all Expand all
108108 typedef ilist BasicBlockListType;
109109 BasicBlockListType BasicBlocks;
110110
111 /// Default debug location. Used to print out the debug label at the beginning
112 /// of a function.
113 DebugLoc DefaultDebugLoc;
114
115111 /// FunctionNumber - This provides a unique ID for each function emitted in
116112 /// this translation unit.
117113 ///
393389 /// normal 'L' label is returned.
394390 MCSymbol *getJTISymbol(unsigned JTI, MCContext &Ctx,
395391 bool isLinkerPrivate = false) const;
396
397
398 //===--------------------------------------------------------------------===//
399 // Debug location.
400 //
401
402 /// getDefaultDebugLoc - Get the default debug location for the machine
403 /// function.
404 DebugLoc getDefaultDebugLoc() const { return DefaultDebugLoc; }
405
406 /// setDefaultDebugLoc - Get the default debug location for the machine
407 /// function.
408 void setDefaultDebugLoc(DebugLoc DL) { DefaultDebugLoc = DL; }
409392 };
410393
411394 //===--------------------------------------------------------------------===//
22822282 }
22832283 }
22842284
2285 /// FindFirstDebugLoc - Find the first debug location in the function. This
2286 /// is intended to be an approximation for the source position of the
2287 /// beginning of the function.
2288 static DebugLoc FindFirstDebugLoc(const MachineFunction *MF) {
2289 for (MachineFunction::const_iterator I = MF->begin(), E = MF->end();
2290 I != E; ++I)
2291 for (MachineBasicBlock::const_iterator MBBI = I->begin(), MBBE = I->end();
2292 MBBI != MBBE; ++MBBI) {
2293 DebugLoc DL = MBBI->getDebugLoc();
2294 if (!DL.isUnknown())
2295 return DL;
2296 }
2297 return DebugLoc();
2298 }
2299
22852300 /// beginFunction - Gather pre-function debug information. Assumes being
22862301 /// emitted immediately after the function entry point.
22872302 void DwarfDebug::beginFunction(const MachineFunction *MF) {
22962311
22972312 // Emit label for the implicitly defined dbg.stoppoint at the start of the
22982313 // function.
2299 DebugLoc FDL = MF->getDefaultDebugLoc();
2314 DebugLoc FDL = FindFirstDebugLoc(MF);
23002315 if (FDL.isUnknown()) return;
23012316
23022317 MDNode *Scope = FDL.getScope(MF->getFunction()->getContext());
234234
235235 if (FastIS)
236236 FastIS->setCurDebugLoc(DL);
237
238 // If the function doesn't have a default debug location yet, set
239 // it. This is a total hack.
240 if (MF->getDefaultDebugLoc().isUnknown())
241 MF->setDefaultDebugLoc(DL);
242237 }
243238
244239 /// ResetDebugLoc - Set MF's and SDB's DebugLocs to Unknown.