1 //===- lib/MC/MCSection.cpp - Machine Code Section Representation ---------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/MC/MCSection.h"
11 #include "llvm/MC/MCAssembler.h"
12 #include "llvm/MC/MCAsmInfo.h"
13 #include "llvm/MC/MCContext.h"
14 #include "llvm/MC/MCSymbol.h"
15 #include "llvm/Support/raw_ostream.h"
18 //===----------------------------------------------------------------------===//
20 //===----------------------------------------------------------------------===//
22 MCSymbol *MCSection::getEndSymbol(MCContext &Ctx) {
24 End = Ctx.createTempSymbol("sec_end", true);
28 bool MCSection::hasEnded() const { return End && End->isInSection(); }
30 MCSection::~MCSection() {
33 void MCSection::setBundleLockState(BundleLockStateType NewState) {
34 if (NewState == NotBundleLocked) {
35 if (BundleLockNestingDepth == 0) {
36 report_fatal_error("Mismatched bundle_lock/unlock directives");
38 if (--BundleLockNestingDepth == 0) {
39 BundleLockState = NotBundleLocked;
44 // If any of the directives is an align_to_end directive, the whole nested
45 // group is align_to_end. So don't downgrade from align_to_end to just locked.
46 if (BundleLockState != BundleLockedAlignToEnd) {
47 BundleLockState = NewState;
49 ++BundleLockNestingDepth;
52 MCSectionData::iterator MCSectionData::begin() { return Fragments.begin(); }
54 MCSectionData::iterator MCSectionData::end() { return Fragments.end(); }
56 MCSectionData::reverse_iterator MCSectionData::rbegin() {
57 return Fragments.rbegin();
60 MCSectionData::reverse_iterator MCSectionData::rend() {
61 return Fragments.rend();
64 size_t MCSectionData::size() const { return Fragments.size(); }
66 bool MCSectionData::empty() const { return Fragments.empty(); }