1 //===-- RISCVISelDAGToDAG.cpp - A dag to dag inst selector for RISCV ------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // This file defines an instruction selector for the RISCV target. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #include "RISCVISelDAGToDAG.h" 14 #include "MCTargetDesc/RISCVMCTargetDesc.h" 15 #include "Utils/RISCVMatInt.h" 16 #include "llvm/CodeGen/MachineFrameInfo.h" 17 #include "llvm/Support/Alignment.h" 18 #include "llvm/Support/Debug.h" 19 #include "llvm/Support/MathExtras.h" 20 #include "llvm/Support/raw_ostream.h" 21 22 using namespace llvm; 23 24 #define DEBUG_TYPE "riscv-isel" 25 26 void RISCVDAGToDAGISel::PostprocessISelDAG() { 27 doPeepholeLoadStoreADDI(); 28 } 29 30 static SDNode *selectImm(SelectionDAG *CurDAG, const SDLoc &DL, int64_t Imm, 31 MVT XLenVT) { 32 RISCVMatInt::InstSeq Seq; 33 RISCVMatInt::generateInstSeq(Imm, XLenVT == MVT::i64, Seq); 34 35 SDNode *Result = nullptr; 36 SDValue SrcReg = CurDAG->getRegister(RISCV::X0, XLenVT); 37 for (RISCVMatInt::Inst &Inst : Seq) { 38 SDValue SDImm = CurDAG->getTargetConstant(Inst.Imm, DL, XLenVT); 39 if (Inst.Opc == RISCV::LUI) 40 Result = CurDAG->getMachineNode(RISCV::LUI, DL, XLenVT, SDImm); 41 else 42 Result = CurDAG->getMachineNode(Inst.Opc, DL, XLenVT, SrcReg, SDImm); 43 44 // Only the first instruction has X0 as its source. 45 SrcReg = SDValue(Result, 0); 46 } 47 48 return Result; 49 } 50 51 // Returns true if the Node is an ISD::AND with a constant argument. If so, 52 // set Mask to that constant value. 53 static bool isConstantMask(SDNode *Node, uint64_t &Mask) { 54 if (Node->getOpcode() == ISD::AND && 55 Node->getOperand(1).getOpcode() == ISD::Constant) { 56 Mask = cast<ConstantSDNode>(Node->getOperand(1))->getZExtValue(); 57 return true; 58 } 59 return false; 60 } 61 62 void RISCVDAGToDAGISel::Select(SDNode *Node) { 63 // If we have a custom node, we have already selected. 64 if (Node->isMachineOpcode()) { 65 LLVM_DEBUG(dbgs() << "== "; Node->dump(CurDAG); dbgs() << "\n"); 66 Node->setNodeId(-1); 67 return; 68 } 69 70 // Instruction Selection not handled by the auto-generated tablegen selection 71 // should be handled here. 72 unsigned Opcode = Node->getOpcode(); 73 MVT XLenVT = Subtarget->getXLenVT(); 74 SDLoc DL(Node); 75 EVT VT = Node->getValueType(0); 76 77 switch (Opcode) { 78 case ISD::ADD: { 79 // Optimize (add r, imm) to (addi (addi r, imm0) imm1) if applicable. The 80 // immediate must be in specific ranges and have a single use. 81 if (auto *ConstOp = dyn_cast<ConstantSDNode>(Node->getOperand(1))) { 82 if (!(ConstOp->hasOneUse())) 83 break; 84 // The imm must be in range [-4096,-2049] or [2048,4094]. 85 int64_t Imm = ConstOp->getSExtValue(); 86 if (!(-4096 <= Imm && Imm <= -2049) && !(2048 <= Imm && Imm <= 4094)) 87 break; 88 // Break the imm to imm0+imm1. 89 SDLoc DL(Node); 90 EVT VT = Node->getValueType(0); 91 const SDValue ImmOp0 = CurDAG->getTargetConstant(Imm - Imm / 2, DL, VT); 92 const SDValue ImmOp1 = CurDAG->getTargetConstant(Imm / 2, DL, VT); 93 auto *NodeAddi0 = CurDAG->getMachineNode(RISCV::ADDI, DL, VT, 94 Node->getOperand(0), ImmOp0); 95 auto *NodeAddi1 = CurDAG->getMachineNode(RISCV::ADDI, DL, VT, 96 SDValue(NodeAddi0, 0), ImmOp1); 97 ReplaceNode(Node, NodeAddi1); 98 return; 99 } 100 break; 101 } 102 case ISD::Constant: { 103 auto ConstNode = cast<ConstantSDNode>(Node); 104 if (VT == XLenVT && ConstNode->isNullValue()) { 105 SDValue New = CurDAG->getCopyFromReg(CurDAG->getEntryNode(), SDLoc(Node), 106 RISCV::X0, XLenVT); 107 ReplaceNode(Node, New.getNode()); 108 return; 109 } 110 int64_t Imm = ConstNode->getSExtValue(); 111 if (XLenVT == MVT::i64) { 112 ReplaceNode(Node, selectImm(CurDAG, SDLoc(Node), Imm, XLenVT)); 113 return; 114 } 115 break; 116 } 117 case ISD::FrameIndex: { 118 SDValue Imm = CurDAG->getTargetConstant(0, DL, XLenVT); 119 int FI = cast<FrameIndexSDNode>(Node)->getIndex(); 120 SDValue TFI = CurDAG->getTargetFrameIndex(FI, VT); 121 ReplaceNode(Node, CurDAG->getMachineNode(RISCV::ADDI, DL, VT, TFI, Imm)); 122 return; 123 } 124 case ISD::SRL: { 125 if (!Subtarget->is64Bit()) 126 break; 127 SDNode *Op0 = Node->getOperand(0).getNode(); 128 uint64_t Mask; 129 // Match (srl (and val, mask), imm) where the result would be a 130 // zero-extended 32-bit integer. i.e. the mask is 0xffffffff or the result 131 // is equivalent to this (SimplifyDemandedBits may have removed lower bits 132 // from the mask that aren't necessary due to the right-shifting). 133 if (isa<ConstantSDNode>(Node->getOperand(1)) && isConstantMask(Op0, Mask)) { 134 uint64_t ShAmt = Node->getConstantOperandVal(1); 135 136 if ((Mask | maskTrailingOnes<uint64_t>(ShAmt)) == 0xffffffff) { 137 SDValue ShAmtVal = 138 CurDAG->getTargetConstant(ShAmt, SDLoc(Node), XLenVT); 139 CurDAG->SelectNodeTo(Node, RISCV::SRLIW, XLenVT, Op0->getOperand(0), 140 ShAmtVal); 141 return; 142 } 143 } 144 break; 145 } 146 case RISCVISD::READ_CYCLE_WIDE: 147 assert(!Subtarget->is64Bit() && "READ_CYCLE_WIDE is only used on riscv32"); 148 149 ReplaceNode(Node, CurDAG->getMachineNode(RISCV::ReadCycleWide, DL, MVT::i32, 150 MVT::i32, MVT::Other, 151 Node->getOperand(0))); 152 return; 153 } 154 155 // Select the default instruction. 156 SelectCode(Node); 157 } 158 159 bool RISCVDAGToDAGISel::SelectInlineAsmMemoryOperand( 160 const SDValue &Op, unsigned ConstraintID, std::vector<SDValue> &OutOps) { 161 switch (ConstraintID) { 162 case InlineAsm::Constraint_m: 163 // We just support simple memory operands that have a single address 164 // operand and need no special handling. 165 OutOps.push_back(Op); 166 return false; 167 case InlineAsm::Constraint_A: 168 OutOps.push_back(Op); 169 return false; 170 default: 171 break; 172 } 173 174 return true; 175 } 176 177 bool RISCVDAGToDAGISel::SelectAddrFI(SDValue Addr, SDValue &Base) { 178 if (auto FIN = dyn_cast<FrameIndexSDNode>(Addr)) { 179 Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), Subtarget->getXLenVT()); 180 return true; 181 } 182 return false; 183 } 184 185 // Check that it is a SLOI (Shift Left Ones Immediate). We first check that 186 // it is the right node tree: 187 // 188 // (OR (SHL RS1, VC2), VC1) 189 // 190 // and then we check that VC1, the mask used to fill with ones, is compatible 191 // with VC2, the shamt: 192 // 193 // VC1 == maskTrailingOnes<uint64_t>(VC2) 194 195 bool RISCVDAGToDAGISel::SelectSLOI(SDValue N, SDValue &RS1, SDValue &Shamt) { 196 MVT XLenVT = Subtarget->getXLenVT(); 197 if (N.getOpcode() == ISD::OR) { 198 SDValue Or = N; 199 if (Or.getOperand(0).getOpcode() == ISD::SHL) { 200 SDValue Shl = Or.getOperand(0); 201 if (isa<ConstantSDNode>(Shl.getOperand(1)) && 202 isa<ConstantSDNode>(Or.getOperand(1))) { 203 if (XLenVT == MVT::i64) { 204 uint64_t VC1 = Or.getConstantOperandVal(1); 205 uint64_t VC2 = Shl.getConstantOperandVal(1); 206 if (VC1 == maskTrailingOnes<uint64_t>(VC2)) { 207 RS1 = Shl.getOperand(0); 208 Shamt = CurDAG->getTargetConstant(VC2, SDLoc(N), 209 Shl.getOperand(1).getValueType()); 210 return true; 211 } 212 } 213 if (XLenVT == MVT::i32) { 214 uint32_t VC1 = Or.getConstantOperandVal(1); 215 uint32_t VC2 = Shl.getConstantOperandVal(1); 216 if (VC1 == maskTrailingOnes<uint32_t>(VC2)) { 217 RS1 = Shl.getOperand(0); 218 Shamt = CurDAG->getTargetConstant(VC2, SDLoc(N), 219 Shl.getOperand(1).getValueType()); 220 return true; 221 } 222 } 223 } 224 } 225 } 226 return false; 227 } 228 229 // Check that it is a SROI (Shift Right Ones Immediate). We first check that 230 // it is the right node tree: 231 // 232 // (OR (SRL RS1, VC2), VC1) 233 // 234 // and then we check that VC1, the mask used to fill with ones, is compatible 235 // with VC2, the shamt: 236 // 237 // VC1 == maskLeadingOnes<uint64_t>(VC2) 238 239 bool RISCVDAGToDAGISel::SelectSROI(SDValue N, SDValue &RS1, SDValue &Shamt) { 240 MVT XLenVT = Subtarget->getXLenVT(); 241 if (N.getOpcode() == ISD::OR) { 242 SDValue Or = N; 243 if (Or.getOperand(0).getOpcode() == ISD::SRL) { 244 SDValue Srl = Or.getOperand(0); 245 if (isa<ConstantSDNode>(Srl.getOperand(1)) && 246 isa<ConstantSDNode>(Or.getOperand(1))) { 247 if (XLenVT == MVT::i64) { 248 uint64_t VC1 = Or.getConstantOperandVal(1); 249 uint64_t VC2 = Srl.getConstantOperandVal(1); 250 if (VC1 == maskLeadingOnes<uint64_t>(VC2)) { 251 RS1 = Srl.getOperand(0); 252 Shamt = CurDAG->getTargetConstant(VC2, SDLoc(N), 253 Srl.getOperand(1).getValueType()); 254 return true; 255 } 256 } 257 if (XLenVT == MVT::i32) { 258 uint32_t VC1 = Or.getConstantOperandVal(1); 259 uint32_t VC2 = Srl.getConstantOperandVal(1); 260 if (VC1 == maskLeadingOnes<uint32_t>(VC2)) { 261 RS1 = Srl.getOperand(0); 262 Shamt = CurDAG->getTargetConstant(VC2, SDLoc(N), 263 Srl.getOperand(1).getValueType()); 264 return true; 265 } 266 } 267 } 268 } 269 } 270 return false; 271 } 272 273 // Check that it is a SLLIUW (Shift Logical Left Immediate Unsigned i32 274 // on RV64). 275 // SLLIUW is the same as SLLI except for the fact that it clears the bits 276 // XLEN-1:32 of the input RS1 before shifting. 277 // We first check that it is the right node tree: 278 // 279 // (AND (SHL RS1, VC2), VC1) 280 // 281 // We check that VC2, the shamt is less than 32, otherwise the pattern is 282 // exactly the same as SLLI and we give priority to that. 283 // Eventually we check that that VC1, the mask used to clear the upper 32 bits 284 // of RS1, is correct: 285 // 286 // VC1 == (0xFFFFFFFF << VC2) 287 288 bool RISCVDAGToDAGISel::SelectSLLIUW(SDValue N, SDValue &RS1, SDValue &Shamt) { 289 if (N.getOpcode() == ISD::AND && Subtarget->getXLenVT() == MVT::i64) { 290 SDValue And = N; 291 if (And.getOperand(0).getOpcode() == ISD::SHL) { 292 SDValue Shl = And.getOperand(0); 293 if (isa<ConstantSDNode>(Shl.getOperand(1)) && 294 isa<ConstantSDNode>(And.getOperand(1))) { 295 uint64_t VC1 = And.getConstantOperandVal(1); 296 uint64_t VC2 = Shl.getConstantOperandVal(1); 297 if (VC2 < 32 && VC1 == ((uint64_t)0xFFFFFFFF << VC2)) { 298 RS1 = Shl.getOperand(0); 299 Shamt = CurDAG->getTargetConstant(VC2, SDLoc(N), 300 Shl.getOperand(1).getValueType()); 301 return true; 302 } 303 } 304 } 305 } 306 return false; 307 } 308 309 // Check that it is a SLOIW (Shift Left Ones Immediate i32 on RV64). 310 // We first check that it is the right node tree: 311 // 312 // (SIGN_EXTEND_INREG (OR (SHL RS1, VC2), VC1)) 313 // 314 // and then we check that VC1, the mask used to fill with ones, is compatible 315 // with VC2, the shamt: 316 // 317 // VC2 < 32 318 // VC1 == maskTrailingOnes<uint64_t>(VC2) 319 320 bool RISCVDAGToDAGISel::SelectSLOIW(SDValue N, SDValue &RS1, SDValue &Shamt) { 321 assert(Subtarget->is64Bit() && "SLOIW should only be matched on RV64"); 322 if (N.getOpcode() != ISD::SIGN_EXTEND_INREG || 323 cast<VTSDNode>(N.getOperand(1))->getVT() != MVT::i32) 324 return false; 325 326 SDValue Or = N.getOperand(0); 327 328 if (Or.getOpcode() != ISD::OR || !isa<ConstantSDNode>(Or.getOperand(1))) 329 return false; 330 331 SDValue Shl = Or.getOperand(0); 332 if (Shl.getOpcode() != ISD::SHL || !isa<ConstantSDNode>(Shl.getOperand(1))) 333 return false; 334 335 uint64_t VC1 = Or.getConstantOperandVal(1); 336 uint64_t VC2 = Shl.getConstantOperandVal(1); 337 338 if (VC2 >= 32 || VC1 != maskTrailingOnes<uint64_t>(VC2)) 339 return false; 340 341 RS1 = Shl.getOperand(0); 342 Shamt = CurDAG->getTargetConstant(VC2, SDLoc(N), 343 Shl.getOperand(1).getValueType()); 344 return true; 345 } 346 347 // Check that it is a SROIW (Shift Right Ones Immediate i32 on RV64). 348 // We first check that it is the right node tree: 349 // 350 // (OR (SRL RS1, VC2), VC1) 351 // 352 // and then we check that VC1, the mask used to fill with ones, is compatible 353 // with VC2, the shamt: 354 // 355 // VC2 < 32 356 // VC1 == maskTrailingZeros<uint64_t>(32 - VC2) 357 // 358 bool RISCVDAGToDAGISel::SelectSROIW(SDValue N, SDValue &RS1, SDValue &Shamt) { 359 assert(Subtarget->is64Bit() && "SROIW should only be matched on RV64"); 360 if (N.getOpcode() != ISD::OR || !isa<ConstantSDNode>(N.getOperand(1))) 361 return false; 362 363 SDValue Srl = N.getOperand(0); 364 if (Srl.getOpcode() != ISD::SRL || !isa<ConstantSDNode>(Srl.getOperand(1))) 365 return false; 366 367 uint64_t VC1 = N.getConstantOperandVal(1); 368 uint64_t VC2 = Srl.getConstantOperandVal(1); 369 370 if (VC2 >= 32 || VC1 != maskTrailingZeros<uint64_t>(32 - VC2)) 371 return false; 372 373 RS1 = Srl.getOperand(0); 374 Shamt = CurDAG->getTargetConstant(VC2, SDLoc(N), 375 Srl.getOperand(1).getValueType()); 376 return true; 377 } 378 379 // Check that it is a RORIW (i32 Right Rotate Immediate on RV64). 380 // We first check that it is the right node tree: 381 // 382 // (SIGN_EXTEND_INREG (OR (SHL RS1, VC2), 383 // (SRL (AND RS1, VC3), VC1))) 384 // 385 // Then we check that the constant operands respect these constraints: 386 // 387 // VC2 == 32 - VC1 388 // VC3 | maskTrailingOnes<uint64_t>(VC1) == 0xffffffff 389 // 390 // being VC1 the Shamt we need, VC2 the complementary of Shamt over 32 391 // and VC3 being 0xffffffff after accounting for SimplifyDemandedBits removing 392 // some bits due to the right shift. 393 394 bool RISCVDAGToDAGISel::SelectRORIW(SDValue N, SDValue &RS1, SDValue &Shamt) { 395 if (N.getOpcode() == ISD::SIGN_EXTEND_INREG && 396 Subtarget->getXLenVT() == MVT::i64 && 397 cast<VTSDNode>(N.getOperand(1))->getVT() == MVT::i32) { 398 if (N.getOperand(0).getOpcode() == ISD::OR) { 399 SDValue Or = N.getOperand(0); 400 SDValue Shl = Or.getOperand(0); 401 SDValue Srl = Or.getOperand(1); 402 403 // OR is commutable so canonicalize SHL to LHS. 404 if (Srl.getOpcode() == ISD::SHL) 405 std::swap(Shl, Srl); 406 407 if (Shl.getOpcode() == ISD::SHL && Srl.getOpcode() == ISD::SRL) { 408 if (Srl.getOperand(0).getOpcode() == ISD::AND) { 409 SDValue And = Srl.getOperand(0); 410 if (And.getOperand(0) == Shl.getOperand(0) && 411 isa<ConstantSDNode>(Srl.getOperand(1)) && 412 isa<ConstantSDNode>(Shl.getOperand(1)) && 413 isa<ConstantSDNode>(And.getOperand(1))) { 414 uint64_t VC1 = Srl.getConstantOperandVal(1); 415 uint64_t VC2 = Shl.getConstantOperandVal(1); 416 uint64_t VC3 = And.getConstantOperandVal(1); 417 // The mask needs to be 0xffffffff, but SimplifyDemandedBits may 418 // have removed lower bits that aren't necessary due to the right 419 // shift. 420 if (VC2 == (32 - VC1) && 421 (VC3 | maskTrailingOnes<uint64_t>(VC1)) == 0xffffffff) { 422 RS1 = Shl.getOperand(0); 423 Shamt = CurDAG->getTargetConstant(VC1, SDLoc(N), 424 Srl.getOperand(1).getValueType()); 425 return true; 426 } 427 } 428 } 429 } 430 } 431 } 432 return false; 433 } 434 435 // Merge an ADDI into the offset of a load/store instruction where possible. 436 // (load (addi base, off1), off2) -> (load base, off1+off2) 437 // (store val, (addi base, off1), off2) -> (store val, base, off1+off2) 438 // This is possible when off1+off2 fits a 12-bit immediate. 439 void RISCVDAGToDAGISel::doPeepholeLoadStoreADDI() { 440 SelectionDAG::allnodes_iterator Position(CurDAG->getRoot().getNode()); 441 ++Position; 442 443 while (Position != CurDAG->allnodes_begin()) { 444 SDNode *N = &*--Position; 445 // Skip dead nodes and any non-machine opcodes. 446 if (N->use_empty() || !N->isMachineOpcode()) 447 continue; 448 449 int OffsetOpIdx; 450 int BaseOpIdx; 451 452 // Only attempt this optimisation for I-type loads and S-type stores. 453 switch (N->getMachineOpcode()) { 454 default: 455 continue; 456 case RISCV::LB: 457 case RISCV::LH: 458 case RISCV::LW: 459 case RISCV::LBU: 460 case RISCV::LHU: 461 case RISCV::LWU: 462 case RISCV::LD: 463 case RISCV::FLW: 464 case RISCV::FLD: 465 BaseOpIdx = 0; 466 OffsetOpIdx = 1; 467 break; 468 case RISCV::SB: 469 case RISCV::SH: 470 case RISCV::SW: 471 case RISCV::SD: 472 case RISCV::FSW: 473 case RISCV::FSD: 474 BaseOpIdx = 1; 475 OffsetOpIdx = 2; 476 break; 477 } 478 479 if (!isa<ConstantSDNode>(N->getOperand(OffsetOpIdx))) 480 continue; 481 482 SDValue Base = N->getOperand(BaseOpIdx); 483 484 // If the base is an ADDI, we can merge it in to the load/store. 485 if (!Base.isMachineOpcode() || Base.getMachineOpcode() != RISCV::ADDI) 486 continue; 487 488 SDValue ImmOperand = Base.getOperand(1); 489 uint64_t Offset2 = N->getConstantOperandVal(OffsetOpIdx); 490 491 if (auto Const = dyn_cast<ConstantSDNode>(ImmOperand)) { 492 int64_t Offset1 = Const->getSExtValue(); 493 int64_t CombinedOffset = Offset1 + Offset2; 494 if (!isInt<12>(CombinedOffset)) 495 continue; 496 ImmOperand = CurDAG->getTargetConstant(CombinedOffset, SDLoc(ImmOperand), 497 ImmOperand.getValueType()); 498 } else if (auto GA = dyn_cast<GlobalAddressSDNode>(ImmOperand)) { 499 // If the off1 in (addi base, off1) is a global variable's address (its 500 // low part, really), then we can rely on the alignment of that variable 501 // to provide a margin of safety before off1 can overflow the 12 bits. 502 // Check if off2 falls within that margin; if so off1+off2 can't overflow. 503 const DataLayout &DL = CurDAG->getDataLayout(); 504 Align Alignment = GA->getGlobal()->getPointerAlignment(DL); 505 if (Offset2 != 0 && Alignment <= Offset2) 506 continue; 507 int64_t Offset1 = GA->getOffset(); 508 int64_t CombinedOffset = Offset1 + Offset2; 509 ImmOperand = CurDAG->getTargetGlobalAddress( 510 GA->getGlobal(), SDLoc(ImmOperand), ImmOperand.getValueType(), 511 CombinedOffset, GA->getTargetFlags()); 512 } else if (auto CP = dyn_cast<ConstantPoolSDNode>(ImmOperand)) { 513 // Ditto. 514 Align Alignment = CP->getAlign(); 515 if (Offset2 != 0 && Alignment <= Offset2) 516 continue; 517 int64_t Offset1 = CP->getOffset(); 518 int64_t CombinedOffset = Offset1 + Offset2; 519 ImmOperand = CurDAG->getTargetConstantPool( 520 CP->getConstVal(), ImmOperand.getValueType(), CP->getAlign(), 521 CombinedOffset, CP->getTargetFlags()); 522 } else { 523 continue; 524 } 525 526 LLVM_DEBUG(dbgs() << "Folding add-immediate into mem-op:\nBase: "); 527 LLVM_DEBUG(Base->dump(CurDAG)); 528 LLVM_DEBUG(dbgs() << "\nN: "); 529 LLVM_DEBUG(N->dump(CurDAG)); 530 LLVM_DEBUG(dbgs() << "\n"); 531 532 // Modify the offset operand of the load/store. 533 if (BaseOpIdx == 0) // Load 534 CurDAG->UpdateNodeOperands(N, Base.getOperand(0), ImmOperand, 535 N->getOperand(2)); 536 else // Store 537 CurDAG->UpdateNodeOperands(N, N->getOperand(0), Base.getOperand(0), 538 ImmOperand, N->getOperand(3)); 539 540 // The add-immediate may now be dead, in which case remove it. 541 if (Base.getNode()->use_empty()) 542 CurDAG->RemoveDeadNode(Base.getNode()); 543 } 544 } 545 546 // This pass converts a legalized DAG into a RISCV-specific DAG, ready 547 // for instruction scheduling. 548 FunctionPass *llvm::createRISCVISelDag(RISCVTargetMachine &TM) { 549 return new RISCVDAGToDAGISel(TM); 550 } 551