#include "AggressiveAntiDepBreaker.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/RegisterClassInfo.h"
#include "llvm/CodeGen/ScheduleDAG.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/CodeGenTypes/MachineValueType.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <utility>
usingnamespacellvm;
#define DEBUG_TYPE …
static cl::opt<int>
DebugDiv("agg-antidep-debugdiv",
cl::desc("Debug control for aggressive anti-dep breaker"),
cl::init(0), cl::Hidden);
static cl::opt<int>
DebugMod("agg-antidep-debugmod",
cl::desc("Debug control for aggressive anti-dep breaker"),
cl::init(0), cl::Hidden);
AggressiveAntiDepState::AggressiveAntiDepState(const unsigned TargetRegs,
MachineBasicBlock *BB)
: … { … }
unsigned AggressiveAntiDepState::GetGroup(unsigned Reg) { … }
void AggressiveAntiDepState::GetGroupRegs(
unsigned Group,
std::vector<unsigned> &Regs,
std::multimap<unsigned, AggressiveAntiDepState::RegisterReference> *RegRefs)
{ … }
unsigned AggressiveAntiDepState::UnionGroups(unsigned Reg1, unsigned Reg2) { … }
unsigned AggressiveAntiDepState::LeaveGroup(unsigned Reg) { … }
bool AggressiveAntiDepState::IsLive(unsigned Reg) { … }
AggressiveAntiDepBreaker::AggressiveAntiDepBreaker(
MachineFunction &MFi, const RegisterClassInfo &RCI,
TargetSubtargetInfo::RegClassVector &CriticalPathRCs)
: … { … }
AggressiveAntiDepBreaker::~AggressiveAntiDepBreaker() { … }
void AggressiveAntiDepBreaker::StartBlock(MachineBasicBlock *BB) { … }
void AggressiveAntiDepBreaker::FinishBlock() { … }
void AggressiveAntiDepBreaker::Observe(MachineInstr &MI, unsigned Count,
unsigned InsertPosIndex) { … }
bool AggressiveAntiDepBreaker::IsImplicitDefUse(MachineInstr &MI,
MachineOperand &MO) { … }
void AggressiveAntiDepBreaker::GetPassthruRegs(
MachineInstr &MI, std::set<unsigned> &PassthruRegs) { … }
static void AntiDepEdges(const SUnit *SU, std::vector<const SDep *> &Edges) { … }
static const SUnit *CriticalPathStep(const SUnit *SU) { … }
void AggressiveAntiDepBreaker::HandleLastUse(unsigned Reg, unsigned KillIdx,
const char *tag,
const char *header,
const char *footer) { … }
void AggressiveAntiDepBreaker::PrescanInstruction(
MachineInstr &MI, unsigned Count, std::set<unsigned> &PassthruRegs) { … }
void AggressiveAntiDepBreaker::ScanInstruction(MachineInstr &MI,
unsigned Count) { … }
BitVector AggressiveAntiDepBreaker::GetRenameRegisters(unsigned Reg) { … }
bool AggressiveAntiDepBreaker::FindSuitableFreeRegisters(
unsigned SuperReg, unsigned AntiDepGroupIndex, RenameOrderType &RenameOrder,
std::map<unsigned, unsigned> &RenameMap) { … }
unsigned AggressiveAntiDepBreaker::BreakAntiDependencies(
const std::vector<SUnit> &SUnits,
MachineBasicBlock::iterator Begin,
MachineBasicBlock::iterator End,
unsigned InsertPosIndex,
DbgValueVector &DbgValues) { … }
AntiDepBreaker *llvm::createAggressiveAntiDepBreaker(
MachineFunction &MFi, const RegisterClassInfo &RCI,
TargetSubtargetInfo::RegClassVector &CriticalPathRCs) { … }