aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-02-03 07:49:15 +0000
committerChris Lattner <sabre@nondot.org>2002-02-03 07:49:15 +0000
commitcf4525bd204c44df281b2db23e1e69a2d9eb3d56 (patch)
tree4ba4ff36396e301954fa645023d52bb92922fb27
parentc019a171371da2f6bdc9965264ff26f096431880 (diff)
* 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
-rw-r--r--lib/Target/SparcV9/SparcV9TargetMachine.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/lib/Target/SparcV9/SparcV9TargetMachine.cpp b/lib/Target/SparcV9/SparcV9TargetMachine.cpp
index dd9e330474..a457abeb1c 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 <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);
+}