LLVM: lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

21using namespace llvm;

22

23#define DEBUG_TYPE "legalize-types"

24

27

28

29void DAGTypeLegalizer::PerformExpensiveChecks() {

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

75

78

79 for (unsigned i = 0, e = Node.getNumValues(); i != e; ++i) {

82

83 auto ResId = ValueToIdMap.lookup(Res);

84

85 unsigned Mapped = 0;

86 if (ResId) {

87 auto I = ReplacedValues.find(ResId);

88 if (I != ReplacedValues.end()) {

89 Mapped |= 1;

90

92 if (U.getResNo() == i)

94 "Remapped value has non-trivial use!");

95

96

97

98 auto NewValId = I->second;

99 I = ReplacedValues.find(NewValId);

100 while (I != ReplacedValues.end()) {

101 NewValId = I->second;

102 I = ReplacedValues.find(NewValId);

103 }

104 SDValue NewVal = getSDValue(NewValId);

105 (void)NewVal;

107 "ReplacedValues maps to a new node!");

108 }

109 if (PromotedIntegers.count(ResId))

110 Mapped |= 2;

111 if (SoftenedFloats.count(ResId))

112 Mapped |= 4;

113 if (ScalarizedVectors.count(ResId))

114 Mapped |= 8;

115 if (ExpandedIntegers.count(ResId))

116 Mapped |= 16;

117 if (ExpandedFloats.count(ResId))

118 Mapped |= 32;

119 if (SplitVectors.count(ResId))

120 Mapped |= 64;

121 if (WidenedVectors.count(ResId))

122 Mapped |= 128;

123 if (PromotedFloats.count(ResId))

124 Mapped |= 256;

125 if (SoftPromotedHalfs.count(ResId))

126 Mapped |= 512;

127 }

128

130

131

132

133 if ((Node.getNodeId() == NewNode && Mapped > 1) ||

134 (Node.getNodeId() != NewNode && Mapped != 0)) {

135 dbgs() << "Unprocessed value in a map!";

137 }

138 } else if (isTypeLegal(Res.getValueType()) || IgnoreNodeResults(&Node)) {

139 if (Mapped > 1) {

140 dbgs() << "Value with legal type was transformed!";

142 }

143 } else {

144 if (Mapped == 0) {

145 SDValue NodeById = IdToValueMap.lookup(ResId);

146

147

148

149

150

152 dbgs() << "Processed value not in any map!";

154 }

155 } else if (Mapped & (Mapped - 1)) {

156 dbgs() << "Value in multiple maps!";

158 }

159 }

160

162 if (Mapped & 1)

163 dbgs() << " ReplacedValues";

164 if (Mapped & 2)

165 dbgs() << " PromotedIntegers";

166 if (Mapped & 4)

167 dbgs() << " SoftenedFloats";

168 if (Mapped & 8)

169 dbgs() << " ScalarizedVectors";

170 if (Mapped & 16)

171 dbgs() << " ExpandedIntegers";

172 if (Mapped & 32)

173 dbgs() << " ExpandedFloats";

174 if (Mapped & 64)

175 dbgs() << " SplitVectors";

176 if (Mapped & 128)

177 dbgs() << " WidenedVectors";

178 if (Mapped & 256)

179 dbgs() << " PromotedFloats";

180 if (Mapped & 512)

181 dbgs() << " SoftPromoteHalfs";

182 dbgs() << "\n";

184 }

185 }

186 }

187

188#ifndef NDEBUG

189

190 for (SDNode *N : NewNodes) {

191 for (SDNode *U : N->users())

192 assert(U->getNodeId() == NewNode && "NewNode used by non-NewNode!");

193 }

194#endif

195}

196

197

198

199

202

203

204

205

208

209

210

212

213

214

215

216 for (SDNode &Node : DAG.allnodes()) {

217 if (Node.getNumOperands() == 0) {

219 Worklist.push_back(&Node);

220 } else {

222 }

223 }

224

225

