switch blackfin to use EmitFunctionHeader. BlackfinAsmPrinter.cpp

is now less than 200 LOC!

llvm-svn: 94699
This commit is contained in:
Chris Lattner 2010-01-27 23:26:37 +00:00
parent 5d9fb4b746
commit 1aef3717bd
1 changed files with 5 additions and 37 deletions

View File

@ -54,7 +54,6 @@ namespace {
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,46 +68,13 @@ extern "C" void LLVMInitializeBlackfinAsmPrinter() {
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();
@ -131,6 +97,8 @@ bool BlackfinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
}
}
EmitJumpTableInfo(MF);
O << "\t.size " << *CurrentFnSym << ", .-" << *CurrentFnSym << "\n";
if (DW)