Files
llvm-project/llvm/lib/CodeGen/MachineCodeForInstruction.cpp
T

64 lines
2.4 KiB
C++
Raw Normal View History

2002-02-03 07:54:50 +00:00
//===-- MachineCodeForInstruction.cpp -------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// 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.
//
//===----------------------------------------------------------------------===//
2002-02-03 07:54:50 +00:00
//
// 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:
2002-02-03 07:54:50 +00:00
//
// "Temporary values" are intermediate values used in the machine instruction
2004-05-30 03:33:48 +00:00
// 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).
2002-02-03 07:54:50 +00:00
//
// (2) "Implicit uses" are values used in the VM instruction but not in the
// machine instruction sequence
2002-02-03 07:54:50 +00:00
//
//===----------------------------------------------------------------------===//
#include "llvm/CodeGen/MachineCodeForInstruction.h"
#include "llvm/Function.h"
2002-02-03 07:54:50 +00:00
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionInfo.h"
2004-02-29 21:40:53 +00:00
#include "../Target/SparcV9/MachineInstrAnnot.h"
2004-01-09 06:30:18 +00:00
using namespace llvm;
2002-02-03 07:54:50 +00:00
2004-02-29 19:02:39 +00:00
MachineCodeForInstruction &MachineCodeForInstruction::get(const Instruction *I){
MachineFunction &MF = MachineFunction::get(I->getParent()->getParent());
return MF.getInfo()->MCFIEntries[I];
2004-02-29 19:02:39 +00:00
}
void MachineCodeForInstruction::destroy(const Instruction *I) {
MachineFunction &MF = MachineFunction::get(I->getParent()->getParent());
MF.getInfo()->MCFIEntries.erase(I);
2004-02-29 19:02:39 +00:00
}
void
MachineCodeForInstruction::dropAllReferences()
{
for (unsigned i=0, N=tempVec.size(); i < N; i++)
2004-01-10 19:16:26 +00:00
cast<Instruction>(tempVec[i])->dropAllReferences();
}
2002-02-03 07:54:50 +00:00
2004-01-09 06:30:18 +00:00
MachineCodeForInstruction::~MachineCodeForInstruction() {
// Let go of all uses in temp. instructions
dropAllReferences();
2002-02-03 07:54:50 +00:00
// Free the Value objects created to hold intermediate values
for (unsigned i=0, N=tempVec.size(); i < N; i++)
delete tempVec[i];
// do not free the MachineInstr objects allocated. they are managed
// by the ilist in MachineBasicBlock
// Free the CallArgsDescriptor if it exists.
2004-01-09 06:30:18 +00:00
delete callArgsDesc;
2002-02-03 07:54:50 +00:00
}