mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
fd25f66f50
instructions. Instead, keep a map of instructions -> MCFI objects in the already sparc-specific class MachineFunctionInfo. This will slow down the sparc backend a bit, but it does not penalize the rest of LLVM! llvm-svn: 14438
64 lines
2.4 KiB
C++
64 lines
2.4 KiB
C++
//===-- 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.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// 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/Function.h"
|
|
#include "llvm/CodeGen/MachineInstr.h"
|
|
#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) {
|
|
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<Instruction>(tempVec[i])->dropAllReferences();
|
|
}
|
|
|
|
|
|
MachineCodeForInstruction::~MachineCodeForInstruction() {
|
|
// Let go of all uses in temp. instructions
|
|
dropAllReferences();
|
|
|
|
// 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.
|
|
delete callArgsDesc;
|
|
}
|