226 while (!Worklist.empty()) {

227#ifndef EXPENSIVE_CHECKS

229#endif

230 PerformExpensiveChecks();

231

232 SDNode *N = Worklist.pop_back_val();

234 "Node should be ready if on worklist!");

235

236

239

240 LLVM_DEBUG(dbgs() << "\nLegalizing node: "; N->dump(&DAG));

241 if (IgnoreNodeResults(N)) {

243 goto ScanOperands;

244 }

245

246

247

248 for (unsigned i = 0, NumResults = N->getNumValues(); i < NumResults; ++i) {

249 EVT ResultVT = N->getValueType(i);

250 LLVM_DEBUG(dbgs() << "Analyzing result type: " << ResultVT << "\n");

251 switch (getTypeAction(ResultVT)) {

254 break;

257 "Scalarization of scalable vectors is not supported.");

258

259

260

261

262

264 PromoteIntegerResult(N, i);

266 goto NodeDone;

268 ExpandIntegerResult(N, i);

270 goto NodeDone;

272 SoftenFloatResult(N, i);

274 goto NodeDone;

276 ExpandFloatResult(N, i);

278 goto NodeDone;

280 ScalarizeVectorResult(N, i);

282 goto NodeDone;

284 SplitVectorResult(N, i);

286 goto NodeDone;

288 WidenVectorResult(N, i);

290 goto NodeDone;

292 PromoteFloatResult(N, i);

294 goto NodeDone;

296 SoftPromoteHalfResult(N, i);

298 goto NodeDone;

299 }

300 }

301

302ScanOperands:

303

304

305 {

306 unsigned NumOperands = N->getNumOperands();

307 bool NeedsReanalyzing = false;

308 unsigned i;

309 for (i = 0; i != NumOperands; ++i) {

310 if (IgnoreNodeResults(N->getOperand(i).getNode()))

311 continue;

312

313 const auto &Op = N->getOperand(i);

315 EVT OpVT = Op.getValueType();

316 switch (getTypeAction(OpVT)) {

319 continue;

322 "Scalarization of scalable vectors is not supported.");

323

324

325

327 NeedsReanalyzing = PromoteIntegerOperand(N, i);

329 break;

331 NeedsReanalyzing = ExpandIntegerOperand(N, i);

333 break;

335 NeedsReanalyzing = SoftenFloatOperand(N, i);

337 break;

339 NeedsReanalyzing = ExpandFloatOperand(N, i);

341 break;

343 NeedsReanalyzing = ScalarizeVectorOperand(N, i);

345 break;

347 NeedsReanalyzing = SplitVectorOperand(N, i);

349 break;

351 NeedsReanalyzing = WidenVectorOperand(N, i);

353 break;

355 NeedsReanalyzing = PromoteFloatOperand(N, i);

357 break;

359 NeedsReanalyzing = SoftPromoteHalfOperand(N, i);

361 break;

362 }

363 break;

364 }

365

366

367

368

369 if (NeedsReanalyzing) {

371

373

374

375 SDNode *M = AnalyzeNewNode(N);

376 if (M == N)

377

378 continue;

379

380

381

382 assert(N->getNumValues() == M->getNumValues() &&

383 "Node morphing changed the number of results!");

384 for (unsigned i = 0, e = N->getNumValues(); i != e; ++i)

385

387 assert(N->getNodeId() == NewNode && "Unexpected node state!");

388

389

390

391 continue;

392 }

393

394 if (i == NumOperands) {

395 LLVM_DEBUG(dbgs() << "Legally typed node: "; N->dump(&DAG));

396 }

397 }

398NodeDone:

399

400

401

404

406 int NodeId = User->getNodeId();

407

408

409

410 if (NodeId > 0) {

411 User->setNodeId(NodeId-1);

412

413

415 Worklist.push_back(User);

416 continue;

417 }

418

419

420

421

423 continue;

424

425

426

427

430

431

433 Worklist.push_back(User);

434 }

435 }

436

