#include "Hexagon.h"
#include "MCTargetDesc/HexagonMCTargetDesc.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Pass.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <vector>
usingnamespacellvm;
#define DEBUG_TYPE …
namespace llvm {
FunctionPass *createHexagonCFGOptimizer();
void initializeHexagonCFGOptimizerPass(PassRegistry&);
}
namespace {
class HexagonCFGOptimizer : public MachineFunctionPass { … };
}
char HexagonCFGOptimizer::ID = …;
static bool IsConditionalBranch(int Opc) { … }
static bool IsUnconditionalJump(int Opc) { … }
void HexagonCFGOptimizer::InvertAndChangeJumpTarget(
MachineInstr &MI, MachineBasicBlock *NewTarget) { … }
bool HexagonCFGOptimizer::isOnFallThroughPath(MachineBasicBlock *MBB) { … }
bool HexagonCFGOptimizer::runOnMachineFunction(MachineFunction &Fn) { … }
INITIALIZE_PASS(…)
FunctionPass *llvm::createHexagonCFGOptimizer() { … }