diff options
| author | Chris Lattner <sabre@nondot.org> | 2006-05-09 04:59:56 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2006-05-09 04:59:56 +0000 |
| commit | 4632d7a57008564c4b0f8246e85bd813a200d2c6 (patch) | |
| tree | 8b69e32644052f6eb34fe57fd56e1024a5f56f77 /lib/Target | |
| parent | f668ffc4c2cf3da8ef0948b316d971c4b41b0e05 (diff) | |
Split SwitchSection into SwitchTo{Text|Data}Section methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28184 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target')
| -rw-r--r-- | lib/Target/Alpha/AlphaAsmPrinter.cpp | 10 | ||||
| -rw-r--r-- | lib/Target/IA64/IA64AsmPrinter.cpp | 9 | ||||
| -rw-r--r-- | lib/Target/PowerPC/PPCAsmPrinter.cpp | 32 | ||||
| -rw-r--r-- | lib/Target/Sparc/SparcAsmPrinter.cpp | 12 | ||||
| -rwxr-xr-x | lib/Target/X86/X86ATTAsmPrinter.cpp | 9 | ||||
| -rw-r--r-- | lib/Target/X86/X86AsmPrinter.cpp | 15 | ||||
| -rwxr-xr-x | lib/Target/X86/X86IntelAsmPrinter.cpp | 10 |
7 files changed, 50 insertions, 47 deletions
diff --git a/lib/Target/Alpha/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AlphaAsmPrinter.cpp index 59a8505376..8c597e4a0a 100644 --- a/lib/Target/Alpha/AlphaAsmPrinter.cpp +++ b/lib/Target/Alpha/AlphaAsmPrinter.cpp @@ -151,7 +151,7 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) { // Print out labels for the function. const Function *F = MF.getFunction(); - SwitchSection(".text", F); + SwitchToTextSection(".text", F); EmitAlignment(4, F); switch (F->getLinkage()) { default: assert(0 && "Unknown linkage type!"); @@ -221,7 +221,7 @@ bool AlphaAsmPrinter::doFinalization(Module &M) { if (C->isNullValue() && (I->hasLinkOnceLinkage() || I->hasInternalLinkage() || I->hasWeakLinkage() /* FIXME: Verify correct */)) { - SwitchSection("\t.section .data", I); + SwitchToDataSection("\t.section .data", I); if (I->hasInternalLinkage()) O << "\t.local " << name << "\n"; @@ -235,7 +235,7 @@ bool AlphaAsmPrinter::doFinalization(Module &M) { // Nonnull linkonce -> weak O << "\t.weak " << name << "\n"; O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\",@progbits\n"; - SwitchSection("", I); + SwitchToDataSection("", I); break; case GlobalValue::AppendingLinkage: // FIXME: appending linkage variables should go into a section of @@ -245,8 +245,8 @@ bool AlphaAsmPrinter::doFinalization(Module &M) { O << "\t.globl " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: - SwitchSection(C->isNullValue() ? "\t.section .bss" : - "\t.section .data", I); + SwitchToDataSection(C->isNullValue() ? "\t.section .bss" : + "\t.section .data", I); break; case GlobalValue::GhostLinkage: std::cerr << "GhostLinkage cannot appear in AlphaAsmPrinter!\n"; diff --git a/lib/Target/IA64/IA64AsmPrinter.cpp b/lib/Target/IA64/IA64AsmPrinter.cpp index 13c2dfbec5..2ebe010389 100644 --- a/lib/Target/IA64/IA64AsmPrinter.cpp +++ b/lib/Target/IA64/IA64AsmPrinter.cpp @@ -142,7 +142,8 @@ bool IA64AsmPrinter::runOnMachineFunction(MachineFunction &MF) { EmitConstantPool(MF.getConstantPool()); // Print out labels for the function. - SwitchSection("\n\t.section .text, \"ax\", \"progbits\"\n", MF.getFunction()); + SwitchToTextSection("\n\t.section .text, \"ax\", \"progbits\"\n", + MF.getFunction()); // ^^ means "Allocated instruXions in mem, initialized" EmitAlignment(5); O << "\t.global\t" << CurrentFnName << "\n"; @@ -282,7 +283,7 @@ bool IA64AsmPrinter::doFinalization(Module &M) { if (C->isNullValue() && (I->hasLinkOnceLinkage() || I->hasInternalLinkage() || I->hasWeakLinkage() /* FIXME: Verify correct */)) { - SwitchSection(".data", I); + SwitchToDataSection(".data", I); if (I->hasInternalLinkage()) { O << "\t.lcomm " << name << "#," << TD->getTypeSize(C->getType()) << "," << (1 << Align); @@ -302,7 +303,7 @@ bool IA64AsmPrinter::doFinalization(Module &M) { O << "\t.weak " << name << "\n"; O << "\t.section\t.llvm.linkonce.d." << name << ", \"aw\", \"progbits\"\n"; - SwitchSection("", I); + SwitchToDataSection("", I); break; case GlobalValue::AppendingLinkage: // FIXME: appending linkage variables should go into a section of @@ -312,7 +313,7 @@ bool IA64AsmPrinter::doFinalization(Module &M) { O << "\t.global " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: - SwitchSection(C->isNullValue() ? ".bss" : ".data", I); + SwitchToDataSection(C->isNullValue() ? ".bss" : ".data", I); break; case GlobalValue::GhostLinkage: std::cerr << "GhostLinkage cannot appear in IA64AsmPrinter!\n"; diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp index 679c96534b..8652f9742d 100644 --- a/lib/Target/PowerPC/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -511,16 +511,16 @@ bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) { switch (F->getLinkage()) { default: assert(0 && "Unknown linkage type!"); case Function::InternalLinkage: // Symbols default to internal. - SwitchSection(".text", F); + SwitchToTextSection(".text", F); break; case Function::ExternalLinkage: - SwitchSection(".text", F); + SwitchToTextSection(".text", F); O << "\t.globl\t" << CurrentFnName << "\n"; break; case Function::WeakLinkage: case Function::LinkOnceLinkage: - SwitchSection(".section __TEXT,__textcoal_nt,coalesced,pure_instructions", - F); + SwitchToTextSection( + ".section __TEXT,__textcoal_nt,coalesced,pure_instructions", F); O << "\t.globl\t" << CurrentFnName << "\n"; O << "\t.weak_definition\t" << CurrentFnName << "\n"; break; @@ -595,10 +595,10 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { O << "\t.zerofill __DATA, __common, " << name << ", " << Size << ", " << Align; } else if (I->hasInternalLinkage()) { - SwitchSection(".data", I); + SwitchToDataSection(".data", I); O << LCOMMDirective << name << "," << Size << "," << Align; } else { - SwitchSection(".data", I); + SwitchToDataSection(".data", I); O << ".comm " << name << "," << Size; } O << "\t\t; '" << I->getName() << "'\n"; @@ -608,7 +608,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { case GlobalValue::WeakLinkage: O << "\t.globl " << name << '\n' << "\t.weak_definition " << name << '\n'; - SwitchSection(".section __DATA,__datacoal_nt,coalesced", I); + SwitchToDataSection(".section __DATA,__datacoal_nt,coalesced", I); break; case GlobalValue::AppendingLinkage: // FIXME: appending linkage variables should go into a section of @@ -618,7 +618,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { O << "\t.globl " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: - SwitchSection(".data", I); + SwitchToDataSection(".data", I); break; default: std::cerr << "Unknown linkage type!"; @@ -636,8 +636,8 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { if (TM.getRelocationModel() == Reloc::PIC) { for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end(); i != e; ++i) { - SwitchSection(".section __TEXT,__picsymbolstub1,symbol_stubs," - "pure_instructions,32", 0); + SwitchToTextSection(".section __TEXT,__picsymbolstub1,symbol_stubs," + "pure_instructions,32", 0); EmitAlignment(2); O << "L" << *i << "$stub:\n"; O << "\t.indirect_symbol " << *i << "\n"; @@ -650,7 +650,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { O << "\tlwzu r12,lo16(L" << *i << "$lazy_ptr-L0$" << *i << ")(r11)\n"; O << "\tmtctr r12\n"; O << "\tbctr\n"; - SwitchSection(".lazy_symbol_pointer", 0); + SwitchToDataSection(".lazy_symbol_pointer", 0); O << "L" << *i << "$lazy_ptr:\n"; O << "\t.indirect_symbol " << *i << "\n"; O << "\t.long dyld_stub_binding_helper\n"; @@ -658,8 +658,8 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { } else { for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end(); i != e; ++i) { - SwitchSection(".section __TEXT,__symbol_stub1,symbol_stubs," - "pure_instructions,16", 0); + SwitchToTextSection(".section __TEXT,__symbol_stub1,symbol_stubs," + "pure_instructions,16", 0); EmitAlignment(4); O << "L" << *i << "$stub:\n"; O << "\t.indirect_symbol " << *i << "\n"; @@ -667,7 +667,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { O << "\tlwzu r12,lo16(L" << *i << "$lazy_ptr)(r11)\n"; O << "\tmtctr r12\n"; O << "\tbctr\n"; - SwitchSection(".lazy_symbol_pointer", 0); + SwitchToDataSection(".lazy_symbol_pointer", 0); O << "L" << *i << "$lazy_ptr:\n"; O << "\t.indirect_symbol " << *i << "\n"; O << "\t.long dyld_stub_binding_helper\n"; @@ -678,7 +678,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) { // Output stubs for external and common global variables. if (GVStubs.begin() != GVStubs.end()) { - SwitchSection(".non_lazy_symbol_pointer", 0); + SwitchToDataSection(".non_lazy_symbol_pointer", 0); for (std::set<std::string>::iterator I = GVStubs.begin(), E = GVStubs.end(); I != E; ++I) { O << "L" << *I << "$non_lazy_ptr:\n"; @@ -747,7 +747,7 @@ bool AIXAsmPrinter::runOnMachineFunction(MachineFunction &MF) { } bool AIXAsmPrinter::doInitialization(Module &M) { - SwitchSection("", 0); + SwitchToDataSection("", 0); const TargetData *TD = TM.getTargetData(); O << "\t.machine \"ppc64\"\n" diff --git a/lib/Target/Sparc/SparcAsmPrinter.cpp b/lib/Target/Sparc/SparcAsmPrinter.cpp index 47ed6fcda7..da2a31e20d 100644 --- a/lib/Target/Sparc/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/SparcAsmPrinter.cpp @@ -98,8 +98,8 @@ bool SparcAsmPrinter::runOnMachineFunction(MachineFunction &MF) { CurrentFnName = Mang->getValueName(MF.getFunction()); // Print out labels for the function. - O << "\t.text\n"; - O << "\t.align 16\n"; + SwitchToTextSection(".text", MF.getFunction()); + EmitAlignment(4, MF.getFunction()); O << "\t.globl\t" << CurrentFnName << "\n"; O << "\t.type\t" << CurrentFnName << ", #function\n"; O << CurrentFnName << ":\n"; @@ -238,7 +238,7 @@ bool SparcAsmPrinter::doFinalization(Module &M) { if (C->isNullValue() && (I->hasLinkOnceLinkage() || I->hasInternalLinkage() || I->hasWeakLinkage() /* FIXME: Verify correct */)) { - SwitchSection(".data", I); + SwitchToDataSection(".data", I); if (I->hasInternalLinkage()) O << "\t.local " << name << "\n"; @@ -253,7 +253,7 @@ bool SparcAsmPrinter::doFinalization(Module &M) { case GlobalValue::WeakLinkage: // FIXME: Verify correct for weak. // Nonnull linkonce -> weak O << "\t.weak " << name << "\n"; - SwitchSection("", I); + SwitchToDataSection("", I); O << "\t.section\t\".llvm.linkonce.d." << name << "\",\"aw\",@progbits\n"; break; @@ -267,9 +267,9 @@ bool SparcAsmPrinter::doFinalization(Module &M) { // FALL THROUGH case GlobalValue::InternalLinkage: if (C->isNullValue()) - SwitchSection(".bss", I); + SwitchToDataSection(".bss", I); else - SwitchSection(".data", I); + SwitchToDataSection(".data", I); break; case GlobalValue::GhostLinkage: std::cerr << "Should not have any unmaterialized functions!\n"; diff --git a/lib/Target/X86/X86ATTAsmPrinter.cpp b/lib/Target/X86/X86ATTAsmPrinter.cpp index 7baa8f8717..b674f15963 100755 --- a/lib/Target/X86/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/X86ATTAsmPrinter.cpp @@ -46,25 +46,26 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) { switch (F->getLinkage()) { default: assert(0 && "Unknown linkage type!"); case Function::InternalLinkage: // Symbols default to internal. - SwitchSection(".text", F); + SwitchToTextSection(".text", F); EmitAlignment(4, F); // FIXME: This should be parameterized somewhere. break; case Function::ExternalLinkage: - SwitchSection(".text", F); + SwitchToTextSection(".text", F); EmitAlignment(4, F); // FIXME: This should be parameterized somewhere. O << "\t.globl\t" << CurrentFnName << "\n"; break; case Function::WeakLinkage: case Function::LinkOnceLinkage: if (forDarwin) { - SwitchSection(".section __TEXT,__textcoal_nt,coalesced,pure_instructions", - F); + SwitchToTextSection( + ".section __TEXT,__textcoal_nt,coalesced,pure_instructions", F); O << "\t.globl\t" << CurrentFnName << "\n"; O << "\t.weak_definition\t" << CurrentFnName << "\n"; } else { EmitAlignment(4, F); // FIXME: This should be parameterized somewhere. O << "\t.section\t.llvm.linkonce.t." << CurrentFnName << ",\"ax\",@progbits\n"; + SwitchToTextSection("", F); O << "\t.weak " << CurrentFnName << "\n"; } break; diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp index 3ac322bfef..0e2bab7ba7 100644 --- a/lib/Target/X86/X86AsmPrinter.cpp +++ b/lib/Target/X86/X86AsmPrinter.cpp @@ -119,7 +119,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { O << "\t.zerofill __DATA__, __common, " << name << ", " << Size << ", " << Align; } else { - SwitchSection(".data", I); + SwitchToDataSection(".data", I); if (LCOMMDirective != NULL) { if (I->hasInternalLinkage()) { O << LCOMMDirective << name << "," << Size; @@ -143,7 +143,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { if (forDarwin) { O << "\t.globl " << name << "\n" << "\t.weak_definition " << name << "\n"; - SwitchSection(".section __DATA,__datacoal_nt,coalesced", I); + SwitchToDataSection(".section __DATA,__datacoal_nt,coalesced", I); } else { O << "\t.section\t.llvm.linkonce.d." << name << ",\"aw\",@progbits\n"; O << "\t.weak " << name << "\n"; @@ -157,7 +157,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { O << "\t.globl " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: - SwitchSection(".data", I); + SwitchToDataSection(".data", I); break; default: assert(0 && "Unknown linkage type!"); @@ -175,14 +175,14 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { } if (forDarwin) { - SwitchSection("", 0); + SwitchToDataSection("", 0); // Output stubs for dynamically-linked functions unsigned j = 1; for (std::set<std::string>::iterator i = FnStubs.begin(), e = FnStubs.end(); i != e; ++i, ++j) { - SwitchSection(".section __IMPORT,__jump_table,symbol_stubs," - "self_modifying_code+pure_instructions,5", 0); + SwitchToDataSection(".section __IMPORT,__jump_table,symbol_stubs," + "self_modifying_code+pure_instructions,5", 0); O << "L" << *i << "$stub:\n"; O << "\t.indirect_symbol " << *i << "\n"; O << "\thlt ; hlt ; hlt ; hlt ; hlt\n"; @@ -192,7 +192,8 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) { // Output stubs for external and common global variables. if (GVStubs.begin() != GVStubs.end()) - SwitchSection(".section __IMPORT,__pointers,non_lazy_symbol_pointers", 0); + SwitchToDataSection( + ".section __IMPORT,__pointers,non_lazy_symbol_pointers", 0); for (std::set<std::string>::iterator i = GVStubs.begin(), e = GVStubs.end(); i != e; ++i) { O << "L" << *i << "$non_lazy_ptr:\n"; diff --git a/lib/Target/X86/X86IntelAsmPrinter.cpp b/lib/Target/X86/X86IntelAsmPrinter.cpp index 952f73206e..d33cb8c556 100755 --- a/lib/Target/X86/X86IntelAsmPrinter.cpp +++ b/lib/Target/X86/X86IntelAsmPrinter.cpp @@ -37,7 +37,7 @@ bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) { EmitConstantPool(MF.getConstantPool()); // Print out labels for the function. - SwitchSection(".code", MF.getFunction()); + SwitchToTextSection(".code", MF.getFunction()); EmitAlignment(4); if (MF.getFunction()->getLinkage() == GlobalValue::ExternalLinkage) O << "\tpublic " << CurrentFnName << "\n"; @@ -342,14 +342,14 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) { switch (I->getLinkage()) { case GlobalValue::LinkOnceLinkage: case GlobalValue::WeakLinkage: - SwitchSection("", 0); + SwitchToDataSection("", 0); O << name << "?\tsegment common 'COMMON'\n"; bCustomSegment = true; // FIXME: the default alignment is 16 bytes, but 1, 2, 4, and 256 // are also available. break; case GlobalValue::AppendingLinkage: - SwitchSection("", 0); + SwitchToDataSection("", 0); O << name << "?\tsegment public 'DATA'\n"; bCustomSegment = true; // FIXME: the default alignment is 16 bytes, but 1, 2, 4, and 256 @@ -359,7 +359,7 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) { O << "\tpublic " << name << "\n"; // FALL THROUGH case GlobalValue::InternalLinkage: - SwitchSection(".data", I); + SwitchToDataSection(".data", I); break; default: assert(0 && "Unknown linkage type!"); @@ -378,7 +378,7 @@ bool X86IntelAsmPrinter::doFinalization(Module &M) { // Bypass X86SharedAsmPrinter::doFinalization(). AsmPrinter::doFinalization(M); - SwitchSection("", 0); + SwitchToDataSection("", 0); O << "\tend\n"; return false; // success } |
