llvm.org GIT mirror llvm / 67144e3
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 Derek Schuff 7 years ago
3 changed file(s) with 20 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
385385 if (Assembler.isBundlingEnabled()) {
386386 MCSectionData *SD = getCurrentSectionData();
387387 if (SD->isBundleLocked() && !SD->isBundleGroupBeforeFirstInst())
388 DF = getOrCreateDataFragment();
388 // If we are bundle-locked, we re-use the current fragment.
389 // The bundle-locking directive ensures this is a new data fragment.
390 DF = cast(getCurrentFragment());
389391 else if (!SD->isBundleLocked() && Fixups.size() == 0) {
390392 // Optimize memory usage by emitting the instruction to a
391393 // MCCompactEncodedInstFragment when not in a bundle-locked group and
393395 MCCompactEncodedInstFragment *CEIF = new MCCompactEncodedInstFragment(SD);
394396 CEIF->getContents().append(Code.begin(), Code.end());
395397 return;
396 }
397 else {
398 } else {
398399 DF = new MCDataFragment(SD);
399400 if (SD->getBundleLockState() == MCSectionData::BundleLockedAlignToEnd) {
400401 // If this is a new fragment created for a bundle-locked group, and the
5858
5959 MCDataFragment *MCObjectStreamer::getOrCreateDataFragment() const {
6060 MCDataFragment *F = dyn_cast_or_null(getCurrentFragment());
61 if (!F)
61 // When bundling is enabled, we don't want to add data to a fragment that
62 // already has instructions (see MCELFStreamer::EmitInstToData for details)
63 if (!F || (Assembler->isBundlingEnabled() && F->hasInstructions()))
6264 F = new MCDataFragment(getCurrentSectionData());
6365 return F;
6466 }
44 # instructions should not be inserted. However, for bundle-locked groups
55 # it can be.
66
7 .syntax unified
8 .text
7 .syntax unified
8 .text
99 .bundle_align_mode 4
1010
1111 bx lr
3434 # CHECK-NEXT: 2c: nop
3535 # CHECK-NEXT: 30: bx
3636
37 .align 4
38 foo:
39 b foo
40 .long 3892240112
41 .long 3892240112
42 .long 3892240112
43 .long 3892240112
44 .long 3892240112
45 .long 3892240112
46 # CHECK: 40: b
47