mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-26 14:15:53 +00:00
Switch MSP430, CellSPU, SystemZ, Darwin/PPC, Alpha, and Sparc to
EmitFunctionHeader: 7 files changed, 16 insertions(+), 210 deletions(-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94630 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8c86db58c8
commit
4129ccdb70
@ -127,40 +127,10 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
SetupMachineFunction(MF);
|
||||
O << "\n\n";
|
||||
|
||||
// Print out constants referenced by the function
|
||||
EmitConstantPool(MF.getConstantPool());
|
||||
|
||||
// Print out jump tables referenced by the function
|
||||
EmitJumpTableInfo(MF);
|
||||
|
||||
// Print out labels for the function.
|
||||
const Function *F = MF.getFunction();
|
||||
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||
|
||||
EmitAlignment(MF.getAlignment(), F);
|
||||
switch (F->getLinkage()) {
|
||||
default: llvm_unreachable("Unknown linkage type!");
|
||||
case Function::InternalLinkage: // Symbols default to internal.
|
||||
case Function::PrivateLinkage:
|
||||
case Function::LinkerPrivateLinkage:
|
||||
break;
|
||||
case Function::ExternalLinkage:
|
||||
O << "\t.globl " << *CurrentFnSym << '\n';
|
||||
break;
|
||||
case Function::WeakAnyLinkage:
|
||||
case Function::WeakODRLinkage:
|
||||
case Function::LinkOnceAnyLinkage:
|
||||
case Function::LinkOnceODRLinkage:
|
||||
O << MAI->getWeakRefDirective() << *CurrentFnSym << '\n';
|
||||
break;
|
||||
}
|
||||
|
||||
printVisibility(CurrentFnSym, F->getVisibility());
|
||||
|
||||
EmitFunctionHeader();
|
||||
|
||||
O << "\t.ent " << *CurrentFnSym << "\n";
|
||||
|
||||
O << *CurrentFnSym << ":\n";
|
||||
|
||||
// Print out code for the function.
|
||||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||
I != E; ++I) {
|
||||
@ -183,6 +153,9 @@ bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
|
||||
O << "\t.end " << *CurrentFnSym << "\n";
|
||||
|
||||
// Print out jump tables referenced by the function
|
||||
EmitJumpTableInfo(MF);
|
||||
|
||||
// We didn't modify anything.
|
||||
return false;
|
||||
}
|
||||
|
@ -406,38 +406,7 @@ bool LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
SetupMachineFunction(MF);
|
||||
O << "\n\n";
|
||||
|
||||
// Print out constants referenced by the function
|
||||
EmitConstantPool(MF.getConstantPool());
|
||||
|
||||
// Print out labels for the function.
|
||||
const Function *F = MF.getFunction();
|
||||
|
||||
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||
EmitAlignment(MF.getAlignment(), F);
|
||||
|
||||
switch (F->getLinkage()) {
|
||||
default: llvm_unreachable("Unknown linkage type!");
|
||||
case Function::PrivateLinkage:
|
||||
case Function::LinkerPrivateLinkage:
|
||||
case Function::InternalLinkage: // Symbols default to internal.
|
||||
break;
|
||||
case Function::ExternalLinkage:
|
||||
O << "\t.global\t" << *CurrentFnSym << "\n" << "\t.type\t";
|
||||
O << *CurrentFnSym << ", @function\n";
|
||||
break;
|
||||
case Function::WeakAnyLinkage:
|
||||
case Function::WeakODRLinkage:
|
||||
case Function::LinkOnceAnyLinkage:
|
||||
case Function::LinkOnceODRLinkage:
|
||||
O << "\t.global\t" << *CurrentFnSym << "\n";
|
||||
O << "\t.weak_definition\t" << *CurrentFnSym << "\n";
|
||||
break;
|
||||
}
|
||||
|
||||
O << *CurrentFnSym << ":\n";
|
||||
|
||||
// Emit pre-function debug information.
|
||||
DW->BeginFunction(&MF);
|
||||
EmitFunctionHeader();
|
||||
|
||||
// Print out code for the function.
|
||||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||
|
@ -78,7 +78,6 @@ namespace {
|
||||
const char *ExtraCode);
|
||||
void printInstructionThroughMCStreamer(const MachineInstr *MI);
|
||||
|
||||
void emitFunctionHeader(const MachineFunction &MF);
|
||||
bool runOnMachineFunction(MachineFunction &F);
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
@ -89,43 +88,11 @@ namespace {
|
||||
} // end of anonymous namespace
|
||||
|
||||
|
||||
void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
|
||||
const Function *F = MF.getFunction();
|
||||
|
||||
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||
|
||||
unsigned FnAlign = MF.getAlignment();
|
||||
EmitAlignment(FnAlign, F);
|
||||
|
||||
switch (F->getLinkage()) {
|
||||
default: llvm_unreachable("Unknown linkage type!");
|
||||
case Function::InternalLinkage: // Symbols default to internal.
|
||||
case Function::PrivateLinkage:
|
||||
case Function::LinkerPrivateLinkage:
|
||||
break;
|
||||
case Function::ExternalLinkage:
|
||||
O << "\t.globl\t" << *CurrentFnSym << '\n';
|
||||
break;
|
||||
case Function::LinkOnceAnyLinkage:
|
||||
case Function::LinkOnceODRLinkage:
|
||||
case Function::WeakAnyLinkage:
|
||||
case Function::WeakODRLinkage:
|
||||
O << "\t.weak\t" << *CurrentFnSym << '\n';
|
||||
break;
|
||||
}
|
||||
|
||||
printVisibility(CurrentFnSym, F->getVisibility());
|
||||
|
||||
O << "\t.type\t" << *CurrentFnSym << ",@function\n";
|
||||
O << *CurrentFnSym << ":\n";
|
||||
}
|
||||
|
||||
bool MSP430AsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
SetupMachineFunction(MF);
|
||||
O << "\n\n";
|
||||
|
||||
// Print the 'header' of function
|
||||
emitFunctionHeader(MF);
|
||||
|
||||
EmitFunctionHeader();
|
||||
|
||||
// Print out code for the function.
|
||||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||
|
@ -601,6 +601,8 @@ bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
SetupMachineFunction(MF);
|
||||
O << "\n\n";
|
||||
|
||||
EmitFunctionHeader();
|
||||
|
||||
// Print out constants referenced by the function
|
||||
EmitConstantPool(MF.getConstantPool());
|
||||
|
||||
@ -702,38 +704,7 @@ bool PPCDarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
SetupMachineFunction(MF);
|
||||
O << "\n\n";
|
||||
|
||||
// Print out constants referenced by the function
|
||||
EmitConstantPool(MF.getConstantPool());
|
||||
|
||||
// Print out labels for the function.
|
||||
const Function *F = MF.getFunction();
|
||||
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||
|
||||
switch (F->getLinkage()) {
|
||||
default: llvm_unreachable("Unknown linkage type!");
|
||||
case Function::PrivateLinkage:
|
||||
case Function::InternalLinkage: // Symbols default to internal.
|
||||
break;
|
||||
case Function::ExternalLinkage:
|
||||
O << "\t.globl\t" << *CurrentFnSym << '\n';
|
||||
break;
|
||||
case Function::WeakAnyLinkage:
|
||||
case Function::WeakODRLinkage:
|
||||
case Function::LinkOnceAnyLinkage:
|
||||
case Function::LinkOnceODRLinkage:
|
||||
case Function::LinkerPrivateLinkage:
|
||||
O << "\t.globl\t" << *CurrentFnSym << '\n';
|
||||
O << "\t.weak_definition\t" << *CurrentFnSym << '\n';
|
||||
break;
|
||||
}
|
||||
|
||||
printVisibility(CurrentFnSym, F->getVisibility());
|
||||
|
||||
EmitAlignment(MF.getAlignment(), F);
|
||||
O << *CurrentFnSym << ":\n";
|
||||
|
||||
// Emit pre-function debug information.
|
||||
DW->BeginFunction(&MF);
|
||||
EmitFunctionHeader();
|
||||
|
||||
// If the function is empty, then we need to emit *something*. Otherwise, the
|
||||
// function's label might be associated with something that it wasn't meant to
|
||||
|
@ -74,7 +74,6 @@ namespace {
|
||||
bool PrintAsmMemoryOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
unsigned AsmVariant, const char *ExtraCode);
|
||||
|
||||
void emitFunctionHeader(const MachineFunction &MF);
|
||||
bool printGetPCX(const MachineInstr *MI, unsigned OpNo);
|
||||
};
|
||||
} // end of anonymous namespace
|
||||
@ -87,19 +86,11 @@ namespace {
|
||||
bool SparcAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
SetupMachineFunction(MF);
|
||||
|
||||
// Print out constants referenced by the function
|
||||
EmitConstantPool(MF.getConstantPool());
|
||||
EmitFunctionHeader();
|
||||
|
||||
// BBNumber is used here so that a given Printer will never give two
|
||||
// BBs the same name. (If you have a better way, please let me know!)
|
||||
|
||||
O << "\n\n";
|
||||
emitFunctionHeader(MF);
|
||||
|
||||
|
||||
// Emit pre-function debug information.
|
||||
DW->BeginFunction(&MF);
|
||||
|
||||
// Number each basic block so that we can consistently refer to them
|
||||
// in PC-relative references.
|
||||
// FIXME: Why not use the MBB numbers?
|
||||
@ -138,38 +129,6 @@ bool SparcAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void SparcAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
|
||||
const Function *F = MF.getFunction();
|
||||
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||
EmitAlignment(MF.getAlignment(), F);
|
||||
|
||||
switch (F->getLinkage()) {
|
||||
default: llvm_unreachable("Unknown linkage type");
|
||||
case Function::PrivateLinkage:
|
||||
case Function::InternalLinkage:
|
||||
// Function is internal.
|
||||
break;
|
||||
case Function::DLLExportLinkage:
|
||||
case Function::ExternalLinkage:
|
||||
// Function is externally visible
|
||||
O << "\t.global\t" << *CurrentFnSym << '\n';
|
||||
break;
|
||||
case Function::LinkerPrivateLinkage:
|
||||
case Function::LinkOnceAnyLinkage:
|
||||
case Function::LinkOnceODRLinkage:
|
||||
case Function::WeakAnyLinkage:
|
||||
case Function::WeakODRLinkage:
|
||||
// Function is weak
|
||||
O << "\t.weak\t" << *CurrentFnSym << '\n';
|
||||
break;
|
||||
}
|
||||
|
||||
printVisibility(CurrentFnSym, F->getVisibility());
|
||||
|
||||
O << "\t.type\t" << *CurrentFnSym << ", #function\n";
|
||||
O << *CurrentFnSym << ":\n";
|
||||
}
|
||||
|
||||
|
||||
void SparcAsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
|
||||
const MachineOperand &MO = MI->getOperand (opNum);
|
||||
|
@ -69,7 +69,6 @@ namespace {
|
||||
|
||||
void printMachineInstruction(const MachineInstr * MI);
|
||||
|
||||
void emitFunctionHeader(const MachineFunction &MF);
|
||||
bool runOnMachineFunction(MachineFunction &F);
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
@ -81,46 +80,14 @@ namespace {
|
||||
|
||||
#include "SystemZGenAsmWriter.inc"
|
||||
|
||||
void SystemZAsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
|
||||
unsigned FnAlign = MF.getAlignment();
|
||||
const Function *F = MF.getFunction();
|
||||
|
||||
OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
|
||||
|
||||
EmitAlignment(FnAlign, F);
|
||||
|
||||
switch (F->getLinkage()) {
|
||||
default: assert(0 && "Unknown linkage type!");
|
||||
case Function::InternalLinkage: // Symbols default to internal.
|
||||
case Function::PrivateLinkage:
|
||||
case Function::LinkerPrivateLinkage:
|
||||
break;
|
||||
case Function::ExternalLinkage:
|
||||
O << "\t.globl\t" << *CurrentFnSym << '\n';
|
||||
break;
|
||||
case Function::LinkOnceAnyLinkage:
|
||||
case Function::LinkOnceODRLinkage:
|
||||
case Function::WeakAnyLinkage:
|
||||
case Function::WeakODRLinkage:
|
||||
O << "\t.weak\t" << *CurrentFnSym << '\n';
|
||||
break;
|
||||
}
|
||||
|
||||
printVisibility(CurrentFnSym, F->getVisibility());
|
||||
|
||||
O << "\t.type\t" << *CurrentFnSym << ",@function\n";
|
||||
O << *CurrentFnSym << ":\n";
|
||||
}
|
||||
|
||||
bool SystemZAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
SetupMachineFunction(MF);
|
||||
O << "\n\n";
|
||||
|
||||
// Print out constants referenced by the function
|
||||
EmitConstantPool(MF.getConstantPool());
|
||||
|
||||
// Print the 'header' of function
|
||||
emitFunctionHeader(MF);
|
||||
EmitFunctionHeader();
|
||||
|
||||
// Print out code for the function.
|
||||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||
|
@ -237,9 +237,6 @@ bool XCoreAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
// Print out constants referenced by the function
|
||||
EmitConstantPool(MF.getConstantPool());
|
||||
|
||||
// Print out jump tables referenced by the function
|
||||
EmitJumpTableInfo(MF);
|
||||
|
||||
// Emit the function start directives
|
||||
emitFunctionStart(MF);
|
||||
|
||||
@ -268,6 +265,9 @@ bool XCoreAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
// Emit function end directives
|
||||
emitFunctionEnd(MF);
|
||||
|
||||
// Print out jump tables referenced by the function
|
||||
EmitJumpTableInfo(MF);
|
||||
|
||||
// Emit post-function debug information.
|
||||
DW->EndFunction(&MF);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user