summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-05-25 15:04:26 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-05-25 15:04:26 +0000
commitb028cc80989ccbdeb6940d89b1bac5a036377249 (patch)
tree0f01b264310859c39f604a891da7b6c991ba4ed6 /llvm/lib
parentc1cd944854e2d654d93851788691a27295b98e48 (diff)
downloadbcm5719-llvm-b028cc80989ccbdeb6940d89b1bac5a036377249.tar.gz
bcm5719-llvm-b028cc80989ccbdeb6940d89b1bac5a036377249.zip
Move bundle info from MCSectionData to MCSection.
llvm-svn: 238143
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCAssembler.cpp23
-rw-r--r--llvm/lib/MC/MCELFStreamer.cpp25
-rw-r--r--llvm/lib/MC/MCObjectStreamer.cpp2
-rw-r--r--llvm/lib/MC/MCSection.cpp18
4 files changed, 34 insertions, 34 deletions
diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp
index cb11555ab51..a3c7c70321c 100644
--- a/llvm/lib/MC/MCAssembler.cpp
+++ b/llvm/lib/MC/MCAssembler.cpp
@@ -293,9 +293,7 @@ MCEncodedFragmentWithFixups::~MCEncodedFragmentWithFixups() {
MCSectionData::MCSectionData() : Section(nullptr) {}
MCSectionData::MCSectionData(MCSection &Section, MCAssembler *A)
- : Section(&Section), BundleLockState(NotBundleLocked),
- BundleLockNestingDepth(0), BundleGroupBeforeFirstInst(false),
- HasInstructions(false) {
+ : Section(&Section), HasInstructions(false) {
if (A)
A->getSectionList().push_back(this);
}
@@ -331,25 +329,6 @@ MCSectionData::getSubsectionInsertionPoint(unsigned Subsection) {
return IP;
}
-void MCSectionData::setBundleLockState(BundleLockStateType NewState) {
- if (NewState == NotBundleLocked) {
- if (BundleLockNestingDepth == 0) {
- report_fatal_error("Mismatched bundle_lock/unlock directives");
- }
- if (--BundleLockNestingDepth == 0) {
- BundleLockState = NotBundleLocked;
- }
- return;
- }
-
- // If any of the directives is an align_to_end directive, the whole nested
- // group is align_to_end. So don't downgrade from align_to_end to just locked.
- if (BundleLockState != BundleLockedAlignToEnd) {
- BundleLockState = NewState;
- }
- ++BundleLockNestingDepth;
-}
-
/* *** */
MCAssembler::MCAssembler(MCContext &Context_, MCAsmBackend &Backend_,
diff --git a/llvm/lib/MC/MCELFStreamer.cpp b/llvm/lib/MC/MCELFStreamer.cpp
index 6a47cc9c1cc..0e4d637c8ce 100644
--- a/llvm/lib/MC/MCELFStreamer.cpp
+++ b/llvm/lib/MC/MCELFStreamer.cpp
@@ -39,7 +39,7 @@
using namespace llvm;
bool MCELFStreamer::isBundleLocked() const {
- return getCurrentSectionData()->isBundleLocked();
+ return getCurrentSectionData()->getSection().isBundleLocked();
}
MCELFStreamer::~MCELFStreamer() {
@@ -507,6 +507,7 @@ void MCELFStreamer::EmitInstToData(const MCInst &Inst,
if (Assembler.isBundlingEnabled()) {
MCSectionData *SD = getCurrentSectionData();
+ MCSection &Sec = SD->getSection();
if (Assembler.getRelaxAll() && isBundleLocked())
// If the -mc-relax-all flag is used and we are bundle-locked, we re-use
// the current bundle group.
@@ -516,7 +517,7 @@ void MCELFStreamer::EmitInstToData(const MCInst &Inst,
// we create a new temporary fragment which will be later merged into
// the current fragment.
DF = new MCDataFragment();
- else if (isBundleLocked() && !SD->isBundleGroupBeforeFirstInst())
+ else if (isBundleLocked() && !Sec.isBundleGroupBeforeFirstInst())
// 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());
@@ -532,7 +533,7 @@ void MCELFStreamer::EmitInstToData(const MCInst &Inst,
DF = new MCDataFragment();
insert(DF);
}
- if (SD->getBundleLockState() == MCSectionData::BundleLockedAlignToEnd) {
+ if (Sec.getBundleLockState() == MCSection::BundleLockedAlignToEnd) {
// If this fragment is for a group marked "align_to_end", set a flag
// in the fragment. This can happen after the fragment has already been
// created if there are nested bundle_align groups and an inner one
@@ -542,7 +543,7 @@ void MCELFStreamer::EmitInstToData(const MCInst &Inst,
// We're now emitting an instruction in a bundle group, so this flag has
// to be turned off.
- SD->setBundleGroupBeforeFirstInst(false);
+ Sec.setBundleGroupBeforeFirstInst(false);
} else {
DF = getOrCreateDataFragment();
}
@@ -575,6 +576,7 @@ void MCELFStreamer::EmitBundleAlignMode(unsigned AlignPow2) {
void MCELFStreamer::EmitBundleLock(bool AlignToEnd) {
MCSectionData *SD = getCurrentSectionData();
+ MCSection &Sec = SD->getSection();
// Sanity checks
//
@@ -582,7 +584,7 @@ void MCELFStreamer::EmitBundleLock(bool AlignToEnd) {
report_fatal_error(".bundle_lock forbidden when bundling is disabled");
if (!isBundleLocked())
- SD->setBundleGroupBeforeFirstInst(true);
+ Sec.setBundleGroupBeforeFirstInst(true);
if (getAssembler().getRelaxAll() && !isBundleLocked()) {
// TODO: drop the lock state and set directly in the fragment
@@ -590,19 +592,20 @@ void MCELFStreamer::EmitBundleLock(bool AlignToEnd) {
BundleGroups.push_back(DF);
}
- SD->setBundleLockState(AlignToEnd ? MCSectionData::BundleLockedAlignToEnd :
- MCSectionData::BundleLocked);
+ Sec.setBundleLockState(AlignToEnd ? MCSection::BundleLockedAlignToEnd
+ : MCSection::BundleLocked);
}
void MCELFStreamer::EmitBundleUnlock() {
MCSectionData *SD = getCurrentSectionData();
+ MCSection &Sec = SD->getSection();
// Sanity checks
if (!getAssembler().isBundlingEnabled())
report_fatal_error(".bundle_unlock forbidden when bundling is disabled");
else if (!isBundleLocked())
report_fatal_error(".bundle_unlock without matching lock");
- else if (SD->isBundleGroupBeforeFirstInst())
+ else if (Sec.isBundleGroupBeforeFirstInst())
report_fatal_error("Empty bundle-locked group is forbidden");
// When the -mc-relax-all flag is used, we emit instructions to fragments
@@ -613,7 +616,7 @@ void MCELFStreamer::EmitBundleUnlock() {
MCDataFragment *DF = BundleGroups.back();
// FIXME: Use BundleGroups to track the lock state instead.
- SD->setBundleLockState(MCSectionData::NotBundleLocked);
+ Sec.setBundleLockState(MCSection::NotBundleLocked);
// FIXME: Use more separate fragments for nested groups.
if (!isBundleLocked()) {
@@ -622,10 +625,10 @@ void MCELFStreamer::EmitBundleUnlock() {
delete DF;
}
- if (SD->getBundleLockState() != MCSectionData::BundleLockedAlignToEnd)
+ if (Sec.getBundleLockState() != MCSection::BundleLockedAlignToEnd)
getOrCreateDataFragment()->setAlignToBundleEnd(false);
} else
- SD->setBundleLockState(MCSectionData::NotBundleLocked);
+ Sec.setBundleLockState(MCSection::NotBundleLocked);
}
void MCELFStreamer::Flush() {
diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp
index 3f32a36194f..b244c3a679c 100644
--- a/llvm/lib/MC/MCObjectStreamer.cpp
+++ b/llvm/lib/MC/MCObjectStreamer.cpp
@@ -254,7 +254,7 @@ void MCObjectStreamer::EmitInstruction(const MCInst &Inst,
// group. We want to emit all such instructions into the same data
// fragment.
if (Assembler.getRelaxAll() ||
- (Assembler.isBundlingEnabled() && SD->isBundleLocked())) {
+ (Assembler.isBundlingEnabled() && SD->getSection().isBundleLocked())) {
MCInst Relaxed;
getAssembler().getBackend().relaxInstruction(Inst, Relaxed);
while (getAssembler().getBackend().mayNeedRelaxation(Relaxed))
diff --git a/llvm/lib/MC/MCSection.cpp b/llvm/lib/MC/MCSection.cpp
index 7204e6cba1f..bf25f3cc163 100644
--- a/llvm/lib/MC/MCSection.cpp
+++ b/llvm/lib/MC/MCSection.cpp
@@ -29,3 +29,21 @@ bool MCSection::hasEnded() const { return End && End->isInSection(); }
MCSection::~MCSection() {
}
+void MCSection::setBundleLockState(BundleLockStateType NewState) {
+ if (NewState == NotBundleLocked) {
+ if (BundleLockNestingDepth == 0) {
+ report_fatal_error("Mismatched bundle_lock/unlock directives");
+ }
+ if (--BundleLockNestingDepth == 0) {
+ BundleLockState = NotBundleLocked;
+ }
+ return;
+ }
+
+ // If any of the directives is an align_to_end directive, the whole nested
+ // group is align_to_end. So don't downgrade from align_to_end to just locked.
+ if (BundleLockState != BundleLockedAlignToEnd) {
+ BundleLockState = NewState;
+ }
+ ++BundleLockNestingDepth;
+}
OpenPOWER on IntegriCloud