aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelDAGToDAG.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelDAGToDAG.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelDAGToDAG.cpp57
1 files changed, 29 insertions, 28 deletions
diff --git a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelDAGToDAG.cpp b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelDAGToDAG.cpp
index 702053e02332..c0c23a45d155 100644
--- a/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelDAGToDAG.cpp
+++ b/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYISelDAGToDAG.cpp
@@ -30,7 +30,7 @@ class CSKYDAGToDAGISel : public SelectionDAGISel {
public:
static char ID;
- explicit CSKYDAGToDAGISel(CSKYTargetMachine &TM, CodeGenOpt::Level OptLevel)
+ explicit CSKYDAGToDAGISel(CSKYTargetMachine &TM, CodeGenOptLevel OptLevel)
: SelectionDAGISel(ID, TM, OptLevel) {}
bool runOnMachineFunction(MachineFunction &MF) override {
@@ -48,7 +48,8 @@ public:
SDNode *createGPRPairNode(EVT VT, SDValue V0, SDValue V1);
- bool SelectInlineAsmMemoryOperand(const SDValue &Op, unsigned ConstraintID,
+ bool SelectInlineAsmMemoryOperand(const SDValue &Op,
+ InlineAsm::ConstraintCode ConstraintID,
std::vector<SDValue> &OutOps) override;
#include "CSKYGenDAGISel.inc"
@@ -116,7 +117,7 @@ void CSKYDAGToDAGISel::Select(SDNode *N) {
bool CSKYDAGToDAGISel::selectInlineAsm(SDNode *N) {
std::vector<SDValue> AsmNodeOperands;
- unsigned Flag, Kind;
+ InlineAsm::Flag Flag;
bool Changed = false;
unsigned NumOps = N->getNumOperands();
@@ -139,23 +140,22 @@ bool CSKYDAGToDAGISel::selectInlineAsm(SDNode *N) {
if (i < InlineAsm::Op_FirstOperand)
continue;
- if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(N->getOperand(i))) {
- Flag = C->getZExtValue();
- Kind = InlineAsm::getKind(Flag);
- } else
+ 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);
@@ -163,26 +163,26 @@ bool CSKYDAGToDAGISel::selectInlineAsm(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 != CSKY::GPRRegClassID)) ||
NumRegs != 2)
continue;
@@ -195,8 +195,7 @@ bool CSKYDAGToDAGISel::selectInlineAsm(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.
@@ -222,7 +221,7 @@ bool CSKYDAGToDAGISel::selectInlineAsm(SDNode *N) {
Ops.push_back(T1.getValue(1));
CurDAG->UpdateNodeOperands(GU, Ops);
} else {
- // For Kind == InlineAsm::Kind_RegUse, we first copy two GPRs into a
+ // 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];
@@ -247,11 +246,12 @@ bool CSKYDAGToDAGISel::selectInlineAsm(SDNode *N) {
if (PairedReg.getNode()) {
OpChanged[OpChanged.size() - 1] = true;
- Flag = InlineAsm::getFlagWord(Kind, 1 /* RegNum*/);
+ // TODO: maybe a setter for getNumOperandRegisters?
+ Flag = InlineAsm::Flag(Flag.getKind(), 1 /* RegNum*/);
if (IsTiedToChangedOp)
- Flag = InlineAsm::getFlagWordForMatchingOp(Flag, DefIdx);
+ Flag.setMatchingOp(DefIdx);
else
- Flag = InlineAsm::getFlagWordForRegClass(Flag, CSKY::GPRPairRegClassID);
+ Flag.setRegClass(CSKY::GPRPairRegClassID);
// Replace the current flag.
AsmNodeOperands[AsmNodeOperands.size() - 1] =
CurDAG->getTargetConstant(Flag, dl, MVT::i32);
@@ -384,9 +384,10 @@ SDNode *CSKYDAGToDAGISel::createGPRPairNode(EVT VT, SDValue V0, SDValue V1) {
}
bool CSKYDAGToDAGISel::SelectInlineAsmMemoryOperand(
- const SDValue &Op, unsigned ConstraintID, std::vector<SDValue> &OutOps) {
+ const SDValue &Op, const InlineAsm::ConstraintCode ConstraintID,
+ std::vector<SDValue> &OutOps) {
switch (ConstraintID) {
- case InlineAsm::Constraint_m:
+ case InlineAsm::ConstraintCode::m:
// We just support simple memory operands that have a single address
// operand and need no special handling.
OutOps.push_back(Op);
@@ -399,6 +400,6 @@ bool CSKYDAGToDAGISel::SelectInlineAsmMemoryOperand(
}
FunctionPass *llvm::createCSKYISelDag(CSKYTargetMachine &TM,
- CodeGenOpt::Level OptLevel) {
+ CodeGenOptLevel OptLevel) {
return new CSKYDAGToDAGISel(TM, OptLevel);
}