[PATCH] D65189: [MC] Support returning a structured rich disassembly output

Seiya Nuta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 15:31:51 PDT 2019


seiya added inline comments.


================
Comment at: llvm/include/llvm/MC/MCInstPrinter.h:113-114
+  /// A stack of pointers which points to &MS set by setMarkupSpans or
+  /// InnerSpans of unclosed MarkupSpans. Here we use std::vector as a stack
+  /// instead of std::stack because we need "clear" method.
+  std::vector<std::vector<MarkupSpan> *> MarkupSpans;
----------------
jhenderson wrote:
> seiya wrote:
> > jhenderson wrote:
> > > You could just use `while(!MarupSpans.empty()) MarkupSpans.pop();` instead of `clear`, if you want to use a `std::stack`.
> > Fixed. First I thought iterating all elements (`O(n)`) is not good but it won't be issue because `n` is small  (typically n < 3) here...
> I think vector::clear is likely O(n) time as well - it has to destroy all its elements.
There's no guarantee but I implicitly assumed that there must be an O(1) optimization for 
 trivially destructible types like pointers.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65189/new/

https://reviews.llvm.org/D65189





More information about the llvm-commits mailing list