summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h36
1 files changed, 26 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
index 0e14797717a..cec2499fa7f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
@@ -14,12 +14,11 @@
#ifndef LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H
#define LLVM_LIB_CODEGEN_ASMPRINTER_CODEVIEWDEBUG_H
-#include "AsmPrinterHandler.h"
+#include "DebugHandlerBase.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/CodeGen/AsmPrinter.h"
-#include "llvm/CodeGen/LexicalScopes.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/DebugInfo/CodeView/TypeIndex.h"
@@ -29,14 +28,25 @@
#include "llvm/Target/TargetLoweringObjectFile.h"
namespace llvm {
+
+class LexicalScope;
+
/// \brief Collects and handles line tables information in a CodeView format.
-class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public AsmPrinterHandler {
- AsmPrinter *Asm;
+class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
MCStreamer &OS;
- DebugLoc PrevInstLoc;
+
+ /// Similar to DbgVariable in DwarfDebug, but not dwarf-specific.
+ struct LocalVariable {
+ const DILocalVariable *DIVar = nullptr;
+ SmallVector<std::pair<const MCSymbol *, const MCSymbol *>, 1> Ranges;
+ unsigned CVRegister = 0;
+ int RegisterOffset = 0;
+ // FIXME: Add support for DIExpressions.
+ };
struct InlineSite {
- TinyPtrVector<const DILocation *> ChildSites;
+ SmallVector<LocalVariable, 1> InlinedLocals;
+ SmallVector<const DILocation *, 1> ChildSites;
const DISubprogram *Inlinee = nullptr;
unsigned SiteFuncId = 0;
};
@@ -46,7 +56,12 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public AsmPrinterHandler {
struct FunctionInfo {
/// Map from inlined call site to inlined instructions and child inlined
/// call sites. Listed in program order.
- MapVector<const DILocation *, InlineSite> InlineSites;
+ std::unordered_map<const DILocation *, InlineSite> InlineSites;
+
+ /// Ordered list of top-level inlined call sites.
+ SmallVector<const DILocation *, 1> ChildSites;
+
+ SmallVector<LocalVariable, 1> Locals;
DebugLoc LastLoc;
const MCSymbol *Begin = nullptr;
@@ -108,6 +123,10 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public AsmPrinterHandler {
void emitInlinedCallSite(const FunctionInfo &FI, const DILocation *InlinedAt,
const InlineSite &Site);
+ void collectVariableInfoFromMMITable();
+
+ void emitLocalVariable(const LocalVariable &Var);
+
public:
CodeViewDebug(AsmPrinter *Asm);
@@ -124,9 +143,6 @@ public:
/// \brief Process beginning of an instruction.
void beginInstruction(const MachineInstr *MI) override;
-
- /// \brief Process end of an instruction.
- void endInstruction() override {}
};
} // End of namespace llvm
OpenPOWER on IntegriCloud