aboutsummaryrefslogtreecommitdiffstats
path: root/lib/MC/MCELFStreamer.cpp
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@google.com>2013-02-15 22:50:52 +0000
committerDerek Schuff <dschuff@google.com>2013-02-15 22:50:52 +0000
commit67144e37ba5cd35ee917daac631e03963b05a674 (patch)
tree0c6baab3975cf0d06248d7eb46d7e4b931fe620c /lib/MC/MCELFStreamer.cpp
parent4788d14b484ba9e2fe19855fd6c97a3659980fca (diff)
downloadexternal_llvm-67144e37ba5cd35ee917daac631e03963b05a674.zip
external_llvm-67144e37ba5cd35ee917daac631e03963b05a674.tar.gz
external_llvm-67144e37ba5cd35ee917daac631e03963b05a674.tar.bz2
If bundle alignment is enabled, do not add data to a fragment with instructions
With bundle alignment, instructions all get their own MCFragments (unless they are in a bundle-locked group). For instructions with fixups, this is an MCDataFragment. Emitting actual data (e.g. for .long) attempts to re-use MCDataFragments, which we don't want int this case since it leads to fragments which exceed the bundle size. So, don't reuse them in this case. Also adds a test and fixes some formatting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175316 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCELFStreamer.cpp')
-rw-r--r--lib/MC/MCELFStreamer.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/MC/MCELFStreamer.cpp b/lib/MC/MCELFStreamer.cpp
index c4c8e6e..8ddbfbb 100644
--- a/lib/MC/MCELFStreamer.cpp
+++ b/lib/MC/MCELFStreamer.cpp
@@ -386,7 +386,9 @@ void MCELFStreamer::EmitInstToData(const MCInst &Inst) {
if (Assembler.isBundlingEnabled()) {
MCSectionData *SD = getCurrentSectionData();
if (SD->isBundleLocked() && !SD->isBundleGroupBeforeFirstInst())
- DF = getOrCreateDataFragment();
+ // If we are bundle-locked, we re-use the current fragment.
+ // The bundle-locking directive ensures this is a new data fragment.
+ DF = cast<MCDataFragment>(getCurrentFragment());
else if (!SD->isBundleLocked() && Fixups.size() == 0) {
// Optimize memory usage by emitting the instruction to a
// MCCompactEncodedInstFragment when not in a bundle-locked group and
@@ -394,8 +396,7 @@ void MCELFStreamer::EmitInstToData(const MCInst &Inst) {
MCCompactEncodedInstFragment *CEIF = new MCCompactEncodedInstFragment(SD);
CEIF->getContents().append(Code.begin(), Code.end());
return;
- }
- else {
+ } else {
DF = new MCDataFragment(SD);
if (SD->getBundleLockState() == MCSectionData::BundleLockedAlignToEnd) {
// If this is a new fragment created for a bundle-locked group, and the