Start using the new function cloning header
[oota-llvm.git] / lib / CodeGen / MachineCodeForInstruction.cpp
index 98871a7e85b0cd881dabafb352796b7c4e5c91df..7b2fb75c653bba751619f5ff51fa7ae682a5812e 100644 (file)
@@ -1,26 +1,26 @@
 //===-- MachineCodeForInstruction.cpp -------------------------------------===//
 //
-//   Representation of the sequence of machine instructions created
-//   for a single VM instruction.  Additionally records information
-//   about hidden and implicit values used by the machine instructions:
-//   about hidden values used by the machine instructions:
+// Representation of the sequence of machine instructions created for a single
+// VM instruction.  Additionally records information about hidden and implicit
+// values used by the machine instructions: about hidden values used by the
+// machine instructions:
 // 
-//   "Temporary values" are intermediate values used in the machine
-//   instruction sequence, but not in the VM instruction
-//   Note that such values should be treated as pure SSA values with
-//   no interpretation of their operands (i.e., as a TmpInstruction
-//   object which actually represents such a value).
+// "Temporary values" are intermediate values used in the machine instruction
+// sequence, but not in the VM instruction Note that such values should be
+// treated as pure SSA values with no interpretation of their operands (i.e., as
+// a TmpInstruction object which actually represents such a value).
 // 
-//   (2) "Implicit uses" are values used in the VM instruction but not in
-//       the machine instruction sequence
+// (2) "Implicit uses" are values used in the VM instruction but not in the
+//     machine instruction sequence
 // 
 //===----------------------------------------------------------------------===//
 
 #include "llvm/CodeGen/MachineCodeForInstruction.h"
 #include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/CodeGen/MachineInstrAnnot.h"
 #include "llvm/CodeGen/InstrSelection.h"
 
-static AnnotationID MCFI_AID(
+AnnotationID MCFI_AID(
              AnnotationManager::getID("CodeGen::MachineCodeForInstruction"));
 
 static Annotation *CreateMCFI(AnnotationID AID, const Annotable *, void *) {
@@ -29,23 +29,11 @@ static Annotation *CreateMCFI(AnnotationID AID, const Annotable *, void *) {
 }
 
 // Register the annotation with the annotation factory
-static struct Initializer {
-  Initializer() {
+static struct MCFIInitializer {
+  MCFIInitializer() {
     AnnotationManager::registerAnnotationFactory(MCFI_AID, &CreateMCFI);
   }
-} RegisterAID;
-
-
-MachineCodeForInstruction&
-MachineCodeForInstruction::get(const Instruction *I){
-  return *(MachineCodeForInstruction*)I->getOrCreateAnnotation(MCFI_AID);
-}
-
-
-void
-MachineCodeForInstruction::destroy(const Instruction *I) {
-  I->deleteAnnotation(MCFI_AID);
-}
+} RegisterCreateMCFI;
 
 
 void
@@ -56,11 +44,6 @@ MachineCodeForInstruction::dropAllReferences()
 }
 
 
-MachineCodeForInstruction::MachineCodeForInstruction()
-  : Annotation(MCFI_AID)
-{}
-
-
 MachineCodeForInstruction::~MachineCodeForInstruction()
 {
   // Let go of all uses in temp. instructions
@@ -73,4 +56,8 @@ MachineCodeForInstruction::~MachineCodeForInstruction()
   // Free the MachineInstr objects allocated, if any.
   for (unsigned i=0, N = size(); i < N; i++)
     delete (*this)[i];
+
+  // Free the CallArgsDescriptor if it exists.
+  if (callArgsDesc)
+    delete callArgsDesc;
 }