#include "AMDGPU.h"
#include "GCNSubtarget.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/TargetSchedule.h"
#include "llvm/Support/BranchProbability.h"
usingnamespacellvm;
#define DEBUG_TYPE …
namespace {
class SIPreEmitPeephole : public MachineFunctionPass { … };
}
INITIALIZE_PASS(…)
char SIPreEmitPeephole::ID = …;
char &llvm::SIPreEmitPeepholeID = …;
bool SIPreEmitPeephole::optimizeVccBranch(MachineInstr &MI) const { … }
bool SIPreEmitPeephole::optimizeSetGPR(MachineInstr &First,
MachineInstr &MI) const { … }
bool SIPreEmitPeephole::getBlockDestinations(
MachineBasicBlock &SrcMBB, MachineBasicBlock *&TrueMBB,
MachineBasicBlock *&FalseMBB, SmallVectorImpl<MachineOperand> &Cond) { … }
namespace {
class BranchWeightCostModel { … };
bool SIPreEmitPeephole::mustRetainExeczBranch(
const MachineInstr &Branch, const MachineBasicBlock &From,
const MachineBasicBlock &To) const { … }
}
bool SIPreEmitPeephole::removeExeczBranch(MachineInstr &MI,
MachineBasicBlock &SrcMBB) { … }
bool SIPreEmitPeephole::runOnMachineFunction(MachineFunction &MF) { … }