[PATCH] D109425: [MC] Add Subtarget for MAsmParser call to emitCodeAlignment

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 8 02:44:05 PDT 2021


peter.smith created this revision.
peter.smith added reviewers: mstorsjo, epastor.
Herald added a subscriber: hiraditya.
peter.smith requested review of this revision.
Herald added a project: LLVM.

The call to emitCodeAlignment was missing a STI which is required after D45962 <https://reviews.llvm.org/D45962>.

Should fix the problem reported in D45962 <https://reviews.llvm.org/D45962> https://reviews.llvm.org/D45962#2988712

emitCodeAlignment has a default parameter of 0 for MaxBytesToEmit. Explicitly passing 0 here was interpreted as as nullptr for the STI. This could possibly be avoided by taking STI as a const reference in emitCodeAlignment. This could be done as a follow up patch to get the fix for the problem resolved.


https://reviews.llvm.org/D109425

Files:
  llvm/lib/MC/MCParser/MasmParser.cpp


Index: llvm/lib/MC/MCParser/MasmParser.cpp
===================================================================
--- llvm/lib/MC/MCParser/MasmParser.cpp
+++ llvm/lib/MC/MCParser/MasmParser.cpp
@@ -4772,7 +4772,8 @@
     const MCSection *Section = getStreamer().getCurrentSectionOnly();
     assert(Section && "must have section to emit alignment");
     if (Section->UseCodeAlign()) {
-      getStreamer().emitCodeAlignment(Alignment, /*MaxBytesToEmit=*/0);
+      getStreamer().emitCodeAlignment(Alignment, &getTargetParser().getSTI(),
+                                      /*MaxBytesToEmit=*/0);
     } else {
       // FIXME: Target specific behavior about how the "extra" bytes are filled.
       getStreamer().emitValueToAlignment(Alignment, /*Value=*/0,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109425.371291.patch
Type: text/x-patch
Size: 759 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210908/7e5d1a17/attachment.bin>


More information about the llvm-commits mailing list