eliminate AsmPrinter::SwitchToSection and just have clients
authorChris Lattner <sabre@nondot.org>
Wed, 19 Aug 2009 05:49:37 +0000 (05:49 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 19 Aug 2009 05:49:37 +0000 (05:49 +0000)
talk to the MCStreamer directly instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79405 91177308-0d34-0410-b5e6-96231b3b80d8

19 files changed:
include/llvm/CodeGen/AsmPrinter.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
lib/CodeGen/AsmPrinter/DwarfException.cpp
lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp
lib/MC/MCAsmStreamer.cpp
lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp
lib/Target/MSP430/AsmPrinter/MSP430AsmPrinter.cpp
lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
lib/Target/PIC16/AsmPrinter/PIC16AsmPrinter.cpp
lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp
lib/Target/SystemZ/AsmPrinter/SystemZAsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86IntelAsmPrinter.cpp
lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp

index 6024f48f9ae1697c8351df807940f225b2c924f5..617f0ee668cdf9f950483f29f18340c084da090f 100644 (file)
@@ -158,10 +158,6 @@ namespace llvm {
     ///
     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.
index 6de6f2b47f4ad17ad79f82a4b1e4b251fbc6284b..1762859e324fbdc76f3e0f1e458fd7835baaa745 100644 (file)
@@ -80,13 +80,6 @@ TargetLoweringObjectFile &AsmPrinter::getObjFileLowering() const {
   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();
@@ -300,7 +293,7 @@ void AsmPrinter::EmitConstantPool(MachineConstantPool *MCP) {
 
   // 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;
@@ -354,12 +347,13 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI,
     // 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;
   }
   
@@ -458,14 +452,14 @@ bool AsmPrinter::EmitSpecialLLVMGlobal(const GlobalVariable *GV) {
   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;
index be92fbd485f55b325e014b5f9d6c621298cb54f9..eedf5c1d32c1bc5a7e7652fb60be396adf7a9039 100644 (file)
@@ -15,6 +15,7 @@
 #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"
@@ -787,9 +788,10 @@ DIE *DwarfDebug::CreateGlobalVariableDIE(CompileUnit *DW_Unit,
   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,
@@ -1362,14 +1364,14 @@ void DwarfDebug::EndModule() {
     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);
   }
 
@@ -1863,39 +1865,40 @@ void DwarfDebug::EmitInitial() {
   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);
 }
 
@@ -1997,7 +2000,8 @@ void DwarfDebug::EmitDebugInfoPerCU(CompileUnit *Unit) {
 
 void DwarfDebug::EmitDebugInfo() {
   // Start debug info section.
-  Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfInfoSection());
+  Asm->OutStreamer.SwitchSection(
+                            Asm->getObjFileLowering().getDwarfInfoSection());
 
   EmitDebugInfoPerCU(ModuleCU);
 }
@@ -2008,7 +2012,8 @@ void DwarfDebug::EmitAbbreviations() const {
   // 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);
 
@@ -2065,7 +2070,8 @@ void DwarfDebug::EmitDebugLines() {
   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);
@@ -2224,7 +2230,8 @@ void DwarfDebug::EmitCommonDebugFrame() {
     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,
@@ -2264,7 +2271,8 @@ DwarfDebug::EmitFunctionDebugFrame(const FunctionDebugFrameInfo&DebugFrameInfo){
     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);
@@ -2328,7 +2336,8 @@ void DwarfDebug::EmitDebugPubNamesPerCU(CompileUnit *Unit) {
 ///
 void DwarfDebug::EmitDebugPubNames() {
   // Start the dwarf pubnames section.
-  Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfPubNamesSection());
+  Asm->OutStreamer.SwitchSection(
+                          Asm->getObjFileLowering().getDwarfPubNamesSection());
 
   EmitDebugPubNamesPerCU(ModuleCU);
 }
@@ -2339,7 +2348,8 @@ void DwarfDebug::EmitDebugStr() {
   // 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();
@@ -2360,7 +2370,8 @@ void DwarfDebug::EmitDebugStr() {
 ///
 void DwarfDebug::EmitDebugLoc() {
   // Start the dwarf loc section.
-  Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfLocSection());
+  Asm->OutStreamer.SwitchSection(
+                              Asm->getObjFileLowering().getDwarfLocSection());
   Asm->EOL();
 }
 
@@ -2368,7 +2379,8 @@ void DwarfDebug::EmitDebugLoc() {
 ///
 void DwarfDebug::EmitDebugARanges() {
   // Start the dwarf aranges section.
-  Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfARangesSection());
+  Asm->OutStreamer.SwitchSection(
+                          Asm->getObjFileLowering().getDwarfARangesSection());
 
   // FIXME - Mock up
 #if 0
@@ -2404,7 +2416,8 @@ void DwarfDebug::EmitDebugARanges() {
 ///
 void DwarfDebug::EmitDebugRanges() {
   // Start the dwarf ranges section.
-  Asm->SwitchToSection(Asm->getObjFileLowering().getDwarfRangesSection());
+  Asm->OutStreamer.SwitchSection(
+                            Asm->getObjFileLowering().getDwarfRangesSection());
   Asm->EOL();
 }
 
@@ -2414,7 +2427,7 @@ void DwarfDebug::EmitDebugMacInfo() {
   if (const MCSection *LineInfo = 
       Asm->getObjFileLowering().getDwarfMacroInfoSection()) {
     // Start the dwarf macinfo section.
-    Asm->SwitchToSection(LineInfo);
+    Asm->OutStreamer.SwitchSection(LineInfo);
     Asm->EOL();
   }
 }
@@ -2444,7 +2457,8 @@ void DwarfDebug::EmitDebugInlineInfo() {
   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);
@@ -2469,9 +2483,10 @@ void DwarfDebug::EmitDebugInlineInfo() {
     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);
index 06dfac4550c7510d2a7013d77cea2ae85724f3fc..aacb33b28f91c3a9984078c2edd4b1d6abdc5994 100644 (file)
 #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;
 
@@ -56,7 +57,7 @@ void DwarfException::EmitCommonEHFrame(const Function *Personality,
     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();
@@ -150,7 +151,7 @@ void DwarfException::EmitEHFrame(const FunctionEHFrameInfo &EHFrameInfo) {
 
   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.
@@ -555,7 +556,7 @@ void DwarfException::EmitExceptionTable() {
 
   // 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";
 
index a87fa9eaf69aed34500453fe197c70696e15c459..af3bbc96e5ae635145bfa5ece217d3980ccca8b0 100644 (file)
 #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 {
@@ -64,10 +65,10 @@ static void EmitCamlGlobal(const Module &M, raw_ostream &OS, AsmPrinter &AP,
 
 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");
 }
 
@@ -99,16 +100,16 @@ void OcamlGCMetadataPrinter::finishAssembly(raw_ostream &OS, AsmPrinter &AP,
     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) {
index cb3642532c1c319e2a29220bda99fc1b565d730b..89bc5bc637a5b63841590f0aeb23473c1fda3162 100644 (file)
@@ -97,6 +97,7 @@ static inline MCValue truncateToSize(const MCValue &Value, unsigned Bytes) {
 }
 
 void MCAsmStreamer::SwitchSection(const MCSection *Section) {
+  assert(Section && "Cannot switch to a null section!");
   if (Section != CurSection) {
     CurSection = Section;
     Section->PrintSwitchToSection(TAI, OS);
index 72fd7e4317c751d73176050f004542a99167ac70..3ef3fc5dbc1ee5e28e3b63591cc808293c09810e 100644 (file)
@@ -28,6 +28,7 @@
 #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"
@@ -260,7 +261,7 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   
   // 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!");
@@ -1162,7 +1163,7 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
   
   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() &&
@@ -1188,7 +1189,7 @@ void ARMAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
           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);
@@ -1297,7 +1298,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
            E = FnStubs.end(); I != E; ++I) {
         const FnStubInfo &Info = I->second;
         
-        SwitchToSection(StubSection);
+        OutStreamer.SwitchSection(StubSection);
         EmitAlignment(2);
         O << "\t.code\t32\n";
 
@@ -1315,7 +1316,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
           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";
@@ -1326,7 +1327,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
     // 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) {
@@ -1337,7 +1338,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
     }
 
     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) {
index a4690a9adef99f7b7ef836f60c3fe468997c0624..a19661d08d796bd9ab0dc2152321a7337dfa4e03 100644 (file)
@@ -21,6 +21,7 @@
 #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"
@@ -138,7 +139,7 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
 
   // 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()) {
@@ -210,7 +211,8 @@ void AlphaAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
   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());
index e8e79a4024108ad3625b01799e0861a05cddbf8e..fd00ea5addd67819a228617a36183c82c160b2e0 100644 (file)
@@ -23,6 +23,7 @@
 #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"
@@ -95,7 +96,8 @@ void BlackfinAsmPrinter::PrintGlobalVariable(const GlobalVariable* GV) {
   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());
@@ -115,7 +117,7 @@ bool BlackfinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   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());
index 3efcc922e12c66959ae013f2ee1257d10923e2db..399d430730999dd5204d3005610b058b827bc238 100644 (file)
 #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;
 
@@ -427,7 +428,7 @@ LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF)
   // 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()) {
@@ -512,7 +513,8 @@ void LinuxAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
   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() &&
index c746385b9a0699b1de2352f44c57e441896a615a..73c24eabaa4eab81b123db750a44db0ac3d740a8 100644 (file)
@@ -26,6 +26,7 @@
 #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"
@@ -78,7 +79,7 @@ namespace {
 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);
index 010a299bc1ee5ffb453ae6999a01562c14d24271..9df23bcbb28cc1a7ef2bfcb65b993831a93b8a10 100644 (file)
@@ -28,6 +28,7 @@
 #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" 
@@ -210,7 +211,7 @@ const char *MipsAsmPrinter::emitCurrentABIString() {
 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);
@@ -420,7 +421,7 @@ printFCCOperand(const MachineInstr *MI, int opNum, const char *Modifier) {
 }
 
 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';
@@ -468,7 +469,8 @@ void MipsAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
 
   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() &&
index 8dbfffc6e6a2964a276a41caf0ced5684c13f9aa..1522e4ca2e6ef44799af87f4861c8379a782c22b 100644 (file)
@@ -22,6 +22,7 @@
 #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"
@@ -73,7 +74,7 @@ bool PIC16AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
     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";
@@ -314,7 +315,7 @@ void PIC16AsmPrinter::EmitRomData(Module &M) {
     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();
@@ -341,7 +342,7 @@ void PIC16AsmPrinter::EmitFunctionFrame(MachineFunction &MF) {
   
   const MCSection *fPDataSection =
     getObjFileLowering().getSectionForFunctionFrame(CurrentFnName);
-  SwitchToSection(fPDataSection);
+  OutStreamer.SwitchSection(fPDataSection);
   
   // Emit function frame label
   O << PAN::getFrameLabel(CurrentFnName) << ":\n";
@@ -384,7 +385,7 @@ void PIC16AsmPrinter::EmitIData(Module &M) {
     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]);
@@ -403,7 +404,7 @@ void PIC16AsmPrinter::EmitUData(Module &M) {
   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]);
@@ -428,7 +429,7 @@ void PIC16AsmPrinter::EmitAutos(std::string FunctName) {
     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]);
@@ -460,7 +461,7 @@ void PIC16AsmPrinter::EmitRemainingAutos() {
     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]);
index 5dca6e6ad24b421fdf397207d5d63c6463b90f37..b56905ca139213396d15a568f9af98c0fd6deea4 100644 (file)
@@ -32,6 +32,7 @@
 #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"
@@ -614,7 +615,7 @@ bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
 
   // 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!");
@@ -675,7 +676,7 @@ bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   // 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);
@@ -703,7 +704,8 @@ void PPCLinuxAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
   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() &&
@@ -802,7 +804,7 @@ bool PPCDarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
 
   // 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!");
@@ -894,19 +896,21 @@ bool PPCDarwinAsmPrinter::doInitialization(Module &M) {
   // 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;
 }
@@ -938,7 +942,7 @@ void PPCDarwinAsmPrinter::PrintGlobalVariable(const GlobalVariable *GVar) {
 
   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 */
@@ -1043,7 +1047,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
                                 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";
@@ -1060,7 +1064,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
       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";
@@ -1074,7 +1078,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
     
     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";
@@ -1084,7 +1088,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
       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";
@@ -1108,7 +1112,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
   // 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(),
@@ -1120,7 +1124,7 @@ bool PPCDarwinAsmPrinter::doFinalization(Module &M) {
   }
 
   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) {
index ff11cdf03917fcd59925e8b74715bd1f3b59ba70..d39b6efa3e3b144007eb156ec47d534d8c167aa3 100644 (file)
 #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>
@@ -95,7 +96,7 @@ bool SparcAsmPrinter::runOnMachineFunction(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));
   EmitAlignment(MF.getAlignment(), F);
   O << "\t.globl\t" << CurrentFnName << '\n';
 
@@ -227,7 +228,8 @@ void SparcAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
 
   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() &&
index de6ff9635fdc7873cacfa1cb7f90ab9c53c3bcc9..ae0dce0d67a27fb7bbb2e09b48d8941682d38abc 100644 (file)
@@ -26,6 +26,7 @@
 #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"
@@ -84,7 +85,7 @@ void SystemZAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
   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);
 
@@ -317,7 +318,8 @@ void SystemZAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
 
   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() &&
index ca001d32dc0c068188dd8f651cbfe0e356a6e7a5..1e2a6de572afaac14099d8f1d30934f153a481a7 100644 (file)
@@ -174,7 +174,7 @@ void X86ATTAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
   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()) {
@@ -933,7 +933,7 @@ void X86ATTAsmPrinter::PrintGlobalVariable(const GlobalVariable* GVar) {
   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() &&
@@ -1074,7 +1074,7 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
                                   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
@@ -1088,7 +1088,7 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
         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 "
@@ -1096,7 +1096,7 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
     }
 
     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)
@@ -1128,8 +1128,8 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
     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)
index e9c8cd647219f634b966c5f0a01f33b2800f7813..141512e64c3a467c46a85b618ca29e5070824122 100644 (file)
 #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");
@@ -143,7 +144,7 @@ bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
 
   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!");
@@ -513,7 +514,7 @@ void X86IntelAsmPrinter::PrintGlobalVariable(const GlobalVariable *GV) {
     O << "\tpublic " << name << "\n";
     // FALL THROUGH
   case GlobalValue::InternalLinkage:
-    SwitchToSection(getObjFileLowering().getDataSection());
+    OutStreamer.SwitchSection(getObjFileLowering().getDataSection());
     break;
   default:
     llvm_unreachable("Unknown linkage type!");
index 87a095687c80556d69568a093415fa98633a645c..88473495d1314ca819c9ad80d0f57960174aa198 100644 (file)
 #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>
@@ -134,7 +135,7 @@ void XCoreAsmPrinter::PrintGlobalVariable(const GlobalVariable *GV) {
 
   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();
@@ -205,7 +206,7 @@ void XCoreAsmPrinter::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));
   
   // Mark the start of the function
   O << "\t.cc_top " << CurrentFnName << ".function," << CurrentFnName << "\n";