X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FMachineCodeForInstruction.cpp;h=c50c8b8c6aef55a7c76ea6f42628c492d61ac6f7;hb=b2f30a3792c84790fcf7f20bf581b963bb0a25d3;hp=50a54099c5c3cf91a2cdcc2526075d164ea1fc86;hpb=ae7fc3aede6205be456739f35e1ebfb7bfd2bd40;p=oota-llvm.git diff --git a/lib/CodeGen/MachineCodeForInstruction.cpp b/lib/CodeGen/MachineCodeForInstruction.cpp index 50a54099c5c..c50c8b8c6ae 100644 --- a/lib/CodeGen/MachineCodeForInstruction.cpp +++ b/lib/CodeGen/MachineCodeForInstruction.cpp @@ -13,7 +13,7 @@ // 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 +// 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). // @@ -23,26 +23,21 @@ //===----------------------------------------------------------------------===// #include "llvm/CodeGen/MachineCodeForInstruction.h" +#include "llvm/Function.h" #include "llvm/CodeGen/MachineInstr.h" -#include "llvm/CodeGen/MachineInstrAnnot.h" -#include "llvm/Instruction.h" +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineFunctionInfo.h" +#include "../Target/SparcV9/MachineInstrAnnot.h" using namespace llvm; -AnnotationID llvm::MCFI_AID( - AnnotationManager::getID("CodeGen::MachineCodeForInstruction")); - -static Annotation *CreateMCFI(AnnotationID AID, const Annotable *, void *) { - assert(AID == MCFI_AID); - return new MachineCodeForInstruction(); // Invoke constructor! +MachineCodeForInstruction &MachineCodeForInstruction::get(const Instruction *I){ + MachineFunction &MF = MachineFunction::get(I->getParent()->getParent()); + return MF.getInfo()->MCFIEntries[I]; +} +void MachineCodeForInstruction::destroy(const Instruction *I) { + MachineFunction &MF = MachineFunction::get(I->getParent()->getParent()); + MF.getInfo()->MCFIEntries.erase(I); } - -// Register the annotation with the annotation factory -static struct MCFIInitializer { - MCFIInitializer() { - AnnotationManager::registerAnnotationFactory(MCFI_AID, &CreateMCFI); - } -} RegisterCreateMCFI; - void MachineCodeForInstruction::dropAllReferences() @@ -60,9 +55,8 @@ 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;