X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FHexagon%2FHexagonPeephole.cpp;h=503bfdb6b3eb3dcc9e2c1a67bb8313f7e3c48b09;hb=60b4c7fc306e3d0584749f461f0dbb309d96f6b2;hp=89e34068894ee3dfbd4ed091599cfbbb67e700a7;hpb=942940a3262242ac55efea88f818959f28d18bba;p=oota-llvm.git diff --git a/lib/Target/Hexagon/HexagonPeephole.cpp b/lib/Target/Hexagon/HexagonPeephole.cpp index 89e34068894..503bfdb6b3e 100644 --- a/lib/Target/Hexagon/HexagonPeephole.cpp +++ b/lib/Target/Hexagon/HexagonPeephole.cpp @@ -29,13 +29,12 @@ // // Note: The peephole pass makes the instrucstions like // %vreg170 = SXTW %vreg166 or %vreg16 = NOT_p %vreg15 -// redundant and relies on some form of dead removal instrucions, like +// redundant and relies on some form of dead removal instructions, like // DCE or DIE to actually eliminate them. //===----------------------------------------------------------------------===// -#define DEBUG_TYPE "hexagon-peephole" #include "Hexagon.h" #include "HexagonTargetMachine.h" #include "llvm/ADT/DenseMap.h" @@ -57,6 +56,8 @@ using namespace llvm; +#define DEBUG_TYPE "hexagon-peephole" + static cl::opt DisableHexagonPeephole("disable-hexagon-peephole", cl::Hidden, cl::ZeroOrMore, cl::init(false), cl::desc("Disable Peephole Optimization")); @@ -89,13 +90,13 @@ namespace { initializeHexagonPeepholePass(*PassRegistry::getPassRegistry()); } - bool runOnMachineFunction(MachineFunction &MF); + bool runOnMachineFunction(MachineFunction &MF) override; - const char *getPassName() const { + const char *getPassName() const override { return "Hexagon optimize redundant zero and size extends"; } - void getAnalysisUsage(AnalysisUsage &AU) const { + void getAnalysisUsage(AnalysisUsage &AU) const override { MachineFunctionPass::getAnalysisUsage(AU); } @@ -110,10 +111,8 @@ INITIALIZE_PASS(HexagonPeephole, "hexagon-peephole", "Hexagon Peephole", false, false) bool HexagonPeephole::runOnMachineFunction(MachineFunction &MF) { - QII = static_cast(MF.getTarget(). - getInstrInfo()); - QRI = static_cast(MF.getTarget(). - getRegisterInfo()); + QII = static_cast(MF.getSubtarget().getInstrInfo()); + QRI = MF.getSubtarget().getRegisterInfo(); MRI = &MF.getRegInfo(); DenseMap PeepholeMap; @@ -134,7 +133,7 @@ bool HexagonPeephole::runOnMachineFunction(MachineFunction &MF) { MachineInstr *MI = MII; // Look for sign extends: // %vreg170 = SXTW %vreg166 - if (!DisableOptSZExt && MI->getOpcode() == Hexagon::SXTW) { + if (!DisableOptSZExt && MI->getOpcode() == Hexagon::A2_sxtw) { assert (MI->getNumOperands() == 2); MachineOperand &Dst = MI->getOperand(0); MachineOperand &Src = MI->getOperand(1); @@ -153,7 +152,7 @@ bool HexagonPeephole::runOnMachineFunction(MachineFunction &MF) { // Look for %vreg170 = COMBINE_ir_V4 (0, %vreg169) // %vreg170:DoublRegs, %vreg169:IntRegs if (!DisableOptExtTo64 && - MI->getOpcode () == Hexagon::COMBINE_Ir_V4) { + MI->getOpcode () == Hexagon::A4_combineir) { assert (MI->getNumOperands() == 3); MachineOperand &Dst = MI->getOperand(0); MachineOperand &Src1 = MI->getOperand(1); @@ -170,7 +169,7 @@ bool HexagonPeephole::runOnMachineFunction(MachineFunction &MF) { // %vregIntReg = COPY %vregDoubleReg1:subreg_loreg. // and convert into // %vregIntReg = COPY %vregDoubleReg0:subreg_hireg. - if (MI->getOpcode() == Hexagon::LSRd_ri) { + if (MI->getOpcode() == Hexagon::S2_lsr_i_p) { assert(MI->getNumOperands() == 3); MachineOperand &Dst = MI->getOperand(0); MachineOperand &Src1 = MI->getOperand(1); @@ -185,7 +184,7 @@ bool HexagonPeephole::runOnMachineFunction(MachineFunction &MF) { // Look for P=NOT(P). if (!DisablePNotP && - (MI->getOpcode() == Hexagon::NOT_p)) { + (MI->getOpcode() == Hexagon::C2_not)) { assert (MI->getNumOperands() == 2); MachineOperand &Dst = MI->getOperand(0); MachineOperand &Src = MI->getOperand(1); @@ -270,23 +269,15 @@ bool HexagonPeephole::runOnMachineFunction(MachineFunction &MF) { unsigned PR = 1, S1 = 2, S2 = 3; // Operand indices. switch (Op) { - case Hexagon::TFR_condset_rr: - case Hexagon::TFR_condset_ii: - case Hexagon::MUX_ii: - case Hexagon::MUX_rr: + case Hexagon::C2_mux: + case Hexagon::C2_muxii: NewOp = Op; break; - case Hexagon::TFR_condset_ri: - NewOp = Hexagon::TFR_condset_ir; - break; - case Hexagon::TFR_condset_ir: - NewOp = Hexagon::TFR_condset_ri; - break; - case Hexagon::MUX_ri: - NewOp = Hexagon::MUX_ir; + case Hexagon::C2_muxri: + NewOp = Hexagon::C2_muxir; break; - case Hexagon::MUX_ir: - NewOp = Hexagon::MUX_ri; + case Hexagon::C2_muxir: + NewOp = Hexagon::C2_muxri; break; } if (NewOp) {