summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-01-29 18:16:43 +0000
committerReid Kleckner <rnk@google.com>2016-01-29 18:16:43 +0000
commitf3b9ba49419b9d541f639414eadfb0efd4e2a784 (patch)
treee76201034a61c5eefea60762b45cf889ce7037ae /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
parent0647dbb1d8d808e26165547ed056dd221d6cb0f3 (diff)
downloadbcm5719-llvm-f3b9ba49419b9d541f639414eadfb0efd4e2a784.tar.gz
bcm5719-llvm-f3b9ba49419b9d541f639414eadfb0efd4e2a784.zip
[codeview] Begin to add support for inlined call sites
Summary: There are three parts to inlined call frames: 1. The inlinee line subsection 2. The inline site symbol record 3. The function ids referenced by both This change starts by emitting function ids (3) for all subprograms and emitting the base inline site symbol record (2). The actual line numbers in (2) use an encoded format that will come next, along with the inlinee line subsection. Reviewers: majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16333 llvm-svn: 259217
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
index 77b5ed39c1f..4883905e907 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
@@ -22,6 +22,7 @@
#include "llvm/CodeGen/LexicalScopes.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/DebugInfo/CodeView/TypeIndex.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DebugLoc.h"
#include "llvm/MC/MCStreamer.h"
@@ -33,19 +34,31 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public AsmPrinterHandler {
AsmPrinter *Asm;
DebugLoc PrevInstLoc;
+ struct InlineSite {
+ TinyPtrVector<const DILocation *> ChildSites;
+ const DISubprogram *Inlinee = nullptr;
+ unsigned SiteFuncId = 0;
+ };
+
// For each function, store a vector of labels to its instructions, as well as
// to the end of the function.
struct FunctionInfo {
+ /// Map from inlined call site to inlined instructions and child inlined
+ /// call sites. Listed in program order.
+ MapVector<const DILocation *, InlineSite> InlineSites;
+
DebugLoc LastLoc;
MCSymbol *End = nullptr;
unsigned FuncId = 0;
- unsigned LastFileId;
+ unsigned LastFileId = 0;
bool HaveLineInfo = false;
};
FunctionInfo *CurFn;
unsigned NextFuncId = 0;
+ InlineSite &getInlineSite(const DILocation *Loc);
+
/// Remember some debug info about each function. Keep it in a stable order to
/// emit at the end of the TU.
MapVector<const Function *, FunctionInfo> FnDebugInfo;
@@ -53,6 +66,16 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public AsmPrinterHandler {
/// Map from DIFile to .cv_file id.
DenseMap<const DIFile *, unsigned> FileIdMap;
+ DenseMap<const DISubprogram *, codeview::TypeIndex> SubprogramToFuncId;
+
+ unsigned TypeCount = 0;
+
+ /// Gets the next type index and increments the count of types streamed so
+ /// far.
+ codeview::TypeIndex getNextTypeIndex() {
+ return codeview::TypeIndex(codeview::TypeIndex::FirstNonSimpleIndex + TypeCount++);
+ }
+
typedef std::map<const DIFile *, std::string> FileToFilepathMapTy;
FileToFilepathMapTy FileToFilepathMap;
StringRef getFullFilepath(const DIFile *S);
@@ -68,8 +91,13 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public AsmPrinterHandler {
FileToFilepathMap.clear();
}
+ void emitTypeInformation();
+
void emitDebugInfoForFunction(const Function *GV, FunctionInfo &FI);
+ void emitInlinedCallSite(const FunctionInfo &FI, const DILocation *InlinedAt,
+ const InlineSite &Site);
+
public:
CodeViewDebug(AsmPrinter *Asm);
OpenPOWER on IntegriCloud