#include "AMDGPU.h"
#include "GCNSubtarget.h"
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
#include "SIMachineFunctionInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/InitializePasses.h"
usingnamespacellvm;
#define DEBUG_TYPE …
namespace {
static cl::opt<double> LongBranchFactor(
"amdgpu-long-branch-factor", cl::init(1.0), cl::Hidden,
cl::desc("Factor to apply to what qualifies as a long branch "
"to reserve a pair of scalar registers. If this value "
"is 0 the long branch registers are never reserved. As this "
"value grows the greater chance the branch distance will fall "
"within the threshold and the registers will be marked to be "
"reserved. We lean towards always reserving a register for "
"long jumps"));
class GCNPreRALongBranchReg : public MachineFunctionPass { … };
}
char GCNPreRALongBranchReg::ID = …;
INITIALIZE_PASS(…)
char &llvm::GCNPreRALongBranchRegID = …;
void GCNPreRALongBranchReg::generateBlockInfo(
MachineFunction &MF, SmallVectorImpl<BasicBlockInfo> &BlockInfo) { … }
bool GCNPreRALongBranchReg::runOnMachineFunction(MachineFunction &MF) { … }