437#ifndef EXPENSIVE_CHECKS

439#endif

440 PerformExpensiveChecks();

441

442

443 DAG.setRoot(Dummy.getValue());

444

445

446

447

448

449 DAG.RemoveDeadNodes();

450

451

452

453#ifndef NDEBUG

454 for (SDNode &Node : DAG.allnodes()) {

456

457

458 if (!IgnoreNodeResults(&Node))

459 for (unsigned i = 0, NumVals = Node.getNumValues(); i < NumVals; ++i)

460 if (!isTypeLegal(Node.getValueType(i))) {

461 dbgs() << "Result type " << i << " illegal: ";

464 }

465

466

467 for (unsigned i = 0, NumOps = Node.getNumOperands(); i < NumOps; ++i)

468 if (!IgnoreNodeResults(Node.getOperand(i).getNode()) &&

469 !isTypeLegal(Node.getOperand(i).getValueType())) {

470 dbgs() << "Operand type " << i << " illegal: ";

471 Node.getOperand(i).dump(&DAG);

473 }

474

477 dbgs() << "New node not analyzed?\n";

479 dbgs() << "Unanalyzed node not noticed?\n";

480 else if (Node.getNodeId() > 0)

481 dbgs() << "Operand not processed?\n";

483 dbgs() << "Not added to worklist?\n";

485 }

486

490 }

491 }

492#endif

493

495}

496

497

498

499

500

501SDNode *DAGTypeLegalizer::AnalyzeNewNode(SDNode *N) {

502

504 return N;

505

506

507

508

509

510

511

512

513

514

515

516

517 std::vector NewOps;

518 unsigned NumProcessed = 0;

519 for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {

520 SDValue OrigOp = N->getOperand(i);

522

523 AnalyzeNewValue(Op);

524

525 if (Op.getNode()->getNodeId() == Processed)

526 ++NumProcessed;

527

528 if (!NewOps.empty()) {

529

530 NewOps.push_back(Op);

531 } else if (Op != OrigOp) {

532

534 NewOps.push_back(Op);

535 }

536 }

537

538

539 if (!NewOps.empty()) {

540 SDNode *M = DAG.UpdateNodeOperands(N, NewOps);

541 if (M != N) {

542

543

544

545

546

549

550 return M;

551

552

553

554

555

556 N = M;

557 }

558 }

559

560

561 N->setNodeId(N->getNumOperands() - NumProcessed);

563 Worklist.push_back(N);

564

565 return N;

566}

567

568

569

570void DAGTypeLegalizer::AnalyzeNewValue(SDValue &Val) {

573

574 RemapValue(Val);

575}

576

577

578

579void DAGTypeLegalizer::RemapValue(SDValue &V) {

580 auto Id = getTableId(V);

581 V = getSDValue(Id);

582}

583

584void DAGTypeLegalizer::RemapId(TableId &Id) {

585 auto I = ReplacedValues.find(Id);

586 if (I != ReplacedValues.end()) {

587 assert(Id != I->second && "Id is mapped to itself.");

588

589

590 RemapId(I->second);

591 Id = I->second;

592

593

594

595

596 }

597}

598

599namespace {

600

601

603 DAGTypeLegalizer &DTL;

604 SmallSetVector<SDNode*, 16> &NodesToAnalyze;

605 public:

606 explicit NodeUpdateListener(DAGTypeLegalizer &dtl,

607 SmallSetVector<SDNode*, 16> &nta)

608 : SelectionDAG::DAGUpdateListener(dtl.getDAG()),

609 DTL(dtl), NodesToAnalyze(nta) {}

610

611 void NodeDeleted(SDNode *N, SDNode *E) override {

614 "Invalid node ID for RAUW deletion!");

615

616

617 assert(E && "Node not replaced?");

619

620

621

622 NodesToAnalyze.remove(N);

623

624

625

626

627

629 NodesToAnalyze.insert(E);

630 }

631

