summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-28 06:22:43 +0000
committerChris Lattner <sabre@nondot.org>2010-01-28 06:22:43 +0000
commitcc9a6f05801061cec17f7b1aaca55e7c4f4ebe6d (patch)
treeb424aa392d5bc382d5a08d65dbc640b569d0fccd /llvm/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
parentac0605e927c487a79954ce6ae716aefc8ff098f4 (diff)
downloadbcm5719-llvm-cc9a6f05801061cec17f7b1aaca55e7c4f4ebe6d.tar.gz
bcm5719-llvm-cc9a6f05801061cec17f7b1aaca55e7c4f4ebe6d.zip
convert the last 3 targets to use EmitFunctionBody() now that
it has before/end body hooks. lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp | 49 ++----------- lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp | 87 ++++++------------------ lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp | 56 +++------------ test/CodeGen/XCore/ashr.ll | 2 4 files changed, 48 insertions(+), 146 deletions(-) llvm-svn: 94741
Diffstat (limited to 'llvm/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp')
-rw-r--r--llvm/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp49
1 files changed, 10 insertions, 39 deletions
diff --git a/llvm/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp b/llvm/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
index 5095705df8e..a4198446ace 100644
--- a/llvm/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
+++ b/llvm/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp
@@ -29,11 +29,8 @@
#include "llvm/Target/TargetRegistry.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
-#include "llvm/ADT/Statistic.h"
using namespace llvm;
-STATISTIC(EmittedInsts, "Number of machine instrs printed");
-
namespace {
struct AlphaAsmPrinter : public AsmPrinter {
/// Unique incrementer for label values for referencing Global values.
@@ -47,12 +44,14 @@ namespace {
return "Alpha Assembly Printer";
}
void printInstruction(const MachineInstr *MI);
+ void EmitInstruction(const MachineInstr *MI) { printInstruction(MI); }
static const char *getRegisterName(unsigned RegNo);
void printOp(const MachineOperand &MO, bool IsCallOp = false);
void printOperand(const MachineInstr *MI, int opNum);
void printBaseOffsetPair(const MachineInstr *MI, int i, bool brackets=true);
- bool runOnMachineFunction(MachineFunction &F);
+ virtual void EmitFunctionBodyStart();
+ virtual void EmitFunctionBodyEnd();
void EmitStartOfAsmFile(Module &M);
bool PrintAsmOperand(const MachineInstr *MI, unsigned OpNo,
@@ -120,44 +119,16 @@ void AlphaAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) {
}
}
-/// runOnMachineFunction - This uses the printMachineInstruction()
-/// method to print assembly for each instruction.
-///
-bool AlphaAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
- SetupMachineFunction(MF);
- O << "\n\n";
-
- EmitFunctionHeader();
-
+/// EmitFunctionBodyStart - Targets can override this to emit stuff before
+/// the first basic block in the function.
+void AlphaAsmPrinter::EmitFunctionBodyStart() {
O << "\t.ent " << *CurrentFnSym << "\n";
+}
- // Print out code for the function.
- for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
- I != E; ++I) {
- if (I != MF.begin())
- EmitBasicBlockStart(I);
-
- for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
- II != E; ++II) {
- // Print the assembly for the instruction.
- ++EmittedInsts;
- processDebugLoc(II, true);
- printInstruction(II);
-
- if (VerboseAsm)
- EmitComments(*II);
- O << '\n';
- processDebugLoc(II, false);
- }
- }
-
+/// EmitFunctionBodyEnd - Targets can override this to emit stuff after
+/// the last basic block in the function.
+void AlphaAsmPrinter::EmitFunctionBodyEnd() {
O << "\t.end " << *CurrentFnSym << "\n";
-
- // Print out jump tables referenced by the function
- EmitJumpTableInfo();
-
- // We didn't modify anything.
- return false;
}
void AlphaAsmPrinter::EmitStartOfAsmFile(Module &M) {
OpenPOWER on IntegriCloud