#include "llvm/CodeGen/ReachingDefAnalysis.h"
#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/CodeGen/LiveRegUnits.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Support/Debug.h"
usingnamespacellvm;
#define DEBUG_TYPE …
char ReachingDefAnalysis::ID = …;
INITIALIZE_PASS(…)
static bool isValidReg(const MachineOperand &MO) { … }
static bool isValidRegUse(const MachineOperand &MO) { … }
static bool isValidRegUseOf(const MachineOperand &MO, MCRegister PhysReg,
const TargetRegisterInfo *TRI) { … }
static bool isValidRegDef(const MachineOperand &MO) { … }
static bool isValidRegDefOf(const MachineOperand &MO, MCRegister PhysReg,
const TargetRegisterInfo *TRI) { … }
void ReachingDefAnalysis::enterBasicBlock(MachineBasicBlock *MBB) { … }
void ReachingDefAnalysis::leaveBasicBlock(MachineBasicBlock *MBB) { … }
void ReachingDefAnalysis::processDefs(MachineInstr *MI) { … }
void ReachingDefAnalysis::reprocessBasicBlock(MachineBasicBlock *MBB) { … }
void ReachingDefAnalysis::processBasicBlock(
const LoopTraversal::TraversedMBBInfo &TraversedMBB) { … }
bool ReachingDefAnalysis::runOnMachineFunction(MachineFunction &mf) { … }
void ReachingDefAnalysis::releaseMemory() { … }
void ReachingDefAnalysis::reset() { … }
void ReachingDefAnalysis::init() { … }
void ReachingDefAnalysis::traverse() { … }
int ReachingDefAnalysis::getReachingDef(MachineInstr *MI,
MCRegister PhysReg) const { … }
MachineInstr *
ReachingDefAnalysis::getReachingLocalMIDef(MachineInstr *MI,
MCRegister PhysReg) const { … }
bool ReachingDefAnalysis::hasSameReachingDef(MachineInstr *A, MachineInstr *B,
MCRegister PhysReg) const { … }
MachineInstr *ReachingDefAnalysis::getInstFromId(MachineBasicBlock *MBB,
int InstId) const { … }
int ReachingDefAnalysis::getClearance(MachineInstr *MI,
MCRegister PhysReg) const { … }
bool ReachingDefAnalysis::hasLocalDefBefore(MachineInstr *MI,
MCRegister PhysReg) const { … }
void ReachingDefAnalysis::getReachingLocalUses(MachineInstr *Def,
MCRegister PhysReg,
InstSet &Uses) const { … }
bool ReachingDefAnalysis::getLiveInUses(MachineBasicBlock *MBB,
MCRegister PhysReg,
InstSet &Uses) const { … }
void ReachingDefAnalysis::getGlobalUses(MachineInstr *MI, MCRegister PhysReg,
InstSet &Uses) const { … }
void ReachingDefAnalysis::getGlobalReachingDefs(MachineInstr *MI,
MCRegister PhysReg,
InstSet &Defs) const { … }
void ReachingDefAnalysis::getLiveOuts(MachineBasicBlock *MBB,
MCRegister PhysReg, InstSet &Defs) const { … }
void ReachingDefAnalysis::getLiveOuts(MachineBasicBlock *MBB,
MCRegister PhysReg, InstSet &Defs,
BlockSet &VisitedBBs) const { … }
MachineInstr *
ReachingDefAnalysis::getUniqueReachingMIDef(MachineInstr *MI,
MCRegister PhysReg) const { … }
MachineInstr *ReachingDefAnalysis::getMIOperand(MachineInstr *MI,
unsigned Idx) const { … }
MachineInstr *ReachingDefAnalysis::getMIOperand(MachineInstr *MI,
MachineOperand &MO) const { … }
bool ReachingDefAnalysis::isRegUsedAfter(MachineInstr *MI,
MCRegister PhysReg) const { … }
bool ReachingDefAnalysis::isRegDefinedAfter(MachineInstr *MI,
MCRegister PhysReg) const { … }
bool ReachingDefAnalysis::isReachingDefLiveOut(MachineInstr *MI,
MCRegister PhysReg) const { … }
MachineInstr *
ReachingDefAnalysis::getLocalLiveOutMIDef(MachineBasicBlock *MBB,
MCRegister PhysReg) const { … }
static bool mayHaveSideEffects(MachineInstr &MI) { … }
template<typename Iterator>
bool ReachingDefAnalysis::isSafeToMove(MachineInstr *From,
MachineInstr *To) const { … }
bool ReachingDefAnalysis::isSafeToMoveForwards(MachineInstr *From,
MachineInstr *To) const { … }
bool ReachingDefAnalysis::isSafeToMoveBackwards(MachineInstr *From,
MachineInstr *To) const { … }
bool ReachingDefAnalysis::isSafeToRemove(MachineInstr *MI,
InstSet &ToRemove) const { … }
bool
ReachingDefAnalysis::isSafeToRemove(MachineInstr *MI, InstSet &ToRemove,
InstSet &Ignore) const { … }
bool
ReachingDefAnalysis::isSafeToRemove(MachineInstr *MI, InstSet &Visited,
InstSet &ToRemove, InstSet &Ignore) const { … }
void ReachingDefAnalysis::collectKilledOperands(MachineInstr *MI,
InstSet &Dead) const { … }
bool ReachingDefAnalysis::isSafeToDefRegAt(MachineInstr *MI,
MCRegister PhysReg) const { … }
bool ReachingDefAnalysis::isSafeToDefRegAt(MachineInstr *MI, MCRegister PhysReg,
InstSet &Ignore) const { … }