* Swithc to new MachineCodeForInstruction model

* Implement memory freeing for instruction temporaries


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1653 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2002-02-03 07:49:15 +00:00
parent c019a17137
commit cf4525bd20

View File

@ -14,8 +14,9 @@
#include "llvm/Target/Sparc.h"
#include "llvm/CodeGen/InstrScheduling.h"
#include "llvm/CodeGen/InstrSelection.h"
#include "llvm/CodeGen/MachineCodeForInstruction.h"
#include "llvm/CodeGen/MachineCodeForMethod.h"
#include "llvm/CodeGen/PhyRegAlloc.h"
#include "llvm/Analysis/LiveVar/MethodLiveVarInfo.h"
#include "llvm/Method.h"
#include <iostream>
using std::cerr;
@ -102,11 +103,11 @@ InsertEpilogCode(Method* method, TargetMachine& target)
unsigned N = GetInstructionsForEpilog(exitBB, target, minstrVec);
MachineCodeForBasicBlock& bbMvec = exitBB->getMachineInstrVec();
MachineCodeForVMInstr& termMvec =
exitBB->getTerminator()->getMachineInstrVec();
MachineCodeForInstruction &termMvec =
MachineCodeForInstruction::get(exitBB->getTerminator());
// Remove the NOPs in the delay slots of the return instruction
const MachineInstrInfo& mii = target.getInstrInfo();
const MachineInstrInfo &mii = target.getInstrInfo();
unsigned numNOPs = 0;
while (termMvec.back()->getOpCode() == NOP)
{
@ -283,7 +284,7 @@ bool
UltraSparc::compileMethod(Method *method)
{
// Construct and initialize the MachineCodeForMethod object for this method.
(void) MachineCodeForMethod::construct(method, *this);
MachineCodeForMethod::construct(method, *this);
if (SelectInstructionsForMethod(method, *this))
{
@ -310,3 +311,19 @@ UltraSparc::compileMethod(Method *method)
return false;
}
static void freeMachineCode(Instruction *I) {
MachineCodeForInstruction::destroy(I);
}
//
// freeCompiledMethod - Release all memory associated with the compiled image
// for this method.
//
void
UltraSparc::freeCompiledMethod(Method *M)
{
for_each(M->inst_begin(), M->inst_end(), freeMachineCode);
// Don't destruct MachineCodeForMethod - The global printer needs it
//MachineCodeForMethod::destruct(M);
}