632 void NodeUpdated(SDNode *N) override {

633

634

635

638 "Invalid node ID for RAUW deletion!");

640 NodesToAnalyze.insert(N);

641 }

642 };

643}

644

645

646

647

648void DAGTypeLegalizer::ReplaceValueWith(SDValue From, SDValue To) {

650

651

652 AnalyzeNewValue(To);

653

654

655

656 SmallSetVector<SDNode*, 16> NodesToAnalyze;

657 NodeUpdateListener NUL(*this, NodesToAnalyze);

658 do {

659

660

661

662 auto FromId = getTableId(From);

663 auto ToId = getTableId(To);

664

665 if (FromId != ToId)

666 ReplacedValues[FromId] = ToId;

667 DAG.ReplaceAllUsesOfValueWith(From, To);

668

669

670 while (!NodesToAnalyze.empty()) {

673

674

675

676 continue;

677

678

679 SDNode *M = AnalyzeNewNode(N);

680 if (M != N) {

681

682

683 assert(M->getNodeId() != NewNode && "Analysis resulted in NewNode!");

684 assert(N->getNumValues() == M->getNumValues() &&

685 "Node morphing changed the number of results!");

686 for (unsigned i = 0, e = N->getNumValues(); i != e; ++i) {

690 RemapValue(NewVal);

691

692

693

694

695 auto OldValId = getTableId(OldVal);

696 auto NewValId = getTableId(NewVal);

697 DAG.ReplaceAllUsesOfValueWith(OldVal, NewVal);

698 if (OldValId != NewValId)

699 ReplacedValues[OldValId] = NewValId;

700 }

701

702 }

703 }

704

705

706

708}

709

710void DAGTypeLegalizer::SetPromotedInteger(SDValue Op, SDValue Result) {

712 TLI.getTypeToTransformTo(*DAG.getContext(), Op.getValueType()) &&

713 "Invalid type for promoted integer");

714 AnalyzeNewValue(Result);

715

716 auto &OpIdEntry = PromotedIntegers[getTableId(Op)];

717 assert((OpIdEntry == 0) && "Node is already promoted!");

718 OpIdEntry = getTableId(Result);

719

720 DAG.transferDbgValues(Op, Result);

721}

722

723void DAGTypeLegalizer::SetSoftenedFloat(SDValue Op, SDValue Result) {

724#ifndef NDEBUG

725 EVT VT = Result.getValueType();

726 LLVMContext &Ctx = *DAG.getContext();

728 VT == TLI.getTypeToTransformTo(Ctx, Op.getValueType())) &&

729 "Invalid type for softened float");

730#endif

731 AnalyzeNewValue(Result);

732

733 auto &OpIdEntry = SoftenedFloats[getTableId(Op)];

734 assert((OpIdEntry == 0) && "Node is already converted to integer!");

735 OpIdEntry = getTableId(Result);

736}

737

738void DAGTypeLegalizer::SetPromotedFloat(SDValue Op, SDValue Result) {

740 TLI.getTypeToTransformTo(*DAG.getContext(), Op.getValueType()) &&

741 "Invalid type for promoted float");

742 AnalyzeNewValue(Result);

743

744 auto &OpIdEntry = PromotedFloats[getTableId(Op)];

745 assert((OpIdEntry == 0) && "Node is already promoted!");

746 OpIdEntry = getTableId(Result);

747}

748

749void DAGTypeLegalizer::SetSoftPromotedHalf(SDValue Op, SDValue Result) {

751 "Invalid type for soft-promoted half");

752 AnalyzeNewValue(Result);

753

754 auto &OpIdEntry = SoftPromotedHalfs[getTableId(Op)];

755 assert((OpIdEntry == 0) && "Node is already promoted!");

756 OpIdEntry = getTableId(Result);

757}

758

