diff options
author | Chris Lattner <sabre@nondot.org> | 2002-02-03 07:54:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-02-03 07:54:50 +0000 |
commit | f2868ce228ca20f72d1c6fbe241de01975cfe609 (patch) | |
tree | da152a11d3f66785dd821b8e452f3413fff565a0 /lib/CodeGen/MachineCodeForInstruction.cpp | |
parent | c8896771951d0cc769b6b40b27bcb420685cf718 (diff) |
Code pulled out of MAchineInstr.(h|cpp)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1660 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineCodeForInstruction.cpp')
-rw-r--r-- | lib/CodeGen/MachineCodeForInstruction.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineCodeForInstruction.cpp b/lib/CodeGen/MachineCodeForInstruction.cpp new file mode 100644 index 0000000000..97a53752e1 --- /dev/null +++ b/lib/CodeGen/MachineCodeForInstruction.cpp @@ -0,0 +1,57 @@ +//===-- 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: +// +// "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/CodeGen/MachineInstr.h" +#include "llvm/Instruction.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 Initializer { + Initializer() { + 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); +} + + +MachineCodeForInstruction::MachineCodeForInstruction() : Annotation(MCFI_AID) {} + +MachineCodeForInstruction::~MachineCodeForInstruction() { + // Free the Value objects created to hold intermediate values + 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]; +} |