mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-22 09:29:31 +00:00
switch blackfin to use EmitFunctionHeader. BlackfinAsmPrinter.cpp
is now less than 200 LOC! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94699 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5006071f7a
commit
ff0210d0b0
@ -54,7 +54,6 @@ namespace {
|
|||||||
void printInstruction(const MachineInstr *MI); // autogenerated.
|
void printInstruction(const MachineInstr *MI); // autogenerated.
|
||||||
static const char *getRegisterName(unsigned RegNo);
|
static const char *getRegisterName(unsigned RegNo);
|
||||||
|
|
||||||
void emitLinkage(const MCSymbol *GVSym, GlobalValue::LinkageTypes l);
|
|
||||||
bool runOnMachineFunction(MachineFunction &F);
|
bool runOnMachineFunction(MachineFunction &F);
|
||||||
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
|
||||||
unsigned AsmVariant, const char *ExtraCode);
|
unsigned AsmVariant, const char *ExtraCode);
|
||||||
@ -69,47 +68,14 @@ extern "C" void LLVMInitializeBlackfinAsmPrinter() {
|
|||||||
RegisterAsmPrinter<BlackfinAsmPrinter> X(TheBlackfinTarget);
|
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()
|
/// runOnMachineFunction - This uses the printInstruction()
|
||||||
/// method to print assembly for each instruction.
|
/// method to print assembly for each instruction.
|
||||||
///
|
///
|
||||||
bool BlackfinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
bool BlackfinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||||
SetupMachineFunction(MF);
|
SetupMachineFunction(MF);
|
||||||
EmitConstantPool(MF.getConstantPool());
|
|
||||||
EmitJumpTableInfo(MF);
|
EmitFunctionHeader();
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
// Print out code for the function.
|
// Print out code for the function.
|
||||||
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
|
||||||
I != E; ++I) {
|
I != E; ++I) {
|
||||||
@ -131,6 +97,8 @@ bool BlackfinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EmitJumpTableInfo(MF);
|
||||||
|
|
||||||
O << "\t.size " << *CurrentFnSym << ", .-" << *CurrentFnSym << "\n";
|
O << "\t.size " << *CurrentFnSym << ", .-" << *CurrentFnSym << "\n";
|
||||||
|
|
||||||
if (DW)
|
if (DW)
|
||||||
|
Loading…
Reference in New Issue
Block a user