759void DAGTypeLegalizer::SetScalarizedVector(SDValue Op, SDValue Result) {

760

761

762

763

764

765 assert(Result.getValueSizeInBits().getFixedValue() >=

766 Op.getScalarValueSizeInBits() &&

767 "Invalid type for scalarized vector");

768 AnalyzeNewValue(Result);

769

770 auto &OpIdEntry = ScalarizedVectors[getTableId(Op)];

771 assert((OpIdEntry == 0) && "Node is already scalarized!");

772 OpIdEntry = getTableId(Result);

773}

774

777 std::pair<TableId, TableId> &Entry = ExpandedIntegers[getTableId(Op)];

778 assert((Entry.first != 0) && "Operand isn't expanded");

779 Lo = getSDValue(Entry.first);

780 Hi = getSDValue(Entry.second);

781}

782

786 TLI.getTypeToTransformTo(*DAG.getContext(), Op.getValueType()) &&

787 Hi.getValueType() == Lo.getValueType() &&

788 "Invalid type for expanded integer");

789

790 AnalyzeNewValue(Lo);

791 AnalyzeNewValue(Hi);

792

793

794

795 if (DAG.getDataLayout().isBigEndian()) {

796 DAG.transferDbgValues(Op, Hi, 0, Hi.getValueSizeInBits(), false);

797 DAG.transferDbgValues(Op, Lo, Hi.getValueSizeInBits(),

798 Lo.getValueSizeInBits());

799 } else {

800 DAG.transferDbgValues(Op, Lo, 0, Lo.getValueSizeInBits(), false);

801 DAG.transferDbgValues(Op, Hi, Lo.getValueSizeInBits(),

802 Hi.getValueSizeInBits());

803 }

804

805

806 std::pair<TableId, TableId> &Entry = ExpandedIntegers[getTableId(Op)];

807 assert((Entry.first == 0) && "Node already expanded");

808 Entry.first = getTableId(Lo);

809 Entry.second = getTableId(Hi);

810}

811

814 std::pair<TableId, TableId> &Entry = ExpandedFloats[getTableId(Op)];

815 assert((Entry.first != 0) && "Operand isn't expanded");

816 Lo = getSDValue(Entry.first);

817 Hi = getSDValue(Entry.second);

818}

819

823 TLI.getTypeToTransformTo(*DAG.getContext(), Op.getValueType()) &&

824 Hi.getValueType() == Lo.getValueType() &&

825 "Invalid type for expanded float");

826

827 AnalyzeNewValue(Lo);

828 AnalyzeNewValue(Hi);

829

830 std::pair<TableId, TableId> &Entry = ExpandedFloats[getTableId(Op)];

831 assert((Entry.first == 0) && "Node already expanded");

832 Entry.first = getTableId(Lo);

833 Entry.second = getTableId(Hi);

834}

835

838 std::pair<TableId, TableId> &Entry = SplitVectors[getTableId(Op)];

839 Lo = getSDValue(Entry.first);

840 Hi = getSDValue(Entry.second);

841 assert(Lo.getNode() && "Operand isn't split");

842 ;

843}

844

847 assert(Lo.getValueType().getVectorElementType() ==

848 Op.getValueType().getVectorElementType() &&

849 Lo.getValueType().getVectorElementCount() * 2 ==

850 Op.getValueType().getVectorElementCount() &&

851 Hi.getValueType() == Lo.getValueType() &&

852 "Invalid type for split vector");

853

854 AnalyzeNewValue(Lo);

855 AnalyzeNewValue(Hi);

856

857

858 std::pair<TableId, TableId> &Entry = SplitVectors[getTableId(Op)];

859 assert((Entry.first == 0) && "Node already split");

860 Entry.first = getTableId(Lo);

861 Entry.second = getTableId(Hi);

862}

863

864void DAGTypeLegalizer::SetWidenedVector(SDValue Op, SDValue Result) {

866 TLI.getTypeToTransformTo(*DAG.getContext(), Op.getValueType()) &&

867 "Invalid type for widened vector");

868 AnalyzeNewValue(Result);

869

870 auto &OpIdEntry = WidenedVectors[getTableId(Op)];

