Add the align_to_end option to .bundle_lock in the MC implementation of aligned
bundling. The document describing this feature and the implementation has also
been updated:
https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/aligned-bundling-support-in-llvm
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171797 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/MC/MCELFStreamer.cpp b/lib/MC/MCELFStreamer.cpp
index e3acc44..e9afff6 100644
--- a/lib/MC/MCELFStreamer.cpp
+++ b/lib/MC/MCELFStreamer.cpp
@@ -379,8 +379,14 @@
MCSectionData *SD = getCurrentSectionData();
if (SD->isBundleLocked() && !SD->isBundleGroupBeforeFirstInst())
DF = getOrCreateDataFragment();
- 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
+ // group was marked as "align_to_end", set a flag in the fragment.
+ DF->setAlignToBundleEnd(true);
+ }
+ }
// We're now emitting an instruction in a bundle group, so this flag has
// to be turned off.
@@ -407,7 +413,7 @@
report_fatal_error(".bundle_align_mode should be only set once per file");
}
-void MCELFStreamer::EmitBundleLock() {
+void MCELFStreamer::EmitBundleLock(bool AlignToEnd) {
MCSectionData *SD = getCurrentSectionData();
// Sanity checks
@@ -417,7 +423,8 @@
else if (SD->isBundleLocked())
report_fatal_error("Nesting of .bundle_lock is forbidden");
- SD->setBundleLocked(true);
+ SD->setBundleLockState(AlignToEnd ? MCSectionData::BundleLockedAlignToEnd :
+ MCSectionData::BundleLocked);
SD->setBundleGroupBeforeFirstInst(true);
}
@@ -432,7 +439,7 @@
else if (SD->isBundleGroupBeforeFirstInst())
report_fatal_error("Empty bundle-locked group is forbidden");
- SD->setBundleLocked(false);
+ SD->setBundleLockState(MCSectionData::NotBundleLocked);
}
void MCELFStreamer::FinishImpl() {