///
bool isVerbose() const { return VerboseAsm; }
- /// SwitchToSection - Switch to the specified section of the executable if
- /// we are not already in it!
- void SwitchToSection(const MCSection *NS);
-
/// getGlobalLinkName - Returns the asm/link name of of the specified
/// global variable. Should be overridden by each target asm printer to
/// generate the appropriate value.
return TM.getTargetLowering()->getObjFileLowering();
}
-/// SwitchToSection - Switch to the specified section of the executable if we
-/// are not already in it!
-void AsmPrinter::SwitchToSection(const MCSection *NS) {
- assert(NS != 0 && "Must specify a section to switch to");
- OutStreamer.SwitchSection(NS);
-}
-
/// getCurrentSection() - Return the current section we are emitting to.
const MCSection *AsmPrinter::getCurrentSection() const {
return OutStreamer.getCurrentSection();
// Now print stuff into the calculated sections.
for (unsigned i = 0, e = CPSections.size(); i != e; ++i) {
- SwitchToSection(CPSections[i].S);
+ OutStreamer.SwitchSection(CPSections[i].S);
EmitAlignment(Log2_32(CPSections[i].Alignment));
unsigned Offset = 0;
// function body itself, otherwise the label differences won't make sense.
// We should also do if the section name is NULL or function is declared in
// discardable section.
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang,
+ TM));
} else {
// Otherwise, drop it in the readonly section.
const MCSection *ReadOnlySection =
getObjFileLowering().getSectionForConstant(SectionKind::getReadOnly());
- SwitchToSection(ReadOnlySection);
+ OutStreamer.SwitchSection(ReadOnlySection);
JTInDiffSection = true;
}
const TargetData *TD = TM.getTargetData();
unsigned Align = Log2_32(TD->getPointerPrefAlignment());
if (GV->getName() == "llvm.global_ctors") {
- SwitchToSection(getObjFileLowering().getStaticCtorSection());
+ OutStreamer.SwitchSection(getObjFileLowering().getStaticCtorSection());
EmitAlignment(Align, 0);
EmitXXStructorList(GV->getInitializer());
return true;
}
if (GV->getName() == "llvm.global_dtors") {
- SwitchToSection(getObjFileLowering().getStaticDtorSection());
+ OutStreamer.SwitchSection(getObjFileLowering().getStaticDtorSection());
EmitAlignment(Align, 0);
EmitXXStructorList(GV->getInitializer());
return true;
#include "llvm/Module.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/MC/MCSection.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetFrameInfo.h"
std::string LinkageName;
GV.getLinkageName(LinkageName);
if (!LinkageName.empty()) {
- // Skip special LLVM prefix that is used to inform the asm printer to not emit
- // usual symbol prefix before the symbol name. This happens for Objective-C
- // symbol names and symbol whose name is replaced using GCC's __asm__ attribute.
+ // Skip special LLVM prefix that is used to inform the asm printer to not
+ // emit usual symbol prefix before the symbol name. This happens for
+ // Objective-C symbol names and symbol whose name is replaced using GCC's
+ // __asm__ attribute.
if (LinkageName[0] == 1)
LinkageName = &LinkageName[1];
AddString(GVDie, dwarf::DW_AT_MIPS_linkage_name, dwarf::DW_FORM_string,
DebugTimer->startTimer();
// Standard sections final addresses.
- Asm->SwitchToSection(Asm->getObjFileLowering().getTextSection());
+ Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getTextSection());
EmitLabel("text_end", 0);
- Asm->SwitchToSection(Asm->getObjFileLowering().getDataSection());
+ Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getDataSection());
EmitLabel("data_end", 0);
// End text sections.
for (unsigned i = 1, N = SectionMap.size(); i <= N; ++i) {
- Asm->SwitchToSection(SectionMap[i]);
+ Asm->OutStreamer.SwitchSection(SectionMap[i]);
EmitLabel("section_end", i);
}
if (didInitial) return;
didInitial = true;
+ const TargetLoweringObjectFile &TLOF = Asm->getObjFileLowering();
+
// Dwarf sections base addresses.
if (TAI->doesDwarfRequireFrameSection()) {
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfFrameSection());
+ Asm->OutStreamer.SwitchSection(TLOF.getDwarfFrameSection());
EmitLabel("section_debug_frame", 0);
}
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfInfoSection());
+ Asm->OutStreamer.SwitchSection(TLOF.getDwarfInfoSection());
EmitLabel("section_info", 0);
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfAbbrevSection());
+ Asm->OutStreamer.SwitchSection(TLOF.getDwarfAbbrevSection());
EmitLabel("section_abbrev", 0);
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfARangesSection());
+ Asm->OutStreamer.SwitchSection(TLOF.getDwarfARangesSection());
EmitLabel("section_aranges", 0);
- if (const MCSection *LineInfoDirective =
- Asm->getObjFileLowering().getDwarfMacroInfoSection()) {
- Asm->SwitchToSection(LineInfoDirective);
+ if (const MCSection *LineInfoDirective = TLOF.getDwarfMacroInfoSection()) {
+ Asm->OutStreamer.SwitchSection(LineInfoDirective);
EmitLabel("section_macinfo", 0);
}
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfLineSection());
+ Asm->OutStreamer.SwitchSection(TLOF.getDwarfLineSection());
EmitLabel("section_line", 0);
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfLocSection());
+ Asm->OutStreamer.SwitchSection(TLOF.getDwarfLocSection());
EmitLabel("section_loc", 0);
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfPubNamesSection());
+ Asm->OutStreamer.SwitchSection(TLOF.getDwarfPubNamesSection());
EmitLabel("section_pubnames", 0);
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfStrSection());
+ Asm->OutStreamer.SwitchSection(TLOF.getDwarfStrSection());
EmitLabel("section_str", 0);
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfRangesSection());
+ Asm->OutStreamer.SwitchSection(TLOF.getDwarfRangesSection());
EmitLabel("section_ranges", 0);
- Asm->SwitchToSection(Asm->getObjFileLowering().getTextSection());
+ Asm->OutStreamer.SwitchSection(TLOF.getTextSection());
EmitLabel("text_begin", 0);
- Asm->SwitchToSection(Asm->getObjFileLowering().getDataSection());
+ Asm->OutStreamer.SwitchSection(TLOF.getDataSection());
EmitLabel("data_begin", 0);
}
void DwarfDebug::EmitDebugInfo() {
// Start debug info section.
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfInfoSection());
+ Asm->OutStreamer.SwitchSection(
+ Asm->getObjFileLowering().getDwarfInfoSection());
EmitDebugInfoPerCU(ModuleCU);
}
// Check to see if it is worth the effort.
if (!Abbreviations.empty()) {
// Start the debug abbrev section.
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfAbbrevSection());
+ Asm->OutStreamer.SwitchSection(
+ Asm->getObjFileLowering().getDwarfAbbrevSection());
EmitLabel("abbrev_begin", 0);
const int MaxLineDelta = 255 + MinLineDelta;
// Start the dwarf line section.
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfLineSection());
+ Asm->OutStreamer.SwitchSection(
+ Asm->getObjFileLowering().getDwarfLineSection());
// Construct the section header.
EmitDifference("line_end", 0, "line_begin", 0, true);
TD->getPointerSize() : -TD->getPointerSize();
// Start the dwarf frame section.
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfFrameSection());
+ Asm->OutStreamer.SwitchSection(
+ Asm->getObjFileLowering().getDwarfFrameSection());
EmitLabel("debug_frame_common", 0);
EmitDifference("debug_frame_common_end", 0,
return;
// Start the dwarf frame section.
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfFrameSection());
+ Asm->OutStreamer.SwitchSection(
+ Asm->getObjFileLowering().getDwarfFrameSection());
EmitDifference("debug_frame_end", DebugFrameInfo.Number,
"debug_frame_begin", DebugFrameInfo.Number, true);
///
void DwarfDebug::EmitDebugPubNames() {
// Start the dwarf pubnames section.
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfPubNamesSection());
+ Asm->OutStreamer.SwitchSection(
+ Asm->getObjFileLowering().getDwarfPubNamesSection());
EmitDebugPubNamesPerCU(ModuleCU);
}
// Check to see if it is worth the effort.
if (!StringPool.empty()) {
// Start the dwarf str section.
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfStrSection());
+ Asm->OutStreamer.SwitchSection(
+ Asm->getObjFileLowering().getDwarfStrSection());
// For each of strings in the string pool.
for (unsigned StringID = 1, N = StringPool.size();
///
void DwarfDebug::EmitDebugLoc() {
// Start the dwarf loc section.
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfLocSection());
+ Asm->OutStreamer.SwitchSection(
+ Asm->getObjFileLowering().getDwarfLocSection());
Asm->EOL();
}
///
void DwarfDebug::EmitDebugARanges() {
// Start the dwarf aranges section.
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfARangesSection());
+ Asm->OutStreamer.SwitchSection(
+ Asm->getObjFileLowering().getDwarfARangesSection());
// FIXME - Mock up
#if 0
///
void DwarfDebug::EmitDebugRanges() {
// Start the dwarf ranges section.
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfRangesSection());
+ Asm->OutStreamer.SwitchSection(
+ Asm->getObjFileLowering().getDwarfRangesSection());
Asm->EOL();
}
if (const MCSection *LineInfo =
Asm->getObjFileLowering().getDwarfMacroInfoSection()) {
// Start the dwarf macinfo section.
- Asm->SwitchToSection(LineInfo);
+ Asm->OutStreamer.SwitchSection(LineInfo);
Asm->EOL();
}
}
if (!ModuleCU)
return;
- Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfDebugInlineSection());
+ Asm->OutStreamer.SwitchSection(
+ Asm->getObjFileLowering().getDwarfDebugInlineSection());
Asm->EOL();
EmitDifference("debug_inlined_end", 1,
"debug_inlined_begin", 1, true);
if (LName.empty())
Asm->EmitString(Name);
else {
- // Skip special LLVM prefix that is used to inform the asm printer to not emit
- // usual symbol prefix before the symbol name. This happens for Objective-C
- // symbol names and symbol whose name is replaced using GCC's __asm__ attribute.
+ // Skip special LLVM prefix that is used to inform the asm printer to not
+ // emit usual symbol prefix before the symbol name. This happens for
+ // Objective-C symbol names and symbol whose name is replaced using GCC's
+ // __asm__ attribute.
if (LName[0] == 1)
LName = &LName[1];
Asm->EmitString(LName);
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
-#include "llvm/Support/Dwarf.h"
-#include "llvm/Support/Timer.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Target/TargetRegisterInfo.h"
+#include "llvm/Support/Dwarf.h"
+#include "llvm/Support/Timer.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/StringExtras.h"
using namespace llvm;
TD->getPointerSize() : -TD->getPointerSize();
// Begin eh frame section.
- Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection());
+ Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getEHFrameSection());
if (TAI->is_EHSymbolPrivate())
O << TAI->getPrivateGlobalPrefix();
const Function *TheFunc = EHFrameInfo.function;
- Asm->SwitchToSection(Asm->getObjFileLowering().getEHFrameSection());
+ Asm->OutStreamer.SwitchSection(Asm->getObjFileLowering().getEHFrameSection());
// Externally visible entry into the functions eh frame info. If the
// corresponding function is static, this should not be externally visible.
// Begin the exception table.
const MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection();
- Asm->SwitchToSection(LSDASection);
+ Asm->OutStreamer.SwitchSection(LSDASection);
Asm->EmitAlignment(2, 0, 0, false);
O << "GCC_except_table" << SubprogramCount << ":\n";
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/GCMetadataPrinter.h"
#include "llvm/Module.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
using namespace llvm;
namespace {
void OcamlGCMetadataPrinter::beginAssembly(raw_ostream &OS, AsmPrinter &AP,
const TargetAsmInfo &TAI) {
- AP.SwitchToSection(AP.getObjFileLowering().getTextSection());
+ AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getTextSection());
EmitCamlGlobal(getModule(), OS, AP, TAI, "code_begin");
- AP.SwitchToSection(AP.getObjFileLowering().getDataSection());
+ AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection());
EmitCamlGlobal(getModule(), OS, AP, TAI, "data_begin");
}
AddressAlignLog = 3;
}
- AP.SwitchToSection(AP.getObjFileLowering().getTextSection());
+ AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getTextSection());
EmitCamlGlobal(getModule(), OS, AP, TAI, "code_end");
- AP.SwitchToSection(AP.getObjFileLowering().getDataSection());
+ AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection());
EmitCamlGlobal(getModule(), OS, AP, TAI, "data_end");
OS << AddressDirective << 0; // FIXME: Why does ocaml emit this??
AP.EOL();
- AP.SwitchToSection(AP.getObjFileLowering().getDataSection());
+ AP.OutStreamer.SwitchSection(AP.getObjFileLowering().getDataSection());
EmitCamlGlobal(getModule(), OS, AP, TAI, "frametable");
for (iterator I = begin(), IE = end(); I != IE; ++I) {
}
void MCAsmStreamer::SwitchSection(const MCSection *Section) {
+ assert(Section && "Cannot switch to a null section!");
if (Section != CurSection) {
CurSection = Section;
Section->PrintSwitchToSection(TAI, OS);
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/MC/MCSectionMachO.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
// Print out labels for the function.
const Function *F = MF.getFunction();
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
switch (F->getLinkage()) {
default: llvm_unreachable("Unknown linkage type!");
const MCSection *TheSection =
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
- SwitchToSection(TheSection);
+ OutStreamer.SwitchSection(TheSection);
// FIXME: get this stuff from section kind flags.
if (C->isNullValue() && !GVar->hasSection() && !GVar->isThreadLocal() &&
O << TAI->getCOMMDirective() << name << "," << Size
<< ',' << Align;
} else {
- SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang,TM));
+ OutStreamer.SwitchSection(TheSection);
O << "\t.globl " << name << '\n'
<< TAI->getWeakDefDirective() << name << '\n';
EmitAlignment(Align, GVar);
E = FnStubs.end(); I != E; ++I) {
const FnStubInfo &Info = I->second;
- SwitchToSection(StubSection);
+ OutStreamer.SwitchSection(StubSection);
EmitAlignment(2);
O << "\t.code\t32\n";
O << "-(" << Info.SCV << "+8)";
O << '\n';
- SwitchToSection(LazySymbolPointerSection);
+ OutStreamer.SwitchSection(LazySymbolPointerSection);
O << Info.LazyPtr << ":\n";
O << "\t.indirect_symbol " << I->getKeyData() << "\n";
O << "\t.long\tdyld_stub_binding_helper\n";
// Output non-lazy-pointers for external and common global variables.
if (!GVNonLazyPtrs.empty()) {
// Switch with ".non_lazy_symbol_pointer" directive.
- SwitchToSection(TLOFMacho.getNonLazySymbolPointerSection());
+ OutStreamer.SwitchSection(TLOFMacho.getNonLazySymbolPointerSection());
EmitAlignment(2);
for (StringMap<std::string>::iterator I = GVNonLazyPtrs.begin(),
E = GVNonLazyPtrs.end(); I != E; ++I) {
}
if (!HiddenGVNonLazyPtrs.empty()) {
- SwitchToSection(getObjFileLowering().getDataSection());
+ OutStreamer.SwitchSection(getObjFileLowering().getDataSection());
EmitAlignment(2);
for (StringMap<std::string>::iterator I = HiddenGVNonLazyPtrs.begin(),
E = HiddenGVNonLazyPtrs.end(); I != E; ++I) {
#include "llvm/Assembly/Writer.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DwarfWriter.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
// Print out labels for the function.
const Function *F = MF.getFunction();
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
EmitAlignment(MF.getAlignment(), F);
switch (F->getLinkage()) {
unsigned Align = TD->getPreferredAlignmentLog(GVar);
// 0: Switch to section
- SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang,
+ TM));
// 1: Check visibility
printVisibility(name, GVar->getVisibility());
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
std::string name = Mang->getMangledName(GV);
Constant *C = GV->getInitializer();
- SwitchToSection(getObjFileLowering().SectionForGlobal(GV, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GV, Mang,
+ TM));
emitLinkage(name, GV->getLinkage());
EmitAlignment(TD->getPreferredAlignmentLog(GV), GV);
printVisibility(name, GV->getVisibility());
EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
const Function *F = MF.getFunction();
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
EmitAlignment(2, F);
emitLinkage(CurrentFnName, F->getLinkage());
printVisibility(CurrentFnName, F->getVisibility());
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/Support/Mangler.h"
-#include "llvm/Support/MathExtras.h"
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/FormattedStream.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/Mangler.h"
+#include "llvm/Support/MathExtras.h"
#include <set>
using namespace llvm;
// Print out labels for the function.
const Function *F = MF.getFunction();
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
EmitAlignment(MF.getAlignment(), F);
switch (F->getLinkage()) {
unsigned Size = TD->getTypeAllocSize(Type);
unsigned Align = TD->getPreferredAlignmentLog(GVar);
- SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang,
+ TM));
if (C->isNullValue() && /* FIXME: Verify correct */
!GVar->hasSection() &&
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetRegistry.h"
void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
const Function *F = MF.getFunction();
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
unsigned FnAlign = MF.getAlignment();
EmitAlignment(FnAlign, F);
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
void MipsAsmPrinter::emitFunctionStart(MachineFunction &MF) {
// Print out the label for the function.
const Function *F = MF.getFunction();
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
// 2 bits aligned
EmitAlignment(MF.getAlignment(), F);
}
bool MipsAsmPrinter::doInitialization(Module &M) {
- // FIXME: Use SwitchToSection.
+ // FIXME: Use SwitchSection.
// Tell the assembler which ABI we are using
O << "\t.section .mdebug." << emitCurrentABIString() << '\n';
printVisibility(name, GVar->getVisibility());
- SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang,
+ TM));
if (C->isNullValue() && !GVar->hasSection()) {
if (!GVar->isThreadLocal() &&
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Support/ErrorHandling.h"
getObjFileLowering().getSectionForFunction(CurrentFnName);
// Start the Code Section.
O << "\n";
- SwitchToSection(fCodeSection);
+ OutStreamer.SwitchSection(fCodeSection);
// Emit the frame address of the function at the beginning of code.
O << "\tretlw low(" << PAN::getFrameLabel(CurrentFnName) << ")\n";
const std::vector<const GlobalVariable*> &Items = ROSections[i]->Items;
if (!Items.size()) continue;
O << "\n";
- SwitchToSection(PTOF->ROSections[i]->S_);
+ OutStreamer.SwitchSection(PTOF->ROSections[i]->S_);
for (unsigned j = 0; j < Items.size(); j++) {
O << Mang->getMangledName(Items[j]);
Constant *C = Items[j]->getInitializer();
const MCSection *fPDataSection =
getObjFileLowering().getSectionForFunctionFrame(CurrentFnName);
- SwitchToSection(fPDataSection);
+ OutStreamer.SwitchSection(fPDataSection);
// Emit function frame label
O << PAN::getFrameLabel(CurrentFnName) << ":\n";
O << "\n";
if (IDATASections[i]->S_->getName().find("llvm.") != std::string::npos)
continue;
- SwitchToSection(IDATASections[i]->S_);
+ OutStreamer.SwitchSection(IDATASections[i]->S_);
std::vector<const GlobalVariable*> Items = IDATASections[i]->Items;
for (unsigned j = 0; j < Items.size(); j++) {
std::string Name = Mang->getMangledName(Items[j]);
const std::vector<PIC16Section*> &BSSSections = PTOF->BSSSections;
for (unsigned i = 0; i < BSSSections.size(); i++) {
O << "\n";
- SwitchToSection(BSSSections[i]->S_);
+ OutStreamer.SwitchSection(BSSSections[i]->S_);
std::vector<const GlobalVariable*> Items = BSSSections[i]->Items;
for (unsigned j = 0; j < Items.size(); j++) {
std::string Name = Mang->getMangledName(Items[j]);
if (AutosSections[i]->S_->getName() == SectionName) {
// Set the printing status to true
AutosSections[i]->setPrintedStatus(true);
- SwitchToSection(AutosSections[i]->S_);
+ OutStreamer.SwitchSection(AutosSections[i]->S_);
const std::vector<const GlobalVariable*> &Items = AutosSections[i]->Items;
for (unsigned j = 0; j < Items.size(); j++) {
std::string VarName = Mang->getMangledName(Items[j]);
AutosSections[i]->setPrintedStatus(true);
O << "\n";
- SwitchToSection(AutosSections[i]->S_);
+ OutStreamer.SwitchSection(AutosSections[i]->S_);
const std::vector<const GlobalVariable*> &Items = AutosSections[i]->Items;
for (unsigned j = 0; j < Items.size(); j++) {
std::string VarName = Mang->getMangledName(Items[j]);
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/MC/MCSectionMachO.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetRegisterInfo.h"
// Print out labels for the function.
const Function *F = MF.getFunction();
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
switch (F->getLinkage()) {
default: llvm_unreachable("Unknown linkage type!");
// Print out jump tables referenced by the function.
EmitJumpTableInfo(MF.getJumpTableInfo(), MF);
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
// Emit post-function debug information.
DW->EndFunction(&MF);
unsigned Size = TD->getTypeAllocSize(Type);
unsigned Align = TD->getPreferredAlignmentLog(GVar);
- SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang,
+ TM));
if (C->isNullValue() && /* FIXME: Verify correct */
!GVar->hasSection() &&
// Print out labels for the function.
const Function *F = MF.getFunction();
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
switch (F->getLinkage()) {
default: llvm_unreachable("Unknown linkage type!");
// large data or debug section causes a branch to exceed 16M limit.
TargetLoweringObjectFileMachO &TLOFMacho =
static_cast<TargetLoweringObjectFileMachO &>(getObjFileLowering());
- SwitchToSection(TLOFMacho.getTextCoalSection());
+ OutStreamer.SwitchSection(TLOFMacho.getTextCoalSection());
if (TM.getRelocationModel() == Reloc::PIC_) {
- SwitchToSection(TLOFMacho.getMachOSection("__TEXT", "__picsymbolstub1",
- MCSectionMachO::S_SYMBOL_STUBS |
- MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
- 32, SectionKind::getText()));
+ OutStreamer.SwitchSection(
+ TLOFMacho.getMachOSection("__TEXT", "__picsymbolstub1",
+ MCSectionMachO::S_SYMBOL_STUBS |
+ MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
+ 32, SectionKind::getText()));
} else if (TM.getRelocationModel() == Reloc::DynamicNoPIC) {
- SwitchToSection(TLOFMacho.getMachOSection("__TEXT","__symbol_stub1",
- MCSectionMachO::S_SYMBOL_STUBS |
- MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
- 16, SectionKind::getText()));
+ OutStreamer.SwitchSection(
+ TLOFMacho.getMachOSection("__TEXT","__symbol_stub1",
+ MCSectionMachO::S_SYMBOL_STUBS |
+ MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
+ 16, SectionKind::getText()));
}
- SwitchToSection(getObjFileLowering().getTextSection());
+ OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
return Result;
}
const MCSection *TheSection =
getObjFileLowering().SectionForGlobal(GVar, Mang, TM);
- SwitchToSection(TheSection);
+ OutStreamer.SwitchSection(TheSection);
/// FIXME: Drive this off the section!
if (C->isNullValue() && /* FIXME: Verify correct */
32, SectionKind::getText());
for (StringMap<FnStubInfo>::iterator I = FnStubs.begin(), E = FnStubs.end();
I != E; ++I) {
- SwitchToSection(StubSection);
+ OutStreamer.SwitchSection(StubSection);
EmitAlignment(4);
const FnStubInfo &Info = I->second;
O << Info.Stub << ":\n";
O << "\tmtctr r12\n";
O << "\tbctr\n";
- SwitchToSection(LSPSection);
+ OutStreamer.SwitchSection(LSPSection);
O << Info.LazyPtr << ":\n";
O << "\t.indirect_symbol " << I->getKeyData() << '\n';
O << (isPPC64 ? "\t.quad" : "\t.long") << " dyld_stub_binding_helper\n";
for (StringMap<FnStubInfo>::iterator I = FnStubs.begin(), E = FnStubs.end();
I != E; ++I) {
- SwitchToSection(StubSection);
+ OutStreamer.SwitchSection(StubSection);
EmitAlignment(4);
const FnStubInfo &Info = I->second;
O << Info.Stub << ":\n";
O << Info.LazyPtr << ")(r11)\n";
O << "\tmtctr r12\n";
O << "\tbctr\n";
- SwitchToSection(LSPSection);
+ OutStreamer.SwitchSection(LSPSection);
O << Info.LazyPtr << ":\n";
O << "\t.indirect_symbol " << I->getKeyData() << '\n';
O << (isPPC64 ? "\t.quad" : "\t.long") << " dyld_stub_binding_helper\n";
// Output macho stubs for external and common global variables.
if (!GVStubs.empty()) {
// Switch with ".non_lazy_symbol_pointer" directive.
- SwitchToSection(TLOFMacho.getNonLazySymbolPointerSection());
+ OutStreamer.SwitchSection(TLOFMacho.getNonLazySymbolPointerSection());
EmitAlignment(isPPC64 ? 3 : 2);
for (StringMap<std::string>::iterator I = GVStubs.begin(),
}
if (!HiddenGVStubs.empty()) {
- SwitchToSection(getObjFileLowering().getDataSection());
+ OutStreamer.SwitchSection(getObjFileLowering().getDataSection());
EmitAlignment(isPPC64 ? 3 : 2);
for (StringMap<std::string>::iterator I = HiddenGVStubs.begin(),
E = HiddenGVStubs.end(); I != E; ++I) {
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetRegistry.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/FormattedStream.h"
-#include "llvm/Support/Mangler.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/Mangler.h"
#include "llvm/Support/MathExtras.h"
#include <cctype>
#include <cstring>
// Print out the label for the function.
const Function *F = MF.getFunction();
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
EmitAlignment(MF.getAlignment(), F);
O << "\t.globl\t" << CurrentFnName << '\n';
printVisibility(name, GVar->getVisibility());
- SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang,
+ TM));
if (C->isNullValue() && !GVar->hasSection()) {
if (!GVar->isThreadLocal() &&
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
unsigned FnAlign = MF.getAlignment();
const Function *F = MF.getFunction();
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
EmitAlignment(FnAlign, F);
O << "\t.type\t" << name << ",@object\n";
- SwitchToSection(getObjFileLowering().SectionForGlobal(GVar, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GVar, Mang,
+ TM));
if (C->isNullValue() && !GVar->hasSection() &&
!GVar->isThreadLocal() &&
if (Subtarget->isTargetCygMing())
DecorateCygMingName(CurrentFnName, F);
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
EmitAlignment(FnAlign, F);
switch (F->getLinkage()) {
SectionKind GVKind = TargetLoweringObjectFile::getKindForGlobal(GVar, TM);
const MCSection *TheSection =
getObjFileLowering().SectionForGlobal(GVar, GVKind, Mang, TM);
- SwitchToSection(TheSection);
+ OutStreamer.SwitchSection(TheSection);
// FIXME: get this stuff from section kind flags.
if (C->isNullValue() && !GVar->hasSection() &&
MCSectionMachO::S_ATTR_SELF_MODIFYING_CODE |
MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
5, SectionKind::getMetadata());
- SwitchToSection(TheSection);
+ OutStreamer.SwitchSection(TheSection);
for (StringMap<std::string>::iterator I = FnStubs.begin(),
E = FnStubs.end(); I != E; ++I)
O << I->getKeyData() << ":\n" << "\t.indirect_symbol " << I->second
TLOFMacho.getMachOSection("__IMPORT", "__pointers",
MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS,
SectionKind::getMetadata());
- SwitchToSection(TheSection);
+ OutStreamer.SwitchSection(TheSection);
for (StringMap<std::string>::iterator I = GVStubs.begin(),
E = GVStubs.end(); I != E; ++I)
O << I->getKeyData() << ":\n\t.indirect_symbol "
}
if (!HiddenGVStubs.empty()) {
- SwitchToSection(getObjFileLowering().getDataSection());
+ OutStreamer.SwitchSection(getObjFileLowering().getDataSection());
EmitAlignment(2);
for (StringMap<std::string>::iterator I = HiddenGVStubs.begin(),
E = HiddenGVStubs.end(); I != E; ++I)
TargetLoweringObjectFileCOFF &TLOFMacho =
static_cast<TargetLoweringObjectFileCOFF&>(getObjFileLowering());
- SwitchToSection(TLOFMacho.getCOFFSection(".section .drectve", true,
- SectionKind::getMetadata()));
+ OutStreamer.SwitchSection(TLOFMacho.getCOFFSection(".section .drectve",true,
+ SectionKind::getMetadata()));
for (StringSet<>::iterator i = DLLExportedGVs.begin(),
e = DLLExportedGVs.end(); i != e; ++i)
#include "llvm/ADT/StringExtras.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/CodeGen/DwarfWriter.h"
-#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/Mangler.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetOptions.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/Mangler.h"
using namespace llvm;
STATISTIC(EmittedInsts, "Number of machine instrs printed");
decorateName(CurrentFnName, F);
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
switch (F->getLinkage()) {
default: llvm_unreachable("Unsupported linkage type!");
O << "\tpublic " << name << "\n";
// FALL THROUGH
case GlobalValue::InternalLinkage:
- SwitchToSection(getObjFileLowering().getDataSection());
+ OutStreamer.SwitchSection(getObjFileLowering().getDataSection());
break;
default:
llvm_unreachable("Unknown linkage type!");
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/MC/MCStreamer.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetRegistry.h"
-#include "llvm/Support/Mangler.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/Mangler.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <cctype>
const TargetData *TD = TM.getTargetData();
- SwitchToSection(getObjFileLowering().SectionForGlobal(GV, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(GV, Mang,TM));
std::string name = Mang->getMangledName(GV);
Constant *C = GV->getInitializer();
// Print out the label for the function.
const Function *F = MF.getFunction();
- SwitchToSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
+ OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
// Mark the start of the function
O << "\t.cc_top " << CurrentFnName << ".function," << CurrentFnName << "\n";