871 assert((OpIdEntry == 0) && "Node already widened!");

872 OpIdEntry = getTableId(Result);

873}

874

875

876

877

878

879

880

882 unsigned BitWidth = Op.getValueSizeInBits();

883 return DAG.getNode(ISD::BITCAST, SDLoc(Op),

885}

886

887

888SDValue DAGTypeLegalizer::BitConvertVectorToIntegerVector(SDValue Op) {

889 assert(Op.getValueType().isVector() && "Only applies to vectors!");

890 unsigned EltWidth = Op.getScalarValueSizeInBits();

892 auto EltCnt = Op.getValueType().getVectorElementCount();

893 return DAG.getNode(ISD::BITCAST, SDLoc(Op),

895}

896

898 EVT DestVT) {

899 SDLoc dl(Op);

900

901

902

903

904

905 Align DestAlign = DAG.getReducedAlign(DestVT, false);

906 Align OpAlign = DAG.getReducedAlign(Op.getValueType(), false);

907 Align Align = std::max(DestAlign, OpAlign);

909 DAG.CreateStackTemporary(Op.getValueType().getStoreSize(), Align);

910

911 SDValue Store = DAG.getStore(DAG.getEntryNode(), dl, Op, StackPtr,

912 MachinePointerInfo(), Align);

913

914 return DAG.getLoad(DestVT, dl, Store, StackPtr, MachinePointerInfo(), Align);

915}

916

917

918

919

920

921

922

923

924

925bool DAGTypeLegalizer::CustomLowerNode(SDNode *N, EVT VT, bool LegalizeResult) {

926

928 return false;

929

931 if (LegalizeResult)

932 TLI.ReplaceNodeResults(N, Results, DAG);

933 else

934 TLI.LowerOperationWrapper(N, Results, DAG);

935

937

938 return false;

939

940

942 "Custom lowering returned the wrong number of results!");

943 for (unsigned i = 0, e = Results.size(); i != e; ++i) {

945 }

946 return true;

947}

948

949

950

951

952bool DAGTypeLegalizer::CustomWidenLowerNode(SDNode *N, EVT VT) {

953

955 return false;

956

958 TLI.ReplaceNodeResults(N, Results, DAG);

959

961

962 return false;

963

964

966 "Custom lowering returned the wrong number of results!");

967 for (unsigned i = 0, e = Results.size(); i != e; ++i) {

968

970 if (WasWidened)

972 else

974 }

975 return true;

976}

977

978SDValue DAGTypeLegalizer::DisintegrateMERGE_VALUES(SDNode *N, unsigned ResNo) {

979 for (unsigned i = 0, e = N->getNumValues(); i != e; ++i)

980 if (i != ResNo)

982 return SDValue(N->getOperand(ResNo));

983}

984

985

986

987void DAGTypeLegalizer::GetPairElements(SDValue Pair,

989 SDLoc dl(Pair);

990 EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), Pair.getValueType());

991 std::tie(Lo, Hi) = DAG.SplitScalar(Pair, dl, NVT, NVT);

992}

993

994

996

997 SDLoc dlHi(Hi);

998 SDLoc dlLo(Lo);

999 EVT LVT = Lo.getValueType();

1000 EVT HVT = Hi.getValueType();

1003

1007 DAG.getShiftAmountConstant(LVT.getSizeInBits(), NVT, dlHi));

1008 return DAG.getNode(ISD::OR, dlHi, NVT, Lo, Hi);

1009}

1010

1011

1012

1013

1014

1015

1016SDValue DAGTypeLegalizer::PromoteTargetBoolean(SDValue Bool, EVT ValVT) {

1017 return TLI.promoteTargetBoolean(DAG, Bool, ValVT);

1018}

1019

1020

1021void DAGTypeLegalizer::SplitInteger(SDValue Op,

1024 SDLoc dl(Op);

1026 Op.getValueSizeInBits() && "Invalid integer splitting!");

