[PATCH] D19924: Representing bundle locked groups as fragments in MCAssembler

Colin LeMahieu via llvm-commits llvm-commits at lists.llvm.org
Wed May 4 09:52:29 PDT 2016


colinl created this revision.
colinl added reviewers: phosek, dschuff, eliben, grosbach, sidneym, khemant.
colinl added a subscriber: llvm-commits.
colinl set the repository for this revision to rL LLVM.

The motivation for this change is because we're interested in using bundle locked groups for Hexagon though want the option to relax previous instructions to satisfy alignment rather than only emitting nops.

The high level changes are creating two new fragment types, MCBundleLockFragment and MCBundleUnlockFragment and handling all the bundle logic in MCObjectStreamer rather than MCElfStreamer/MCAssembler.

computeBundlePadding was converted to MCBundleLockFragment::getSize which is queried when computing fragment size.

A function MCAssembler::writeNopData was extracted to write nop data according to bundling requirements.

I removed special functionality around relax-all handling.  I'm not sure how much assemble-time memory it was saving but it was generating degenerate sequences of nops:

```
foo:
       0:       55      pushl   %ebp
       1:       66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00    nopw    %cs:(%eax,%eax)
      10:       66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00    nopw    %cs:(%eax,%eax)
      1f:       90      nop
      20:       c7 04 24 01 00 00 00    movl    $1, (%esp)
```

Memory usage will decrease during non bundle locked assembling due to the fact that the bundle lock members were removed from the MCFragment base class.

Repository:
  rL LLVM

http://reviews.llvm.org/D19924

Files:
  include/llvm/MC/MCAssembler.h
  include/llvm/MC/MCELFStreamer.h
  include/llvm/MC/MCFragment.h
  include/llvm/MC/MCObjectStreamer.h
  lib/MC/MCAssembler.cpp
  lib/MC/MCELFStreamer.cpp
  lib/MC/MCFragment.cpp
  lib/MC/MCObjectStreamer.cpp
  test/MC/X86/AlignedBundling/misaligned-bundle-group.s
  test/MC/X86/AlignedBundling/misaligned-bundle.s
  test/MC/X86/AlignedBundling/nesting.s
  test/MC/X86/AlignedBundling/relax-in-bundle-group.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19924.56163.patch
Type: text/x-patch
Size: 41136 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160504/873133f7/attachment.bin>


More information about the llvm-commits mailing list