aboutsummaryrefslogtreecommitdiff
path: root/lib/MC/MCELFStreamer.cpp
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2013-01-07 21:51:08 +0000
committerEli Bendersky <eliben@google.com>2013-01-07 21:51:08 +0000
commit6c1d4972cf1cd6b6072e31c05f97abb1ed7a8497 (patch)
tree01a1fc8d4730a3b75657fafa9a5428bd7e4f0057 /lib/MC/MCELFStreamer.cpp
parentd3ae2866d105f6da6375544eb41aea0dad75a9f2 (diff)
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
Diffstat (limited to 'lib/MC/MCELFStreamer.cpp')
-rw-r--r--lib/MC/MCELFStreamer.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/MC/MCELFStreamer.cpp b/lib/MC/MCELFStreamer.cpp
index e3acc44a85..e9afff6bed 100644
--- a/lib/MC/MCELFStreamer.cpp
+++ b/lib/MC/MCELFStreamer.cpp
@@ -379,8 +379,14 @@ void MCELFStreamer::EmitInstToData(const MCInst &Inst) {
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 @@ void MCELFStreamer::EmitBundleAlignMode(unsigned AlignPow2) {
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 @@ void MCELFStreamer::EmitBundleLock() {
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 @@ void MCELFStreamer::EmitBundleUnlock() {
else if (SD->isBundleGroupBeforeFirstInst())
report_fatal_error("Empty bundle-locked group is forbidden");
- SD->setBundleLocked(false);
+ SD->setBundleLockState(MCSectionData::NotBundleLocked);
}
void MCELFStreamer::FinishImpl() {