summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2015-05-20 22:51:27 +0000
committerPete Cooper <peter_cooper@apple.com>2015-05-20 22:51:27 +0000
commita05c082866dd9376407c43bb85517975f55652c4 (patch)
tree4be9f7759ef9590db2d8ad8e64988b4820766de6 /llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h
parent31d1de222998cc2363cf9d68a1392c77932f71d1 (diff)
downloadbcm5719-llvm-a05c082866dd9376407c43bb85517975f55652c4.tar.gz
bcm5719-llvm-a05c082866dd9376407c43bb85517975f55652c4.zip
Don't generate comments in the DebugLocStream unless required. NFC.
The ByteStreamer here wasn't taking account of whether the asm streamer was text based and verbose. Only with that combination should we emit comments. This change makes sure that we only actually convert a Twine to a string using Twine::str() if we need the comment. This saves about 10000 small allocations on a test case involving the verify-use_list-order bitcode going through llc with debug info. Note, this is NFC as the comments would ultimately never be emitted unless required. Reviewed by Duncan Exon Smith and David Blaikie. llvm-svn: 237851
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h b/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h
index 818ea626bb2..3001da21b90 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h
@@ -23,7 +23,6 @@ class MCSymbol;
/// Stores a unified stream of .debug_loc entries. There's \a List for each
/// variable/inlined-at pair, and an \a Entry for each \a DebugLocEntry.
///
-/// FIXME: Why do we have comments even when it's an object stream?
/// FIXME: Do we need all these temp symbols?
/// FIXME: Why not output directly to the output stream?
class DebugLocStream {
@@ -52,7 +51,12 @@ private:
SmallString<256> DWARFBytes;
SmallVector<std::string, 32> Comments;
+ /// \brief Only verbose textual output needs comments. This will be set to
+ /// true for that case, and false otherwise.
+ bool GenerateComments;
+
public:
+ DebugLocStream(bool GenerateComments) : GenerateComments(GenerateComments) { }
size_t getNumLists() const { return Lists.size(); }
const List &getList(size_t LI) const { return Lists[LI]; }
ArrayRef<List> getLists() const { return Lists; }
@@ -78,7 +82,7 @@ public:
}
BufferByteStreamer getStreamer() {
- return BufferByteStreamer(DWARFBytes, Comments);
+ return BufferByteStreamer(DWARFBytes, Comments, GenerateComments);
}
ArrayRef<Entry> getEntries(const List &L) const {
OpenPOWER on IntegriCloud