#include "Hexagon.h"
#include "HexagonTargetMachine.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.h"
#include "llvm/IR/Constants.h"
#include "llvm/Pass.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include <algorithm>
usingnamespacellvm;
#define DEBUG_TYPE …
static cl::opt<bool>
DisableHexagonPeephole("disable-hexagon-peephole", cl::Hidden,
cl::desc("Disable Peephole Optimization"));
static cl::opt<bool> DisablePNotP("disable-hexagon-pnotp", cl::Hidden,
cl::desc("Disable Optimization of PNotP"));
static cl::opt<bool>
DisableOptSZExt("disable-hexagon-optszext", cl::Hidden, cl::init(true),
cl::desc("Disable Optimization of Sign/Zero Extends"));
static cl::opt<bool>
DisableOptExtTo64("disable-hexagon-opt-ext-to-64", cl::Hidden,
cl::init(true),
cl::desc("Disable Optimization of extensions to i64."));
namespace llvm {
FunctionPass *createHexagonPeephole();
void initializeHexagonPeepholePass(PassRegistry&);
}
namespace {
struct HexagonPeephole : public MachineFunctionPass { … };
}
char HexagonPeephole::ID = …;
INITIALIZE_PASS(…)
bool HexagonPeephole::runOnMachineFunction(MachineFunction &MF) { … }
FunctionPass *llvm::createHexagonPeephole() { … }