Changes in directory llvm/lib/Target/Alpha:
AlphaAsmPrinter.cpp updated: 1.22 -> 1.23 --- Log message: Switch to the new shared SwitchSection --- Diffs of the changes: (+6 -26) AlphaAsmPrinter.cpp | 32 ++++++-------------------------- 1 files changed, 6 insertions(+), 26 deletions(-) Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.22 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.23 --- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.22 Mon Nov 21 00:55:27 2005 +++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp Mon Nov 21 01:30:28 2005 @@ -21,12 +21,9 @@ #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/ValueTypes.h" #include "llvm/CodeGen/AsmPrinter.h" - #include "llvm/Target/TargetMachine.h" - #include "llvm/Support/Mangler.h" #include "llvm/ADT/Statistic.h" -#include "llvm/Support/CommandLine.h" using namespace llvm; @@ -66,7 +63,6 @@ bool runOnMachineFunction(MachineFunction &F); bool doInitialization(Module &M); bool doFinalization(Module &M); - void switchSection(std::ostream &OS, const char *NewSection); }; } // end of anonymous namespace @@ -180,7 +176,7 @@ printConstantPool(MF.getConstantPool()); // Print out labels for the function. - switchSection(O, "text"); + SwitchSection("\t.section .text", MF.getFunction()); emitAlignment(4); O << "\t.globl " << CurrentFnName << "\n"; O << "\t.ent " << CurrentFnName << "\n"; @@ -220,9 +216,8 @@ if (CP.empty()) return; - switchSection(O, "rodata"); + SwitchSection("\t.section .rodata", 0); for (unsigned i = 0, e = CP.size(); i != e; ++i) { - // switchSection(O, "section .rodata, \"dr\""); emitAlignment(TD.getTypeAlignmentShift(CP[i]->getType())); O << PrivateGlobalPrefix << "CPI" << CurrentFnName << "_" << i << ":\t\t\t\t\t" << CommentString << *CP[i] << "\n"; @@ -242,19 +237,6 @@ return false; } - -// switchSection - Switch to the specified section of the executable if we are -// not already in it! -// -void AlphaAsmPrinter::switchSection(std::ostream &OS, const char *NewSection) -{ - if (CurSection != NewSection) { - CurSection = NewSection; - if (!CurSection.empty()) - OS << "\t.section ." << NewSection << "\n"; - } -} - bool AlphaAsmPrinter::doFinalization(Module &M) { const TargetData &TD = TM.getTargetData(); @@ -269,7 +251,7 @@ if (C->isNullValue() && (I->hasLinkOnceLinkage() || I->hasInternalLinkage() || I->hasWeakLinkage() /* FIXME: Verify correct */)) { - switchSection(O, "data"); + SwitchSection("\t.section .data", I); if (I->hasInternalLinkage()) O << "\t.local " << name << "\n"; @@ -284,8 +266,8 @@ case GlobalValue::WeakLinkage: // FIXME: Verify correct for weak. // Nonnull linkonce -> weak O << "\t.weak " << name << "\n"; - switchSection(O, ""); O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\",@progbits\n"; + SwitchSection("", I); break; case GlobalValue::AppendingLinkage: // FIXME: appending linkage variables should go into a section of @@ -295,10 +277,8 @@ O << "\t.globl " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: - if (C->isNullValue()) - switchSection(O, "bss"); - else - switchSection(O, "data"); + SwitchSection(C->isNullValue() ? "\t.section .bss" : + "\t.section .data", I); break; case GlobalValue::GhostLinkage: std::cerr << "GhostLinkage cannot appear in AlphaAsmPrinter!\n"; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits