LLVM: lib/Target/DirectX/DXILWriter/DXILValueEnumerator.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

16#include "llvm/Config/llvm-config.h"

44#include

45#include

46#include

47#include

48

49using namespace llvm;

51

52namespace {

53

54struct OrderMap {

55 DenseMap<const Value *, std::pair<unsigned, bool>> IDs;

56 unsigned LastGlobalConstantID = 0;

57 unsigned LastGlobalValueID = 0;

58

60

61 bool isGlobalConstant(unsigned ID) const {

62 return ID <= LastGlobalConstantID;

63 }

64

65 bool isGlobalValue(unsigned ID) const {

66 return ID <= LastGlobalValueID && !isGlobalConstant(ID);

67 }

68

69 unsigned size() const { return IDs.size(); }

70 std::pair<unsigned, bool> &operator[](const Value *V) { return IDs[V]; }

71

72 std::pair<unsigned, bool> lookup(const Value *V) const {

74 }

75

76 void index(const Value *V) {

77

78 unsigned ID = IDs.size() + 1;

79 IDs[V].first = ID;

80 }

81};

82

83}

84

86 if (OM.lookup(V).first)

87 return;

88

91 for (const Value *Op : C->operands())

95 if (CE->getOpcode() == Instruction::ShuffleVector)

96 orderValue(CE->getShuffleMaskForBitcode(), OM);

97 }

98 }

99

100

101

102 OM.index(V);

103}

104

106

107

108 OrderMap OM;

109

110

111

112

113

114

116 if (G.hasInitializer())

126 for (const Use &U : F.operands())

129 }

130

131

132

133

134

135

136 auto orderConstantValue = [&OM](const Value *V) {

139 };

141 if (F.isDeclaration())

142 continue;

145 for (const Value *V : I.operands()) {

147 if (const auto *VAM =

149 orderConstantValue(VAM->getValue());

150 } else if (const auto *AL =

152 for (const auto *VAM : AL->getArgs())

153 orderConstantValue(VAM->getValue());

154 }

155 }

156 }

157 }

158 OM.LastGlobalConstantID = OM.size();

159

160

161

162

163

164

165

166

167

176 OM.LastGlobalValueID = OM.size();

177

179 if (F.isDeclaration())

180 continue;

181

182

183

190 for (const Value *Op : I.operands())

195 orderValue(SVI->getShuffleMaskForBitcode(), OM);

196 }

200 }

201 return OM;

202}

203

205 unsigned ID, const OrderMap &OM,

207

208 using Entry = std::pair<const Use *, unsigned>;

210 for (const Use &U : V->uses())

211

212 if (OM.lookup(U.getUser()).first)

213 List.push_back(std::make_pair(&U, List.size()));

214

215 if (List.size() < 2)

216

217 return;

218

219 bool IsGlobalValue = OM.isGlobalValue(ID);

220 llvm::sort(List, [&](const Entry &L, const Entry &R) {

221 const Use *LU = L.first;

222 const Use *RU = R.first;

223 if (LU == RU)

224 return false;

225

226 auto LID = OM.lookup(LU->getUser()).first;

227 auto RID = OM.lookup(RU->getUser()).first;

228

229

230

231

232

233

234

235 if (OM.isGlobalValue(LID) && OM.isGlobalValue(RID)) {

236 if (LID == RID)

237 return LU->getOperandNo() > RU->getOperandNo();

238 return LID < RID;

239 }

240

241

242 if (LID < RID) {

243 if (RID <= ID)

244 if (!IsGlobalValue)

245 return true;

246 return false;

247 }

248 if (RID < LID) {

249 if (LID <= ID)

250 if (!IsGlobalValue)

251 return false;

252 return true;

253 }

254

255

256

257 if (LID <= ID)

258 if (!IsGlobalValue)

259 return LU->getOperandNo() < RU->getOperandNo();

260 return LU->getOperandNo() > RU->getOperandNo();

261 });

262

264

265 return;

266

267

268 Stack.emplace_back(V, F, List.size());

269 assert(List.size() == Stack.back().Shuffle.size() && "Wrong size");

