#include "AMDGPU.h"
#include "GCNSubtarget.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
usingnamespacellvm;
#define DEBUG_TYPE …
static unsigned SkipThreshold;
static cl::opt<unsigned, true> SkipThresholdFlag(
"amdgpu-skip-threshold", cl::Hidden,
cl::desc(
"Number of instructions before jumping over divergent control flow"),
cl::location(SkipThreshold), cl::init(12));
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) { … }
bool SIPreEmitPeephole::mustRetainExeczBranch(
const MachineBasicBlock &From, const MachineBasicBlock &To) const { … }
bool SIPreEmitPeephole::removeExeczBranch(MachineInstr &MI,
MachineBasicBlock &SrcMBB) { … }
bool SIPreEmitPeephole::runOnMachineFunction(MachineFunction &MF) { … }