1 //===-- MachineCodeForInstruction.cpp -------------------------------------===//
3 // Representation of the sequence of machine instructions created for a single
4 // VM instruction. Additionally records information about hidden and implicit
5 // values used by the machine instructions: about hidden values used by the
6 // machine instructions:
8 // "Temporary values" are intermediate values used in the machine instruction
9 // sequence, but not in the VM instruction Note that such values should be
10 // treated as pure SSA values with no interpretation of their operands (i.e., as
11 // a TmpInstruction object which actually represents such a value).
13 // (2) "Implicit uses" are values used in the VM instruction but not in the
14 // machine instruction sequence
16 //===----------------------------------------------------------------------===//
18 #include "llvm/CodeGen/MachineCodeForInstruction.h"
19 #include "llvm/CodeGen/MachineInstr.h"
20 #include "llvm/CodeGen/MachineInstrAnnot.h"
21 #include "llvm/CodeGen/InstrSelection.h"
23 AnnotationID MCFI_AID(
24 AnnotationManager::getID("CodeGen::MachineCodeForInstruction"));
26 static Annotation *CreateMCFI(AnnotationID AID, const Annotable *, void *) {
27 assert(AID == MCFI_AID);
28 return new MachineCodeForInstruction(); // Invoke constructor!
31 // Register the annotation with the annotation factory
32 static struct MCFIInitializer {
34 AnnotationManager::registerAnnotationFactory(MCFI_AID, &CreateMCFI);
40 MachineCodeForInstruction::dropAllReferences()
42 for (unsigned i=0, N=tempVec.size(); i < N; i++)
43 cast<TmpInstruction>(tempVec[i])->dropAllReferences();
47 MachineCodeForInstruction::~MachineCodeForInstruction()
49 // Let go of all uses in temp. instructions
52 // Free the Value objects created to hold intermediate values
53 for (unsigned i=0, N=tempVec.size(); i < N; i++)
56 // Free the MachineInstr objects allocated, if any.
57 for (unsigned i=0, N = size(); i < N; i++)
60 // Free the CallArgsDescriptor if it exists.