270 for (size_t I = 0, E = List.size(); I != E; ++I)

271 Stack.back().Shuffle[I] = List[I].second;

272}

273

276 auto &IDPair = OM[V];

277 assert(IDPair.first && "Unmapped value");

278 if (IDPair.second)

279

280 return;

281

282

283 IDPair.second = true;

284 if (!V->use_empty() && std::next(V->use_begin()) != V->use_end())

286

287

289 if (C->getNumOperands()) {

290 for (const Value *Op : C->operands())

294 if (CE->getOpcode() == Instruction::ShuffleVector)

296 Stack);

297 }

298 }

299}

300

303

304

305

306

307

308

310

311

312

313

315 if (F.isDeclaration())

316 continue;

323 for (const Value *Op : I.operands())

328 Stack);

329 }

333 }

334

335

336

346 if (G.hasInitializer())

353 for (const Use &U : F.operands())

355 }

356

357 return Stack;

358}

359

362

364

365

367 EnumerateValue(&GV);

369 }

370

371

373 EnumerateValue(&F);

377 EnumerateAttributes(F.getAttributes());

378 }

379

380

381 for (const GlobalAlias &GA : M.aliases()) {

382 EnumerateValue(&GA);

384 }

385

386

387 for (const GlobalIFunc &GIF : M.ifuncs()) {

388 EnumerateValue(&GIF);

390 }

391

392

394 if (GV.hasInitializer())

395 EnumerateValue(GV.getInitializer());

398 if (GV.hasAttributes())

399 EnumerateAttributes(GV.getAttributesAsList(AttributeList::FunctionIndex));

400 }

401

402

403 for (const GlobalAlias &GA : M.aliases())

404 EnumerateValue(GA.getAliasee());

405

406

407 for (const GlobalIFunc &GIF : M.ifuncs())

408 EnumerateValue(GIF.getResolver());

409

410

412 for (const Use &U : F.operands())

413 EnumerateValue(U.get());

414

415

416

417

418

420

421

422

423 EnumerateValueSymbolTable(M.getValueSymbolTable());

424 EnumerateNamedMetadata(M);

425

428 MDs.clear();

429 GV.getAllMetadata(MDs);

430 for (const auto &I : MDs)

431

432

433

434 EnumerateMetadata(nullptr, I.second);

435 }

436

437

441

442

443 MDs.clear();

444 F.getAllMetadata(MDs);

445 for (const auto &I : MDs)

446 EnumerateMetadata(F.isDeclaration() ? nullptr : &F, I.second);

447

450 for (const Use &Op : I.operands()) {

452 if (!MD) {

453 EnumerateOperandType(Op);

454 continue;

455 }

456

457

458

459

461 continue;

463 for (auto *VAM : AL->getArgs())

465 EnumerateMetadata(&F, VAM);

466 continue;

467 }

468

469 EnumerateMetadata(&F, MD->getMetadata());

470 }

472 EnumerateType(SVI->getShuffleMaskForBitcode()->getType());

479 EnumerateAttributes(Call->getAttributes());

481 }

482

483

484 MDs.clear();

485 I.getAllMetadataOtherThanDebugLoc(MDs);

486 for (unsigned i = 0, e = MDs.size(); i != e; ++i)

487 EnumerateMetadata(&F, MDs[i].second);

488

489

490

492 for (const Metadata *Op : L->operands())

493 EnumerateMetadata(&F, Op);

494 }

495 }

496

497

498 organizeMetadata();

499}

500

503 assert(I != InstructionMap.end() && "Instruction is not mapped!");

504 return I->second;

505}

506

508 unsigned ComdatID = Comdats.idFor(C);

509 assert(ComdatID && "Comdat not found!");

510 return ComdatID;

511}

512

514 InstructionMap[I] = InstructionCount++;

515}

516

520

522 assert(I != ValueMap.end() && "Value not in slotcalculator!");

523 return I->second - 1;

524}

525

526#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

528 print(dbgs(), ValueMap, "Default");

529 dbgs() << '\n';

