xref: /freebsd/contrib/llvm-project/llvm/lib/MC/MCSectionXCOFF.cpp (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric //===- lib/MC/MCSectionXCOFF.cpp - XCOFF Code Section Representation ------===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric 
9*0b57cec5SDimitry Andric #include "llvm/MC/MCSectionXCOFF.h"
10*0b57cec5SDimitry Andric #include "llvm/MC/MCAsmInfo.h"
11*0b57cec5SDimitry Andric #include "llvm/MC/MCExpr.h"
12*0b57cec5SDimitry Andric #include "llvm/Support/raw_ostream.h"
13*0b57cec5SDimitry Andric 
14*0b57cec5SDimitry Andric using namespace llvm;
15*0b57cec5SDimitry Andric 
16*0b57cec5SDimitry Andric MCSectionXCOFF::~MCSectionXCOFF() = default;
17*0b57cec5SDimitry Andric 
18*0b57cec5SDimitry Andric void MCSectionXCOFF::PrintSwitchToSection(const MCAsmInfo &MAI, const Triple &T,
19*0b57cec5SDimitry Andric                                           raw_ostream &OS,
20*0b57cec5SDimitry Andric                                           const MCExpr *Subsection) const {
21*0b57cec5SDimitry Andric   if (getKind().isText()) {
22*0b57cec5SDimitry Andric     OS << "\t.csect " << getSectionName() << "["
23*0b57cec5SDimitry Andric        << "PR"
24*0b57cec5SDimitry Andric        << "]" << '\n';
25*0b57cec5SDimitry Andric     return;
26*0b57cec5SDimitry Andric   }
27*0b57cec5SDimitry Andric 
28*0b57cec5SDimitry Andric   report_fatal_error("Printing for this SectionKind is unimplemented.");
29*0b57cec5SDimitry Andric }
30*0b57cec5SDimitry Andric 
31*0b57cec5SDimitry Andric bool MCSectionXCOFF::UseCodeAlign() const { return getKind().isText(); }
32*0b57cec5SDimitry Andric 
33*0b57cec5SDimitry Andric bool MCSectionXCOFF::isVirtualSection() const { return !getKind().isCommon(); }
34