From: Chris Lattner Date: Sun, 3 Feb 2002 07:49:15 +0000 (+0000) Subject: * Swithc to new MachineCodeForInstruction model X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=cf4525bd204c44df281b2db23e1e69a2d9eb3d56;p=oota-llvm.git * 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 --- diff --git a/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/lib/Target/SparcV9/SparcV9TargetMachine.cpp index dd9e3304746..a457abeb1ca 100644 --- a/lib/Target/SparcV9/SparcV9TargetMachine.cpp +++ b/lib/Target/SparcV9/SparcV9TargetMachine.cpp @@ -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 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); +}