530 print(dbgs(), MetadataMap, "MetaData");

531 dbgs() << '\n';

532}

533#endif

534

536 const char *Name) const {

537 OS << "Map Name: " << Name << "\n";

538 OS << "Size: " << Map.size() << "\n";

539 for (const auto &I : Map) {

540 const Value *V = I.first;

541 if (V->hasName())

542 OS << "Value: " << V->getName();

543 else

544 OS << "Value: [null]\n";

545 V->print(errs());

546 errs() << '\n';

547

548 OS << " Uses(" << V->getNumUses() << "):";

549 for (const Use &U : V->uses()) {

550 if (&U != &*V->use_begin())

551 OS << ",";

552 if (U->hasName())

553 OS << " " << U->getName();

554 else

555 OS << " [null]";

556 }

557 OS << "\n\n";

558 }

559}

560

562 const char *Name) const {

563 OS << "Map Name: " << Name << "\n";

564 OS << "Size: " << Map.size() << "\n";

565 for (const auto &I : Map) {

567 OS << "Metadata: slot = " << I.second.ID << "\n";

568 OS << "Metadata: function = " << I.second.F << "\n";

570 OS << "\n";

571 }

572}

573

574

575

576void ValueEnumerator::EnumerateValueSymbolTable(const ValueSymbolTable &VST) {

578 VI != VE; ++VI)

579 EnumerateValue(VI->getValue());

580}

581

582

583

584void ValueEnumerator::EnumerateNamedMetadata(const Module &M) {

585 for (const auto &I : M.named_metadata())

586 EnumerateNamedMDNode(&I);

587}

588

589void ValueEnumerator::EnumerateNamedMDNode(const NamedMDNode *MD) {

590 for (unsigned i = 0, e = MD->getNumOperands(); i != e; ++i)

591 EnumerateMetadata(nullptr, MD->getOperand(i));

592}

593

594unsigned ValueEnumerator::getMetadataFunctionID(const Function *F) const {

596}

597

598void ValueEnumerator::EnumerateMetadata(const Function *F, const Metadata *MD) {

599 EnumerateMetadata(getMetadataFunctionID(F), MD);

600}

601

602void ValueEnumerator::EnumerateFunctionLocalMetadata(

604 EnumerateFunctionLocalMetadata(getMetadataFunctionID(&F), Local);

605}

606

607void ValueEnumerator::EnumerateFunctionLocalListMetadata(

609 EnumerateFunctionLocalListMetadata(getMetadataFunctionID(&F), ArgList);

610}

611

612void ValueEnumerator::dropFunctionFromMetadata(

613 MetadataMapType::value_type &FirstMD) {

616 auto &Entry = MD.second;

617

618

620 return;

621

622

624

625

626

630 };

631 push(FirstMD);

632 while (!Worklist.empty())

634 if (Op)

635 continue;

636 auto MD = MetadataMap.find(Op);

637 if (MD != MetadataMap.end())

638 push(*MD);

639 }

640}

641

642void ValueEnumerator::EnumerateMetadata(unsigned F, const Metadata *MD) {

643

644

645

646

648

649

650

652 if (const MDNode *N = enumerateMetadataImpl(F, MD))

653 Worklist.push_back(std::make_pair(N, N->op_begin()));

654

655 while (!Worklist.empty()) {

656 const MDNode *N = Worklist.back().first;

657

658

659

661 Worklist.back().second, N->op_end(),

662 [&](const Metadata *MD) { return enumerateMetadataImpl(F, MD); });

663 if (I != N->op_end()) {

665 Worklist.back().second = ++I;

666

667

668 if (Op->isDistinct() && N->isDistinct())

670 else

671 Worklist.push_back(std::make_pair(Op, Op->op_begin()));

672 continue;

673 }

674

675

677 MDs.push_back(N);

678 MetadataMap[N].ID = MDs.size();

679

680

681

682 if (Worklist.empty() || Worklist.back().first->isDistinct()) {

683 for (const MDNode *N : DelayedDistinctNodes)

684 Worklist.push_back(std::make_pair(N, N->op_begin()));

685 DelayedDistinctNodes.clear();

686 }

687 }

