- SD->setBundleLockState(MCSectionData::NotBundleLocked);
-}
-
-void MCELFStreamer::Flush() {
- for (std::vector<LocalCommon>::const_iterator i = LocalCommons.begin(),
- e = LocalCommons.end();
- i != e; ++i) {
- MCSymbolData *SD = i->SD;
- uint64_t Size = i->Size;
- unsigned ByteAlignment = i->ByteAlignment;
- const MCSymbol &Symbol = SD->getSymbol();
- const MCSection &Section = Symbol.getSection();
-
- MCSectionData &SectData = getAssembler().getOrCreateSectionData(Section);
- new MCAlignFragment(ByteAlignment, 0, 1, ByteAlignment, &SectData);
-
- MCFragment *F = new MCFillFragment(0, 0, Size, &SectData);
- SD->setFragment(F);
-
- // Update the maximum alignment of the section if necessary.
- if (ByteAlignment > SectData.getAlignment())
- SectData.setAlignment(ByteAlignment);
- }
+ // When the -mc-relax-all flag is used, we emit instructions to fragments
+ // stored on a stack. When the bundle unlock is emitted, we pop a fragment
+ // from the stack a merge it to the one below.
+ if (getAssembler().getRelaxAll()) {
+ assert(!BundleGroups.empty() && "There are no bundle groups");
+ MCDataFragment *DF = BundleGroups.back();
+
+ // FIXME: Use BundleGroups to track the lock state instead.
+ Sec.setBundleLockState(MCSection::NotBundleLocked);
+
+ // FIXME: Use more separate fragments for nested groups.
+ if (!isBundleLocked()) {
+ mergeFragment(getOrCreateDataFragment(), DF);
+ BundleGroups.pop_back();
+ delete DF;
+ }