[llvm-commits] [llvm] r94699 - /llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
Chris Lattner
sabre at nondot.org
Wed Jan 27 15:26:37 PST 2010
Author: lattner
Date: Wed Jan 27 17:26:37 2010
New Revision: 94699
URL: http://llvm.org/viewvc/llvm-project?rev=94699&view=rev
Log:
switch blackfin to use EmitFunctionHeader. BlackfinAsmPrinter.cpp
is now less than 200 LOC!
Modified:
llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp?rev=94699&r1=94698&r2=94699&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Blackfin/AsmPrinter/BlackfinAsmPrinter.cpp Wed Jan 27 17:26:37 2010
@@ -54,7 +54,6 @@
void printInstruction(const MachineInstr *MI); // autogenerated.
static const char *getRegisterName(unsigned RegNo);
- void emitLinkage(const MCSymbol *GVSym, GlobalValue::LinkageTypes l);
bool runOnMachineFunction(MachineFunction &F);
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
unsigned AsmVariant, const char *ExtraCode);
@@ -69,47 +68,14 @@
RegisterAsmPrinter<BlackfinAsmPrinter> X(TheBlackfinTarget);
}
-void BlackfinAsmPrinter::emitLinkage(const MCSymbol *GVSym,
- GlobalValue::LinkageTypes L) {
- switch (L) {
- default: llvm_unreachable("Unknown linkage type!");
- case GlobalValue::InternalLinkage: // Symbols default to internal.
- case GlobalValue::PrivateLinkage:
- case GlobalValue::LinkerPrivateLinkage:
- break;
- case GlobalValue::ExternalLinkage:
- O << MAI->getGlobalDirective() << *GVSym << "\n";
- break;
- case GlobalValue::LinkOnceAnyLinkage:
- case GlobalValue::LinkOnceODRLinkage:
- case GlobalValue::WeakAnyLinkage:
- case GlobalValue::WeakODRLinkage:
- O << MAI->getGlobalDirective() << *GVSym << "\n";
- O << MAI->getWeakDefDirective() << *GVSym << "\n";
- break;
- }
-}
-
/// runOnMachineFunction - This uses the printInstruction()
/// method to print assembly for each instruction.
///
bool BlackfinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
SetupMachineFunction(MF);
- EmitConstantPool(MF.getConstantPool());
- EmitJumpTableInfo(MF);
-
- const Function *F = MF.getFunction();
- OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
- EmitAlignment(2, F);
- emitLinkage(CurrentFnSym, F->getLinkage());
- printVisibility(CurrentFnSym, F->getVisibility());
-
- O << "\t.type\t" << *CurrentFnSym << ", STT_FUNC\n";
- O << *CurrentFnSym << ":\n";
-
- if (DW)
- DW->BeginFunction(&MF);
-
+
+ EmitFunctionHeader();
+
// Print out code for the function.
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
@@ -131,6 +97,8 @@
}
}
+ EmitJumpTableInfo(MF);
+
O << "\t.size " << *CurrentFnSym << ", .-" << *CurrentFnSym << "\n";
if (DW)
More information about the llvm-commits
mailing list