688}

689

690const MDNode *ValueEnumerator::enumerateMetadataImpl(unsigned F,

692 if (!MD)

693 return nullptr;

694

697 "Invalid metadata kind");

698

699 auto Insertion = MetadataMap.insert(std::make_pair(MD, MDIndex(F)));

700 MDIndex &Entry = Insertion.first->second;

701 if (!Insertion.second) {

702

703 if (Entry.hasDifferentFunction(F))

704 dropFunctionFromMetadata(*Insertion.first);

705 return nullptr;

706 }

707

708

710 return N;

711

712

713 MDs.push_back(MD);

714 Entry.ID = MDs.size();

715

716

718 EnumerateValue(C->getValue());

719

720 return nullptr;

721}

722

723

724

725void ValueEnumerator::EnumerateFunctionLocalMetadata(

727 assert(F && "Expected a function");

728

729

732 assert(Index.F == F && "Expected the same function");

733 return;

734 }

735

736 MDs.push_back(Local);

738 Index.ID = MDs.size();

739

740 EnumerateValue(Local->getValue());

741}

742

743

744

745void ValueEnumerator::EnumerateFunctionLocalListMetadata(

746 unsigned F, const DIArgList *ArgList) {

747 assert(F && "Expected a function");

748

749

750 MDIndex &Index = MetadataMap[ArgList];

752 assert(Index.F == F && "Expected the same function");

753 return;

754 }

755

756 for (ValueAsMetadata *VAM : ArgList->getArgs()) {

758 assert(MetadataMap.count(VAM) &&

759 "LocalAsMetadata should be enumerated before DIArgList");

760 assert(MetadataMap[VAM].F == F &&

761 "Expected LocalAsMetadata in the same function");

762 } else {

764 "Expected LocalAsMetadata or ConstantAsMetadata");

765 assert(ValueMap.count(VAM->getValue()) &&

766 "Constant should be enumerated beforeDIArgList");

767 EnumerateMetadata(F, VAM);

768 }

769 }

770

771 MDs.push_back(ArgList);

773 Index.ID = MDs.size();

774}

775

777

779 return 0;

780

781

782

784 if (N)

785 return 1;

786

787

788

789 return N->isDistinct() ? 2 : 3;

790}

791

792void ValueEnumerator::organizeMetadata() {

793 assert(MetadataMap.size() == MDs.size() &&

794 "Metadata map and vector out of sync");

795

796 if (MDs.empty())

797 return;

798

799

800

802 Order.reserve(MetadataMap.size());

803 for (const Metadata *MD : MDs)

804 Order.push_back(MetadataMap.lookup(MD));

805

806

807

808

809

810

811

815 });

816

817

818

819 std::vector<const Metadata *> OldMDs;

820 MDs.swap(OldMDs);

821 MDs.reserve(OldMDs.size());

822 for (unsigned I = 0, E = Order.size(); I != E && !Order[I].F; ++I) {

823 auto *MD = Order[I].get(OldMDs);

825 MetadataMap[MD].ID = I + 1;

827 ++NumMDStrings;

828 }

829

830

831 if (MDs.size() == Order.size())

832 return;

833

834

835 MDRange R;

836 FunctionMDs.reserve(OldMDs.size());

837 unsigned PrevF = 0;

838 for (unsigned I = MDs.size(), E = Order.size(), ID = MDs.size(); I != E;

839 ++I) {

840 unsigned F = Order[I].F;

841 if (!PrevF) {

842 PrevF = F;

843 } else if (PrevF != F) {

844 R.Last = FunctionMDs.size();

845 std::swap(R, FunctionMDInfo[PrevF]);

846 R.First = FunctionMDs.size();

847

848 ID = MDs.size();

849 PrevF = F;

850 }

851

852 auto *MD = Order[I].get(OldMDs);

854 MetadataMap[MD].ID = ++ID;

856 ++R.NumStrings;

857 }

858 R.Last = FunctionMDs.size();

