Add back #include I messed up
[oota-llvm.git] / lib / CodeGen / MachineCodeForInstruction.cpp
index 7b2fb75c653bba751619f5ff51fa7ae682a5812e..8bf1c4129a49863a2bd0e09fc99ef6d0eb81ef0d 100644 (file)
@@ -1,4 +1,11 @@
 //===-- MachineCodeForInstruction.cpp -------------------------------------===//
+// 
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by the LLVM research group and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// 
+//===----------------------------------------------------------------------===//
 //
 // Representation of the sequence of machine instructions created for a single
 // VM instruction.  Additionally records information about hidden and implicit
 
 #include "llvm/CodeGen/MachineCodeForInstruction.h"
 #include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/CodeGen/MachineInstrAnnot.h"
-#include "llvm/CodeGen/InstrSelection.h"
+#include "../Target/SparcV9/MachineInstrAnnot.h"
+#include "llvm/Instruction.h"
+using namespace llvm;
+
+MachineCodeForInstruction &MachineCodeForInstruction::get(const Instruction *I){
+  return *(MachineCodeForInstruction*)I->getOrCreateAnnotation(MCFI_AID);
+}
+void MachineCodeForInstruction::destroy(const Instruction *I) {
+  I->deleteAnnotation(MCFI_AID);
+}
+
 
-AnnotationID MCFI_AID(
+
+AnnotationID llvm::MCFI_AID(
              AnnotationManager::getID("CodeGen::MachineCodeForInstruction"));
 
 static Annotation *CreateMCFI(AnnotationID AID, const Annotable *, void *) {
@@ -40,12 +57,11 @@ void
 MachineCodeForInstruction::dropAllReferences()
 {
   for (unsigned i=0, N=tempVec.size(); i < N; i++)
-    cast<TmpInstruction>(tempVec[i])->dropAllReferences();
+    cast<Instruction>(tempVec[i])->dropAllReferences();
 }
 
 
-MachineCodeForInstruction::~MachineCodeForInstruction()
-{
+MachineCodeForInstruction::~MachineCodeForInstruction() {
   // Let go of all uses in temp. instructions
   dropAllReferences();
   
@@ -53,11 +69,9 @@ MachineCodeForInstruction::~MachineCodeForInstruction()
   for (unsigned i=0, N=tempVec.size(); i < N; i++)
     delete tempVec[i];
   
-  // Free the MachineInstr objects allocated, if any.
-  for (unsigned i=0, N = size(); i < N; i++)
-    delete (*this)[i];
+  // do not free the MachineInstr objects allocated. they are managed
+  // by the ilist in MachineBasicBlock
 
   // Free the CallArgsDescriptor if it exists.
-  if (callArgsDesc)
-    delete callArgsDesc;
+  delete callArgsDesc;
 }