[PATCH] [MC] Attach labels to existing fragments instead of using a separate fragment

Derek Schuff dschuff at google.com
Wed Oct 22 10:32:39 PDT 2014


Hi jvoung, eliben,

Currently when emitting a label, a new data fragment is created for it if the
current fragment isn't a data fragment.
This change instead enqueues the label and attaches it to the next fragment
(e.g. created for the next instruction) if possible.

When bundle alignment is not enabled, this has no functionality change (it
just results in fewer extra fragments being created). For bundle alignment,
previously labels would point to the beginning of the bundle padding instead
of the beginning of the emitted instruction. This was not only less efficient
(e.g. jumping to the nops instead of past them) but also led to miscalculation
of the address of the GOT (since MC uses a label difference rather than
emitting a "." symbol).

Fixes https://code.google.com/p/nativeclient/issues/detail?id=3982

http://reviews.llvm.org/D5915

Files:
  include/llvm/MC/MCObjectStreamer.h
  lib/MC/MCObjectStreamer.cpp
  test/MC/X86/AlignedBundling/labeloffset.s
  test/MC/X86/AlignedBundling/long-nop-pad.s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5915.15256.patch
Type: text/x-patch
Size: 6604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141022/f6d5654e/attachment.bin>


More information about the llvm-commits mailing list