summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
diff options
context:
space:
mode:
authorNilanjana Basu <nilanjana.basu87@gmail.com>2019-08-01 22:05:14 +0000
committerNilanjana Basu <nilanjana.basu87@gmail.com>2019-08-01 22:05:14 +0000
commitac7e5788ca03dac225fd92ac937593454bd36d21 (patch)
tree700c62b68f7e9274e3ac622635b2c5809088e941 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
parente86fffcd4489f4862a514a0fd85276b968313739 (diff)
downloadbcm5719-llvm-ac7e5788ca03dac225fd92ac937593454bd36d21.tar.gz
bcm5719-llvm-ac7e5788ca03dac225fd92ac937593454bd36d21.zip
Changes to improve CodeView debug info type record inline comments
Signed-off-by: Nilanjana Basu <nilanjana.basu87@gmail.com> llvm-svn: 367623
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index b3dabca0a8a..f4514335cb3 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -98,7 +98,8 @@ using namespace llvm::codeview;
namespace {
class CVMCAdapter : public CodeViewRecordStreamer {
public:
- CVMCAdapter(MCStreamer &OS) : OS(&OS) {}
+ CVMCAdapter(MCStreamer &OS, TypeCollection &TypeTable)
+ : OS(&OS), TypeTable(TypeTable) {}
void EmitBytes(StringRef Data) { OS->EmitBytes(Data); }
@@ -110,8 +111,24 @@ public:
void AddComment(const Twine &T) { OS->AddComment(T); }
+ void AddRawComment(const Twine &T) { OS->emitRawComment(T); }
+
+ bool isVerboseAsm() { return OS->isVerboseAsm(); }
+
+ StringRef getTypeName(TypeIndex TI) {
+ StringRef TypeName;
+ if (!TI.isNoneType()) {
+ if (TI.isSimple())
+ TypeName = TypeIndex::simpleTypeName(TI);
+ else
+ TypeName = TypeTable.getTypeName(TI);
+ }
+ return TypeName;
+ }
+
private:
MCStreamer *OS = nullptr;
+ TypeCollection &TypeTable;
};
} // namespace
@@ -617,13 +634,6 @@ emitNullTerminatedSymbolName(MCStreamer &OS, StringRef S,
OS.EmitBytes(NullTerminatedString);
}
-static StringRef getTypeLeafName(TypeLeafKind TypeKind) {
- for (const EnumEntry<TypeLeafKind> &EE : getTypeLeafNames())
- if (EE.Value == TypeKind)
- return EE.Name;
- return "";
-}
-
void CodeViewDebug::emitTypeInformation() {
if (TypeTable.empty())
return;
@@ -640,11 +650,11 @@ void CodeViewDebug::emitTypeInformation() {
}
TypeTableCollection Table(TypeTable.records());
+ TypeVisitorCallbackPipeline Pipeline;
SmallString<512> CommentBlock;
raw_svector_ostream CommentOS(CommentBlock);
std::unique_ptr<ScopedPrinter> SP;
std::unique_ptr<TypeDumpVisitor> TDV;
- TypeVisitorCallbackPipeline Pipeline;
if (OS.isVerboseAsm()) {
// To construct block comment describing the type record for readability.
@@ -655,7 +665,7 @@ void CodeViewDebug::emitTypeInformation() {
}
// To emit type record using Codeview MCStreamer adapter
- CVMCAdapter CVMCOS(OS);
+ CVMCAdapter CVMCOS(OS, Table);
TypeRecordMapping typeMapping(CVMCOS);
Pipeline.addCallbackToPipeline(typeMapping);
@@ -665,16 +675,6 @@ void CodeViewDebug::emitTypeInformation() {
CVType Record = Table.getType(*B);
CommentBlock.clear();
-
- auto RecordLen = Record.length();
- auto RecordKind = Record.kind();
- if (OS.isVerboseAsm())
- CVMCOS.AddComment("Record length");
- CVMCOS.EmitIntValue(RecordLen - 2, 2);
- if (OS.isVerboseAsm())
- CVMCOS.AddComment("Record kind: " + getTypeLeafName(RecordKind));
- CVMCOS.EmitIntValue(RecordKind, sizeof(RecordKind));
-
Error E = codeview::visitTypeRecord(Record, *B, Pipeline);
if (E) {
OpenPOWER on IntegriCloud