mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 02:25:01 +00:00
Add back machine code deleter pass until we get a MachineCode pass
that will be responsible for the creation of MachineFunctions and will be required by all MachineFunctionPass passes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11453 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -62,6 +62,27 @@ FunctionPass *llvm::createMachineFunctionPrinterPass(std::ostream *OS,
|
|||||||
return new Printer(OS, Banner);
|
return new Printer(OS, Banner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
struct Deleter : public MachineFunctionPass {
|
||||||
|
const char *getPassName() const { return "Machine Code Deleter"; }
|
||||||
|
|
||||||
|
bool runOnMachineFunction(MachineFunction &MF) {
|
||||||
|
// Delete the annotation from the function now.
|
||||||
|
MachineFunction::destruct(MF.getFunction());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// MachineCodeDeletion Pass - This pass deletes all of the machine code for
|
||||||
|
/// the current function, which should happen after the function has been
|
||||||
|
/// emitted to a .s file or to memory.
|
||||||
|
FunctionPass *llvm::createMachineCodeDeleter() {
|
||||||
|
return new Deleter();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//===---------------------------------------------------------------------===//
|
//===---------------------------------------------------------------------===//
|
||||||
// MachineFunction implementation
|
// MachineFunction implementation
|
||||||
//===---------------------------------------------------------------------===//
|
//===---------------------------------------------------------------------===//
|
||||||
|
@@ -45,6 +45,7 @@ bool PowerPCTargetMachine::addPassesToEmitAssembly(PassManager &PM,
|
|||||||
PM.add(createRegisterAllocator());
|
PM.add(createRegisterAllocator());
|
||||||
PM.add(createPrologEpilogCodeInserter());
|
PM.add(createPrologEpilogCodeInserter());
|
||||||
// <insert assembly code output passes here>
|
// <insert assembly code output passes here>
|
||||||
|
PM.add(createMachineCodeDeleter());
|
||||||
return true; // change to `return false' when this actually works.
|
return true; // change to `return false' when this actually works.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -212,6 +212,8 @@ namespace {
|
|||||||
bool X86TargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM,
|
bool X86TargetMachine::addPassesToEmitMachineCode(FunctionPassManager &PM,
|
||||||
MachineCodeEmitter &MCE) {
|
MachineCodeEmitter &MCE) {
|
||||||
PM.add(new Emitter(MCE));
|
PM.add(new Emitter(MCE));
|
||||||
|
// Delete machine code for this function
|
||||||
|
PM.add(createMachineCodeDeleter());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -104,6 +104,9 @@ bool X86TargetMachine::addPassesToEmitAssembly(PassManager &PM,
|
|||||||
if (!DisableOutput)
|
if (!DisableOutput)
|
||||||
PM.add(createX86CodePrinterPass(Out, *this));
|
PM.add(createX86CodePrinterPass(Out, *this));
|
||||||
|
|
||||||
|
// Delete machine code for this function
|
||||||
|
PM.add(createMachineCodeDeleter());
|
||||||
|
|
||||||
return false; // success!
|
return false; // success!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user