#include "llvm/CodeGen/VirtRegMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/LiveDebugVariables.h"
#include "llvm/CodeGen/LiveInterval.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/LiveStacks.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SlotIndexes.h"
#include "llvm/CodeGen/TargetFrameLowering.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/MC/LaneBitmask.h"
#include "llvm/Pass.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <iterator>
#include <utility>
usingnamespacellvm;
#define DEBUG_TYPE …
STATISTIC(NumSpillSlots, "Number of spill slots allocated");
STATISTIC(NumIdCopies, "Number of identity moves eliminated after rewriting");
char VirtRegMap::ID = …;
INITIALIZE_PASS(…)
bool VirtRegMap::runOnMachineFunction(MachineFunction &mf) { … }
void VirtRegMap::grow() { … }
void VirtRegMap::assignVirt2Phys(Register virtReg, MCPhysReg physReg) { … }
unsigned VirtRegMap::createSpillSlot(const TargetRegisterClass *RC) { … }
bool VirtRegMap::hasPreferredPhys(Register VirtReg) const { … }
bool VirtRegMap::hasKnownPreference(Register VirtReg) const { … }
int VirtRegMap::assignVirt2StackSlot(Register virtReg) { … }
void VirtRegMap::assignVirt2StackSlot(Register virtReg, int SS) { … }
void VirtRegMap::print(raw_ostream &OS, const Module*) const { … }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void VirtRegMap::dump() const {
print(dbgs());
}
#endif
namespace {
class VirtRegRewriter : public MachineFunctionPass { … };
}
char VirtRegRewriter::ID = …;
char &llvm::VirtRegRewriterID = …;
INITIALIZE_PASS_BEGIN(VirtRegRewriter, "virtregrewriter",
"Virtual Register Rewriter", false, false)
INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass)
INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass)
INITIALIZE_PASS_DEPENDENCY(LiveDebugVariables)
INITIALIZE_PASS_DEPENDENCY(LiveStacks)
INITIALIZE_PASS_DEPENDENCY(VirtRegMap)
INITIALIZE_PASS_END(VirtRegRewriter, "virtregrewriter",
"Virtual Register Rewriter", false, false)
void VirtRegRewriter::getAnalysisUsage(AnalysisUsage &AU) const { … }
bool VirtRegRewriter::runOnMachineFunction(MachineFunction &fn) { … }
void VirtRegRewriter::addLiveInsForSubRanges(const LiveInterval &LI,
MCRegister PhysReg) const { … }
void VirtRegRewriter::addMBBLiveIns() { … }
bool VirtRegRewriter::readsUndefSubreg(const MachineOperand &MO) const { … }
void VirtRegRewriter::handleIdentityCopy(MachineInstr &MI) { … }
void VirtRegRewriter::expandCopyBundle(MachineInstr &MI) const { … }
bool VirtRegRewriter::subRegLiveThrough(const MachineInstr &MI,
MCRegister SuperPhysReg) const { … }
void VirtRegRewriter::rewrite() { … }
FunctionPass *llvm::createVirtRegRewriter(bool ClearVirtRegs) { … }