1028 Hi = DAG.getNode(

1030 DAG.getShiftAmountConstant(LoVT.getSizeInBits(), Op.getValueType(), dl));

1032}

1033

1034

1035

1036void DAGTypeLegalizer::SplitInteger(SDValue Op,

1038 EVT HalfVT =

1040 SplitInteger(Op, HalfVT, HalfVT, Lo, Hi);

1041}

1042

1043

1044

1045

1046

1047

1048

1049

1050

1051

1052

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

Function Alias Analysis Results

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

const size_t AbstractManglingParser< Derived, Alloc >::NumOps

static cl::opt< bool > EnableExpensiveChecks("enable-legalize-types-checking", cl::Hidden)

This file implements a set that has insertion order iteration characteristics.

DEMANGLE_DUMP_METHOD void dump() const

This takes an arbitrary SelectionDAG as input and hacks on it until only value types the target machi...

bool run()

This is the main entry point for the type legalizer.

Definition LegalizeTypes.cpp:200

void NoteDeletion(SDNode *Old, SDNode *New)

@ ReadyToProcess

All operands have been processed, so this node is ready to be handled.

@ NewNode

This is a new node, not before seen, that was created in the process of legalizing some other node.

@ Unanalyzed

This node's ID needs to be set to the number of its unprocessed operands.

@ Processed

This is a node that has already been processed.

Convenience struct for specifying and reasoning about fast-math flags.

Type * getValueType() const

This class is used to form a handle around another node that is persistent and is updated across invo...

const SDValue & getValue() const

Represents one node in the SelectionDAG.

int getNodeId() const

Return the unique node id.

void setNodeId(int Id)

Set unique node id.

Represents a use of a SDNode.

Unlike LLVM values, Selection DAG nodes may return multiple values as the result of a computation.

SDNode * getNode() const

get the SDNode which holds the desired result

EVT getValueType() const

Return the ValueType of the referenced return value.

bool use_empty() const

Return true if there are no nodes using value ResNo of Node.

void setNode(SDNode *N)

set the SDNode

Help to insert SDNodeFlags automatically in transforming.

iterator_range< allnodes_iterator > allnodes()

LLVM_ABI bool LegalizeTypes()

This transforms the SelectionDAG into a SelectionDAG that only uses types natively supported by the t...

Definition LegalizeTypes.cpp:1053

bool remove(const value_type &X)

Remove an item from the set vector.

bool empty() const

Determine if the SetVector is empty or not.

bool insert(const value_type &X)

Insert a new element into the SetVector.

value_type pop_back_val()

void push_back(const T &Elt)

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

@ TypeScalarizeScalableVector

unsigned getNumOperands() const

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

constexpr char Align[]

Key for Kernel::Arg::Metadata::mAlign.

@ ANY_EXTEND

ANY_EXTEND - Used for integer types. The high bits are undefined.

@ SHL

Shift and rotation operations.

@ ZERO_EXTEND

ZERO_EXTEND - Used for integer types, zeroing the new bits.

@ TRUNCATE

TRUNCATE - Completely drop the high bits.

NodeAddr< NodeBase * > Node

This is an optimization pass for GlobalISel generic memory operations.

testing::Matcher< const detail::ErrorHolder & > Failed()

void append_range(Container &C, Range &&R)

Wrapper function to append range R to container C.

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)

class LLVM_GSL_OWNER SmallVector

Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...

DWARFExpression::Operation Op

constexpr unsigned BitWidth

static EVT getVectorVT(LLVMContext &Context, EVT VT, unsigned NumElements, bool IsScalable=false)

Returns the EVT that represents a vector NumElements in length, where each element is of type VT.

TypeSize getSizeInBits() const

Return the size of the specified value type in bits.

static EVT getIntegerVT(LLVMContext &Context, unsigned BitWidth)

Returns the EVT that represents an integer with the given number of bits.

These are IR-level optimization flags that may be propagated to SDNodes.

Clients of various APIs that cause global effects on the DAG can optionally implement this interface.