diff options
Diffstat (limited to 'lib/Target/ARM/ARMISelDAGToDAG.cpp')
| -rw-r--r-- | lib/Target/ARM/ARMISelDAGToDAG.cpp | 53 | 
1 files changed, 25 insertions, 28 deletions
diff --git a/lib/Target/ARM/ARMISelDAGToDAG.cpp b/lib/Target/ARM/ARMISelDAGToDAG.cpp index be543a91ef26e..200371bbaf75a 100644 --- a/lib/Target/ARM/ARMISelDAGToDAG.cpp +++ b/lib/Target/ARM/ARMISelDAGToDAG.cpp @@ -41,14 +41,14 @@ static const unsigned arm_dsubreg_1 = 6;  ///  namespace {  class ARMDAGToDAGISel : public SelectionDAGISel { -  ARMTargetMachine &TM; +  ARMBaseTargetMachine &TM;    /// Subtarget - Keep a pointer to the ARMSubtarget around so that we can    /// make the right decision when generating code for different targets.    const ARMSubtarget *Subtarget;  public: -  explicit ARMDAGToDAGISel(ARMTargetMachine &tm) +  explicit ARMDAGToDAGISel(ARMBaseTargetMachine &tm)      : SelectionDAGISel(tm), TM(tm),      Subtarget(&TM.getSubtarget<ARMSubtarget>()) {    } @@ -92,11 +92,10 @@ public:    bool SelectThumbAddrModeSP(SDValue Op, SDValue N, SDValue &Base,                               SDValue &OffImm); -  bool SelectThumb2ShifterOperandReg(SDValue Op, SDValue N, -                                     SDValue &BaseReg, SDValue &Opc); -    bool SelectShifterOperandReg(SDValue Op, SDValue N, SDValue &A,                                 SDValue &B, SDValue &C); +  bool SelectT2ShifterOperandReg(SDValue Op, SDValue N, +                                 SDValue &BaseReg, SDValue &Opc);    // Include the pieces autogenerated from the target description.  #include "ARMGenDAGISel.inc" @@ -520,28 +519,6 @@ bool ARMDAGToDAGISel::SelectThumbAddrModeSP(SDValue Op, SDValue N,    return false;  } -bool ARMDAGToDAGISel::SelectThumb2ShifterOperandReg(SDValue Op, -                                                    SDValue N, -                                                    SDValue &BaseReg, -                                                    SDValue &Opc) { -  ARM_AM::ShiftOpc ShOpcVal = ARM_AM::getShiftOpcForNode(N); - -  // Don't match base register only case. That is matched to a separate -  // lower complexity pattern with explicit register operand. -  if (ShOpcVal == ARM_AM::no_shift) return false; - -  BaseReg = N.getOperand(0); -  unsigned ShImmVal = 0; -  if (ConstantSDNode *RHS = dyn_cast<ConstantSDNode>(N.getOperand(1))) -    ShImmVal = RHS->getZExtValue() & 31; -  else -    return false; - -  Opc = getI32Imm(ARM_AM::getSORegOpc(ShOpcVal, ShImmVal)); - -  return true; -} -  bool ARMDAGToDAGISel::SelectShifterOperandReg(SDValue Op,                                                SDValue N,                                                SDValue &BaseReg, @@ -566,6 +543,26 @@ bool ARMDAGToDAGISel::SelectShifterOperandReg(SDValue Op,    return true;  } +bool ARMDAGToDAGISel::SelectT2ShifterOperandReg(SDValue Op, SDValue N, +                                                SDValue &BaseReg, +                                                SDValue &Opc) { +  ARM_AM::ShiftOpc ShOpcVal = ARM_AM::getShiftOpcForNode(N); + +  // Don't match base register only case. That is matched to a separate +  // lower complexity pattern with explicit register operand. +  if (ShOpcVal == ARM_AM::no_shift) return false; + +  BaseReg = N.getOperand(0); +  unsigned ShImmVal = 0; +  if (ConstantSDNode *RHS = dyn_cast<ConstantSDNode>(N.getOperand(1))) { +    ShImmVal = RHS->getZExtValue() & 31; +    Opc = getI32Imm(ARM_AM::getSORegOpc(ShOpcVal, ShImmVal)); +    return true; +  } + +  return false; +} +  /// getAL - Returns a ARMCC::AL immediate node.  static inline SDValue getAL(SelectionDAG *CurDAG) {    return CurDAG->getTargetConstant((uint64_t)ARMCC::AL, MVT::i32); @@ -1003,6 +1000,6 @@ SelectInlineAsmMemoryOperand(const SDValue &Op, char ConstraintCode,  /// createARMISelDag - This pass converts a legalized DAG into a  /// ARM-specific DAG, ready for instruction scheduling.  /// -FunctionPass *llvm::createARMISelDag(ARMTargetMachine &TM) { +FunctionPass *llvm::createARMISelDag(ARMBaseTargetMachine &TM) {    return new ARMDAGToDAGISel(TM);  }  | 
