#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
usingnamespacellvm;
AnalysisKey LiveVariablesAnalysis::Key;
LiveVariablesAnalysis::Result
LiveVariablesAnalysis::run(MachineFunction &MF,
MachineFunctionAnalysisManager &) { … }
PreservedAnalyses
LiveVariablesPrinterPass::run(MachineFunction &MF,
MachineFunctionAnalysisManager &MFAM) { … }
char LiveVariablesWrapperPass::ID = …;
char &llvm::LiveVariablesID = …;
INITIALIZE_PASS_BEGIN(LiveVariablesWrapperPass, "livevars",
"Live Variable Analysis", false, false)
INITIALIZE_PASS_DEPENDENCY(UnreachableMachineBlockElim)
INITIALIZE_PASS_END(LiveVariablesWrapperPass, "livevars",
"Live Variable Analysis", false, false)
void LiveVariablesWrapperPass::getAnalysisUsage(AnalysisUsage &AU) const { … }
LiveVariables::LiveVariables(MachineFunction &MF)
: … { … }
void LiveVariables::print(raw_ostream &OS) const { … }
MachineInstr *
LiveVariables::VarInfo::findKill(const MachineBasicBlock *MBB) const { … }
void LiveVariables::VarInfo::print(raw_ostream &OS) const { … }
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void LiveVariables::VarInfo::dump() const { print(dbgs()); }
#endif
LiveVariables::VarInfo &LiveVariables::getVarInfo(Register Reg) { … }
void LiveVariables::MarkVirtRegAliveInBlock(
VarInfo &VRInfo, MachineBasicBlock *DefBlock, MachineBasicBlock *MBB,
SmallVectorImpl<MachineBasicBlock *> &WorkList) { … }
void LiveVariables::MarkVirtRegAliveInBlock(VarInfo &VRInfo,
MachineBasicBlock *DefBlock,
MachineBasicBlock *MBB) { … }
void LiveVariables::HandleVirtRegUse(Register Reg, MachineBasicBlock *MBB,
MachineInstr &MI) { … }
void LiveVariables::HandleVirtRegDef(Register Reg, MachineInstr &MI) { … }
MachineInstr *
LiveVariables::FindLastPartialDef(Register Reg,
SmallSet<unsigned, 4> &PartDefRegs) { … }
void LiveVariables::HandlePhysRegUse(Register Reg, MachineInstr &MI) { … }
MachineInstr *LiveVariables::FindLastRefOrPartRef(Register Reg) { … }
bool LiveVariables::HandlePhysRegKill(Register Reg, MachineInstr *MI) { … }
void LiveVariables::HandleRegMask(const MachineOperand &MO, unsigned NumRegs) { … }
void LiveVariables::HandlePhysRegDef(Register Reg, MachineInstr *MI,
SmallVectorImpl<unsigned> &Defs) { … }
void LiveVariables::UpdatePhysRegDefs(MachineInstr &MI,
SmallVectorImpl<unsigned> &Defs) { … }
void LiveVariables::runOnInstr(MachineInstr &MI,
SmallVectorImpl<unsigned> &Defs,
unsigned NumRegs) { … }
void LiveVariables::runOnBlock(MachineBasicBlock *MBB, unsigned NumRegs) { … }
void LiveVariables::analyze(MachineFunction &mf) { … }
void LiveVariables::recomputeForSingleDefVirtReg(Register Reg) { … }
void LiveVariables::replaceKillInstruction(Register Reg, MachineInstr &OldMI,
MachineInstr &NewMI) { … }
void LiveVariables::removeVirtualRegistersKilled(MachineInstr &MI) { … }
void LiveVariables::analyzePHINodes(const MachineFunction& Fn) { … }
bool LiveVariables::VarInfo::isLiveIn(const MachineBasicBlock &MBB,
Register Reg, MachineRegisterInfo &MRI) { … }
bool LiveVariables::isLiveOut(Register Reg, const MachineBasicBlock &MBB) { … }
void LiveVariables::addNewBlock(MachineBasicBlock *BB,
MachineBasicBlock *DomBB,
MachineBasicBlock *SuccBB) { … }
void LiveVariables::addNewBlock(MachineBasicBlock *BB,
MachineBasicBlock *DomBB,
MachineBasicBlock *SuccBB,
std::vector<SparseBitVector<>> &LiveInSets) { … }