diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp')
| -rw-r--r-- | contrib/llvm-project/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp | 88 |
1 files changed, 41 insertions, 47 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp b/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp index a0607cb5662e..984d8d3e0b08 100644 --- a/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp +++ b/contrib/llvm-project/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp @@ -63,7 +63,7 @@ public: ARMDAGToDAGISel() = delete; - explicit ARMDAGToDAGISel(ARMBaseTargetMachine &tm, CodeGenOpt::Level OptLevel) + explicit ARMDAGToDAGISel(ARMBaseTargetMachine &tm, CodeGenOptLevel OptLevel) : SelectionDAGISel(ID, tm, OptLevel) {} bool runOnMachineFunction(MachineFunction &MF) override { @@ -331,7 +331,8 @@ private: /// SelectInlineAsmMemoryOperand - Implement addressing mode selection for /// inline asm expressions. - bool SelectInlineAsmMemoryOperand(const SDValue &Op, unsigned ConstraintID, + bool SelectInlineAsmMemoryOperand(const SDValue &Op, + InlineAsm::ConstraintCode ConstraintID, std::vector<SDValue> &OutOps) override; // Form pairs of consecutive R, S, D, or Q registers. @@ -498,7 +499,7 @@ void ARMDAGToDAGISel::PreprocessISelDAG() { /// node. VFP / NEON fp VMLA / VMLS instructions have special RAW hazards (at /// least on current ARM implementations) which should be avoidded. bool ARMDAGToDAGISel::hasNoVMLxHazardUse(SDNode *N) const { - if (OptLevel == CodeGenOpt::None) + if (OptLevel == CodeGenOptLevel::None) return true; if (!Subtarget->hasVMLxHazards()) @@ -1130,8 +1131,7 @@ static bool shouldUseZeroOffsetLdSt(SDValue N) { bool ARMDAGToDAGISel::SelectThumbAddrModeRRSext(SDValue N, SDValue &Base, SDValue &Offset) { if (N.getOpcode() != ISD::ADD && !CurDAG->isBaseWithConstantOffset(N)) { - ConstantSDNode *NC = dyn_cast<ConstantSDNode>(N); - if (!NC || !NC->isZero()) + if (!isNullConstant(N)) return false; Base = Offset = N; @@ -3559,8 +3559,7 @@ void ARMDAGToDAGISel::SelectCMPZ(SDNode *N, bool &SwitchEQNEToPLMI) { return; SDValue Zero = N->getOperand(1); - if (!isa<ConstantSDNode>(Zero) || !cast<ConstantSDNode>(Zero)->isZero() || - And->getOpcode() != ISD::AND) + if (!isNullConstant(Zero) || And->getOpcode() != ISD::AND) return; SDValue X = And.getOperand(0); auto C = dyn_cast<ConstantSDNode>(And.getOperand(1)); @@ -5709,7 +5708,7 @@ bool ARMDAGToDAGISel::tryWriteRegister(SDNode *N){ bool ARMDAGToDAGISel::tryInlineAsm(SDNode *N){ std::vector<SDValue> AsmNodeOperands; - unsigned Flag, Kind; + InlineAsm::Flag Flag; bool Changed = false; unsigned NumOps = N->getNumOperands(); @@ -5733,24 +5732,22 @@ bool ARMDAGToDAGISel::tryInlineAsm(SDNode *N){ if (i < InlineAsm::Op_FirstOperand) continue; - if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(N->getOperand(i))) { - Flag = C->getZExtValue(); - Kind = InlineAsm::getKind(Flag); - } + if (const auto *C = dyn_cast<ConstantSDNode>(N->getOperand(i))) + Flag = InlineAsm::Flag(C->getZExtValue()); else continue; // Immediate operands to inline asm in the SelectionDAG are modeled with - // two operands. The first is a constant of value InlineAsm::Kind_Imm, and + // two operands. The first is a constant of value InlineAsm::Kind::Imm, and // the second is a constant with the value of the immediate. If we get here - // and we have a Kind_Imm, skip the next operand, and continue. - if (Kind == InlineAsm::Kind_Imm) { + // and we have a Kind::Imm, skip the next operand, and continue. + if (Flag.isImmKind()) { SDValue op = N->getOperand(++i); AsmNodeOperands.push_back(op); continue; } - unsigned NumRegs = InlineAsm::getNumOperandRegisters(Flag); + const unsigned NumRegs = Flag.getNumOperandRegisters(); if (NumRegs) OpChanged.push_back(false); @@ -5758,26 +5755,26 @@ bool ARMDAGToDAGISel::tryInlineAsm(SDNode *N){ bool IsTiedToChangedOp = false; // If it's a use that is tied with a previous def, it has no // reg class constraint. - if (Changed && InlineAsm::isUseOperandTiedToDef(Flag, DefIdx)) + if (Changed && Flag.isUseOperandTiedToDef(DefIdx)) IsTiedToChangedOp = OpChanged[DefIdx]; // Memory operands to inline asm in the SelectionDAG are modeled with two - // operands: a constant of value InlineAsm::Kind_Mem followed by the input - // operand. If we get here and we have a Kind_Mem, skip the next operand (so - // it doesn't get misinterpreted), and continue. We do this here because + // operands: a constant of value InlineAsm::Kind::Mem followed by the input + // operand. If we get here and we have a Kind::Mem, skip the next operand + // (so it doesn't get misinterpreted), and continue. We do this here because // it's important to update the OpChanged array correctly before moving on. - if (Kind == InlineAsm::Kind_Mem) { + if (Flag.isMemKind()) { SDValue op = N->getOperand(++i); AsmNodeOperands.push_back(op); continue; } - if (Kind != InlineAsm::Kind_RegUse && Kind != InlineAsm::Kind_RegDef - && Kind != InlineAsm::Kind_RegDefEarlyClobber) + if (!Flag.isRegUseKind() && !Flag.isRegDefKind() && + !Flag.isRegDefEarlyClobberKind()) continue; unsigned RC; - bool HasRC = InlineAsm::hasRegClassConstraint(Flag, RC); + const bool HasRC = Flag.hasRegClassConstraint(RC); if ((!IsTiedToChangedOp && (!HasRC || RC != ARM::GPRRegClassID)) || NumRegs != 2) continue; @@ -5790,8 +5787,7 @@ bool ARMDAGToDAGISel::tryInlineAsm(SDNode *N){ SDValue PairedReg; MachineRegisterInfo &MRI = MF->getRegInfo(); - if (Kind == InlineAsm::Kind_RegDef || - Kind == InlineAsm::Kind_RegDefEarlyClobber) { + if (Flag.isRegDefKind() || Flag.isRegDefEarlyClobberKind()) { // Replace the two GPRs with 1 GPRPair and copy values from GPRPair to // the original GPRs. @@ -5816,9 +5812,8 @@ bool ARMDAGToDAGISel::tryInlineAsm(SDNode *N){ std::vector<SDValue> Ops(GU->op_begin(), GU->op_end()-1); Ops.push_back(T1.getValue(1)); CurDAG->UpdateNodeOperands(GU, Ops); - } - else { - // For Kind == InlineAsm::Kind_RegUse, we first copy two GPRs into a + } else { + // For Kind == InlineAsm::Kind::RegUse, we first copy two GPRs into a // GPRPair and then pass the GPRPair to the inline asm. SDValue Chain = AsmNodeOperands[InlineAsm::Op_InputChain]; @@ -5843,11 +5838,11 @@ bool ARMDAGToDAGISel::tryInlineAsm(SDNode *N){ if(PairedReg.getNode()) { OpChanged[OpChanged.size() -1 ] = true; - Flag = InlineAsm::getFlagWord(Kind, 1 /* RegNum*/); + Flag = InlineAsm::Flag(Flag.getKind(), 1 /* RegNum*/); if (IsTiedToChangedOp) - Flag = InlineAsm::getFlagWordForMatchingOp(Flag, DefIdx); + Flag.setMatchingOp(DefIdx); else - Flag = InlineAsm::getFlagWordForRegClass(Flag, ARM::GPRPairRegClassID); + Flag.setRegClass(ARM::GPRPairRegClassID); // Replace the current flag. AsmNodeOperands[AsmNodeOperands.size() -1] = CurDAG->getTargetConstant( Flag, dl, MVT::i32); @@ -5870,23 +5865,22 @@ bool ARMDAGToDAGISel::tryInlineAsm(SDNode *N){ return true; } - -bool ARMDAGToDAGISel:: -SelectInlineAsmMemoryOperand(const SDValue &Op, unsigned ConstraintID, - std::vector<SDValue> &OutOps) { +bool ARMDAGToDAGISel::SelectInlineAsmMemoryOperand( + const SDValue &Op, InlineAsm::ConstraintCode ConstraintID, + std::vector<SDValue> &OutOps) { switch(ConstraintID) { default: llvm_unreachable("Unexpected asm memory constraint"); - case InlineAsm::Constraint_m: - case InlineAsm::Constraint_o: - case InlineAsm::Constraint_Q: - case InlineAsm::Constraint_Um: - case InlineAsm::Constraint_Un: - case InlineAsm::Constraint_Uq: - case InlineAsm::Constraint_Us: - case InlineAsm::Constraint_Ut: - case InlineAsm::Constraint_Uv: - case InlineAsm::Constraint_Uy: + case InlineAsm::ConstraintCode::m: + case InlineAsm::ConstraintCode::o: + case InlineAsm::ConstraintCode::Q: + case InlineAsm::ConstraintCode::Um: + case InlineAsm::ConstraintCode::Un: + case InlineAsm::ConstraintCode::Uq: + case InlineAsm::ConstraintCode::Us: + case InlineAsm::ConstraintCode::Ut: + case InlineAsm::ConstraintCode::Uv: + case InlineAsm::ConstraintCode::Uy: // Require the address to be in a register. That is safe for all ARM // variants and it is hard to do anything much smarter without knowing // how the operand is used. @@ -5900,6 +5894,6 @@ SelectInlineAsmMemoryOperand(const SDValue &Op, unsigned ConstraintID, /// ARM-specific DAG, ready for instruction scheduling. /// FunctionPass *llvm::createARMISelDag(ARMBaseTargetMachine &TM, - CodeGenOpt::Level OptLevel) { + CodeGenOptLevel OptLevel) { return new ARMDAGToDAGISel(TM, OptLevel); } |
