[PATCH] D43002: Emit S_OBJNAME symbol in CodeView

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 10:28:17 PST 2018


zturner added a comment.

In https://reviews.llvm.org/D43002#1000801, @dblaikie wrote:

> > It would be more efficient to put, e.g., a NamedMDNode into the module so this information can be shared between the CUs.
>
> I assume the string data itself is shared by the bitcode format? But I don't really know.


All of this code is new to me, so I'm still kind of fumbling along as I learn how all this stuff works together, but my impression was that Adrian's suggestion only really applied if I wanted the name of the lto.o file.  Given that I need the name of the bitcode containing .o file, does any of this still apply?  Is the current solution appropriate in that case?



================
Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:674-679
+  for (unsigned i = 0; i != Str.size(); ++i) {
+    if (Str[i] == '\\' && i != Str.size() - 1) {
+      if (Str[i + 1] == '\\')
+        Str.erase(Str.begin() + i + 1);
+    }
+  }
----------------
dblaikie wrote:
> This is O(N^2) (erase is O(N)) & could be made O(N) (using a technique similar to the erase+remove idiom - using literal erase+remove probably isn't practical due to the stateful nature of the walk).
> 
> Is there no other logic for this already elsewhere in LLVM?
Unfortunately there's not.  But you're right, I can do this a bit more efficiently by keeping a separate read pointer and write pointer.


https://reviews.llvm.org/D43002





More information about the llvm-commits mailing list