summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCCodeView.cpp
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-07-14 23:47:15 +0000
committerReid Kleckner <rnk@google.com>2016-07-14 23:47:15 +0000
commitc29b4f07f9cf6fdbaac1b3565f9677421710ae09 (patch)
treed04f57000dab6f4f30e339164c2364dd0f94efe9 /llvm/lib/MC/MCCodeView.cpp
parent1a3fd1377679cff451a34ef1ac03a656b0ea2736 (diff)
downloadbcm5719-llvm-c29b4f07f9cf6fdbaac1b3565f9677421710ae09.tar.gz
bcm5719-llvm-c29b4f07f9cf6fdbaac1b3565f9677421710ae09.zip
[codeview] Shrink inlined call site line info tables
For a fully inlined call chain like a -> b -> c -> d, we were emitting line info for 'd' 3 separate times: once for d's actual InlineSite line table, and twice for 'b' and 'c'. This is particularly inefficient when all these functions are in different headers, because now we need to encode the file change. Windbg was coping with our suboptimal output, so this should not be noticeable from the debugger. llvm-svn: 275502
Diffstat (limited to 'llvm/lib/MC/MCCodeView.cpp')
-rw-r--r--llvm/lib/MC/MCCodeView.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/lib/MC/MCCodeView.cpp b/llvm/lib/MC/MCCodeView.cpp
index d3f2aa2a80c..65cff41abeb 100644
--- a/llvm/lib/MC/MCCodeView.cpp
+++ b/llvm/lib/MC/MCCodeView.cpp
@@ -302,7 +302,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
StartLoc.setFileNum(Frag.StartFileId);
StartLoc.setLine(Frag.StartLineNum);
const MCCVLineEntry *LastLoc = &StartLoc;
- bool WithinFunction = true;
+ bool HaveOpenRange = false;
SmallVectorImpl<char> &Buffer = Frag.getContents();
Buffer.clear(); // Clear old contents if we went through relaxation.
@@ -310,16 +310,22 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
if (!InlinedFuncIds.count(Loc.getFunctionId())) {
// We've hit a cv_loc not attributed to this inline call site. Use this
// label to end the PC range.
- if (WithinFunction) {
+ if (HaveOpenRange) {
unsigned Length =
computeLabelDiff(Layout, LastLoc->getLabel(), Loc.getLabel());
compressAnnotation(BinaryAnnotationsOpCode::ChangeCodeLength, Buffer);
compressAnnotation(Length, Buffer);
}
- WithinFunction = false;
+ HaveOpenRange = false;
continue;
}
- WithinFunction = true;
+
+ // If we've already opened the function and we're at an indirectly inlined
+ // location, continue until the next directly inlined location.
+ bool DirectlyInlined = Loc.getFunctionId() == Frag.SiteFuncId;
+ if (!DirectlyInlined && HaveOpenRange)
+ continue;
+ HaveOpenRange = true;
if (Loc.getFileNum() != LastLoc->getFileNum()) {
// File ids are 1 based, and each file checksum table entry is 8 bytes
@@ -358,7 +364,7 @@ void CodeViewContext::encodeInlineLineTable(MCAsmLayout &Layout,
LastLoc = &Loc;
}
- assert(WithinFunction);
+ assert(HaveOpenRange);
unsigned EndSymLength =
computeLabelDiff(Layout, LastLoc->getLabel(), Frag.getFnEndSym());
OpenPOWER on IntegriCloud