Provide an API to temporarily suppress DebugLocations from being attached

to emitted instructions.  Use this if you want an instruction to be
counted towards the prologue or if there is no useful source location.

rdar://problem/13442648

llvm-svn: 180929
This commit is contained in:
Adrian Prantl 2013-05-02 17:27:49 +00:00
parent 05e2c79f87
commit 9ee5840de4
1 changed files with 21 additions and 0 deletions

View File

@ -49,6 +49,10 @@ protected:
class IRBuilderBase {
DebugLoc CurDbgLocation;
protected:
/// Save the current debug location here while we are suppressing
/// line table entries.
llvm::DebugLoc SavedDbgLocation;
BasicBlock *BB;
BasicBlock::iterator InsertPt;
LLVMContext &Context;
@ -113,6 +117,23 @@ public:
CurDbgLocation = L;
}
/// \brief Temporarily suppress DebugLocations from being attached
/// to emitted instructions, until the next call to
/// SetCurrentDebugLocation() or EnableDebugLocations(). Use this
/// if you want an instruction to be counted towards the prologue or
/// if there is no useful source location.
void DisableDebugLocations() {
llvm::DebugLoc Empty;
SavedDbgLocation = getCurrentDebugLocation();
SetCurrentDebugLocation(Empty);
}
/// \brief Restore the previously saved DebugLocation.
void EnableDebugLocations() {
assert(CurDbgLocation.isUnknown());
SetCurrentDebugLocation(SavedDbgLocation);
}
/// \brief Get location information used by debugging information.
DebugLoc getCurrentDebugLocation() const { return CurDbgLocation; }