mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
Switch MSP430, SPU, Sparc, and SystemZ to use EmitFunctionBody().
Diffstat: 6 files changed, 30 insertions(+), 284 deletions(-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94727 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -19,12 +19,8 @@
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
#include "llvm/Module.h"
|
||||
#include "llvm/Assembly/Writer.h"
|
||||
#include "llvm/CodeGen/AsmPrinter.h"
|
||||
#include "llvm/CodeGen/DwarfWriter.h"
|
||||
#include "llvm/CodeGen/MachineModuleInfo.h"
|
||||
#include "llvm/CodeGen/MachineFunctionPass.h"
|
||||
#include "llvm/CodeGen/MachineInstr.h"
|
||||
#include "llvm/MC/MCStreamer.h"
|
||||
#include "llvm/MC/MCAsmInfo.h"
|
||||
#include "llvm/MC/MCSymbol.h"
|
||||
@@ -33,20 +29,12 @@
|
||||
#include "llvm/Target/TargetOptions.h"
|
||||
#include "llvm/Target/TargetRegisterInfo.h"
|
||||
#include "llvm/Target/TargetRegistry.h"
|
||||
#include "llvm/ADT/Statistic.h"
|
||||
#include "llvm/ADT/StringExtras.h"
|
||||
#include "llvm/Support/CommandLine.h"
|
||||
#include "llvm/Support/Debug.h"
|
||||
#include "llvm/Support/ErrorHandling.h"
|
||||
#include "llvm/Support/FormattedStream.h"
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
using namespace llvm;
|
||||
|
||||
namespace {
|
||||
STATISTIC(EmittedInsts, "Number of machine instrs printed");
|
||||
|
||||
const std::string bss_section(".bss");
|
||||
|
||||
class SPUAsmPrinter : public AsmPrinter {
|
||||
public:
|
||||
explicit SPUAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
|
||||
@@ -67,7 +55,9 @@ namespace {
|
||||
static const char *getRegisterName(unsigned RegNo);
|
||||
|
||||
|
||||
void printMachineInstruction(const MachineInstr *MI);
|
||||
void EmitInstruction(const MachineInstr *MI) {
|
||||
printInstruction(MI);
|
||||
}
|
||||
void printOp(const MachineOperand &MO);
|
||||
|
||||
/// printRegister - Print register according to target requirements.
|
||||
@@ -276,8 +266,6 @@ namespace {
|
||||
llvm_unreachable("Invalid/non-immediate rotate amount in printRotateNeg7Imm");
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool runOnMachineFunction(MachineFunction &F) = 0;
|
||||
};
|
||||
|
||||
/// LinuxAsmPrinter - SPU assembly printer, customized for Linux
|
||||
@@ -290,15 +278,6 @@ namespace {
|
||||
virtual const char *getPassName() const {
|
||||
return "STI CBEA SPU Assembly Printer";
|
||||
}
|
||||
|
||||
bool runOnMachineFunction(MachineFunction &F);
|
||||
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.setPreservesAll();
|
||||
AU.addRequired<MachineModuleInfo>();
|
||||
AU.addRequired<DwarfWriter>();
|
||||
SPUAsmPrinter::getAnalysisUsage(AU);
|
||||
}
|
||||
};
|
||||
} // end of anonymous namespace
|
||||
|
||||
@@ -386,54 +365,6 @@ bool SPUAsmPrinter::PrintAsmMemoryOperand(const MachineInstr *MI,
|
||||
return false;
|
||||
}
|
||||
|
||||
/// printMachineInstruction -- Print out a single PowerPC MI in Darwin syntax
|
||||
/// to the current output stream.
|
||||
///
|
||||
void SPUAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
|
||||
++EmittedInsts;
|
||||
processDebugLoc(MI, true);
|
||||
printInstruction(MI);
|
||||
if (VerboseAsm)
|
||||
EmitComments(*MI);
|
||||
processDebugLoc(MI, false);
|
||||
O << '\n';
|
||||
}
|
||||
|
||||
/// runOnMachineFunction - This uses the printMachineInstruction()
|
||||
/// method to print assembly for each instruction.
|
||||
///
|
||||
bool LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
SetupMachineFunction(MF);
|
||||
O << "\n\n";
|
||||
|
||||
EmitFunctionHeader();
|
||||
|
||||
// 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()) {
|
||||
EmitBasicBlockStart(I);
|
||||
}
|
||||
for (MachineBasicBlock::const_iterator II = I->begin(), E = I->end();
|
||||
II != E; ++II) {
|
||||
// Print the assembly for the instruction.
|
||||
printMachineInstruction(II);
|
||||
}
|
||||
}
|
||||
|
||||
O << "\t.size\t" << *CurrentFnSym << ",.-" << *CurrentFnSym << "\n";
|
||||
|
||||
// Print out jump tables referenced by the function.
|
||||
EmitJumpTableInfo();
|
||||
|
||||
// Emit post-function debug information.
|
||||
DW->EndFunction(&MF);
|
||||
|
||||
// We didn't modify anything.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Force static initialization.
|
||||
extern "C" void LLVMInitializeCellSPUAsmPrinter() {
|
||||
RegisterAsmPrinter<LinuxAsmPrinter> X(TheCellSPUTarget);
|
||||
|
Reference in New Issue
Block a user