TargetInstrInfo::hasOperandInterlock() is always true, because it is
[oota-llvm.git] / lib / CodeGen / MachineCodeForInstruction.cpp
index 6156399224148ab5d64e5e88f558927a4176655b..c50c8b8c6aef55a7c76ea6f42628c492d61ac6f7 100644 (file)
@@ -1,69 +1,53 @@
 //===-- MachineCodeForInstruction.cpp -------------------------------------===//
+// 
+//                     The LLVM Compiler Infrastructure
 //
-//   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:
+// 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.
 // 
-//   "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).
+//===----------------------------------------------------------------------===//
+//
+// 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:
 // 
-//   (2) "Implicit uses" are values used in the VM instruction but not in
-//       the machine instruction sequence
+// "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
 // 
 //===----------------------------------------------------------------------===//
 
 #include "llvm/CodeGen/MachineCodeForInstruction.h"
+#include "llvm/Function.h"
 #include "llvm/CodeGen/MachineInstr.h"
-#include "llvm/CodeGen/InstrSelection.h"
-
-static AnnotationID MCFI_AID(
-             AnnotationManager::getID("CodeGen::MachineCodeForInstruction"));
-
-static Annotation *CreateMCFI(AnnotationID AID, const Annotable *, void *) {
-  assert(AID == MCFI_AID);
-  return new MachineCodeForInstruction();  // Invoke constructor!
-}
-
-// Register the annotation with the annotation factory
-static struct MCFIInitializer {
-  MCFIInitializer() {
-    AnnotationManager::registerAnnotationFactory(MCFI_AID, &CreateMCFI);
-  }
-} RegisterCreateMCFI;
-
-
-MachineCodeForInstruction&
-MachineCodeForInstruction::get(const Instruction *I){
-  assert(I != NULL);
-  return *(MachineCodeForInstruction*)I->getOrCreateAnnotation(MCFI_AID);
+#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineFunctionInfo.h"
+#include "../Target/SparcV9/MachineInstrAnnot.h"
+using namespace llvm;
+
+MachineCodeForInstruction &MachineCodeForInstruction::get(const Instruction *I){
+  MachineFunction &MF = MachineFunction::get(I->getParent()->getParent());
+  return MF.getInfo()->MCFIEntries[I];
 }
-
-
-void
-MachineCodeForInstruction::destroy(const Instruction *I) {
-  I->deleteAnnotation(MCFI_AID);
+void MachineCodeForInstruction::destroy(const Instruction *I) {
+  MachineFunction &MF = MachineFunction::get(I->getParent()->getParent());
+  MF.getInfo()->MCFIEntries.erase(I);
 }
 
-
 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()
-  : Annotation(MCFI_AID)
-{}
-
-
-MachineCodeForInstruction::~MachineCodeForInstruction()
-{
+MachineCodeForInstruction::~MachineCodeForInstruction() {
   // Let go of all uses in temp. instructions
   dropAllReferences();
   
@@ -71,7 +55,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.
+  delete callArgsDesc;
 }