[llvm-commits] [llvm] r94698 - /llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
Chris Lattner
sabre at nondot.org
Wed Jan 27 15:23:58 PST 2010
Author: lattner
Date: Wed Jan 27 17:23:58 2010
New Revision: 94698
URL: http://llvm.org/viewvc/llvm-project?rev=94698&view=rev
Log:
switch mips to use the shared EmitFunctionHeader() function
Modified:
llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp?rev=94698&r1=94697&r2=94698&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp Wed Jan 27 17:23:58 2010
@@ -74,7 +74,6 @@
void printHex32(unsigned int Value);
const char *emitCurrentABIString();
- void emitFunctionStart(MachineFunction &MF);
void emitFunctionEnd(MachineFunction &MF);
void emitFrameDirective(MachineFunction &MF);
@@ -82,6 +81,7 @@
static const char *getRegisterName(unsigned RegNo);
bool runOnMachineFunction(MachineFunction &F);
+ virtual void EmitFunctionEntryLabel();
void EmitStartOfAsmFile(Module &M);
};
} // end of anonymous namespace
@@ -207,31 +207,6 @@
return NULL;
}
-/// Emit the directives used by GAS on the start of functions
-void MipsAsmPrinter::emitFunctionStart(MachineFunction &MF) {
- // Print out the label for the function.
- const Function *F = MF.getFunction();
- OutStreamer.SwitchSection(getObjFileLowering().SectionForGlobal(F, Mang, TM));
-
- // 2 bits aligned
- EmitAlignment(MF.getAlignment(), F);
-
- O << "\t.globl\t" << *CurrentFnSym << '\n';
- O << "\t.ent\t" << *CurrentFnSym << '\n';
-
- printVisibility(CurrentFnSym, F->getVisibility());
-
- if ((MAI->hasDotTypeDotSizeDirective()) && Subtarget->isLinux())
- O << "\t.type\t" << *CurrentFnSym << ", @function\n";
-
- O << *CurrentFnSym << ":\n";
-
- emitFrameDirective(MF);
- printSavedRegsBitmask(MF);
-
- O << '\n';
-}
-
/// Emit the directives used by GAS on the end of functions
void MipsAsmPrinter::emitFunctionEnd(MachineFunction &MF) {
// There are instruction for this macros, but they must
@@ -245,30 +220,30 @@
O << "\t.size\t" << *CurrentFnSym << ", .-" << *CurrentFnSym << '\n';
}
+void MipsAsmPrinter::EmitFunctionEntryLabel() {
+ O << "\t.ent\t" << *CurrentFnSym << '\n';
+ OutStreamer.EmitLabel(CurrentFnSym);
+}
+
/// runOnMachineFunction - This uses the printMachineInstruction()
/// method to print assembly for each instruction.
bool MipsAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
SetupMachineFunction(MF);
-
- // Print out constants referenced by the function
- EmitConstantPool(MF.getConstantPool());
-
- // Print out jump tables referenced by the function
- EmitJumpTableInfo(MF);
-
- O << "\n\n";
-
- // Emit the function start directives
- emitFunctionStart(MF);
-
+
+ EmitFunctionHeader();
+
+ emitFrameDirective(MF);
+ printSavedRegsBitmask(MF);
+
+ O << '\n';
+
// Print out code for the function.
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
// Print a label for the basic block.
- if (I != MF.begin()) {
+ if (I != MF.begin())
EmitBasicBlockStart(I);
- }
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
II != E; ++II) {
@@ -291,7 +266,10 @@
// Emit function end directives
emitFunctionEnd(MF);
-
+
+ // Print out jump tables referenced by the function
+ EmitJumpTableInfo(MF);
+
// We didn't modify anything.
return false;
}
More information about the llvm-commits
mailing list