859 FunctionMDInfo[PrevF] = R;

860}

861

862void ValueEnumerator::incorporateFunctionMetadata(const Function &F) {

863 NumModuleMDs = MDs.size();

864

865 auto R = FunctionMDInfo.lookup(getValueID(&F) + 1);

866 NumMDStrings = R.NumStrings;

867 MDs.insert(MDs.end(), FunctionMDs.begin() + R.First,

868 FunctionMDs.begin() + R.Last);

869}

870

871void ValueEnumerator::EnumerateValue(const Value *V) {

872 assert(V->getType()->isVoidTy() && "Can't insert void values!");

874

875

876 unsigned &ValueID = ValueMap[V];

877 if (ValueID) {

878

879 Values[ValueID - 1].second++;

880 return;

881 }

882

884 if (const Comdat *C = GO->getComdat())

885 Comdats.insert(C);

886

887

888 EnumerateType(V->getType());

889

892

893 } else if (C->getNumOperands()) {

894

895

896

897

898

899

900

901

903 ++I)

904 if (isa<BasicBlock>(*I))

905 EnumerateValue(*I);

907 if (CE->getOpcode() == Instruction::ShuffleVector)

908 EnumerateValue(CE->getShuffleMaskForBitcode());

910 EnumerateType(GEP->getSourceElementType());

911 }

912

913

914

915 Values.push_back(std::make_pair(V, 1U));

916 ValueMap[V] = Values.size();

917 return;

918 }

919 }

920

921

922 Values.push_back(std::make_pair(V, 1U));

923 ValueID = Values.size();

924}

925

926void ValueEnumerator::EnumerateType(Type *Ty) {

927 unsigned *TypeID = &TypeMap[Ty];

928

929

931 return;

932

933

934

935

937 if (!STy->isLiteral())

939

940

941

943 EnumerateType(SubTy);

944

945

946 TypeID = &TypeMap[Ty];

947

948

949

950

951

952

954 return;

955

956

957 Types.push_back(Ty);

958

959 *TypeID = Types.size();

960}

961

962

963

964void ValueEnumerator::EnumerateOperandType(const Value *V) {

965 EnumerateType(V->getType());

966

968

970 if (C)

971 return;

972

973

974

975 if (ValueMap.count(C))

976 return;

977

978

979

980 for (const Value *Op : C->operands()) {

981

982

984 continue;

985

986 EnumerateOperandType(Op);

987 }

989 if (CE->getOpcode() == Instruction::ShuffleVector)

990 EnumerateOperandType(CE->getShuffleMaskForBitcode());

991 if (CE->getOpcode() == Instruction::GetElementPtr)

993 }

994}

995

996void ValueEnumerator::EnumerateAttributes(AttributeList PAL) {

997 if (PAL.isEmpty())

998 return;

999

1000

1001 unsigned &Entry = AttributeListMap[PAL];

1002 if (Entry == 0) {

1003

1004 AttributeLists.push_back(PAL);

1005 Entry = AttributeLists.size();

1006 }

1007

1008

1009 for (unsigned i : PAL.indexes()) {

1010 AttributeSet AS = PAL.getAttributes(i);

1012 continue;

1014 unsigned &Entry = AttributeGroupMap[Pair];

1015 if (Entry == 0) {

1016 AttributeGroups.push_back(Pair);

1017 Entry = AttributeGroups.size();

1018

1020 if (Attr.isTypeAttribute())

1021 EnumerateType(Attr.getValueAsType());

1022 }

1023 }

1024 }

1025}

1026

1028 InstructionCount = 0;

1029 NumModuleValues = Values.size();

1030

1031

1032

1033 incorporateFunctionMetadata(F);

1034

1035

1036 for (const auto &I : F.args()) {

1037 EnumerateValue(&I);

1038 if (I.hasAttribute(Attribute::ByVal))

1039 EnumerateType(I.getParamByValType());

1040 else if (I.hasAttribute(Attribute::StructRet))

1041 EnumerateType(I.getParamStructRetType());

1042 else if (I.hasAttribute(Attribute::ByRef))

1043 EnumerateType(I.getParamByRefType());

1044 }

1045 FirstFuncConstantID = Values.size();

1046

1047

1048 for (const BasicBlock &BB : F) {

1049 for (const Instruction &I : BB) {

1050 for (const Use &OI : I.operands()) {

1052 EnumerateValue(OI);

1053 }

1055 EnumerateValue(SVI->getShuffleMaskForBitcode());

1056 }

1057 BasicBlocks.push_back(&BB);

1058 ValueMap[&BB] = BasicBlocks.size();

1059 }

1060

1061

1062

1063 EnumerateAttributes(F.getAttributes());

1064

1065 FirstInstID = Values.size();

1066

1069

1070 for (const BasicBlock &BB : F) {

1071 for (const Instruction &I : BB) {

1072 for (const Use &OI : I.operands()) {

1075

1078 ArgListMDVector.push_back(ArgList);

1079 for (ValueAsMetadata *VMD : ArgList->getArgs()) {

1081

1082

1084 }

1085 }

1086 }

1087 }

1088 }

1089

1090 if (I.getType()->isVoidTy())

1091 EnumerateValue(&I);

1092 }

1093 }

1094

1095

1096 for (unsigned i = 0, e = FnLocalMDVector.size(); i != e; ++i) {

1097

1098

1099 assert(ValueMap.count(FnLocalMDVector[i]->getValue()) &&

1100 "Missing value for metadata operand");

1101 EnumerateFunctionLocalMetadata(F, FnLocalMDVector[i]);

1102 }

1103

1104

1105 for (const DIArgList *ArgList : ArgListMDVector)

1106 EnumerateFunctionLocalListMetadata(F, ArgList);

1107}

1108

1110

1111 for (unsigned i = NumModuleValues, e = Values.size(); i != e; ++i)

1112 ValueMap.erase(Values[i].first);

1113 for (unsigned i = NumModuleMDs, e = MDs.size(); i != e; ++i)

1114 MetadataMap.erase(MDs[i]);

1115 for (const BasicBlock *BB : BasicBlocks)

1116 ValueMap.erase(BB);

1117

1118 Values.resize(NumModuleValues);

1119 MDs.resize(NumModuleMDs);

1120 BasicBlocks.clear();

1121 NumMDStrings = 0;

1122}

1123

1126 unsigned Counter = 0;

1128 IDMap[&BB] = ++Counter;

1129}

1130

1131

1132

1133

1135 unsigned &Idx = GlobalBasicBlockIDs[BB];

1136 if (Idx != 0)

1137 return Idx - 1;

1138

1141}

1142

1145}

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

MapVector< const Value *, unsigned > OrderMap

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

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

#define LLVM_DUMP_METHOD

Mark debug helper function definitions like dump() that should not be stripped from debug builds.

static void predictValueUseListOrderImpl(const Value *V, const Function *F, unsigned ID, const OrderMap &OM, UseListOrderStack &Stack)

Definition DXILValueEnumerator.cpp:204

static void orderValue(const Value *V, OrderMap &OM)

Definition DXILValueEnumerator.cpp:85

static void predictValueUseListOrder(const Value *V, const Function *F, OrderMap &OM, UseListOrderStack &Stack)

Definition DXILValueEnumerator.cpp:274

static UseListOrderStack predictUseListOrder(const Module &M)

Definition DXILValueEnumerator.cpp:301

static OrderMap orderModule(const Module &M)

Definition DXILValueEnumerator.cpp:105

This file contains the declaration of the GlobalIFunc class, which represents a single indirect funct...

Module.h This file contains the declarations for the Module class.

This defines the Use class.

static bool lookup(const GsymReader &GR, DataExtractor &Data, uint64_t &Offset, uint64_t BaseAddr, uint64_t Addr, SourceLocations &SrcLocs, llvm::Error &Err)

A Lookup helper functions.

This file defines the SmallVector class.

static unsigned getMetadataTypeOrder(const Metadata *MD)

static UseListOrderStack predictUseListOrder(const Module &M)

static void IncorporateFunctionInfoGlobalBBIDs(const Function *F, DenseMap< const BasicBlock *, unsigned > &IDMap)

This class represents an incoming formal argument to a Function.

bool hasAttributes() const

Return true if attributes exists in this set.

LLVM Basic Block Representation.

const Function * getParent() const

Return the enclosing method, or null if none.

This is an important base class in LLVM.

List of ValueAsMetadata, to be used as an argument to a dbg.value intrinsic.

ArrayRef< ValueAsMetadata * > getArgs() const

ValueT lookup(const_arg_type_t< KeyT > Val) const

lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...

iterator find(const_arg_type_t< KeyT > Val)

DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT, true > const_iterator

const MDOperand * op_iterator

unsigned & operator[](const const Value *&Key)

A Module instance is used to store all the information related to an LLVM module.

LLVM_ABI MDNode * getOperand(unsigned i) const

LLVM_ABI unsigned getNumOperands() const

void reserve(size_type N)

void push_back(const T &Elt)

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

The instances of the Type class are immutable: once they are created, they are never changed.

static LLVM_ABI Type * getMetadataTy(LLVMContext &C)

ArrayRef< Type * > subtypes() const

static LLVM_ABI TypedPointerType * get(Type *ElementType, unsigned AddressSpace)

This constructs a pointer to an object of the specified type in a numbered address space.

unsigned idFor(const T &Entry) const

idFor - return the ID for an existing entry.

A Use represents the edge between a Value definition and its users.

const Use * const_op_iterator

unsigned getMetadataID(const Metadata *MD) const

void print(raw_ostream &OS, const ValueMapType &Map, const char *Name) const

unsigned getInstructionID(const Instruction *I) const

void incorporateFunction(const Function &F)

incorporateFunction/purgeFunction - If you'd like to deal with a function, use these two methods to g...

ValueEnumerator(const Module &M, bool ShouldPreserveUseListOrder)

unsigned getComdatID(const Comdat *C) const

uint64_t computeBitsRequiredForTypeIndices() const

unsigned getValueID(const Value *V) const

unsigned getGlobalBasicBlockID(const BasicBlock *BB) const

getGlobalBasicBlockID - This returns the function-specific ID for the specified basic block.

void setInstructionID(const Instruction *I)

std::pair< unsigned, AttributeSet > IndexAndAttrSet

Attribute groups as encoded in bitcode are almost AttributeSets, but they include the AttributeList i...

const TypeList & getTypes() const

This class provides a symbol table of name/value pairs.

ValueMap::const_iterator const_iterator

A const_iterator over a ValueMap.

iterator end()

Get an iterator to the end of the symbol table.

iterator begin()

Get an iterator that from the beginning of the symbol table.

LLVM Value Representation.

iterator_range< use_iterator > uses()

void EnumerateType(Type *T)

UseListOrderStack UseListOrders

This class implements an extremely fast bulk output stream that can only output to a stream.

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

@ C

The default llvm calling convention, compatible with C.

@ CE

Windows NT (Windows on ARM)

This is an optimization pass for GlobalISel generic memory operations.

unsigned Log2_32_Ceil(uint32_t Value)

Return the ceil log base 2 of the specified value, 32 if the value is zero.

FunctionAddr VTableAddr Value

auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)

Get the size of a range.

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

auto reverse(ContainerTy &&C)

void sort(IteratorTy Start, IteratorTy End)

LLVM_ABI raw_ostream & dbgs()

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

bool is_sorted(R &&Range, Compare C)

Wrapper function around std::is_sorted to check if elements in a range R are sorted with respect to a...

class LLVM_GSL_OWNER SmallVector

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

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

std::vector< UseListOrder > UseListOrderStack

LLVM_ABI raw_fd_ostream & errs()

This returns a reference to a raw_ostream for standard error.

DWARFExpression::Operation Op

decltype(auto) cast(const From &Val)

cast - Return the argument parameter cast to the specified type.

void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)

Implement std::swap in terms of BitVector swap.

Function object to check whether the second component of a container supported by std::get (like std:...